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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations