Search in sources :

Example 1 with DividerItemDecoration

use of com.google.android.setupdesign.DividerItemDecoration in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PanelFragment method loadPanelWhenReady.

/**
 * When all of the Slices have loaded for the first time, then we can setup the
 * {@link RecyclerView}.
 * <p>
 *     When the Recyclerview has been laid out, we can begin the animation with the
 *     {@link mOnGlobalLayoutListener}, which calls {@link #animateIn()}.
 */
private void loadPanelWhenReady() {
    if (mPanelSlicesLoaderCountdownLatch.isPanelReadyToLoad()) {
        mAdapter = new PanelSlicesAdapter(this, mSliceLiveData, mPanel.getMetricsCategory());
        mPanelSlices.setAdapter(mAdapter);
        mPanelSlices.getViewTreeObserver().addOnGlobalLayoutListener(mOnGlobalLayoutListener);
        mPanelSlices.setVisibility(View.VISIBLE);
        DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity());
        itemDecoration.setDividerCondition(DividerItemDecoration.DIVIDER_CONDITION_BOTH);
        mPanelSlices.addItemDecoration(itemDecoration);
    }
}
Also used : DividerItemDecoration(com.google.android.setupdesign.DividerItemDecoration)

Example 2 with DividerItemDecoration

use of com.google.android.setupdesign.DividerItemDecoration in project android_packages_apps_Settings by omnirom.

the class PanelFragment method loadPanelWhenReady.

/**
 * When all of the Slices have loaded for the first time, then we can setup the
 * {@link RecyclerView}.
 * <p>
 * When the Recyclerview has been laid out, we can begin the animation with the
 * {@link mOnGlobalLayoutListener}, which calls {@link #animateIn()}.
 */
private void loadPanelWhenReady() {
    if (mPanelSlicesLoaderCountdownLatch.isPanelReadyToLoad()) {
        mAdapter = new PanelSlicesAdapter(this, mSliceLiveData, mPanel.getMetricsCategory());
        mPanelSlices.setAdapter(mAdapter);
        mPanelSlices.getViewTreeObserver().addOnGlobalLayoutListener(mOnGlobalLayoutListener);
        mPanelSlices.setVisibility(View.VISIBLE);
        final FragmentActivity activity = getActivity();
        if (activity == null) {
            return;
        }
        final DividerItemDecoration itemDecoration = new DividerItemDecoration(activity);
        itemDecoration.setDividerCondition(DividerItemDecoration.DIVIDER_CONDITION_BOTH);
        if (mPanelSlices.getItemDecorationCount() == 0) {
            mPanelSlices.addItemDecoration(itemDecoration);
        }
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) DividerItemDecoration(com.google.android.setupdesign.DividerItemDecoration)

Aggregations

DividerItemDecoration (com.google.android.setupdesign.DividerItemDecoration)2 FragmentActivity (androidx.fragment.app.FragmentActivity)1