Search in sources :

Example 21 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Signal-Android by WhisperSystems.

the class EnterPhoneNumberFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setDebugLogSubmitMultiTapView(view.findViewById(R.id.verify_header));
    countryCode = view.findViewById(R.id.country_code);
    number = view.findViewById(R.id.number);
    countrySpinner = view.findViewById(R.id.country_spinner);
    cancel = view.findViewById(R.id.cancel_button);
    scrollView = view.findViewById(R.id.scroll_view);
    register = view.findViewById(R.id.registerButton);
    RegistrationNumberInputController controller = new RegistrationNumberInputController(requireContext(), countryCode, number, countrySpinner, true, this);
    register.setOnClickListener(v -> handleRegister(requireContext()));
    disposables.bindTo(getViewLifecycleOwner().getLifecycle());
    viewModel = new ViewModelProvider(requireActivity()).get(RegistrationViewModel.class);
    if (viewModel.isReregister()) {
        cancel.setVisibility(View.VISIBLE);
        cancel.setOnClickListener(v -> Navigation.findNavController(v).navigateUp());
    } else {
        cancel.setVisibility(View.GONE);
    }
    viewModel.getLiveNumber().observe(getViewLifecycleOwner(), controller::updateNumber);
    if (viewModel.hasCaptchaToken()) {
        ThreadUtil.runOnMainDelayed(() -> handleRegister(requireContext()), 250);
    }
    Toolbar toolbar = view.findViewById(R.id.toolbar);
    ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(null);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) RegistrationNumberInputController(org.thoughtcrime.securesms.registration.util.RegistrationNumberInputController) ViewModelProvider(androidx.lifecycle.ViewModelProvider) RegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.RegistrationViewModel) Toolbar(androidx.appcompat.widget.Toolbar)

Example 22 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Signal-Android by WhisperSystems.

