Search in sources :

Example 1 with ToolbarShadowAnimationHelper

use of org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper in project Signal-Android by WhisperSystems.

the class ContactSelectionListFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
    emptyText = view.findViewById(android.R.id.empty);
    recyclerView = view.findViewById(R.id.recycler_view);
    swipeRefresh = view.findViewById(R.id.swipe_refresh);
    fastScroller = view.findViewById(R.id.fast_scroller);
    showContactsLayout = view.findViewById(R.id.show_contacts_container);
    showContactsButton = view.findViewById(R.id.show_contacts_button);
    showContactsDescription = view.findViewById(R.id.show_contacts_description);
    showContactsProgress = view.findViewById(R.id.progress);
    chipGroup = view.findViewById(R.id.chipGroup);
    chipGroupScrollContainer = view.findViewById(R.id.chipGroupScrollContainer);
    constraintLayout = view.findViewById(R.id.container);
    shadowView = view.findViewById(R.id.toolbar_shadow);
    toolbarShadowAnimationHelper = new ToolbarShadowAnimationHelper(shadowView);
    recyclerView.addOnScrollListener(toolbarShadowAnimationHelper);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(new DefaultItemAnimator() {

        @Override
        public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {
            return true;
        }
    });
    Intent intent = requireActivity().getIntent();
    Bundle arguments = safeArguments();
    int recyclerViewPadBottom = arguments.getInt(RV_PADDING_BOTTOM, intent.getIntExtra(RV_PADDING_BOTTOM, -1));
    boolean recyclerViewClipping = arguments.getBoolean(RV_CLIP, intent.getBooleanExtra(RV_CLIP, true));
    if (recyclerViewPadBottom != -1) {
        ViewUtil.setPaddingBottom(recyclerView, recyclerViewPadBottom);
    }
    recyclerView.setClipToPadding(recyclerViewClipping);
    boolean isRefreshable = arguments.getBoolean(REFRESHABLE, intent.getBooleanExtra(REFRESHABLE, true));
    swipeRefresh.setNestedScrollingEnabled(isRefreshable);
    swipeRefresh.setEnabled(isRefreshable);
    hideCount = arguments.getBoolean(HIDE_COUNT, intent.getBooleanExtra(HIDE_COUNT, false));
    selectionLimit = arguments.getParcelable(SELECTION_LIMITS);
    if (selectionLimit == null) {
        selectionLimit = intent.getParcelableExtra(SELECTION_LIMITS);
    }
    isMulti = selectionLimit != null;
    canSelectSelf = arguments.getBoolean(CAN_SELECT_SELF, intent.getBooleanExtra(CAN_SELECT_SELF, !isMulti));
    if (!isMulti) {
        selectionLimit = SelectionLimits.NO_LIMITS;
    }
    currentSelection = getCurrentSelection();
    return view;
}
Also used : ToolbarShadowAnimationHelper(org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper) Bundle(android.os.Bundle) RecyclerView(androidx.recyclerview.widget.RecyclerView) Intent(android.content.Intent) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) SuppressLint(android.annotation.SuppressLint)

Example 2 with ToolbarShadowAnimationHelper

use of org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper in project Signal-Android by WhisperSystems.

the class MessageDetailsFragment method initializeList.

private void initializeList(@NonNull View view) {
    RecyclerView list = view.findViewById(R.id.message_details_list);
    View toolbarShadow = view.findViewById(R.id.toolbar_shadow);
    colorizer = new Colorizer();
    adapter = new MessageDetailsAdapter(this, glideRequests, colorizer, this::onErrorClicked);
    recyclerViewColorizer = new RecyclerViewColorizer(list);
    list.setAdapter(adapter);
    list.setItemAnimator(null);
    list.addOnScrollListener(new ToolbarShadowAnimationHelper(toolbarShadow));
}
Also used : RecyclerViewColorizer(org.thoughtcrime.securesms.conversation.colors.RecyclerViewColorizer) ToolbarShadowAnimationHelper(org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper) RecyclerView(androidx.recyclerview.widget.RecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) RecyclerViewColorizer(org.thoughtcrime.securesms.conversation.colors.RecyclerViewColorizer) Colorizer(org.thoughtcrime.securesms.conversation.colors.Colorizer)

Example 3 with ToolbarShadowAnimationHelper

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

the class MessageDetailsFragment method initializeList.

