Make the app header bar more consistent.
- Don't include info link if just came from app info page - include back button on app info page when launched from header Bug: 22203029 Change-Id: I737332a487c41e0a93d161b55659700a1f936844
This commit is contained in:
@@ -84,7 +84,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
|
||||
public static void startBatteryDetailPage(
|
||||
SettingsActivity caller, BatteryStatsHelper helper, int statsType, BatteryEntry entry,
|
||||
boolean showLocationButton) {
|
||||
boolean showLocationButton, boolean includeAppInfo) {
|
||||
// Initialize mStats if necessary.
|
||||
helper.getStats();
|
||||
|
||||
@@ -104,6 +104,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
}
|
||||
args.putSerializable(PowerUsageDetail.EXTRA_DRAIN_TYPE, entry.sipper.drainType);
|
||||
args.putBoolean(PowerUsageDetail.EXTRA_SHOW_LOCATION_BUTTON, showLocationButton);
|
||||
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, !includeAppInfo);
|
||||
|
||||
int userId = UserHandle.myUserId();
|
||||
int[] types;
|
||||
@@ -462,13 +463,15 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
String pkg = args.getString(EXTRA_ICON_PACKAGE);
|
||||
int iconId = args.getInt(EXTRA_ICON_ID, 0);
|
||||
Drawable appIcon = null;
|
||||
int uid = -1;
|
||||
final PackageManager pm = getActivity().getPackageManager();
|
||||
|
||||
if (!TextUtils.isEmpty(pkg)) {
|
||||
try {
|
||||
final PackageManager pm = getActivity().getPackageManager();
|
||||
ApplicationInfo ai = pm.getPackageInfo(pkg, 0).applicationInfo;
|
||||
if (ai != null) {
|
||||
appIcon = ai.loadIcon(pm);
|
||||
uid = ai.uid;
|
||||
}
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
// Use default icon
|
||||
@@ -483,8 +486,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
if (pkg == null && mPackages != null) {
|
||||
pkg = mPackages[0];
|
||||
}
|
||||
AppHeader.createAppHeader(this, appIcon, title,
|
||||
pkg != null ? AppInfoWithHeader.getInfoIntent(this, pkg) : null,
|
||||
AppHeader.createAppHeader(this, appIcon, title, pkg, uid,
|
||||
mDrainType != DrainType.APP ? android.R.color.white : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.android.settings.HelpUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.ManageApplications;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -123,7 +124,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
PowerGaugePreference pgp = (PowerGaugePreference) preference;
|
||||
BatteryEntry entry = pgp.getInfo();
|
||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), mStatsHelper,
|
||||
mStatsType, entry, true);
|
||||
mStatsType, entry, true, true);
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user