lets be a bit more stylish

This commit is contained in:
tibbi 2016-06-01 15:10:45 +02:00
parent b666f121b8
commit 61d68dd31f
7 changed files with 18 additions and 14 deletions

View File

@ -54,10 +54,10 @@ public class MainActivity extends AppCompatActivity implements Calculator {
private void setupResultView() { private void setupResultView() {
final Resources res = getResources(); final Resources res = getResources();
result.setBackgroundColor(res.getColor(android.R.color.white)); result.setBackgroundColor(res.getColor(android.R.color.white));
result.setTextColor(res.getColor(R.color.dark_grey)); result.setTextColor( res.getColor(R.color.text_grey));
formula.setBackgroundColor(res.getColor(android.R.color.white)); formula.setBackgroundColor(res.getColor(android.R.color.white));
formula.setTextColor(res.getColor(R.color.dark_grey)); formula.setTextColor(res.getColor(R.color.text_grey));
} }
@OnClick(R.id.btn_plus) @OnClick(R.id.btn_plus)

View File

@ -56,7 +56,7 @@ public class MyWidgetConfigure extends AppCompatActivity {
bgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, 1); bgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, 1);
if (bgColor == 1) { if (bgColor == 1) {
bgColor = Color.BLACK; bgColor = Color.BLACK;
bgAlpha = .5f; bgAlpha = .2f;
} else { } else {
bgAlpha = Color.alpha(bgColor) / (float) 255; bgAlpha = Color.alpha(bgColor) / (float) 255;
} }
@ -67,7 +67,7 @@ public class MyWidgetConfigure extends AppCompatActivity {
bgSeekBar.setProgress((int) (bgAlpha * 100)); bgSeekBar.setProgress((int) (bgAlpha * 100));
updateBackgroundColor(); updateBackgroundColor();
textColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE); textColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, getResources().getColor(R.color.colorPrimary));
updateTextColor(); updateTextColor();
formula.setText("15,937*5"); formula.setText("15,937*5");

View File

@ -62,7 +62,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
cxt = context; cxt = context;
updateWidgetIds(); updateWidgetIds();
prefs = initPrefs(cxt); prefs = initPrefs(cxt);
final int defaultColor = cxt.getResources().getColor(R.color.dark_grey); final int defaultColor = cxt.getResources().getColor(R.color.text_grey);
final int newBgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, defaultColor); final int newBgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, defaultColor);
final int newTextColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE); final int newTextColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE);

View File

@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/dark_grey" android:background="@color/buttons_background"
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/MainTheme" android:theme="@style/MainTheme"
tools:context=".MainActivity"> tools:context=".MainActivity">
@ -15,6 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2.1" android:layout_weight="2.1"
android:fontFamily="sans-serif-light"
android:gravity="right|bottom" android:gravity="right|bottom"
android:lines="1" android:lines="1"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
@ -27,6 +28,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1.8" android:layout_weight="1.8"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical|right" android:gravity="center_vertical|right"
android:lines="1" android:lines="1"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"

View File

@ -1,9 +1,10 @@
<resources> <resources>
<style name="MyButton" parent="Widget.AppCompat.Button"> <style name="MyButton" parent="Widget.AppCompat.Button">
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@color/colorPrimary</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item> <item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
<item name="android:textSize">@dimen/button_text_size</item> <item name="android:textSize">@dimen/button_text_size</item>
<item name="android:fontFamily">sans-serif-light</item>
</style> </style>
</resources> </resources>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#3F51B5</color> <color name="colorPrimary">#ffff6f00</color>
<color name="colorPrimaryDark">#303F9F</color> <color name="colorPrimaryDark">#ffe46300</color>
<color name="colorAccent">#FF0000</color> <color name="colorAccent">@color/colorPrimary</color>
<color name="dark_grey">#88000000</color> <color name="buttons_background">#05000000</color>
<color name="dark_grey_pressed">#aa000000</color> <color name="text_grey">#77000000</color>
<color name="dark_grey_pressed_mask">#22000000</color> <color name="dark_grey_pressed_mask">#11000000</color>
</resources> </resources>

View File

@ -11,9 +11,10 @@
</style> </style>
<style name="MyButton" parent="Widget.AppCompat.Button"> <style name="MyButton" parent="Widget.AppCompat.Button">
<item name="android:textColor">@android:color/white</item> <item name="android:textColor">@color/colorPrimary</item>
<item name="android:background">@drawable/button</item> <item name="android:background">@drawable/button</item>
<item name="android:textSize">@dimen/button_text_size</item> <item name="android:textSize">@dimen/button_text_size</item>
<item name="android:fontFamily">sans-serif-light</item>
</style> </style>
<style name="MyWidgetConfigTheme" parent="@style/AppTheme"> <style name="MyWidgetConfigTheme" parent="@style/AppTheme">