private void initializeList(@NonNull View view) {
    RecyclerView list = view.findViewById(R.id.message_details_list);
    View toolbarShadow = view.findViewById(R.id.toolbar_shadow);
    colorizer = new Colorizer();
    adapter = new MessageDetailsAdapter(this, glideRequests, colorizer, this::onErrorClicked);
    recyclerViewColorizer = new RecyclerViewColorizer(list);
    list.setAdapter(adapter);
    list.setItemAnimator(null);
    list.addOnScrollListener(new ToolbarShadowAnimationHelper(toolbarShadow));
}
Also used : RecyclerViewColorizer(org.thoughtcrime.securesms.conversation.colors.RecyclerViewColorizer) ToolbarShadowAnimationHelper(org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper) RecyclerView(androidx.recyclerview.widget.RecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) RecyclerViewColorizer(org.thoughtcrime.securesms.conversation.colors.RecyclerViewColorizer) Colorizer(org.thoughtcrime.securesms.conversation.colors.Colorizer)

Example 4 with ToolbarShadowAnimationHelper

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

the class ContactSelectionListFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
    emptyText = view.findViewById(android.R.id.empty);
    recyclerView = view.findViewById(R.id.recycler_view);
    swipeRefresh = view.findViewById(R.id.swipe_refresh);
    fastScroller = view.findViewById(R.id.fast_scroller);
    showContactsLayout = view.findViewById(R.id.show_contacts_container);
    showContactsButton = view.findViewById(R.id.show_contacts_button);
    showContactsDescription = view.findViewById(R.id.show_contacts_description);
    showContactsProgress = view.findViewById(R.id.progress);
    chipGroup = view.findViewById(R.id.chipGroup);
    chipGroupScrollContainer = view.findViewById(R.id.chipGroupScrollContainer);
    constraintLayout = view.findViewById(R.id.container);
    shadowView = view.findViewById(R.id.toolbar_shadow);
    toolbarShadowAnimationHelper = new ToolbarShadowAnimationHelper(shadowView);
    recyclerView.addOnScrollListener(toolbarShadowAnimationHelper);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(new DefaultItemAnimator() {

        @Override
        public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {
            return true;
        }
    });
    Intent intent = requireActivity().getIntent();
    Bundle arguments = safeArguments();
    int recyclerViewPadBottom = arguments.getInt(RV_PADDING_BOTTOM, intent.getIntExtra(RV_PADDING_BOTTOM, -1));
    boolean recyclerViewClipping = arguments.getBoolean(RV_CLIP, intent.getBooleanExtra(RV_CLIP, true));
    if (recyclerViewPadBottom != -1) {
        ViewUtil.setPaddingBottom(recyclerView, recyclerViewPadBottom);
    }
    recyclerView.setClipToPadding(recyclerViewClipping);
    boolean isRefreshable = arguments.getBoolean(REFRESHABLE, intent.getBooleanExtra(REFRESHABLE, true));
    swipeRefresh.setNestedScrollingEnabled(isRefreshable);
    swipeRefresh.setEnabled(isRefreshable);
    hideCount = arguments.getBoolean(HIDE_COUNT, intent.getBooleanExtra(HIDE_COUNT, false));
    selectionLimit = arguments.getParcelable(SELECTION_LIMITS);
    if (selectionLimit == null) {
        selectionLimit = intent.getParcelableExtra(SELECTION_LIMITS);
    }
    isMulti = selectionLimit != null;
    canSelectSelf = arguments.getBoolean(CAN_SELECT_SELF, intent.getBooleanExtra(CAN_SELECT_SELF, !isMulti));
    if (!isMulti) {
        selectionLimit = SelectionLimits.NO_LIMITS;
    }
    currentSelection = getCurrentSelection();
    return view;
}
Also used : ToolbarShadowAnimationHelper(org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper) Bundle(android.os.Bundle) RecyclerView(androidx.recyclerview.widget.RecyclerView) Intent(android.content.Intent) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) SuppressLint(android.annotation.SuppressLint)

Aggregations

View (android.view.View)4 RecyclerView (androidx.recyclerview.widget.RecyclerView)4 ToolbarShadowAnimationHelper (org.thoughtcrime.securesms.components.recyclerview.ToolbarShadowAnimationHelper)4 SuppressLint (android.annotation.SuppressLint)2 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 HorizontalScrollView (android.widget.HorizontalScrollView)2 TextView (android.widget.TextView)2 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 Colorizer (org.thoughtcrime.securesms.conversation.colors.Colorizer)2 RecyclerViewColorizer (org.thoughtcrime.securesms.conversation.colors.RecyclerViewColorizer)2