Themes & styles

This commit is contained in:
serso 2015-01-28 09:54:23 +01:00
parent 467a753f21
commit ac07d546c1
19 changed files with 120 additions and 54 deletions

View File

@ -74,7 +74,7 @@
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules /> <modules />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">

View File

@ -128,7 +128,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
AndroidCalculatorDisplayView.this.state = state; AndroidCalculatorDisplayView.this.state = state;
if (state.isValid()) { if (state.isValid()) {
setTextColor(getResources().getColor(R.color.cpp_default_text_color)); setTextColor(getResources().getColor(R.color.cpp_text));
setText(text); setText(text);
adjustTextSize(); adjustTextSize();
@ -136,7 +136,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
} else { } else {
// update text in order to get rid of HTML tags // update text in order to get rid of HTML tags
setText(getText().toString()); setText(getText().toString());
setTextColor(getResources().getColor(R.color.cpp_display_error_text_color)); setTextColor(getResources().getColor(R.color.cpp_text_error));
// error messages are never shown -> just greyed out text (error message will be shown on click) // error messages are never shown -> just greyed out text (error message will be shown on click)
//setText(state.getErrorMessage()); //setText(state.getErrorMessage());

View File

@ -67,9 +67,9 @@ public class AngleUnitsButton extends DirectionDragButton {
final int color; final int color;
final Resources resources = getResources(); final Resources resources = getResources();
if (isCurrentAngleUnits(directionText)) { if (isCurrentAngleUnits(directionText)) {
color = resources.getColor(R.color.cpp_selected_angle_unit_text_color); color = resources.getColor(R.color.cpp_selected_angle_unit_text);
} else { } else {
color = resources.getColor(R.color.cpp_default_text_color); color = resources.getColor(R.color.cpp_text);
} }
return color; return color;
} }

View File

@ -65,9 +65,9 @@ public class NumeralBasesButton extends DirectionDragButton {
int getDirectionTextColor(@Nonnull String directionText) { int getDirectionTextColor(@Nonnull String directionText) {
final int color; final int color;
if (isCurrentNumberBase(directionText)) { if (isCurrentNumberBase(directionText)) {
color = getResources().getColor(R.color.cpp_selected_angle_unit_text_color); color = getResources().getColor(R.color.cpp_selected_angle_unit_text);
} else { } else {
color = getResources().getColor(R.color.cpp_default_text_color); color = getResources().getColor(R.color.cpp_text);
} }
return color; return color;
} }

View File

@ -95,7 +95,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider {
@Nonnull @Nonnull
private String getCursorColor(@Nonnull Context context) { private String getCursorColor(@Nonnull Context context) {
if (cursorColor == null) { if (cursorColor == null) {
cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor_color)).substring(2); cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor)).substring(2);
} }
return cursorColor; return cursorColor;
} }
@ -198,9 +198,9 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider {
private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState) { private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState) {
if (displayState.isValid()) { if (displayState.isValid()) {
views.setTextViewText(R.id.calculator_display, displayState.getText()); views.setTextViewText(R.id.calculator_display, displayState.getText());
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_default_text_color)); views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_text));
} else { } else {
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_display_error_text_color)); views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_text_error));
} }
} }

View File

@ -21,6 +21,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/cpp_metro_button_background"/> <solid android:color="@color/cpp_metro_button"/>
<corners android:radius="1dp"/> <corners android:radius="1dp"/>
</shape> </shape>

View File

@ -21,6 +21,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/cpp_metro_green_color"/> <solid android:color="@color/cpp_metro_green"/>
<corners android:radius="1dp"/> <corners android:radius="1dp"/>
</shape> </shape>

View File

@ -21,6 +21,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/cpp_metro_light_button_background"/> <solid android:color="@color/cpp_metro_button_light"/>
<corners android:radius="1dp"/> <corners android:radius="1dp"/>
</shape> </shape>

View File

