Search in sources :

Example 1 with RecyclerViewFastScroller

use of com.android.launcher3.views.RecyclerViewFastScroller in project android_packages_apps_Launcher3 by crdroidandroid.

the class WidgetsFullSheet method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mContent = findViewById(R.id.container);
    TopRoundedCornerView springLayout = (TopRoundedCornerView) mContent;
    LayoutInflater layoutInflater = LayoutInflater.from(getContext());
    int contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view : R.layout.widgets_full_sheet_recyclerview;
    layoutInflater.inflate(contentLayoutRes, springLayout, true);
    RecyclerViewFastScroller fastScroller = findViewById(R.id.fast_scroller);
    mAdapters.get(AdapterHolder.PRIMARY).setup(findViewById(R.id.primary_widgets_list_view));
    mAdapters.get(AdapterHolder.SEARCH).setup(findViewById(R.id.search_widgets_list_view));
    if (mHasWorkProfile) {
        mViewPager = findViewById(R.id.widgets_view_pager);
        mViewPager.initParentViews(this);
        mViewPager.getPageIndicator().setOnActivePageChangedListener(this);
        mViewPager.getPageIndicator().setActiveMarker(AdapterHolder.PRIMARY);
        mTabsView = findViewById(R.id.tabs);
        findViewById(R.id.tab_personal).setOnClickListener((View view) -> mViewPager.snapToPage(0));
        findViewById(R.id.tab_work).setOnClickListener((View view) -> mViewPager.snapToPage(1));
        fastScroller.setIsRecyclerViewFirstChildInParent(false);
        mAdapters.get(AdapterHolder.WORK).setup(findViewById(R.id.work_widgets_list_view));
    } else {
        mViewPager = null;
    }
    layoutInflater.inflate(R.layout.widgets_full_sheet_search_and_recommendations, springLayout, true);
    mNoWidgetsView = findViewById(R.id.no_widgets_text);
    mSearchAndRecommendationViewHolder = new SearchAndRecommendationViewHolder(findViewById(R.id.search_and_recommendations_container));
    TopRoundedCornerView.LayoutParams layoutParams = (TopRoundedCornerView.LayoutParams) mSearchAndRecommendationViewHolder.mContainer.getLayoutParams();
    layoutParams.bottomMargin = mSearchAndRecommendationContainerBottomMargin;
    mSearchAndRecommendationViewHolder.mContainer.setLayoutParams(layoutParams);
    mSearchAndRecommendationsScrollController = new SearchAndRecommendationsScrollController(mHasWorkProfile, mTabsHeight, mSearchAndRecommendationViewHolder, findViewById(R.id.primary_widgets_list_view), mHasWorkProfile ? findViewById(R.id.work_widgets_list_view) : null, findViewById(R.id.search_widgets_list_view), mTabsView, mViewPager, mNoWidgetsView);
    fastScroller.setOnFastScrollChangeListener(mSearchAndRecommendationsScrollController);
    onRecommendedWidgetsBound();
    onWidgetsBound();
    mSearchAndRecommendationViewHolder.mSearchBar.initialize(mActivityContext.getPopupDataProvider(), /* searchModeListener= */
    this);
    setUpEducationViewsIfNeeded();
}
Also used : TopRoundedCornerView(com.android.launcher3.views.TopRoundedCornerView) LayoutInflater(android.view.LayoutInflater) RecyclerViewFastScroller(com.android.launcher3.views.RecyclerViewFastScroller) PersonalWorkPagedView(com.android.launcher3.workprofile.PersonalWorkPagedView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) WidgetsEduView(com.android.launcher3.views.WidgetsEduView) TextView(android.widget.TextView) TopRoundedCornerView(com.android.launcher3.views.TopRoundedCornerView) ArrowTipView(com.android.launcher3.views.ArrowTipView)

Example 2 with RecyclerViewFastScroller

use of com.android.launcher3.views.RecyclerViewFastScroller in project android_packages_apps_Launcher3 by crdroidandroid.

the class WidgetsFullSheet method onControllerInterceptTouchEvent.

@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    // Disable swipe down when recycler view is scrolling
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        mNoIntercept = false;
        RecyclerViewFastScroller scroller = getRecyclerView().getScrollbar();
        if (scroller.getThumbOffsetY() >= 0 && getPopupContainer().isEventOverView(scroller, ev)) {
            mNoIntercept = true;
        } else if (getPopupContainer().isEventOverView(mContent, ev)) {
            mNoIntercept = !getRecyclerView().shouldContainerScroll(ev, getPopupContainer());
        }
        if (mSearchAndRecommendationViewHolder.mSearchBar.isSearchBarFocused() && !getPopupContainer().isEventOverView(mSearchAndRecommendationViewHolder.mSearchBarContainer, ev)) {
            mSearchAndRecommendationViewHolder.mSearchBar.clearSearchBarFocus();
        }
    }
    return super.onControllerInterceptTouchEvent(ev);
}
Also used : RecyclerViewFastScroller(com.android.launcher3.views.RecyclerViewFastScroller)

Example 3 with RecyclerViewFastScroller

use of com.android.launcher3.views.RecyclerViewFastScroller in project android_packages_apps_Launcher3 by AOSPA.

