Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab837049 authored by Antoan Angelov's avatar Antoan Angelov Committed by Android (Google) Code Review
Browse files

Merge "Move content preview outside of the ViewPager (work tab part 2)"

parents e8d1d0d2 a3912cf2
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.internal.app;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.content.Context;
import android.os.UserHandle;
import android.view.View;
@@ -60,7 +61,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
            @Override
            public void onPageSelected(int position) {
                mCurrentPage = position;
                getCurrentListAdapter().rebuildList();
                getActiveListAdapter().rebuildList();
            }
        });
        viewPager.setAdapter(this);
@@ -89,7 +90,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
    }

    UserHandle getCurrentUserHandle() {
        return getCurrentListAdapter().mResolverListController.getUserHandle();
        return getActiveListAdapter().mResolverListController.getUserHandle();
    }

    @Override
@@ -136,7 +137,17 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
    abstract Object getAdapterForIndex(int pageIndex);

    @VisibleForTesting
    public abstract ResolverListAdapter getCurrentListAdapter();
    public abstract ResolverListAdapter getActiveListAdapter();

    /**
     * If this is a device with a work profile, returns the {@link ResolverListAdapter} instance
     * of the profile that is not the active one. Otherwise returns {@code null}. For example,
     * if the share sheet is launched in the work profile, this method returns the personal
     * profile {@link ResolverListAdapter}.
     * @see #getActiveListAdapter()
     */
    @VisibleForTesting
    public abstract @Nullable ResolverListAdapter getInactiveListAdapter();

    abstract Object getCurrentRootAdapter();

+81 −86

File changed.

Preview size limit exceeded, changes collapsed.

+10 −1
Original line number Diff line number Diff line
@@ -102,10 +102,19 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd

    @Override
    @VisibleForTesting
    public ChooserListAdapter getCurrentListAdapter() {
    public ChooserListAdapter getActiveListAdapter() {
        return getAdapterForIndex(getCurrentPage()).getListAdapter();
    }

    @Override
    @VisibleForTesting
    public ChooserListAdapter getInactiveListAdapter() {
        if (getCount() == 1) {
            return null;
        }
        return getAdapterForIndex(1 - getCurrentPage()).getListAdapter();
    }

    @Override
    ChooserActivity.ChooserGridAdapter getCurrentRootAdapter() {
        return getAdapterForIndex(getCurrentPage());
+55 −52

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -351,12 +351,12 @@ public class ResolverListAdapter extends BaseAdapter {
     * determine the layout known. We therefore can't update the UI inline and post to the
     * handler thread to update after the current task is finished.
     */
    private void postListReadyRunnable() {
    void postListReadyRunnable() {
        if (mPostListReadyRunnable == null) {
            mPostListReadyRunnable = new Runnable() {
                @Override
                public void run() {
                    mResolverListCommunicator.onPostListReady();
                    mResolverListCommunicator.onPostListReady(ResolverListAdapter.this);
                    mPostListReadyRunnable = null;
                }
            };
@@ -599,7 +599,7 @@ public class ResolverListAdapter extends BaseAdapter {

        Intent getReplacementIntent(ActivityInfo activityInfo, Intent defIntent);

        void onPostListReady();
        void onPostListReady(ResolverListAdapter listAdapter);

        void sendVoiceChoicesIfNeeded();

Loading