@ -21,6 +21,6 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/cpp_metro_purple_color"/> <solid android:color="@color/cpp_metro_purple"/>
<corners android:radius="1dp"/> <corners android:radius="1dp"/>
</shape> </shape>

View File

@ -28,25 +28,25 @@
<item a:state_focused="false" a:state_selected="false" a:state_pressed="false" <item a:state_focused="false" a:state_selected="false" a:state_pressed="false"
a:drawable="@android:color/transparent"/> a:drawable="@android:color/transparent"/>
<item a:state_focused="false" a:state_selected="true" a:state_pressed="false" <item a:state_focused="false" a:state_selected="true" a:state_pressed="false"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<!-- Focused states --> <!-- Focused states -->
<item a:state_focused="true" a:state_selected="false" a:state_pressed="false" <item a:state_focused="true" a:state_selected="false" a:state_pressed="false"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<item a:state_focused="true" a:state_selected="true" a:state_pressed="false" <item a:state_focused="true" a:state_selected="true" a:state_pressed="false"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<!-- Pressed --> <!-- Pressed -->
<!-- Non focused states --> <!-- Non focused states -->
<item a:state_focused="false" a:state_selected="false" a:state_pressed="true" <item a:state_focused="false" a:state_selected="false" a:state_pressed="true"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<item a:state_focused="false" a:state_selected="true" a:state_pressed="true" <item a:state_focused="false" a:state_selected="true" a:state_pressed="true"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<!-- Focused states --> <!-- Focused states -->
<item a:state_focused="true" a:state_selected="false" a:state_pressed="true" <item a:state_focused="true" a:state_selected="false" a:state_pressed="true"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
<item a:state_focused="true" a:state_selected="true" a:state_pressed="true" <item a:state_focused="true" a:state_selected="true" a:state_pressed="true"
a:drawable="@color/cpp_metro_green_color"/> a:drawable="@color/cpp_metro_green"/>
</selector> </selector>

View File

@ -28,24 +28,24 @@
<item a:state_focused="false" a:state_selected="false" a:state_pressed="false" <item a:state_focused="false" a:state_selected="false" a:state_pressed="false"
a:drawable="@android:color/transparent"/> a:drawable="@android:color/transparent"/>
<item a:state_focused="false" a:state_selected="true" a:state_pressed="false" <item a:state_focused="false" a:state_selected="true" a:state_pressed="false"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<!-- Focused states --> <!-- Focused states -->
<item a:state_focused="true" a:state_selected="false" a:state_pressed="false" <item a:state_focused="true" a:state_selected="false" a:state_pressed="false"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<item a:state_focused="true" a:state_selected="true" a:state_pressed="false" <item a:state_focused="true" a:state_selected="true" a:state_pressed="false"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<!-- Pressed --> <!-- Pressed -->
<!-- Non focused states --> <!-- Non focused states -->
<item a:state_focused="false" a:state_selected="false" a:state_pressed="true" <item a:state_focused="false" a:state_selected="false" a:state_pressed="true"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<item a:state_focused="false" a:state_selected="true" a:state_pressed="true" <item a:state_focused="false" a:state_selected="true" a:state_pressed="true"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<!-- Focused states --> <!-- Focused states -->
<item a:state_focused="true" a:state_selected="false" a:state_pressed="true" <item a:state_focused="true" a:state_selected="false" a:state_pressed="true"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
<item a:state_focused="true" a:state_selected="true" a:state_pressed="true" <item a:state_focused="true" a:state_selected="true" a:state_pressed="true"
a:drawable="@color/cpp_metro_purple_color"/> a:drawable="@color/cpp_metro_purple"/>
</selector> </selector>

View File

@ -50,8 +50,8 @@
a:layout_gravity="bottom|right" a:layout_gravity="bottom|right"
a:layout_margin="16dp" a:layout_margin="16dp"
a:src="@drawable/ic_delete_white_36dp" a:src="@drawable/ic_delete_white_36dp"
fab:fab_colorNormal="@color/cpp_metro_button_background" fab:fab_colorNormal="@color/cpp_metro_button"
fab:fab_colorPressed="@color/cpp_metro_button_background" fab:fab_colorPressed="@color/cpp_metro_button"
fab:fab_colorRipple="?attr/colorControlHighlight" /> fab:fab_colorRipple="?attr/colorControlHighlight" />
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2013 serso aka se.solovyev
~
~ 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.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<resources>
<style name="Theme" parent="Theme.Base">
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
</style>
<style name="Theme.Dialog" parent="Theme.Base.Dialog">
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
</style>
</resources>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
~ Copyright 2013 serso aka se.solovyev ~ Copyright 2013 serso aka se.solovyev
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
@ -23,22 +22,23 @@
<resources> <resources>
<color name="cpp_list_divider">#ff2e2e2e</color> <color name="cpp_list_divider">#ff2e2e2e</color>
<color name="cpp_default_text_color">#ffffffff</color> <color name="cpp_text">#ffeeeeee</color>
<color name="cpp_display_error_text_color">#ff393939</color> <color name="cpp_text_error">#ff393939</color>
<color name="cpp_button_text_color">#ffffffff</color> <color name="cpp_button_text">#ffffffff</color>
<color name="cpp_button_operator_text_color">#ffffff99</color> <color name="cpp_button_text_operator">#ffffff99</color>
<color name="cpp_button_ce_text_color">#ffffffff</color> <color name="cpp_button_text_ce">#ffffffff</color>
<color name="cpp_selected_angle_unit_text_color">#ffffff99</color> <color name="cpp_selected_angle_unit_text">#ffffff99</color>
<color name="cpp_main_bg">#ff000000</color> <color name="cpp_main_bg">#ff000000</color>
<color name="cpp_pane_background">#ff1f1f1f</color> <color name="cpp_pane_background">#ff1f1f1f</color>
<color name="cpp_metro_button_background">#ff1f1f1f</color> <color name="cpp_metro_button_dark">#ff000000</color>
<color name="cpp_metro_button">#212121</color>
<color name="cpp_metro_button_light">#393939</color>
<color name="cpp_metro_blue">#10648c</color> <color name="cpp_metro_blue">#10648c</color>
<color name="cpp_metro_blue_dark">#ff092c39</color> <color name="cpp_metro_blue_dark">#ff092c39</color>
<color name="cpp_metro_green_color">#088e3a</color> <color name="cpp_metro_green">#088e3a</color>
<color name="cpp_metro_purple_color">#651456</color> <color name="cpp_metro_purple">#651456</color>
<color name="cpp_metro_light_button_background">#393939</color> <color name="cpp_widget_cursor">#ff707070</color>
<color name="cpp_widget_cursor_color">#ff707070</color> <color name="cpp_text_primary">#ddffffff</color>
<color name="cpp_text_primary">#ddffffff</color> <color name="cpp_text_secondary">#89ffffff</color>
<color name="cpp_text_secondary">#89ffffff</color> <color name="cpp_widget_ripple">#40ffffff</color>
<color name="cpp_widget_ripple">#40ffffff</color>
</resources> </resources>

View File

@ -46,7 +46,7 @@
<item name="android:focusable">true</item> <item name="android:focusable">true</item>
<item name="android:background">@drawable/metro_blue_button</item> <item name="android:background">@drawable/metro_blue_button</item>
<item name="android:textSize">@dimen/cpp_button_text_size</item> <item name="android:textSize">@dimen/cpp_button_text_size</item>
<item name="android:textColor">@color/cpp_button_text_color</item> <item name="android:textColor">@color/cpp_button_text</item>
</style> </style>
<style name="cpp_keyboard_button_style"> <style name="cpp_keyboard_button_style">
@ -57,7 +57,7 @@
<item name="android:background">@drawable/metro_button_dark</item> <item name="android:background">@drawable/metro_button_dark</item>
<item name="android:layout_margin">@dimen/cpp_button_margin</item> <item name="android:layout_margin">@dimen/cpp_button_margin</item>
<item name="android:textSize">@dimen/cpp_keyboard_button_text_size</item> <item name="android:textSize">@dimen/cpp_keyboard_button_text_size</item>
<item name="android:textColor">@color/cpp_button_text_color</item> <item name="android:textColor">@color/cpp_button_text</item>
<item name="android:scaleType">centerInside</item> <item name="android:scaleType">centerInside</item>
</style> </style>
@ -103,7 +103,7 @@
<style name="cpp_default_text"> <style name="cpp_default_text">
<item name="android:background">@android:color/transparent</item> <item name="android:background">@android:color/transparent</item>
<item name="android:textColor">@color/cpp_default_text_color</item> <item name="android:textColor">@color/cpp_text</item>
</style> </style>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2013 serso aka se.solovyev
~
~ 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.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<resources>
<style name="Theme" parent="Theme.Base"></style>
<style name="Theme.Dialog" parent="Theme.Base.Dialog"></style>
<style name="Theme.Base" parent="@style/Theme.AppCompat"></style>
<style name="Theme.Base.Dialog" parent="@style/Theme.AppCompat.Dialog"></style>
</resources>

View File

@ -40,7 +40,7 @@
</style> </style>
<style name="cpp_default_operation_button_style" parent="cpp_default_digit_button_style"> <style name="cpp_default_operation_button_style" parent="cpp_default_digit_button_style">
<item name="android:textColor">@color/cpp_button_operator_text_color</item> <item name="android:textColor">@color/cpp_button_text_operator</item>
</style> </style>
<style name="cpp_default_control_image_button_style" parent="cpp_default_control_button_style"> <style name="cpp_default_control_image_button_style" parent="cpp_default_control_button_style">
@ -115,7 +115,7 @@
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
</style> </style>
<style name="cpp_gray_theme" parent="@style/Theme.AppCompat"> <style name="cpp_gray_theme" parent="Theme">
<item name="android:windowBackground">@color/cpp_main_bg</item> <item name="android:windowBackground">@color/cpp_main_bg</item>
<!-- buttons --> <!-- buttons -->
@ -139,7 +139,7 @@
<item name="cpp_pane_style_transparent">@style/cpp_default_pane_style_transparent</item> <item name="cpp_pane_style_transparent">@style/cpp_default_pane_style_transparent</item>
</style> </style>
<style name="cpp_gray_dialog_theme" parent="@style/Theme.AppCompat.Dialog"> <style name="cpp_gray_dialog_theme" parent="Theme.Dialog">
<item name="android:windowCloseOnTouchOutside">false</item> <item name="android:windowCloseOnTouchOutside">false</item>
<!-- buttons --> <!-- buttons -->
<item name="cpp_digit_button_style">@style/cpp_default_digit_button_style</item> <item name="cpp_digit_button_style">@style/cpp_default_digit_button_style</item>

View File

@ -31,7 +31,7 @@
</style> </style>
<style name="light_blue_operation_button_style" parent="light_blue_digit_button_style"> <style name="light_blue_operation_button_style" parent="light_blue_digit_button_style">
<item name="android:textColor">@color/cpp_button_operator_text_color</item> <item name="android:textColor">@color/cpp_button_text_operator</item>
</style> </style>
<style name="light_blue_control_image_button_style" parent="light_blue_control_button_style"> <style name="light_blue_control_image_button_style" parent="light_blue_control_button_style">

View File

@ -27,7 +27,7 @@
</style> </style>
<style name="violet_operation_button_style" parent="violet_digit_button_style"> <style name="violet_operation_button_style" parent="violet_digit_button_style">
<item name="android:textColor">@color/cpp_button_operator_text_color</item> <item name="android:textColor">@color/cpp_button_text_operator</item>
</style> </style>
<style name="violet_control_button_style" parent="cpp_keyboard_button_style"> <style name="violet_control_button_style" parent="cpp_keyboard_button_style">