Search in sources :

Example 1 with StorageStatsSource

use of com.android.settingslib.applications.StorageStatsSource in project android_packages_apps_Settings by LineageOS.

the class ManageApplications method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;
    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
        // Create adapter and list view here
        View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
        ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
        if (emptyView != null) {
            lv.setEmptyView(emptyView);
        }
        lv.setOnItemClickListener(this);
        lv.setSaveEnabled(true);
        lv.setItemsCanFocus(true);
        lv.setTextFilterEnabled(true);
        mListView = lv;
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
        if (savedInstanceState != null) {
            mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
            mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
        }
        int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
        if (mStorageType == STORAGE_TYPE_MUSIC) {
            Context context = getContext();
            mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        } else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
            Context context = getContext();
            mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        }
        mListView.setAdapter(mApplications);
        mListView.setRecyclerListener(mApplications);
        mListView.setFastScrollEnabled(isFastScrollEnabled());
        Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
    }
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }
    createHeader();
    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
    return mRootView;
}
Also used : Context(android.content.Context) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) PreferenceFrameLayout(android.preference.PreferenceFrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Example 2 with StorageStatsSource

use of com.android.settingslib.applications.StorageStatsSource in project platform_packages_apps_Settings by BlissRoms.

the class ManageApplications method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;
    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
        // Create adapter and list view here
        View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
        ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
        if (emptyView != null) {
            lv.setEmptyView(emptyView);
        }
        lv.setOnItemClickListener(this);
        lv.setSaveEnabled(true);
        lv.setItemsCanFocus(true);
        lv.setTextFilterEnabled(true);
        lv.setFastScrollEnabled(true);
        mListView = lv;
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
        if (savedInstanceState != null) {
            mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
            mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
        }
        int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
        if (mStorageType == STORAGE_TYPE_MUSIC) {
            Context context = getContext();
            mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        } else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
            Context context = getContext();
            mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        }
        mListView.setAdapter(mApplications);
        mListView.setRecyclerListener(mApplications);
        mListView.setFastScrollEnabled(isFastScrollEnabled());
        Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
    }
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }
    createHeader();
    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
    return mRootView;
}
Also used : Context(android.content.Context) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) PreferenceFrameLayout(android.preference.PreferenceFrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Example 3 with StorageStatsSource

use of com.android.settingslib.applications.StorageStatsSource in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ManageApplications method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mListType == LIST_TYPE_OVERLAY && !Utils.isSystemAlertWindowEnabled(getContext())) {
        mRootView = inflater.inflate(R.layout.manage_applications_apps_unsupported, null);
        setHasOptionsMenu(false);
        return mRootView;
    }
    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
        // Create adapter and list view here
        mEmptyView = mListContainer.findViewById(android.R.id.empty);
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter, savedInstanceState);
        if (savedInstanceState != null) {
            mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
            mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
        }
        int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
        if (mStorageType == STORAGE_TYPE_MUSIC) {
            Context context = getContext();
            mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        } else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
            Context context = getContext();
            mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        }
        mRecyclerView = mListContainer.findViewById(R.id.apps_list);
        mRecyclerView.setItemAnimator(null);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
        mRecyclerView.setAdapter(mApplications);
    }
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }
    createHeader();
    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
    return mRootView;
}
Also used : Context(android.content.Context) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) PreferenceFrameLayout(android.preference.PreferenceFrameLayout)

Example 4 with StorageStatsSource

use of com.android.settingslib.applications.StorageStatsSource in project android_packages_apps_Settings by omnirom.

the class ManageApplications method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;
    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
        // Create adapter and list view here
        View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
        ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
        if (emptyView != null) {
            lv.setEmptyView(emptyView);
        }
        lv.setOnItemClickListener(this);
        lv.setSaveEnabled(true);
        lv.setItemsCanFocus(true);
        lv.setTextFilterEnabled(true);
        mListView = lv;
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
        if (savedInstanceState != null) {
            mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
            mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
        }
        int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
        if (mStorageType == STORAGE_TYPE_MUSIC) {
            Context context = getContext();
            mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        } else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
            Context context = getContext();
            mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        }
        mListView.setAdapter(mApplications);
        mListView.setRecyclerListener(mApplications);
        mListView.setFastScrollEnabled(isFastScrollEnabled());
        Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
    }
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }
    createHeader();
    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
    return mRootView;
}
Also used : Context(android.content.Context) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) PreferenceFrameLayout(android.preference.PreferenceFrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Example 5 with StorageStatsSource

use of com.android.settingslib.applications.StorageStatsSource in project android_packages_apps_Settings by DirtyUnicorns.

the class ManageApplications method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;
    mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
    mLoadingContainer = mRootView.findViewById(R.id.loading_container);
    mListContainer = mRootView.findViewById(R.id.list_container);
    if (mListContainer != null) {
        // Create adapter and list view here
        View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
        ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
        if (emptyView != null) {
            lv.setEmptyView(emptyView);
        }
        lv.setOnItemClickListener(this);
        lv.setSaveEnabled(true);
        lv.setItemsCanFocus(true);
        lv.setTextFilterEnabled(true);
        mListView = lv;
        mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
        if (savedInstanceState != null) {
            mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
            mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
        }
        int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
        if (mStorageType == STORAGE_TYPE_MUSIC) {
            Context context = getContext();
            mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        } else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
            Context context = getContext();
            mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
        }
        mListView.setAdapter(mApplications);
        mListView.setRecyclerListener(mApplications);
        mListView.setFastScrollEnabled(isFastScrollEnabled());
        Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
    }
    // only when the view is added.
    if (container instanceof PreferenceFrameLayout) {
        ((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
    }
    createHeader();
    mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
    return mRootView;
}
Also used : Context(android.content.Context) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) PreferenceFrameLayout(android.preference.PreferenceFrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Aggregations

Context (android.content.Context)7 PreferenceFrameLayout (android.preference.PreferenceFrameLayout)7 StorageStatsSource (com.android.settingslib.applications.StorageStatsSource)7 View (android.view.View)6 AbsListView (android.widget.AbsListView)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 TextView (android.widget.TextView)6 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1