Loading src/com/android/settings/fuelgauge/PowerGaugePreference.java +2 −1 Original line number Diff line number Diff line Loading @@ -111,8 +111,9 @@ public class PowerGaugePreference extends TintablePreference { if (mShowAnomalyIcon) { subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_warning_24dp, 0, 0, 0); } else { subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0); } ((TextView) view.findViewById(R.id.widget_summary)).setText(mProgress); if (mContentDescription != null) { final TextView titleView = (TextView) view.findViewById(android.R.id.title); titleView.setContentDescription(mContentDescription); Loading tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ public class PowerGaugePreferenceTest { } @Test public void testOnBindViewHolder_bindAnomalyIcon() { public void testOnBindViewHolder_showAnomaly_bindAnomalyIcon() { mPowerGaugePreference.shouldShowAnomalyIcon(true); mPowerGaugePreference.onBindViewHolder(mPreferenceViewHolder); Loading @@ -92,6 +92,17 @@ public class PowerGaugePreferenceTest { assertThat(drawables[0]).isInstanceOf(VectorDrawable.class); } @Test public void testOnBindViewHolder_notShowAnomaly_bindAnomalyIcon() { mPowerGaugePreference.shouldShowAnomalyIcon(false); mPowerGaugePreference.onBindViewHolder(mPreferenceViewHolder); final Drawable[] drawables = ((TextView) mPreferenceViewHolder.findViewById( R.id.widget_summary)).getCompoundDrawablesRelative(); assertThat(drawables[0]).isNull(); } @Test public void testOnBindViewHolder_bindContentDescription() { mPowerGaugePreference.setContentDescription(CONTENT_DESCRIPTION); Loading Loading
src/com/android/settings/fuelgauge/PowerGaugePreference.java +2 −1 Original line number Diff line number Diff line Loading @@ -111,8 +111,9 @@ public class PowerGaugePreference extends TintablePreference { if (mShowAnomalyIcon) { subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_warning_24dp, 0, 0, 0); } else { subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0); } ((TextView) view.findViewById(R.id.widget_summary)).setText(mProgress); if (mContentDescription != null) { final TextView titleView = (TextView) view.findViewById(android.R.id.title); titleView.setContentDescription(mContentDescription); Loading
tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ public class PowerGaugePreferenceTest { } @Test public void testOnBindViewHolder_bindAnomalyIcon() { public void testOnBindViewHolder_showAnomaly_bindAnomalyIcon() { mPowerGaugePreference.shouldShowAnomalyIcon(true); mPowerGaugePreference.onBindViewHolder(mPreferenceViewHolder); Loading @@ -92,6 +92,17 @@ public class PowerGaugePreferenceTest { assertThat(drawables[0]).isInstanceOf(VectorDrawable.class); } @Test public void testOnBindViewHolder_notShowAnomaly_bindAnomalyIcon() { mPowerGaugePreference.shouldShowAnomalyIcon(false); mPowerGaugePreference.onBindViewHolder(mPreferenceViewHolder); final Drawable[] drawables = ((TextView) mPreferenceViewHolder.findViewById( R.id.widget_summary)).getCompoundDrawablesRelative(); assertThat(drawables[0]).isNull(); } @Test public void testOnBindViewHolder_bindContentDescription() { mPowerGaugePreference.setContentDescription(CONTENT_DESCRIPTION); Loading