Search in sources :

Example 1 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project android_packages_apps_Settings by omnirom.

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(), getLifecycle()).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);
        boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
        CharSequence summary = isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
        controller.setSummary(summary);
    }
    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(android.support.annotation.VisibleForTesting)

Example 2 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project android_packages_apps_Settings by SudaMod.

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(), getLifecycle()).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);
        boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
        CharSequence summary = isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
        controller.setSummary(summary);
    }
    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(android.support.annotation.VisibleForTesting)

Example 3 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project android_packages_apps_Settings by DirtyUnicorns.

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(), getLifecycle()).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);
        boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
        CharSequence summary = isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
        controller.setSummary(summary);
    }
    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(android.support.annotation.VisibleForTesting)

Example 4 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project platform_packages_apps_Settings by BlissRoms.

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(), getLifecycle()).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);
        boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
        CharSequence summary = isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
        controller.setSummary(summary);
    }
    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(android.support.annotation.VisibleForTesting)

Example 5 with EntityHeaderController

use of com.android.settings.widget.EntityHeaderController in project android_packages_apps_Settings by LineageOS.

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(), getLifecycle()).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);
        boolean isInstantApp = AppUtils.isInstant(mAppEntry.info);
        CharSequence summary = isInstantApp ? null : getString(Utils.getInstallationStatus(mAppEntry.info));
        controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info));
        controller.setSummary(summary);
    }
    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(android.support.annotation.VisibleForTesting)

Aggregations

Activity (android.app.Activity)8 Bundle (android.os.Bundle)8 View (android.view.View)8 EntityHeaderController (com.android.settings.widget.EntityHeaderController)8 SettingsActivity (com.android.settings.SettingsActivity)7 VisibleForTesting (android.support.annotation.VisibleForTesting)6 UserInfo (android.content.pm.UserInfo)1 UserManager (android.os.UserManager)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 LayoutPreference (com.android.settingslib.widget.LayoutPreference)1