Update master switch style
- When off, background grey - When on, background accent - Switch toggle always white, only change the slider color during on/off Change-Id: I0ca49439f4e20e75517d503f28cc3068930591e8 Bug: 69462439 Test: robotests
This commit is contained in:
@@ -1,18 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<issues format="4">
|
<issues format="4">
|
||||||
|
|
||||||
<issue
|
|
||||||
id="LintError"
|
|
||||||
severity="Error"
|
|
||||||
message="No `.class` files were found in project ".", so none of the classfile based checks could be run. Does the project need to be built first?"
|
|
||||||
category="Lint"
|
|
||||||
priority="10"
|
|
||||||
summary="Lint Failure"
|
|
||||||
explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
|
|
||||||
<location
|
|
||||||
file="."/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
<issue
|
||||||
id="HardCodedColor"
|
id="HardCodedColor"
|
||||||
severity="Error"
|
severity="Error"
|
||||||
@@ -749,6 +737,22 @@
|
|||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="HardCodedColor"
|
||||||
|
severity="Error"
|
||||||
|
message="Avoid using hardcoded color"
|
||||||
|
category="Correctness"
|
||||||
|
priority="4"
|
||||||
|
summary="Using hardcoded color"
|
||||||
|
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
||||||
|
errorLine1=" <color name="switch_bar_background">#ff80868B</color>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="res/values/colors.xml"
|
||||||
|
line="84"
|
||||||
|
column="5"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
<issue
|
<issue
|
||||||
id="HardCodedColor"
|
id="HardCodedColor"
|
||||||
severity="Error"
|
severity="Error"
|
||||||
@@ -761,7 +765,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="85"
|
line="87"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -777,7 +781,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="86"
|
line="88"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -793,7 +797,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="87"
|
line="89"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -809,7 +813,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="88"
|
line="90"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -825,7 +829,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="89"
|
line="91"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -841,7 +845,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="90"
|
line="92"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -857,7 +861,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="91"
|
line="93"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -873,7 +877,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="92"
|
line="94"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -889,7 +893,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="93"
|
line="95"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -905,7 +909,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="94"
|
line="96"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -921,7 +925,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="95"
|
line="97"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -937,7 +941,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="98"
|
line="100"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -953,7 +957,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="100"
|
line="102"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -969,7 +973,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="103"
|
line="105"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -985,7 +989,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="105"
|
line="107"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1001,7 +1005,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="108"
|
line="110"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1017,7 +1021,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="111"
|
line="113"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1033,7 +1037,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="114"
|
line="116"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1049,7 +1053,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="117"
|
line="119"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1065,7 +1069,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/colors.xml"
|
file="res/values/colors.xml"
|
||||||
line="118"
|
line="120"
|
||||||
column="5"/>
|
column="5"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1305,7 +1309,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_color_inversion.xml"
|
file="res/drawable/ic_color_inversion.xml"
|
||||||
line="17"
|
line="32"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1321,7 +1325,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_color_inversion.xml"
|
file="res/drawable/ic_color_inversion.xml"
|
||||||
line="18"
|
line="33"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1337,7 +1341,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_color_inversion.xml"
|
file="res/drawable/ic_color_inversion.xml"
|
||||||
line="32"
|
line="47"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1353,7 +1357,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_color_inversion.xml"
|
file="res/drawable/ic_color_inversion.xml"
|
||||||
line="33"
|
line="48"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1369,7 +1373,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_daltonizer.xml"
|
file="res/drawable/ic_daltonizer.xml"
|
||||||
line="16"
|
line="31"
|
||||||
column="27"/>
|
column="27"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1385,7 +1389,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_daltonizer.xml"
|
file="res/drawable/ic_daltonizer.xml"
|
||||||
line="17"
|
line="32"
|
||||||
column="27"/>
|
column="27"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1401,7 +1405,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_daltonizer.xml"
|
file="res/drawable/ic_daltonizer.xml"
|
||||||
line="36"
|
line="51"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -1417,7 +1421,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/drawable/ic_daltonizer.xml"
|
file="res/drawable/ic_daltonizer.xml"
|
||||||
line="37"
|
line="52"
|
||||||
column="23"/>
|
column="23"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2073,7 +2077,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values-en-rXC/strings.xml"
|
file="res/values-en-rXC/strings.xml"
|
||||||
line="2333"
|
line="2353"
|
||||||
column="168"/>
|
column="168"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2089,7 +2093,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values-en-rAU/strings.xml"
|
file="res/values-en-rAU/strings.xml"
|
||||||
line="2334"
|
line="2354"
|
||||||
column="64"/>
|
column="64"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2105,7 +2109,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values-en-rCA/strings.xml"
|
file="res/values-en-rCA/strings.xml"
|
||||||
line="2334"
|
line="2354"
|
||||||
column="64"/>
|
column="64"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2121,7 +2125,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values-en-rGB/strings.xml"
|
file="res/values-en-rGB/strings.xml"
|
||||||
line="2334"
|
line="2354"
|
||||||
column="64"/>
|
column="64"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2137,7 +2141,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values-en-rIN/strings.xml"
|
file="res/values-en-rIN/strings.xml"
|
||||||
line="2334"
|
line="2354"
|
||||||
column="64"/>
|
column="64"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2153,7 +2157,7 @@
|
|||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
<location
|
<location
|
||||||
file="res/values/strings.xml"
|
file="res/values/strings.xml"
|
||||||
line="5512"
|
line="5539"
|
||||||
column="36"/>
|
column="36"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2173,22 +2177,6 @@
|
|||||||
column="41"/>
|
column="41"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
<issue
|
|
||||||
id="HardCodedColor"
|
|
||||||
severity="Error"
|
|
||||||
message="Avoid using hardcoded color"
|
|
||||||
category="Correctness"
|
|
||||||
priority="4"
|
|
||||||
summary="Using hardcoded color"
|
|
||||||
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
|
||||||
errorLine1=" <item name="android:colorAccent">#ff009688</item>"
|
|
||||||
errorLine2=" ^">
|
|
||||||
<location
|
|
||||||
file="res/values/styles.xml"
|
|
||||||
line="366"
|
|
||||||
column="42"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
<issue
|
||||||
id="HardCodedColor"
|
id="HardCodedColor"
|
||||||
severity="Error"
|
severity="Error"
|
||||||
@@ -2201,7 +2189,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/styles.xml"
|
file="res/values/styles.xml"
|
||||||
line="443"
|
line="442"
|
||||||
column="44"/>
|
column="44"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2217,7 +2205,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/styles.xml"
|
file="res/values/styles.xml"
|
||||||
line="449"
|
line="448"
|
||||||
column="44"/>
|
column="44"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2233,7 +2221,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/styles.xml"
|
file="res/values/styles.xml"
|
||||||
line="450"
|
line="449"
|
||||||
column="44"/>
|
column="44"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2249,7 +2237,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/styles.xml"
|
file="res/values/styles.xml"
|
||||||
line="473"
|
line="472"
|
||||||
column="41"/>
|
column="41"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2393,7 +2381,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="139"
|
line="154"
|
||||||
column="43"/>
|
column="43"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2409,7 +2397,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="140"
|
line="155"
|
||||||
column="42"/>
|
column="42"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2425,7 +2413,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="141"
|
line="156"
|
||||||
column="45"/>
|
column="45"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2437,30 +2425,14 @@
|
|||||||
priority="4"
|
priority="4"
|
||||||
summary="Using hardcoded color"
|
summary="Using hardcoded color"
|
||||||
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
||||||
errorLine1=" <item name="switchBarBackgroundColor">@color/material_grey_200</item>"
|
errorLine1=" <item name="switchBarBackgroundColor">@color/switch_bar_background</item>"
|
||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="147"
|
line="233"
|
||||||
column="47"/>
|
column="47"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
<issue
|
|
||||||
id="HardCodedColor"
|
|
||||||
severity="Error"
|
|
||||||
message="Avoid using hardcoded color"
|
|
||||||
category="Correctness"
|
|
||||||
priority="4"
|
|
||||||
summary="Using hardcoded color"
|
|
||||||
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
|
|
||||||
errorLine1=" <item name="android:colorControlActivated">@color/material_blue_500</item>"
|
|
||||||
errorLine2=" ^">
|
|
||||||
<location
|
|
||||||
file="res/values/themes.xml"
|
|
||||||
line="148"
|
|
||||||
column="52"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
<issue
|
||||||
id="HardCodedColor"
|
id="HardCodedColor"
|
||||||
severity="Error"
|
severity="Error"
|
||||||
@@ -2473,7 +2445,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="298"
|
line="316"
|
||||||
column="45"/>
|
column="45"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2489,7 +2461,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="299"
|
line="317"
|
||||||
column="49"/>
|
column="49"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2505,7 +2477,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="307"
|
line="325"
|
||||||
column="45"/>
|
column="45"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
@@ -2521,7 +2493,7 @@
|
|||||||
errorLine2=" ^">
|
errorLine2=" ^">
|
||||||
<location
|
<location
|
||||||
file="res/values/themes.xml"
|
file="res/values/themes.xml"
|
||||||
line="308"
|
line="326"
|
||||||
column="49"/>
|
column="49"/>
|
||||||
</issue>
|
</issue>
|
||||||
|
|
||||||
|
20
res/color/switchbar_switch_thumb_tint.xml
Normal file
20
res/color/switchbar_switch_thumb_tint.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#FFFFFF" />
|
||||||
|
</selector>
|
21
res/color/switchbar_switch_track_tint.xml
Normal file
21
res/color/switchbar_switch_track_tint.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="#BFFFFFFF" />
|
||||||
|
</selector>
|
@@ -31,15 +31,12 @@
|
|||||||
<com.android.settings.widget.SwitchBar android:id="@+id/switch_bar"
|
<com.android.settings.widget.SwitchBar android:id="@+id/switch_bar"
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/switchbar_background"
|
android:theme="?attr/switchBarTheme" />
|
||||||
android:theme="?attr/switchBarTheme"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/main_content"
|
android:id="@+id/main_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" />
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -54,8 +51,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dip"
|
android:layout_margin="5dip"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:text="@*android:string/back_button_label"
|
android:text="@*android:string/back_button_label" />
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@@ -68,15 +64,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dip"
|
android:layout_margin="5dip"
|
||||||
android:text="@*android:string/skip_button_label"
|
android:text="@*android:string/skip_button_label"
|
||||||
android:visibility="gone"
|
android:visibility="gone" />
|
||||||
/>
|
|
||||||
|
|
||||||
<Button android:id="@+id/next_button"
|
<Button android:id="@+id/next_button"
|
||||||
android:layout_width="150dip"
|
android:layout_width="150dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dip"
|
android:layout_margin="5dip"
|
||||||
android:text="@*android:string/next_button_label"
|
android:text="@*android:string/next_button_label" />
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@@ -25,7 +25,5 @@
|
|||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
android:background="@drawable/switchbar_background"
|
android:theme="?attr/switchBarTheme" />
|
||||||
android:theme="?attr/switchBarTheme"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@@ -17,33 +17,37 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<TextView android:id="@+id/switch_text"
|
<TextView
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/switch_text"
|
||||||
android:layout_width="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_width="0dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_weight="1"
|
||||||
android:maxLines="2"
|
android:layout_gravity="center_vertical"
|
||||||
android:ellipsize="end"
|
android:maxLines="2"
|
||||||
android:textAppearance="@style/TextAppearance.Switch"
|
android:ellipsize="end"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textAppearance="@style/TextAppearance.Switch"
|
||||||
android:textAlignment="viewStart" />
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textAlignment="viewStart" />
|
||||||
|
|
||||||
<ImageView android:id="@+id/restricted_icon"
|
<ImageView
|
||||||
android:layout_width="@dimen/restricted_icon_size"
|
android:id="@+id/restricted_icon"
|
||||||
android:layout_height="@dimen/restricted_icon_size"
|
android:layout_width="@dimen/restricted_icon_size"
|
||||||
android:src="@drawable/ic_info"
|
android:layout_height="@dimen/restricted_icon_size"
|
||||||
android:theme="@android:style/Theme.Material"
|
android:src="@drawable/ic_info"
|
||||||
android:layout_gravity="center_vertical"
|
android:theme="@android:style/Theme.Material"
|
||||||
android:layout_marginEnd="@dimen/restricted_icon_margin_end"
|
android:layout_gravity="center_vertical"
|
||||||
android:visibility="gone" />
|
android:layout_marginEnd="@dimen/restricted_icon_margin_end"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<com.android.settings.widget.ToggleSwitch android:id="@+id/switch_widget"
|
<com.android.settings.widget.ToggleSwitch
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/switch_widget"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/ThemeOverlay.SwitchBar.Settings" />
|
android:layout_gravity="center_vertical"
|
||||||
|
android:theme="@style/Widget.SwitchBar.Switch" />
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
|
||||||
|
@@ -14,8 +14,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/tabs_container"
|
android:id="@+id/tabs_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
android:id="@+id/switch_bar"
|
android:id="@+id/switch_bar"
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/switchbar_background"
|
|
||||||
android:theme="?attr/switchBarTheme" />
|
android:theme="?attr/switchBarTheme" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@@ -57,7 +57,6 @@
|
|||||||
|
|
||||||
<!-- SwitchBar sub settings margin start / end -->
|
<!-- SwitchBar sub settings margin start / end -->
|
||||||
<dimen name="switchbar_subsettings_margin_start">80dp</dimen>
|
<dimen name="switchbar_subsettings_margin_start">80dp</dimen>
|
||||||
<dimen name="switchbar_subsettings_margin_end">24dp</dimen>
|
|
||||||
|
|
||||||
<dimen name="search_bar_height">64dp</dimen>
|
<dimen name="search_bar_height">64dp</dimen>
|
||||||
<dimen name="search_bar_half_height">32dp</dimen>
|
<dimen name="search_bar_half_height">32dp</dimen>
|
||||||
|
@@ -123,6 +123,7 @@
|
|||||||
<attr name="switchBarMarginStart" format="dimension" />
|
<attr name="switchBarMarginStart" format="dimension" />
|
||||||
<attr name="switchBarMarginEnd" format="dimension" />
|
<attr name="switchBarMarginEnd" format="dimension" />
|
||||||
<attr name="switchBarBackgroundColor" format="color" />
|
<attr name="switchBarBackgroundColor" format="color" />
|
||||||
|
<attr name="switchBarBackgroundActivatedColor" format="color" />
|
||||||
|
|
||||||
<attr name="preferenceBackgroundColor" format="color" />
|
<attr name="preferenceBackgroundColor" format="color" />
|
||||||
|
|
||||||
|
@@ -81,6 +81,8 @@
|
|||||||
<color name="material_blue_700">#3367D6</color>
|
<color name="material_blue_700">#3367D6</color>
|
||||||
<color name="material_grey_100">#f5f5f5</color>
|
<color name="material_grey_100">#f5f5f5</color>
|
||||||
<color name="material_grey_200">#ffffff</color>
|
<color name="material_grey_200">#ffffff</color>
|
||||||
|
<color name="switch_bar_background">#ff80868B</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="message_text_incoming">#ffffffff</color>
|
<color name="message_text_incoming">#ffffffff</color>
|
||||||
<color name="message_text_outgoing">#ff323232</color>
|
<color name="message_text_outgoing">#ff323232</color>
|
||||||
|
@@ -112,7 +112,7 @@
|
|||||||
|
|
||||||
<!-- SwitchBar sub settings margin start / end -->
|
<!-- SwitchBar sub settings margin start / end -->
|
||||||
<dimen name="switchbar_subsettings_margin_start">72dp</dimen>
|
<dimen name="switchbar_subsettings_margin_start">72dp</dimen>
|
||||||
<dimen name="switchbar_subsettings_margin_end">16dp</dimen>
|
<dimen name="switchbar_subsettings_margin_end">24dp</dimen>
|
||||||
|
|
||||||
<!-- The following two margins need to match, with the caveat that
|
<!-- The following two margins need to match, with the caveat that
|
||||||
the second should be negative. The second one ensures that the icons and text
|
the second should be negative. The second one ensures that the icons and text
|
||||||
|
@@ -155,13 +155,7 @@
|
|||||||
<item name="android:colorAccent">@color/material_blue_700</item>
|
<item name="android:colorAccent">@color/material_blue_700</item>
|
||||||
<item name="android:titleTextColor">@color/material_blue_700</item>
|
<item name="android:titleTextColor">@color/material_blue_700</item>
|
||||||
<item name="preferenceTheme">@style/PreferenceTheme</item>
|
<item name="preferenceTheme">@style/PreferenceTheme</item>
|
||||||
<item name="switchBarTheme">@style/SetupWizardAccessibilitySwitchBarTheme</item>
|
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="SetupWizardAccessibilitySwitchBarTheme" parent="ThemeOverlay.SwitchBar.Settings">
|
|
||||||
<item name="switchBarBackgroundColor">@color/material_grey_200</item>
|
|
||||||
<item name="android:colorControlActivated">@color/material_blue_500</item>
|
|
||||||
<item name="android:textColorPrimary">@android:color/black</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Theme with no local references, used by AccountPreferenceBase where we have to inflate
|
<!-- Theme with no local references, used by AccountPreferenceBase where we have to inflate
|
||||||
@@ -205,7 +199,7 @@
|
|||||||
<!-- Redefine the ActionBar style for contentInsetStart -->
|
<!-- Redefine the ActionBar style for contentInsetStart -->
|
||||||
<item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
|
<item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
|
||||||
|
|
||||||
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.SubSettings</item>
|
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar.Settings</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Variant of the settings theme with no action bar. -->
|
<!-- Variant of the settings theme with no action bar. -->
|
||||||
@@ -233,15 +227,16 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
<style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
||||||
|
<item name="android:textColorPrimary">@android:color/white</item>
|
||||||
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
|
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
|
||||||
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
|
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
|
||||||
<item name="switchBarBackgroundColor">?android:attr/colorSecondary</item>
|
<item name="switchBarBackgroundColor">@color/switch_bar_background</item>
|
||||||
|
<item name="switchBarBackgroundActivatedColor">?android:attr/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeOverlay.SwitchBar.SubSettings" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
<style name="Widget.SwitchBar.Switch" parent="@android:style/Widget.Material.CompoundButton.Switch">
|
||||||
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
|
<item name="android:trackTint">@color/switchbar_switch_track_tint</item>
|
||||||
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
|
<item name="android:thumbTint">@color/switchbar_switch_thumb_tint</item>
|
||||||
<item name="switchBarBackgroundColor">?android:attr/colorSecondary</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.CryptKeeper" parent="@android:style/Theme.Material.NoActionBar">
|
<style name="Theme.CryptKeeper" parent="@android:style/Theme.Material.NoActionBar">
|
||||||
|
@@ -22,6 +22,8 @@ import android.content.Context;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import android.support.annotation.ColorInt;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.style.TextAppearanceSpan;
|
import android.text.style.TextAppearanceSpan;
|
||||||
@@ -42,6 +44,7 @@ import com.android.settings.overlay.FeatureFactory;
|
|||||||
import com.android.settingslib.RestrictedLockUtils;
|
import com.android.settingslib.RestrictedLockUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
|
public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
|
||||||
View.OnClickListener {
|
View.OnClickListener {
|
||||||
@@ -56,7 +59,14 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
void onSwitchChanged(Switch switchView, boolean isChecked);
|
void onSwitchChanged(Switch switchView, boolean isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
private static final int[] XML_ATTRIBUTES = {
|
||||||
|
R.attr.switchBarMarginStart,
|
||||||
|
R.attr.switchBarMarginEnd,
|
||||||
|
R.attr.switchBarBackgroundColor,
|
||||||
|
R.attr.switchBarBackgroundActivatedColor};
|
||||||
|
|
||||||
|
private final List<OnSwitchChangeListener> mSwitchChangeListeners = new ArrayList<>();
|
||||||
|
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
private final TextAppearanceSpan mSummarySpan;
|
private final TextAppearanceSpan mSummarySpan;
|
||||||
|
|
||||||
private ToggleSwitch mSwitch;
|
private ToggleSwitch mSwitch;
|
||||||
@@ -64,20 +74,20 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
private String mLabel;
|
private String mLabel;
|
||||||
private String mSummary;
|
private String mSummary;
|
||||||
|
@ColorInt
|
||||||
|
private int mBackgroundColor;
|
||||||
|
@ColorInt
|
||||||
|
private int mBackgroundActivatedColor;
|
||||||
|
@StringRes
|
||||||
private int mOnTextId;
|
private int mOnTextId;
|
||||||
|
@StringRes
|
||||||
private int mOffTextId;
|
private int mOffTextId;
|
||||||
|
|
||||||
private boolean mLoggingIntialized;
|
private boolean mLoggingIntialized;
|
||||||
private boolean mDisabledByAdmin;
|
private boolean mDisabledByAdmin;
|
||||||
private EnforcedAdmin mEnforcedAdmin = null;
|
private EnforcedAdmin mEnforcedAdmin = null;
|
||||||
|
|
||||||
private String mMetricsTag;
|
private String mMetricsTag;
|
||||||
|
|
||||||
private final ArrayList<OnSwitchChangeListener> mSwitchChangeListeners = new ArrayList<>();
|
|
||||||
|
|
||||||
private static int[] XML_ATTRIBUTES = {
|
|
||||||
R.attr.switchBarMarginStart, R.attr.switchBarMarginEnd,
|
|
||||||
R.attr.switchBarBackgroundColor};
|
|
||||||
|
|
||||||
public SwitchBar(Context context) {
|
public SwitchBar(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -99,32 +109,30 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
final TypedArray a = context.obtainStyledAttributes(attrs, XML_ATTRIBUTES);
|
final TypedArray a = context.obtainStyledAttributes(attrs, XML_ATTRIBUTES);
|
||||||
int switchBarMarginStart = (int) a.getDimension(0, 0);
|
int switchBarMarginStart = (int) a.getDimension(0, 0);
|
||||||
int switchBarMarginEnd = (int) a.getDimension(1, 0);
|
int switchBarMarginEnd = (int) a.getDimension(1, 0);
|
||||||
int switchBarBackgroundColor = (int) a.getColor(2, 0);
|
mBackgroundColor = a.getColor(2, 0);
|
||||||
|
mBackgroundActivatedColor = a.getColor(3, 0);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
|
||||||
mTextView = (TextView) findViewById(R.id.switch_text);
|
mTextView = findViewById(R.id.switch_text);
|
||||||
mTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
mTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
mSummarySpan = new TextAppearanceSpan(mContext, R.style.TextAppearance_Small_SwitchBar);
|
mSummarySpan = new TextAppearanceSpan(mContext, R.style.TextAppearance_Small_SwitchBar);
|
||||||
ViewGroup.MarginLayoutParams lp = (MarginLayoutParams) mTextView.getLayoutParams();
|
ViewGroup.MarginLayoutParams lp = (MarginLayoutParams) mTextView.getLayoutParams();
|
||||||
lp.setMarginStart(switchBarMarginStart);
|
lp.setMarginStart(switchBarMarginStart);
|
||||||
|
|
||||||
mSwitch = (ToggleSwitch) findViewById(R.id.switch_widget);
|
mSwitch = findViewById(R.id.switch_widget);
|
||||||
// Prevent onSaveInstanceState() to be called as we are managing the state of the Switch
|
// Prevent onSaveInstanceState() to be called as we are managing the state of the Switch
|
||||||
// on our own
|
// on our own
|
||||||
mSwitch.setSaveEnabled(false);
|
mSwitch.setSaveEnabled(false);
|
||||||
mSwitch.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
mSwitch.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
|
|
||||||
lp = (MarginLayoutParams) mSwitch.getLayoutParams();
|
lp = (MarginLayoutParams) mSwitch.getLayoutParams();
|
||||||
lp.setMarginEnd(switchBarMarginEnd);
|
lp.setMarginEnd(switchBarMarginEnd);
|
||||||
setBackgroundColor(switchBarBackgroundColor);
|
setBackgroundColor(mBackgroundColor);
|
||||||
|
|
||||||
setSwitchBarText(R.string.switch_on_text, R.string.switch_off_text);
|
setSwitchBarText(R.string.switch_on_text, R.string.switch_off_text);
|
||||||
|
|
||||||
addOnSwitchChangeListener(new OnSwitchChangeListener() {
|
addOnSwitchChangeListener(
|
||||||
@Override
|
(switchView, isChecked) -> setTextViewLabelAndBackground(isChecked));
|
||||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
|
||||||
setTextViewLabel(isChecked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mRestrictedIcon = findViewById(R.id.restricted_icon);
|
mRestrictedIcon = findViewById(R.id.restricted_icon);
|
||||||
|
|
||||||
@@ -140,15 +148,16 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
mMetricsTag = tag;
|
mMetricsTag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextViewLabel(boolean isChecked) {
|
public void setTextViewLabelAndBackground(boolean isChecked) {
|
||||||
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
|
mLabel = getResources().getString(isChecked ? mOnTextId : mOffTextId);
|
||||||
|
setBackgroundColor(isChecked ? mBackgroundActivatedColor : mBackgroundColor);
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwitchBarText(int onText, int offText) {
|
public void setSwitchBarText(int onText, int offText) {
|
||||||
mOnTextId = onText;
|
mOnTextId = onText;
|
||||||
mOffTextId = offText;
|
mOffTextId = offText;
|
||||||
setTextViewLabel(isChecked());
|
setTextViewLabelAndBackground(isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSummary(String summary) {
|
public void setSummary(String summary) {
|
||||||
@@ -169,12 +178,12 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setChecked(boolean checked) {
|
public void setChecked(boolean checked) {
|
||||||
setTextViewLabel(checked);
|
setTextViewLabelAndBackground(checked);
|
||||||
mSwitch.setChecked(checked);
|
mSwitch.setChecked(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCheckedInternal(boolean checked) {
|
public void setCheckedInternal(boolean checked) {
|
||||||
setTextViewLabel(checked);
|
setTextViewLabelAndBackground(checked);
|
||||||
mSwitch.setCheckedInternal(checked);
|
mSwitch.setCheckedInternal(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +299,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
*/
|
*/
|
||||||
private SavedState(Parcel in) {
|
private SavedState(Parcel in) {
|
||||||
super(in);
|
super(in);
|
||||||
checked = (Boolean)in.readValue(null);
|
checked = (Boolean) in.readValue(null);
|
||||||
visible = (Boolean)in.readValue(null);
|
visible = (Boolean) in.readValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -338,7 +347,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
super.onRestoreInstanceState(ss.getSuperState());
|
super.onRestoreInstanceState(ss.getSuperState());
|
||||||
|
|
||||||
mSwitch.setCheckedInternal(ss.checked);
|
mSwitch.setCheckedInternal(ss.checked);
|
||||||
setTextViewLabel(ss.checked);
|
setTextViewLabelAndBackground(ss.checked);
|
||||||
setVisibility(ss.visible ? View.VISIBLE : View.GONE);
|
setVisibility(ss.visible ? View.VISIBLE : View.GONE);
|
||||||
mSwitch.setOnCheckedChangeListener(ss.visible ? this : null);
|
mSwitch.setOnCheckedChangeListener(ss.visible ? this : null);
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ public class SwitchBarController extends SwitchWidgetController implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTitle(boolean isChecked) {
|
public void updateTitle(boolean isChecked) {
|
||||||
mSwitchBar.setTextViewLabel(isChecked);
|
mSwitchBar.setTextViewLabelAndBackground(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -24,8 +24,8 @@ public class ToggleSwitch extends Switch {
|
|||||||
|
|
||||||
private ToggleSwitch.OnBeforeCheckedChangeListener mOnBeforeListener;
|
private ToggleSwitch.OnBeforeCheckedChangeListener mOnBeforeListener;
|
||||||
|
|
||||||
public static interface OnBeforeCheckedChangeListener {
|
public interface OnBeforeCheckedChangeListener {
|
||||||
public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked);
|
boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToggleSwitch(Context context) {
|
public ToggleSwitch(Context context) {
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
package com.android.settings.widget;
|
package com.android.settings.widget;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.robolectric.RuntimeEnvironment.application;
|
import static org.robolectric.RuntimeEnvironment.application;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -38,36 +38,50 @@ import org.robolectric.annotation.Config;
|
|||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class SwitchBarTest {
|
public class SwitchBarTest {
|
||||||
|
|
||||||
|
private static final int COLOR_BACKGROUND = 1;
|
||||||
|
private static final int COLOR_BACKGROUND_ACTIVATED = 2;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private SwitchBar mBar;
|
private SwitchBar mBar;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mBar = new SwitchBar(application, Robolectric.buildAttributeSet().build());
|
mBar = new SwitchBar(application, Robolectric.buildAttributeSet()
|
||||||
|
.addAttribute(R.attr.switchBarBackgroundColor, String.valueOf(COLOR_BACKGROUND))
|
||||||
|
.addAttribute(R.attr.switchBarBackgroundActivatedColor,
|
||||||
|
String.valueOf(COLOR_BACKGROUND_ACTIVATED))
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultLabels() {
|
public void cycleChecked_defaultLabel_shouldUpdateTextAndBackground() {
|
||||||
int defaultOnText = R.string.switch_on_text;
|
final int defaultOnText = R.string.switch_on_text;
|
||||||
int defaultOffText = R.string.switch_off_text;
|
final int defaultOffText = R.string.switch_off_text;
|
||||||
|
|
||||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||||
.isEqualTo(mContext.getString(defaultOffText));
|
.isEqualTo(mContext.getString(defaultOffText));
|
||||||
|
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND));
|
||||||
|
|
||||||
mBar.setChecked(true);
|
mBar.setChecked(true);
|
||||||
|
|
||||||
|
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND_ACTIVATED));
|
||||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||||
.isEqualTo(mContext.getString(defaultOnText));
|
.isEqualTo(mContext.getString(defaultOnText));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomLabels() {
|
public void cycleChecked_customLabel_shouldUpdateTextAndBackground() {
|
||||||
int onText = R.string.master_clear_progress_text;
|
final int onText = R.string.master_clear_progress_text;
|
||||||
int offText = R.string.manage_space_text;
|
final int offText = R.string.manage_space_text;
|
||||||
|
|
||||||
mBar.setSwitchBarText(onText, offText);
|
mBar.setSwitchBarText(onText, offText);
|
||||||
|
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND));
|
||||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||||
.isEqualTo(mContext.getString(offText));
|
.isEqualTo(mContext.getString(offText));
|
||||||
|
|
||||||
mBar.setChecked(true);
|
mBar.setChecked(true);
|
||||||
|
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND_ACTIVATED));
|
||||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||||
.isEqualTo(mContext.getString(onText));
|
.isEqualTo(mContext.getString(onText));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user