the class WidgetsFullSheet method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mContent = findViewById(R.id.container);
    LayoutInflater layoutInflater = LayoutInflater.from(getContext());
    int contentLayoutRes = mHasWorkProfile ? R.layout.widgets_full_sheet_paged_view : R.layout.widgets_full_sheet_recyclerview;
    layoutInflater.inflate(contentLayoutRes, mContent, true);
    RecyclerViewFastScroller fastScroller = findViewById(R.id.fast_scroller);
    mAdapters.get(AdapterHolder.PRIMARY).setup(findViewById(R.id.primary_widgets_list_view));
    mAdapters.get(AdapterHolder.SEARCH).setup(findViewById(R.id.search_widgets_list_view));
    if (mHasWorkProfile) {
        mViewPager = findViewById(R.id.widgets_view_pager);
        mViewPager.initParentViews(this);
        mViewPager.getPageIndicator().setOnActivePageChangedListener(this);
        mViewPager.getPageIndicator().setActiveMarker(AdapterHolder.PRIMARY);
        findViewById(R.id.tab_personal).setOnClickListener((View view) -> mViewPager.snapToPage(0));
        findViewById(R.id.tab_work).setOnClickListener((View view) -> mViewPager.snapToPage(1));
        mAdapters.get(AdapterHolder.WORK).setup(findViewById(R.id.work_widgets_list_view));
    } else {
        mViewPager = null;
    }
    mNoWidgetsView = findViewById(R.id.no_widgets_text);
    mSearchScrollController = new SearchAndRecommendationsScrollController(findViewById(R.id.search_and_recommendations_container));
    mSearchScrollController.setCurrentRecyclerView(findViewById(R.id.primary_widgets_list_view));
    mSearchScrollController.mRecommendedWidgetsTable.setWidgetCellLongClickListener(this);
    mSearchScrollController.mRecommendedWidgetsTable.setWidgetCellOnClickListener(this);
    onRecommendedWidgetsBound();
    onWidgetsBound();
    mSearchScrollController.mSearchBar.initialize(mActivityContext.getPopupDataProvider(), /* searchModeListener= */
    this);
    setUpEducationViewsIfNeeded();
}
Also used : LayoutInflater(android.view.LayoutInflater) RecyclerViewFastScroller(com.android.launcher3.views.RecyclerViewFastScroller) PersonalWorkPagedView(com.android.launcher3.workprofile.PersonalWorkPagedView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) WidgetsEduView(com.android.launcher3.views.WidgetsEduView) TextView(android.widget.TextView) ArrowTipView(com.android.launcher3.views.ArrowTipView)

Example 4 with RecyclerViewFastScroller

use of com.android.launcher3.views.RecyclerViewFastScroller in project android_packages_apps_Launcher3 by AOSPA.

the class WidgetsFullSheet method onControllerInterceptTouchEvent.

@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    // Disable swipe down when recycler view is scrolling
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        mNoIntercept = false;
        RecyclerViewFastScroller scroller = getRecyclerView().getScrollbar();
        if (scroller.getThumbOffsetY() >= 0 && getPopupContainer().isEventOverView(scroller, ev)) {
            mNoIntercept = true;
        } else if (getPopupContainer().isEventOverView(mContent, ev)) {
            mNoIntercept = !getRecyclerView().shouldContainerScroll(ev, getPopupContainer());
        }
        if (mSearchScrollController.mSearchBar.isSearchBarFocused() && !getPopupContainer().isEventOverView(mSearchScrollController.mSearchBarContainer, ev)) {
            mSearchScrollController.mSearchBar.clearSearchBarFocus();
        }
    }
    return super.onControllerInterceptTouchEvent(ev);
}
Also used : RecyclerViewFastScroller(com.android.launcher3.views.RecyclerViewFastScroller)

Example 5 with RecyclerViewFastScroller

use of com.android.launcher3.views.RecyclerViewFastScroller in project android_packages_apps_Trebuchet by LineageOS.

the class WidgetsFullSheet method onControllerInterceptTouchEvent.

@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
    // Disable swipe down when recycler view is scrolling
    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
        mNoIntercept = false;
        RecyclerViewFastScroller scroller = mRecyclerView.getScrollbar();
        if (scroller.getThumbOffsetY() >= 0 && getPopupContainer().isEventOverView(scroller, ev)) {
            mNoIntercept = true;
        } else if (getPopupContainer().isEventOverView(mContent, ev)) {
            mNoIntercept = !mRecyclerView.shouldContainerScroll(ev, getPopupContainer());
        }
    }
    return super.onControllerInterceptTouchEvent(ev);
}
Also used : RecyclerViewFastScroller(com.android.launcher3.views.RecyclerViewFastScroller)

Aggregations

RecyclerViewFastScroller (com.android.launcher3.views.RecyclerViewFastScroller)12 LayoutInflater (android.view.LayoutInflater)5 View (android.view.View)5 TextView (android.widget.TextView)5 RecyclerView (androidx.recyclerview.widget.RecyclerView)5 ArrowTipView (com.android.launcher3.views.ArrowTipView)5 WidgetsEduView (com.android.launcher3.views.WidgetsEduView)5 PersonalWorkPagedView (com.android.launcher3.workprofile.PersonalWorkPagedView)5 TopRoundedCornerView (com.android.launcher3.views.TopRoundedCornerView)1