rating bar edited

This commit is contained in:
Gongxter 2016-01-31 14:54:37 +01:00
parent 9c3579d4af
commit e680fc5a9a
3 changed files with 9 additions and 2 deletions

View file

@ -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();

View file

@ -110,7 +110,7 @@
android:clickable="true"
android:numStars="4"
android:rating="1"
android:stepSize="1" />
android:stepSize="1"/>
<Button
android:textColor="@color/white"

View file

@ -29,6 +29,7 @@
<item name="android:windowSoftInputMode">adjustPan|stateUnspecified</item>
</style>
<!-- <style name="FontStyle">
<item name="android:fontFamily"></item>
</style> -->