diff --git a/res/color/white_disabled.xml b/res/color/white_disabled.xml
deleted file mode 100644
index 17008a87ea2..00000000000
--- a/res/color/white_disabled.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
diff --git a/res/drawable/data_usage_progress.xml b/res/drawable/color_bar_progress.xml
similarity index 72%
rename from res/drawable/data_usage_progress.xml
rename to res/drawable/color_bar_progress.xml
index 46b9a128b7b..d2774678636 100644
--- a/res/drawable/data_usage_progress.xml
+++ b/res/drawable/color_bar_progress.xml
@@ -16,19 +16,19 @@
-
-
+ android:tint="@*android:color/config_progress_background_tint">
+
-
+
-
+ r
-
-
+
-
+
@@ -36,9 +36,9 @@
-
+
-
+
diff --git a/res/drawable/ring_progress.xml b/res/drawable/ring_progress.xml
index 02fcd5bf30c..346ff5f5bed 100644
--- a/res/drawable/ring_progress.xml
+++ b/res/drawable/ring_progress.xml
@@ -22,7 +22,7 @@
android:thickness="@dimen/ring_progress_bar_thickness"
android:useLevel="false"
android:tint="?android:colorControlNormal">
-
+
-
diff --git a/res/layout/data_usage_summary_preference.xml b/res/layout/data_usage_summary_preference.xml
index eda8a81e250..7a1e3b295d9 100644
--- a/res/layout/data_usage_summary_preference.xml
+++ b/res/layout/data_usage_summary_preference.xml
@@ -68,8 +68,8 @@
android:id="@+id/determinateBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
- android:layout_height="10dp"
- android:progressDrawable="@drawable/data_usage_progress"/>
+ android:layout_height="wrap_content"
+ android:progressDrawable="@drawable/color_bar_progress"/>
-
+ android:layout_height="wrap_content"
+ android:progressDrawable="@drawable/color_bar_progress"/>
-
+ android:layout_height="wrap_content"
+ android:progressDrawable="@drawable/color_bar_progress"/>
= DisplayMetrics.DENSITY_HIGH
- ? 2 : 1;
- mEdgeGradientPaint.setStrokeWidth(mLineWidth);
- mEdgeGradientPaint.setAntiAlias(true);
- mLeftColor = mMiddleColor = Utils.getColorAccent(context);
- }
-
- public void setRatios(float red, float yellow, float green) {
- mRedRatio = red;
- mYellowRatio = yellow;
- mGreenRatio = green;
- invalidate();
- }
-
- public void setColors(int red, int yellow, int green) {
- mLeftColor = red;
- mMiddleColor = yellow;
- mRightColor = green;
- updateIndicator();
- invalidate();
- }
-
- private void updateIndicator() {
- int off = getPaddingTop() - getPaddingBottom();
- if (off < 0) off = 0;
- mRect.top = off;
- mRect.bottom = getHeight();
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- updateIndicator();
- }
-
- @Override
- protected void dispatchSetPressed(boolean pressed) {
- invalidate();
- }
-
- private int pickColor(int color, int region) {
- if (isPressed() && (mLastRegion & region) != 0) {
- return WHITE_COLOR;
- }
- if ((mColoredRegions & region) == 0) {
- return GRAY_COLOR;
- }
- return color;
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
-
- final int width = getWidth();
-
- if (!isLayoutRtl()) {
- drawLtr(canvas, width);
- } else {
- drawRtl(canvas, width);
- }
- }
-
- private void drawLtr(Canvas canvas, int width) {
- int start = 0;
- int end = start + (int) (width * mRedRatio);
- int end2 = end + (int) (width * mYellowRatio);
-
- if (start < end) {
- mRect.left = start;
- mRect.right = end;
- mPaint.setColor(pickColor(mLeftColor, REGION_RED));
- canvas.drawRect(mRect, mPaint);
- start = end;
- }
-
- end = end2;
-
- if (start < end) {
- mRect.left = start;
- mRect.right = end;
- mPaint.setColor(pickColor(mMiddleColor, REGION_YELLOW));
- canvas.drawRect(mRect, mPaint);
- start = end;
- }
-
- end = width;
- if (start < end) {
- mRect.left = start;
- mRect.right = end;
- mPaint.setColor(pickColor(mRightColor, REGION_GREEN));
- canvas.drawRect(mRect, mPaint);
- }
- }
-
- private void drawRtl(Canvas canvas, int width) {
- int start = width;
- int end = start - (int) (width * mRedRatio);
- int end2 = end - (int) (width * mYellowRatio);
-
- if (start > end) {
- mRect.left = end;
- mRect.right = start;
- mPaint.setColor(pickColor(mLeftColor, REGION_RED));
- canvas.drawRect(mRect, mPaint);
- start = end;
- }
-
- end = end2;
-
- if (start > end) {
- mRect.left = end;
- mRect.right = start;
- mPaint.setColor(pickColor(mMiddleColor, REGION_YELLOW));
- canvas.drawRect(mRect, mPaint);
- start = end;
- }
-
- end = 0;
- if (start > end) {
- mRect.left = end;
- mRect.right = start;
- mPaint.setColor(pickColor(mRightColor, REGION_GREEN));
- canvas.drawRect(mRect, mPaint);
- }
- }
-}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
index 9ca93f5ad34..9352d4bc042 100644
--- a/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
@@ -25,13 +25,16 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.annotation.Config;
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
+@Config(shadows = SettingsShadowResourcesImpl.class)
public class SummaryPreferenceTest {
private PreferenceViewHolder mHolder;
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
index c9ed3a5062d..b9a6b105fa5 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
@@ -36,6 +36,7 @@ import com.android.settings.R;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import com.android.settings.testutils.shadow.ShadowUtils;
import com.android.settings.testutils.shadow.ShadowVibrator;
import com.android.settings.wrapper.FingerprintManagerWrapper;
@@ -54,7 +55,10 @@ import org.robolectric.shadow.api.Shadow;
import java.util.concurrent.TimeUnit;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(shadows = {ShadowUtils.class, ShadowVibrator.class})
+@Config(shadows = {
+ SettingsShadowResourcesImpl.class,
+ ShadowUtils.class,
+ ShadowVibrator.class})
public class FingerprintEnrollEnrollingTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java
index 361b7b3805c..3fb8e2decb5 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java
@@ -52,6 +52,11 @@ public class SettingsShadowResourcesImpl extends ShadowResourcesImpl {
id = R.drawable.ic_expand_more_inverse;
} else if (id == R.drawable.selectable_card_grey) {
id = R.drawable.ic_expand_more_inverse;
+ } else if (id == R.drawable.color_bar_progress
+ || id == R.drawable.ring_progress) {
+ // color_bar_progress and ring_progress use hidden resources, so just use the regular
+ // progress_horizontal drawable
+ id = android.R.drawable.progress_horizontal;
}
return super.loadDrawable(wrapper, value, id, density, theme);
}
diff --git a/tests/robotests/src/com/android/settings/widget/LinearColorBarTest.java b/tests/robotests/src/com/android/settings/widget/LinearColorBarTest.java
deleted file mode 100644
index e2c82c276a9..00000000000
--- a/tests/robotests/src/com/android/settings/widget/LinearColorBarTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.widget;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.graphics.Canvas;
-
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.Shadows;
-import org.robolectric.shadows.ShadowCanvas;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class LinearColorBarTest {
-
- private static final int HEIGHT = 100;
- private static final int WIDTH = 100;
-
- private Context mContext;
- private LinearColorBar mLinearColorBar;
- private Canvas mCanvas;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mLinearColorBar = spy(new LinearColorBar(mContext, null /* attrs */));
- when(mLinearColorBar.getHeight()).thenReturn(HEIGHT);
- when(mLinearColorBar.getWidth()).thenReturn(WIDTH);
- mLinearColorBar.setRatios(0.2f, 0.4f, 0.4f);
- mLinearColorBar.setColors(1, 2, 3);
- mCanvas = new Canvas();
- }
-
- @Test
- public void draw_ltr_showStartFromLeft() {
- mLinearColorBar.onDraw(mCanvas);
-
- final ShadowCanvas shadowCanvas = Shadows.shadowOf(mCanvas);
- assertThat(shadowCanvas.getRectPaintHistoryCount()).isEqualTo(3);
-
- // 3 boxes, takes space of 20%, 40%, 40% of the the WIDTH correspondingly.
- assertThat(shadowCanvas.getDrawnRect(0).left).isWithin(0.01f).of(0);
- assertThat(shadowCanvas.getDrawnRect(1).left).isWithin(0.01f).of(20);
- assertThat(shadowCanvas.getDrawnRect(2).left).isWithin(0.01f).of(60);
- }
-
- @Test
- public void draw_rtl_showStartFromRight() {
- when(mLinearColorBar.isLayoutRtl()).thenReturn(true);
-
- mLinearColorBar.onDraw(mCanvas);
-
- final ShadowCanvas shadowCanvas = Shadows.shadowOf(mCanvas);
- assertThat(shadowCanvas.getRectPaintHistoryCount()).isEqualTo(3);
-
- // 3 boxes, takes space of 20%, 40%, 40% of the the WIDTH correspondingly.
- assertThat(shadowCanvas.getDrawnRect(0).right).isWithin(0.01f).of(100);
- assertThat(shadowCanvas.getDrawnRect(1).right).isWithin(0.01f).of(80);
- assertThat(shadowCanvas.getDrawnRect(2).right).isWithin(0.01f).of(40);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java b/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
index d14203d4cbd..8dc78a5740b 100644
--- a/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.view.View.MeasureSpec;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import org.junit.Before;
import org.junit.Test;
@@ -29,6 +30,7 @@ import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
+@org.robolectric.annotation.Config(shadows = SettingsShadowResourcesImpl.class)
public class RingProgressBarTest {
private Context mContext = RuntimeEnvironment.application;