Unify data/power layout, confirm disable, round.

Share consistent layout between data usage and battery usage.  Show
confirmation dialog before disabling mobile data.  Round warning/limit
sweep values to match displayed label.  Suppress fade when switching
data usage tabs.

Bug: 5208510, 5058157, 5038589, 5252816
Change-Id: I3c76f3397445d2d3b173666a41672871df4c61af
This commit is contained in:
Jeff Sharkey
2011-09-02 16:10:24 -07:00
parent 4e658ba969
commit 28130d9638
12 changed files with 151 additions and 212 deletions

View File

@@ -41,6 +41,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.DisplaySettings;
@@ -116,7 +117,6 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
private ViewGroup mControlsParent;
private long mStartTime;
private DrainType mDrainType;
private PercentageBar mGauge;
private Drawable mAppIcon;
private double mNoCoverage; // Percentage of time that there was no coverage
@@ -181,30 +181,29 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
}
// Set the description
String summary = getDescriptionForDrainType();
((TextView)mRootView.findViewById(R.id.summary)).setText(summary);
final TextView summary = (TextView) mRootView.findViewById(android.R.id.summary);
summary.setText(getDescriptionForDrainType());
summary.setVisibility(View.VISIBLE);
mTypes = args.getIntArray(EXTRA_DETAIL_TYPES);
mValues = args.getDoubleArray(EXTRA_DETAIL_VALUES);
mTitleView = (TextView)mRootView.findViewById(R.id.name);
mTitleView = (TextView) mRootView.findViewById(android.R.id.title);
mTitleView.setText(mTitle);
((TextView)mRootView.findViewById(R.id.battery_percentage))
.setText(String.format("%d%%", percentage));
final TextView text1 = (TextView)mRootView.findViewById(android.R.id.text1);
text1.setText(getString(R.string.percentage, percentage));
mTwoButtonsPanel = (ViewGroup)mRootView.findViewById(R.id.two_buttons_panel);
mForceStopButton = (Button)mRootView.findViewById(R.id.left_button);
mReportButton = (Button)mRootView.findViewById(R.id.right_button);
mForceStopButton.setEnabled(false);
ImageView gaugeImage = (ImageView)mRootView.findViewById(R.id.gauge);
mGauge = new PercentageBar();
mGauge.percent = gaugeValue;
mGauge.bar = getResources().getDrawable(R.drawable.app_gauge);
gaugeImage.setImageDrawable(mGauge);
ImageView iconImage = (ImageView)mRootView.findViewById(R.id.icon);
iconImage.setImageDrawable(mAppIcon);
final ProgressBar progress = (ProgressBar) mRootView.findViewById(android.R.id.progress);
progress.setProgress(gaugeValue);
final ImageView icon = (ImageView) mRootView.findViewById(android.R.id.icon);
icon.setImageDrawable(mAppIcon);
mDetailsParent = (ViewGroup)mRootView.findViewById(R.id.details);
mControlsParent = (ViewGroup)mRootView.findViewById(R.id.controls);