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:
@@ -195,13 +195,18 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
||||
|
||||
public static void startAppInfoFragment(Class<?> fragment, int titleRes,
|
||||
String pkg, int uid, Fragment source, int request) {
|
||||
startAppInfoFragment(fragment, titleRes, pkg, uid, source.getActivity(), request);
|
||||
}
|
||||
|
||||
public static void startAppInfoFragment(Class<?> fragment, int titleRes,
|
||||
String pkg, int uid, Activity source, int request) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg);
|
||||
args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid);
|
||||
|
||||
Intent intent = Utils.onBuildStartFragmentIntent(source.getActivity(), fragment.getName(),
|
||||
Intent intent = Utils.onBuildStartFragmentIntent(source, fragment.getName(),
|
||||
args, null, titleRes, null, false);
|
||||
source.getActivity().startActivityForResultAsUser(intent, request,
|
||||
source.startActivityForResultAsUser(intent, request,
|
||||
new UserHandle(UserHandle.getUserId(uid)));
|
||||
}
|
||||
|
||||
|
@@ -16,19 +16,13 @@
|
||||
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.AppHeader;
|
||||
|
||||
public abstract class AppInfoWithHeader extends AppInfoBase {
|
||||
|
||||
public static final String EXTRA_HIDE_INFO_BUTTON = "hideInfoButton";
|
||||
|
||||
private boolean mCreated;
|
||||
|
||||
@Override
|
||||
@@ -41,24 +35,7 @@ public abstract class AppInfoWithHeader extends AppInfoBase {
|
||||
mCreated = true;
|
||||
if (mPackageInfo == null) return;
|
||||
AppHeader.createAppHeader(this, mPackageInfo.applicationInfo.loadIcon(mPm),
|
||||
mPackageInfo.applicationInfo.loadLabel(mPm), getInfoIntent(this, mPackageName), 0);
|
||||
}
|
||||
|
||||
public static Intent getInfoIntent(Fragment fragment, String packageName) {
|
||||
Bundle args = fragment.getArguments();
|
||||
Intent intent = fragment.getActivity().getIntent();
|
||||
boolean showInfo = true;
|
||||
if (args != null && args.getBoolean(EXTRA_HIDE_INFO_BUTTON, false)) {
|
||||
showInfo = false;
|
||||
}
|
||||
if (intent != null && intent.getBooleanExtra(EXTRA_HIDE_INFO_BUTTON, false)) {
|
||||
showInfo = false;
|
||||
}
|
||||
Intent infoIntent = null;
|
||||
if (showInfo) {
|
||||
infoIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
infoIntent.setData(Uri.fromParts("package", packageName, null));
|
||||
}
|
||||
return infoIntent;
|
||||
mPackageInfo.applicationInfo.loadLabel(mPm), mPackageName,
|
||||
mPackageInfo.applicationInfo.uid, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -67,6 +67,7 @@ import android.widget.TextView;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.os.BatterySipper;
|
||||
import com.android.internal.os.BatteryStatsHelper;
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.DataUsageSummary;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
@@ -680,7 +681,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
// start new activity to manage app permissions
|
||||
Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
|
||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mAppEntry.info.packageName);
|
||||
intent.putExtra(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||
intent.putExtra(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
@@ -693,7 +694,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PACKAGE_NAME, mAppEntry.info.packageName);
|
||||
args.putInt(ARG_PACKAGE_UID, mAppEntry.info.uid);
|
||||
args.putBoolean(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||
|
||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
||||
sa.startPreferencePanel(fragment.getName(), args, -1, title, this, SUB_INFO_FRAGMENT);
|
||||
@@ -742,7 +743,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
|
||||
} else if (preference == mMemoryPreference) {
|
||||
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
|
||||
mStatsManager.getMemInfo(), mStats);
|
||||
mStatsManager.getMemInfo(), mStats, false);
|
||||
} else if (preference == mDataPreference) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(DataUsageSummary.EXTRA_SHOW_APP_IMMEDIATE_PKG,
|
||||
@@ -754,7 +755,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
} else if (preference == mBatteryPreference) {
|
||||
BatteryEntry entry = new BatteryEntry(getActivity(), null, mUserManager, mSipper);
|
||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(),
|
||||
mBatteryHelper, BatteryStats.STATS_SINCE_CHARGED, entry, true);
|
||||
mBatteryHelper, BatteryStats.STATS_SINCE_CHARGED, entry, true, false);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@@ -363,7 +363,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (mListType == LIST_TYPE_STORAGE) {
|
||||
FrameLayout pinnedHeader = (FrameLayout) mRootView.findViewById(R.id.pinned_header);
|
||||
AppHeader.createAppHeader(getActivity(), null, mVolumeName, null, pinnedHeader);
|
||||
AppHeader.createAppHeader(getActivity(), null, mVolumeName, null, -1, pinnedHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.android.internal.app.ProcessStats;
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
@@ -128,7 +129,7 @@ public abstract class ProcessStatsBase extends SettingsPreferenceFragment
|
||||
public abstract void refreshUi();
|
||||
|
||||
public static void launchMemoryDetail(SettingsActivity activity, MemInfo memInfo,
|
||||
ProcStatsPackageEntry entry) {
|
||||
ProcStatsPackageEntry entry, boolean includeAppInfo) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, entry);
|
||||
args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM, memInfo.weightToRam);
|
||||
@@ -136,6 +137,7 @@ public abstract class ProcessStatsBase extends SettingsPreferenceFragment
|
||||
args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE,
|
||||
memInfo.usedWeight * memInfo.weightToRam);
|
||||
args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
|
||||
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, !includeAppInfo);
|
||||
activity.startPreferencePanel(ProcessStatsDetail.class.getName(), args,
|
||||
R.string.memory_usage, null, null, 0);
|
||||
}
|
||||
|
@@ -121,8 +121,7 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
|
||||
|
||||
AppHeader.createAppHeader(this,
|
||||
mApp.mUiTargetApp != null ? mApp.mUiTargetApp.loadIcon(mPm) : new ColorDrawable(0),
|
||||
mApp.mUiLabel, mApp.mPackage.equals(Utils.OS_PKG) ? null
|
||||
: AppInfoWithHeader.getInfoIntent(this, mApp.mPackage));
|
||||
mApp.mUiLabel, mApp.mPackage, mApp.mUiTargetApp.uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -108,7 +108,7 @@ public class ProcessStatsUi extends ProcessStatsBase {
|
||||
}
|
||||
ProcessStatsPreference pgp = (ProcessStatsPreference) preference;
|
||||
MemInfo memInfo = mStatsManager.getMemInfo();
|
||||
launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry());
|
||||
launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry(), true);
|
||||
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
Reference in New Issue
Block a user