From e680fc5a9a52cc9bc9d319afaed74e89c5a88686 Mon Sep 17 00:00:00 2001 From: Gongxter Date: Sun, 31 Jan 2016 14:54:37 +0100 Subject: [PATCH] rating bar edited --- .../org/secuso/privacyfriendlysudoku/ui/MainActivity.java | 8 +++++++- app/src/main/res/layout/activity_main_menu.xml | 2 +- app/src/main/res/values/styles.xml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 4a4de9c..8f9242a 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -2,6 +2,8 @@ package org.secuso.privacyfriendlysudoku.ui; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.PorterDuff; +import android.graphics.drawable.LayerDrawable; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.support.design.widget.NavigationView; @@ -115,7 +117,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On } }); GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(settings.getString("lastChosenDifficulty", "Easy")); - difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty)+1); + difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(lastChosenDifficulty) + 1); + LayerDrawable stars = (LayerDrawable)difficultyBar.getProgressDrawable(); + stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);//Color for Stars fully selected + stars.getDrawable(1).setColorFilter(getResources().getColor(R.color.middleblue), PorterDuff.Mode.SRC_ATOP);//Color for Stars partially selected + stars.getDrawable(0).setColorFilter(getResources().getColor(R.color.lightblue), PorterDuff.Mode.SRC_ATOP);//color for stars not selected // on first create always check for loadable levels! SharedPreferences.Editor editor = settings.edit(); diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml index 9962430..51f1f84 100644 --- a/app/src/main/res/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/activity_main_menu.xml @@ -110,7 +110,7 @@ android:clickable="true" android:numStars="4" android:rating="1" - android:stepSize="1" /> + android:stepSize="1"/>