Rename GLIF Pixel to GLIF v2
Since we are giving the option to OEMs to use the center alignment theme, rename it to something not Pixel specific. Test: Tests updated. ./gradlew connectedAndroidTest test Bug: 36857917 Change-Id: I09b0ebb743ccaa0ad6b215a12576ce1109a3fa31
This commit is contained in:
parent
f6b2d025f6
commit
e46be9bcf0
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<!-- General styles -->
|
<!-- General styles -->
|
||||||
|
|
||||||
<style name="SuwThemeGlifPixel" parent="SuwThemeGlif">
|
<style name="SuwThemeGlifV2" parent="SuwThemeGlif">
|
||||||
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
|
||||||
|
|
||||||
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
|
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
|
||||||
|
@ -28,7 +28,10 @@
|
||||||
<item name="suwScrollIndicators">top|bottom</item>
|
<item name="suwScrollIndicators">top|bottom</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SuwThemeGlifPixel.Light" parent="SuwThemeGlif.Light">
|
<!-- Deprecated. Use SuwThemeGlifV2 instead -->
|
||||||
|
<style name="SuwThemeGlifPixel" parent="SuwThemeGlifV2" />
|
||||||
|
|
||||||
|
<style name="SuwThemeGlifV2.Light" parent="SuwThemeGlif.Light">
|
||||||
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
|
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
|
||||||
|
|
||||||
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
|
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
|
||||||
|
@ -37,6 +40,9 @@
|
||||||
<item name="suwScrollIndicators">top|bottom</item>
|
<item name="suwScrollIndicators">top|bottom</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Deprecated. Use SuwThemeGlifV2.Light instead -->
|
||||||
|
<style name="SuwThemeGlifPixel.Light" parent="SuwThemeGlifV2.Light" />
|
||||||
|
|
||||||
<style name="Animation.SuwWindowAnimation" parent="@android:style/Animation.Activity">
|
<style name="Animation.SuwWindowAnimation" parent="@android:style/Animation.Activity">
|
||||||
<item name="android:activityOpenEnterAnimation">@anim/suw_slide_next_in</item>
|
<item name="android:activityOpenEnterAnimation">@anim/suw_slide_next_in</item>
|
||||||
<item name="android:activityOpenExitAnimation">@anim/suw_slide_next_out</item>
|
<item name="android:activityOpenExitAnimation">@anim/suw_slide_next_out</item>
|
||||||
|
|
|
@ -71,13 +71,25 @@ public class WizardManagerHelper {
|
||||||
* Passed in a setup wizard intent as {@link #EXTRA_THEME}. This is the dark variant of the
|
* Passed in a setup wizard intent as {@link #EXTRA_THEME}. This is the dark variant of the
|
||||||
* theme used in setup wizard for O DR.
|
* theme used in setup wizard for O DR.
|
||||||
*/
|
*/
|
||||||
public static final String THEME_GLIF_PIXEL = "glif_pixel";
|
public static final String THEME_GLIF_V2 = "glif_v2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link #THEME_GLIF_V2} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final String THEME_GLIF_PIXEL = THEME_GLIF_V2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passed in a setup wizard intent as {@link #EXTRA_THEME}. This is the default theme used in
|
* Passed in a setup wizard intent as {@link #EXTRA_THEME}. This is the default theme used in
|
||||||
* setup wizard for O DR.
|
* setup wizard for O DR.
|
||||||
*/
|
*/
|
||||||
public static final String THEME_GLIF_PIXEL_LIGHT = "glif_pixel_light";
|
public static final String THEME_GLIF_V2_LIGHT = "glif_v2_light";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link #THEME_GLIF_V2_LIGHT} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final String THEME_GLIF_PIXEL_LIGHT = THEME_GLIF_V2_LIGHT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an intent that will invoke the next step of setup wizard.
|
* Get an intent that will invoke the next step of setup wizard.
|
||||||
|
@ -208,10 +220,10 @@ public class WizardManagerHelper {
|
||||||
*/
|
*/
|
||||||
public static boolean isLightTheme(String theme, boolean def) {
|
public static boolean isLightTheme(String theme, boolean def) {
|
||||||
if (THEME_HOLO_LIGHT.equals(theme) || THEME_MATERIAL_LIGHT.equals(theme)
|
if (THEME_HOLO_LIGHT.equals(theme) || THEME_MATERIAL_LIGHT.equals(theme)
|
||||||
|| THEME_GLIF_LIGHT.equals(theme) || THEME_GLIF_PIXEL_LIGHT.equals(theme)) {
|
|| THEME_GLIF_LIGHT.equals(theme) || THEME_GLIF_V2_LIGHT.equals(theme)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (THEME_HOLO.equals(theme) || THEME_MATERIAL.equals(theme)
|
} else if (THEME_HOLO.equals(theme) || THEME_MATERIAL.equals(theme)
|
||||||
|| THEME_GLIF.equals(theme) || THEME_GLIF_PIXEL.equals(theme)) {
|
|| THEME_GLIF.equals(theme) || THEME_GLIF_V2.equals(theme)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return def;
|
return def;
|
||||||
|
@ -256,10 +268,10 @@ public class WizardManagerHelper {
|
||||||
public static @StyleRes int getThemeRes(String theme, @StyleRes int defaultTheme) {
|
public static @StyleRes int getThemeRes(String theme, @StyleRes int defaultTheme) {
|
||||||
if (theme != null) {
|
if (theme != null) {
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
case THEME_GLIF_PIXEL_LIGHT:
|
case THEME_GLIF_V2_LIGHT:
|
||||||
return R.style.SuwThemeGlifPixel_Light;
|
return R.style.SuwThemeGlifV2_Light;
|
||||||
case THEME_GLIF_PIXEL:
|
case THEME_GLIF_V2:
|
||||||
return R.style.SuwThemeGlifPixel;
|
return R.style.SuwThemeGlifV2;
|
||||||
case THEME_GLIF_LIGHT:
|
case THEME_GLIF_LIGHT:
|
||||||
return R.style.SuwThemeGlif_Light;
|
return R.style.SuwThemeGlif_Light;
|
||||||
case THEME_GLIF:
|
case THEME_GLIF:
|
||||||
|
|
|
@ -95,29 +95,29 @@ public class GlifLayoutTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlifPixelTheme() {
|
public void testGlifV2Theme() {
|
||||||
mContext = new ContextThemeWrapper(InstrumentationRegistry.getContext(),
|
mContext = new ContextThemeWrapper(InstrumentationRegistry.getContext(),
|
||||||
R.style.SuwThemeGlifPixel_Light);
|
R.style.SuwThemeGlifV2_Light);
|
||||||
final GlifLayout glifLayout = new GlifLayout(mContext);
|
final GlifLayout glifLayout = new GlifLayout(mContext);
|
||||||
final TextView titleView = (TextView) glifLayout.findManagedViewById(R.id.suw_layout_title);
|
final TextView titleView = (TextView) glifLayout.findManagedViewById(R.id.suw_layout_title);
|
||||||
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
|
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
assertEquals(View.TEXT_ALIGNMENT_GRAVITY, titleView.getTextAlignment());
|
assertEquals(View.TEXT_ALIGNMENT_GRAVITY, titleView.getTextAlignment());
|
||||||
}
|
}
|
||||||
assertEquals("Title text should be center aligned on GLIF Pixel theme",
|
assertEquals("Title text should be center aligned on GLIF v2 theme",
|
||||||
Gravity.CENTER_HORIZONTAL, titleView.getGravity() & Gravity.CENTER_HORIZONTAL);
|
Gravity.CENTER_HORIZONTAL, titleView.getGravity() & Gravity.CENTER_HORIZONTAL);
|
||||||
|
|
||||||
if (VERSION.SDK_INT >= VERSION_CODES.N) {
|
if (VERSION.SDK_INT >= VERSION_CODES.N) {
|
||||||
// LinearLayout.getGravity is only available on versions >= N
|
// LinearLayout.getGravity is only available on versions >= N
|
||||||
final View iconView = glifLayout.findManagedViewById(R.id.suw_layout_icon);
|
final View iconView = glifLayout.findManagedViewById(R.id.suw_layout_icon);
|
||||||
final LinearLayout parent = (LinearLayout) iconView.getParent();
|
final LinearLayout parent = (LinearLayout) iconView.getParent();
|
||||||
assertEquals("Icon should be center aligned on GLIF Pixel theme",
|
assertEquals("Icon should be center aligned on GLIF v2 theme",
|
||||||
Gravity.CENTER_HORIZONTAL, parent.getGravity() & Gravity.CENTER_HORIZONTAL);
|
Gravity.CENTER_HORIZONTAL, parent.getGravity() & Gravity.CENTER_HORIZONTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("Status bar color should be white in GLIF Pixel theme",
|
assertEquals("Status bar color should be white in GLIF v2 theme",
|
||||||
"fffafafa",
|
"fffafafa",
|
||||||
Integer.toHexString(glifLayout.getBackgroundBaseColor().getDefaultColor()));
|
Integer.toHexString(glifLayout.getBackgroundBaseColor().getDefaultColor()));
|
||||||
assertFalse("GLIF Pixel theme shuold not have patterned background",
|
assertFalse("GLIF v2 theme shuold not have patterned background",
|
||||||
glifLayout.isBackgroundPatterned());
|
glifLayout.isBackgroundPatterned());
|
||||||
|
|
||||||
if (VERSION.SDK_INT >= VERSION_CODES.M) {
|
if (VERSION.SDK_INT >= VERSION_CODES.M) {
|
||||||
|
|
|
@ -140,22 +140,22 @@ public class WizardManagerHelperTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlifPixelIsDarkTheme() {
|
public void testGlifV2IsDarkTheme() {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra("theme", "glif_pixel");
|
intent.putExtra("theme", "glif_v2");
|
||||||
assertFalse("Theme glif_pixel should be dark theme",
|
assertFalse("Theme glif_v2 should be dark theme",
|
||||||
WizardManagerHelper.isLightTheme(intent, false));
|
WizardManagerHelper.isLightTheme(intent, false));
|
||||||
assertFalse("Theme glif_pixel should be dark theme",
|
assertFalse("Theme glif_v2 should be dark theme",
|
||||||
WizardManagerHelper.isLightTheme(intent, true));
|
WizardManagerHelper.isLightTheme(intent, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGlifPixelLightIsLightTheme() {
|
public void testGlifV2LightIsLightTheme() {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra("theme", "glif_pixel_light");
|
intent.putExtra("theme", "glif_v2_light");
|
||||||
assertTrue("Theme glif_pixel_light should be light theme",
|
assertTrue("Theme glif_v2_light should be light theme",
|
||||||
WizardManagerHelper.isLightTheme(intent, false));
|
WizardManagerHelper.isLightTheme(intent, false));
|
||||||
assertTrue("Theme glif_pixel_light should be light theme",
|
assertTrue("Theme glif_v2_light should be light theme",
|
||||||
WizardManagerHelper.isLightTheme(intent, true));
|
WizardManagerHelper.isLightTheme(intent, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,15 +195,15 @@ public class WizardManagerHelperTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetThemeResGlifPixelLight() {
|
public void testGetThemeResGlifV2Light() {
|
||||||
assertEquals(R.style.SuwThemeGlifPixel_Light,
|
assertEquals(R.style.SuwThemeGlifV2_Light,
|
||||||
WizardManagerHelper.getThemeRes("glif_pixel_light", 0));
|
WizardManagerHelper.getThemeRes("glif_v2_light", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetThemeResGlifPixel() {
|
public void testGetThemeResGlifV2() {
|
||||||
assertEquals(R.style.SuwThemeGlifPixel,
|
assertEquals(R.style.SuwThemeGlifV2,
|
||||||
WizardManagerHelper.getThemeRes("glif_pixel", 0));
|
WizardManagerHelper.getThemeRes("glif_v2", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue