Search in sources :

Example 1 with SearchToolbar

use of org.thoughtcrime.securesms.components.SearchToolbar in project Signal-Android by signalapp.

the class ConversationListActivity method onCreate.

@Override
protected void onCreate(Bundle icicle, boolean ready) {
    setContentView(R.layout.conversation_list_activity);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    searchToolbar = findViewById(R.id.search_toolbar);
    searchAction = findViewById(R.id.search_action);
    fragment = initFragment(R.id.fragment_container, new ConversationListFragment(), dynamicLanguage.getCurrentLocale());
    initializeSearchListener();
    RatingManager.showRatingDialogIfNecessary(this);
    RegistrationLockDialog.showReminderIfNecessary(this);
}
Also used : SearchToolbar(org.thoughtcrime.securesms.components.SearchToolbar) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with SearchToolbar

use of org.thoughtcrime.securesms.components.SearchToolbar 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 3 with SearchToolbar

use of org.thoughtcrime.securesms.components.SearchToolbar in project Signal-Android by signalapp.

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)

Aggregations

SearchToolbar (org.thoughtcrime.securesms.components.SearchToolbar)3 Intent (android.content.Intent)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)2 Toolbar (androidx.appcompat.widget.Toolbar)2 ItemTouchHelper (androidx.recyclerview.widget.ItemTouchHelper)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 SnapToTopDataObserver (org.thoughtcrime.securesms.util.SnapToTopDataObserver)2 Toolbar (android.support.v7.widget.Toolbar)1