Search in sources :

Example 31 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project packages_apps_Settings by AICP.

the class AdvancedPowerUsageDetail method initHeader.

@VisibleForTesting
void initHeader() {
    final View appSnippet = mHeaderPreference.findViewById(R.id.entity_header);
    final Activity context = getActivity();
    final Bundle bundle = getArguments();
    EntityHeaderController controller = EntityHeaderController.newInstance(context, this, appSnippet).setRecyclerView(getListView(), getSettingsLifecycle()).setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE);
    if (mAppEntry == null) {
        controller.setLabel(bundle.getString(EXTRA_LABEL));
        final int iconId = bundle.getInt(EXTRA_ICON_ID, 0);
        if (iconId == 0) {
            controller.setIcon(context.getPackageManager().getDefaultActivityIcon());
        } else {
            controller.setIcon(context.getDrawable(bundle.getInt(EXTRA_ICON_ID)));
        }
    } else {
        mState.ensureIcon(mAppEntry);
        controller.setLabel(mAppEntry);
        controller.setIcon(mAppEntry);
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
    }
    if (mEnableTriState) {
        controller.setSummary(getAppActiveTime(bundle));
    }
    controller.done(context, true);
}
Also used : EntityHeaderController(com.android.settings.widget.EntityHeaderController) Bundle(android.os.Bundle) SettingsActivity(com.android.settings.SettingsActivity) Activity(android.app.Activity) View(android.view.View) VisibleForTesting(androidx.annotation.VisibleForTesting)

Aggregations

Activity (android.app.Activity)31 Bundle (android.os.Bundle)31 View (android.view.View)31 EntityHeaderController (com.android.settings.widget.EntityHeaderController)31 SettingsActivity (com.android.settings.SettingsActivity)16 UserInfo (android.content.pm.UserInfo)15 UserManager (android.os.UserManager)15 LayoutPreference (com.android.settingslib.widget.LayoutPreference)15 VisibleForTesting (androidx.annotation.VisibleForTesting)14 VisibleForTesting (android.support.annotation.VisibleForTesting)2 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 TextView (android.widget.TextView)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1