Merge "Make Process Stats more beautiful"

This commit is contained in:
Fabrice Di Meglio
2014-06-18 23:15:38 +00:00
committed by Android (Google) Code Review
6 changed files with 104 additions and 71 deletions

View File

@@ -18,6 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Label for the item-->
<TextView
android:id="@+id/label"
@@ -31,8 +32,8 @@
android:layout_toStartOf="@+id/value"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:layout_marginStart="4dip"
android:layout_marginEnd="4dip"/>
<TextView
android:id="@+id/value"
android:layout_width="wrap_content"
@@ -42,6 +43,6 @@
android:textStyle="normal"
android:singleLine="true"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:layout_marginEnd="10dip"/>
android:layout_marginTop="4dip" />
</RelativeLayout>

View File

@@ -25,6 +25,8 @@
android:id="@+id/all_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:orientation="vertical">
@@ -89,5 +91,6 @@
<!-- Insert detail items here -->
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -17,7 +17,9 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingEnd="?android:attr/scrollbarSize">
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<com.android.settings.applications.LinearColorBar
android:id="@+id/linear_color_bar"
android:layout_width="match_parent"
@@ -31,4 +33,5 @@
android:shadowDx="2"
android:shadowDy="2">
</com.android.settings.applications.LinearColorBar>
</FrameLayout>

View File

@@ -31,6 +31,13 @@
<include layout="@layout/app_percentage_item" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical">
<!-- Force stop and report buttons -->
<LinearLayout
android:id="@+id/two_buttons_panel"
@@ -38,8 +45,8 @@
android:layout_height="wrap_content"
android:paddingBottom="6dip"
android:orientation="vertical">
<include
layout="@layout/two_buttons_panel"/>
<include layout="@layout/two_buttons_panel"/>
</LinearLayout>
<TextView
@@ -50,7 +57,6 @@
android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="6dip"
android:orientation="vertical">
<!-- Insert detail items here -->
@@ -65,7 +71,6 @@
android:id="@+id/services"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="6dip"
android:orientation="vertical">
<!-- Insert service items here -->
@@ -73,4 +78,7 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -21,20 +21,37 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.preference.Preference;
import android.text.format.Formatter;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.R;
public class ProcessStatsPreference extends Preference {
private final ProcStatsEntry mEntry;
private ProcStatsEntry mEntry;
private int mProgress;
private CharSequence mProgressText;
public ProcessStatsPreference(Context context, Drawable icon, ProcStatsEntry entry) {
super(context);
mEntry = entry;
public ProcessStatsPreference(Context context) {
this(context, null);
}
public ProcessStatsPreference(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.app_percentage_item);
}
public void init(Drawable icon, ProcStatsEntry entry) {
mEntry = entry;
setIcon(icon != null ? icon : new ColorDrawable(0));
}

View File

@@ -579,7 +579,8 @@ public class ProcessStatsUi extends PreferenceFragment
+ " time=" + percentOfTime);
continue;
}
ProcessStatsPreference pref = new ProcessStatsPreference(getActivity(), null, proc);
ProcessStatsPreference pref = new ProcessStatsPreference(getActivity());
pref.init(null, proc);
proc.evaluateTargetPackage(pm, mStats, totals, sEntryCompare, mUseUss,
mStatsType == MENU_TYPE_BACKGROUND);
proc.retrieveUiData(pm);