diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml index ce2b6c61930..5bfdb694bda 100644 --- a/res/layout/manage_applications_apps.xml +++ b/res/layout/manage_applications_apps.xml @@ -39,50 +39,6 @@ android:text="@string/no_applications" android:textAppearance="?android:attr/textAppearanceLarge" /> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/running_processes_view.xml b/res/layout/running_processes_view.xml index 68967e4981a..19293abf000 100644 --- a/res/layout/running_processes_view.xml +++ b/res/layout/running_processes_view.xml @@ -37,52 +37,4 @@ android:text="@string/no_running_services" android:textAppearance="?android:attr/textAppearanceLarge" /> - - - - - - diff --git a/res/values/colors.xml b/res/values/colors.xml index d1e892e594b..2fbc591999e 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -56,6 +56,10 @@ @color/theme_accent #fff4511e + #ff384248 + #ff009587 + #ffced7db + #ff263238 #ff21272b diff --git a/res/values/strings.xml b/res/values/strings.xml index 77fd6de3e31..cfb73b23ef3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3096,6 +3096,28 @@ %1$d processes and %2$d services + + Device memory + + App RAM usage + + System + + Apps + + Free + + Used + + Cached + + %1$s of RAM Running app diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index 48e2d5ed233..e40ad25030b 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -199,10 +199,10 @@ public class ManageApplications extends Fragment implements // Custom view used to display running processes private RunningProcessesView mRunningProcessesView; - private LinearColorBar mColorBar; - private TextView mStorageChartLabel; - private TextView mUsedStorageText; - private TextView mFreeStorageText; + //private LinearColorBar mColorBar; + //private TextView mStorageChartLabel; + //private TextView mUsedStorageText; + //private TextView mFreeStorageText; private long mFreeStorage = 0, mAppStorage = 0, mTotalStorage = 0; private long mLastUsedStorage, mLastAppStorage, mLastFreeStorage; @@ -263,17 +263,17 @@ public class ManageApplications extends Fragment implements mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter); mListView.setAdapter(mApplications); mListView.setRecyclerListener(mApplications); - mColorBar = (LinearColorBar)mListContainer.findViewById(R.id.storage_color_bar); - mStorageChartLabel = (TextView)mListContainer.findViewById(R.id.storageChartLabel); - mUsedStorageText = (TextView)mListContainer.findViewById(R.id.usedStorageText); - mFreeStorageText = (TextView)mListContainer.findViewById(R.id.freeStorageText); + //mColorBar = (LinearColorBar)mListContainer.findViewById(R.id.storage_color_bar); + //mStorageChartLabel = (TextView)mListContainer.findViewById(R.id.storageChartLabel); + //mUsedStorageText = (TextView)mListContainer.findViewById(R.id.usedStorageText); + //mFreeStorageText = (TextView)mListContainer.findViewById(R.id.freeStorageText); Utils.prepareCustomPreferencesList(contentParent, contentChild, mListView, false); if (mFilter == FILTER_APPS_SDCARD) { - mStorageChartLabel.setText(mOwner.getActivity().getText( - R.string.sd_card_storage)); + //mStorageChartLabel.setText(mOwner.getActivity().getText( + // R.string.sd_card_storage)); } else { - mStorageChartLabel.setText(mOwner.getActivity().getText( - R.string.internal_storage)); + //mStorageChartLabel.setText(mOwner.getActivity().getText( + // R.string.internal_storage)); } applyCurrentStorage(); } @@ -389,6 +389,7 @@ public class ManageApplications extends Fragment implements if (mRootView == null) { return; } + /* if (mTotalStorage > 0) { BidiFormatter bidiFormatter = BidiFormatter.getInstance(); mColorBar.setRatios((mTotalStorage-mFreeStorage-mAppStorage)/(float)mTotalStorage, @@ -419,6 +420,7 @@ public class ManageApplications extends Fragment implements mFreeStorageText.setText(""); } } + */ } @Override diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java index caa54507660..d0da04bea0c 100644 --- a/src/com/android/settings/applications/RunningProcessesView.java +++ b/src/com/android/settings/applications/RunningProcessesView.java @@ -16,6 +16,7 @@ package com.android.settings.applications; +import android.content.res.Resources; import android.text.BidiFormatter; import com.android.internal.util.MemInfoReader; import com.android.settings.R; @@ -71,9 +72,11 @@ public class RunningProcessesView extends FrameLayout RunningState.BaseItem mCurSelected; ListView mListView; + View mHeader; ServiceListAdapter mAdapter; LinearColorBar mColorBar; TextView mBackgroundProcessText; + TextView mAppsProcessText; TextView mForegroundProcessText; int mLastNumBackgroundProcesses = -1; @@ -316,7 +319,7 @@ public class RunningProcessesView extends FrameLayout void refreshUi(boolean dataChanged) { if (dataChanged) { - ServiceListAdapter adapter = (ServiceListAdapter)(mListView.getAdapter()); + ServiceListAdapter adapter = mAdapter; adapter.refreshItems(); adapter.notifyDataSetChanged(); } @@ -338,38 +341,35 @@ public class RunningProcessesView extends FrameLayout synchronized (mState.mLock) { if (mLastNumBackgroundProcesses != mState.mNumBackgroundProcesses || mLastBackgroundProcessMemory != mState.mBackgroundProcessMemory + || mLastNumForegroundProcesses != mState.mNumForegroundProcesses + || mLastForegroundProcessMemory != mState.mForegroundProcessMemory + || mLastNumServiceProcesses != mState.mNumServiceProcesses + || mLastServiceProcessMemory != mState.mServiceProcessMemory || mLastAvailMemory != availMem) { mLastNumBackgroundProcesses = mState.mNumBackgroundProcesses; mLastBackgroundProcessMemory = mState.mBackgroundProcessMemory; + mLastForegroundProcessMemory = mState.mForegroundProcessMemory; + mLastServiceProcessMemory = mState.mServiceProcessMemory; mLastAvailMemory = availMem; long freeMem = mLastAvailMemory + mLastBackgroundProcessMemory; BidiFormatter bidiFormatter = BidiFormatter.getInstance(); String sizeStr = bidiFormatter.unicodeWrap( Formatter.formatShortFileSize(getContext(), freeMem)); mBackgroundProcessText.setText(getResources().getString( - R.string.service_background_processes, sizeStr)); + R.string.running_processes_header_ram, sizeStr)); sizeStr = bidiFormatter.unicodeWrap( Formatter.formatShortFileSize(getContext(), - mMemInfoReader.getTotalSize() - freeMem)); + mLastForegroundProcessMemory + mLastServiceProcessMemory)); + mAppsProcessText.setText(getResources().getString( + R.string.running_processes_header_ram, sizeStr)); + sizeStr = bidiFormatter.unicodeWrap( + Formatter.formatShortFileSize(getContext(), + mMemInfoReader.getTotalSize() - freeMem + - mLastForegroundProcessMemory - mLastServiceProcessMemory)); mForegroundProcessText.setText(getResources().getString( - R.string.service_foreground_processes, sizeStr)); + R.string.running_processes_header_ram, sizeStr)); } - if (mLastNumForegroundProcesses != mState.mNumForegroundProcesses - || mLastForegroundProcessMemory != mState.mForegroundProcessMemory - || mLastNumServiceProcesses != mState.mNumServiceProcesses - || mLastServiceProcessMemory != mState.mServiceProcessMemory) { - mLastNumForegroundProcesses = mState.mNumForegroundProcesses; - mLastForegroundProcessMemory = mState.mForegroundProcessMemory; - mLastNumServiceProcesses = mState.mNumServiceProcesses; - mLastServiceProcessMemory = mState.mServiceProcessMemory; - /* - String sizeStr = Formatter.formatShortFileSize(getContext(), - mLastForegroundProcessMemory + mLastServiceProcessMemory); - mForegroundProcessText.setText(getResources().getString( - R.string.service_foreground_processes, sizeStr)); - */ - } - + float totalMem = mMemInfoReader.getTotalSize(); float totalShownMem = availMem + mLastBackgroundProcessMemory + mLastServiceProcessMemory; @@ -428,27 +428,16 @@ public class RunningProcessesView extends FrameLayout mListView.setRecyclerListener(this); mAdapter = new ServiceListAdapter(mState); mListView.setAdapter(mAdapter); - mColorBar = (LinearColorBar)findViewById(R.id.color_bar); - mBackgroundProcessText = (TextView)findViewById(R.id.backgroundText); - mBackgroundProcessText.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mAdapter.setShowBackground(true); - if (mOwner != null) { - mOwner.getActivity().invalidateOptionsMenu(); - } - } - }); - mForegroundProcessText = (TextView)findViewById(R.id.foregroundText); - mForegroundProcessText.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mAdapter.setShowBackground(false); - if (mOwner != null) { - mOwner.getActivity().invalidateOptionsMenu(); - } - } - }); + mHeader = inflater.inflate(R.layout.running_processes_header, null); + mListView.addHeaderView(mHeader); + mColorBar = (LinearColorBar)mHeader.findViewById(R.id.color_bar); + Resources res = getResources(); + mColorBar.setColors(res.getColor(R.color.running_processes_system_ram), + res.getColor(R.color.running_processes_apps_ram), + res.getColor(R.color.running_processes_free_ram)); + mBackgroundProcessText = (TextView)mHeader.findViewById(R.id.freeSize); + mAppsProcessText = (TextView)mHeader.findViewById(R.id.appsSize); + mForegroundProcessText = (TextView)mHeader.findViewById(R.id.systemSize); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); mAm.getMemoryInfo(memInfo);