the class ConversationListFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    constraintLayout = view.findViewById(R.id.constraint_layout);
    list = view.findViewById(R.id.list);
    fab = view.findViewById(R.id.fab);
    cameraFab = view.findViewById(R.id.camera_fab);
    searchEmptyState = view.findViewById(R.id.search_no_results);
    searchAction = view.findViewById(R.id.search_action);
    toolbarShadow = view.findViewById(R.id.conversation_list_toolbar_shadow);
    notificationProfileStatus = view.findViewById(R.id.conversation_list_notification_profile_status);
    proxyStatus = view.findViewById(R.id.conversation_list_proxy_status);
    unreadPaymentsDot = view.findViewById(R.id.unread_payments_indicator);
    bottomActionBar = view.findViewById(R.id.conversation_list_bottom_action_bar);
    reminderView = new Stub<>(view.findViewById(R.id.reminder));
    emptyState = new Stub<>(view.findViewById(R.id.empty_state));
    searchToolbar = new Stub<>(view.findViewById(R.id.search_toolbar));
    megaphoneContainer = new Stub<>(view.findViewById(R.id.megaphone_container));
    paymentNotificationView = new Stub<>(view.findViewById(R.id.payments_notification));
    voiceNotePlayerViewStub = new Stub<>(view.findViewById(R.id.voice_note_player));
    Toolbar toolbar = getToolbar(view);
    toolbar.setVisibility(View.VISIBLE);
    ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
    notificationProfileStatus.setOnClickListener(v -> handleNotificationProfile());
    proxyStatus.setOnClickListener(v -> onProxyStatusClicked());
    fab.show();
    cameraFab.show();
    archiveDecoration = new ConversationListArchiveItemDecoration(new ColorDrawable(getResources().getColor(R.color.conversation_list_archive_background_end)));
    itemAnimator = new ConversationListItemAnimator();
    list.setLayoutManager(new LinearLayoutManager(requireActivity()));
    list.setItemAnimator(itemAnimator);
    list.addOnScrollListener(new ScrollListener());
    list.addItemDecoration(archiveDecoration);
    snapToTopDataObserver = new SnapToTopDataObserver(list);
    new ItemTouchHelper(new ArchiveListenerCallback(getResources().getColor(R.color.conversation_list_archive_background_start), getResources().getColor(R.color.conversation_list_archive_background_end))).attachToRecyclerView(list);
    fab.setOnClickListener(v -> startActivity(new Intent(getActivity(), NewConversationActivity.class)));
    cameraFab.setOnClickListener(v -> {
        Permissions.with(this).request(Manifest.permission.CAMERA).ifNecessary().withRationaleDialog(getString(R.string.ConversationActivity_to_capture_photos_and_video_allow_signal_access_to_the_camera), R.drawable.ic_camera_24).withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_the_camera_permission_to_take_photos_or_video)).onAllGranted(() -> startActivity(MediaSelectionActivity.camera(requireContext()))).onAnyDenied(() -> Toast.makeText(requireContext(), R.string.ConversationActivity_signal_needs_camera_permissions_to_take_photos_or_video, Toast.LENGTH_LONG).show()).execute();
    });
    initializeViewModel();
    initializeListAdapters();
    initializeTypingObserver();
    initializeSearchListener();
    initializeVoiceNotePlayer();
    RatingManager.showRatingDialogIfNecessary(requireContext());
    TooltipCompat.setTooltipText(searchAction, getText(R.string.SearchToolbar_search_for_conversations_contacts_and_messages));
}
Also used : ItemTouchHelper(androidx.recyclerview.widget.ItemTouchHelper) ColorDrawable(android.graphics.drawable.ColorDrawable) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) SnapToTopDataObserver(org.thoughtcrime.securesms.util.SnapToTopDataObserver) Intent(android.content.Intent) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SearchToolbar(org.thoughtcrime.securesms.components.SearchToolbar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 23 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Signal-Android by WhisperSystems.

the class CameraContactSelectionFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    this.contactList = view.findViewById(R.id.camera_contacts_list);
    this.selectionList = view.findViewById(R.id.camera_contacts_selected_list);
    this.toolbar = view.findViewById(R.id.camera_contacts_toolbar);
    this.sendButton = view.findViewById(R.id.camera_contacts_send_button);
    this.selectionFooterGroup = view.findViewById(R.id.camera_contacts_footer_group);
    this.cameraContactsEmpty = view.findViewById(R.id.camera_contacts_empty);
    this.inviteButton = view.findViewById(R.id.camera_contacts_invite_button);
    this.contactAdapter = new CameraContactAdapter(GlideApp.with(this), this);
    this.selectionAdapter = new CameraContactSelectionAdapter();
    contactList.setLayoutManager(new LinearLayoutManager(requireContext()));
    contactList.setAdapter(contactAdapter);
    selectionList.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
    selectionList.setAdapter(selectionAdapter);
    ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(v -> requireActivity().onBackPressed());
    inviteButton.setOnClickListener(v -> onInviteContactsClicked());
    initViewModel();
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 24 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project UltimateRecyclerView by cymcsg.

the class ViewPagerTabFragmentParentFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.simplefragment_viewpaper_fragment_parent, container, false);
    totalfullheight = view.getHeight();
    AppCompatActivity parentActivity = (AppCompatActivity) getActivity();
    mPagerAdapter = new NavigationAdapter(getChildFragmentManager());
    mPager = (ViewPager) view.findViewById(R.id.pager);
    pager_wrapper = (FrameLayout) view.findViewById(R.id.pager_wrapper);
    mPager.setAdapter(mPagerAdapter);
    mHeaderContainer = (View) view.findViewById(R.id.header);
    headerBanner = (ImageView) view.findViewById(R.id.header_background);
    slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);
    ViewConfiguration vc = ViewConfiguration.get(parentActivity);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionLayout) view.findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
    mPager.setCurrentItem(0);
    return view;
}
Also used : ViewConfiguration(android.view.ViewConfiguration) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ImageView(android.widget.ImageView) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) View(android.view.View)

Example 25 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project J2ME-Loader by nikita36078.

the class Form method set.

public void set(final int index, final Item item) {
    if (item.hasOwnerForm()) {
        throw new IllegalStateException();
    }
    items.set(index, item).setOwnerForm(null);
    item.setOwnerForm(this);
    if (layout != null) {
        AppCompatActivity a = getParentActivity();
        if (a != null) {
            a.runOnUiThread(() -> {
                View v = item.getItemView();
                layout.removeViewAt(index);
                layout.addView(v, index);
            });
        }
    }
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ScrollView(android.widget.ScrollView) View(android.view.View)

Aggregations

AppCompatActivity (androidx.appcompat.app.AppCompatActivity)76 ActionBar (androidx.appcompat.app.ActionBar)23 View (android.view.View)20 Toolbar (androidx.appcompat.widget.Toolbar)19 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)10 TextView (android.widget.TextView)7 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 Intent (android.content.Intent)6 Fragment (androidx.fragment.app.Fragment)6 BindView (butterknife.BindView)6 Activity (android.app.Activity)5 LayoutInflater (android.view.LayoutInflater)5 Bundle (android.os.Bundle)4 ImageView (android.widget.ImageView)4 ScrollView (android.widget.ScrollView)4 List (java.util.List)4 Nullable (androidx.annotation.Nullable)3 SuppressLint (android.annotation.SuppressLint)2 TargetApi (android.annotation.TargetApi)2 Dialog (android.app.Dialog)2