rating bar edited

This commit is contained in:
Gongxter 2016-02-01 16:23:54 +01:00
parent e680fc5a9a
commit 1e79a289df
11 changed files with 420 additions and 12 deletions

View file

@ -118,11 +118,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}); });
GameDifficulty lastChosenDifficulty = GameDifficulty.valueOf(settings.getString("lastChosenDifficulty", "Easy")); 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(); /*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(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(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 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! // on first create always check for loadable levels!
SharedPreferences.Editor editor = settings.edit(); SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("savesChanged", true); editor.putBoolean("savesChanged", true);

View file

@ -26,7 +26,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
SudokuButton [] buttons; SudokuButton [] buttons;
GameController gameController; GameController gameController;
Symbol symbolsToUse = Symbol.Default; Symbol symbolsToUse = Symbol.Default;
float normalTextSize = 30; // in dp float normalTextSize = 30; // in sp
LinearLayout [] layouts = new LinearLayout[2]; LinearLayout [] layouts = new LinearLayout[2];
OnClickListener listener = new OnClickListener() { OnClickListener listener = new OnClickListener() {
@ -115,7 +115,7 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
buttons[buttonIndex].setTextColor(getResources().getColor(R.color.white)); buttons[buttonIndex].setTextColor(getResources().getColor(R.color.white));
buttons[buttonIndex].setBackgroundResource(R.drawable.mnenomic_numpad_button); buttons[buttonIndex].setBackgroundResource(R.drawable.mnenomic_numpad_button);
buttons[buttonIndex].setText(Symbol.getSymbol(symbolsToUse, buttonIndex)); buttons[buttonIndex].setText(Symbol.getSymbol(symbolsToUse, buttonIndex));
buttons[buttonIndex].setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize); buttons[buttonIndex].setTextSize(TypedValue.COMPLEX_UNIT_SP,normalTextSize);
buttons[buttonIndex].setValue(buttonIndex + 1); buttons[buttonIndex].setValue(buttonIndex + 1);
buttons[buttonIndex].setOnClickListener(listener); buttons[buttonIndex].setOnClickListener(listener);
@ -146,9 +146,9 @@ public class SudokuKeyboardLayout extends LinearLayout implements IHighlightChan
public void updateNotesEnabled() { public void updateNotesEnabled() {
if(gameController.getNoteStatus()) { if(gameController.getNoteStatus()) {
setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize*0.55f); setTextSize(TypedValue.COMPLEX_UNIT_SP,normalTextSize*0.55f);
} else { } else {
setTextSize(TypedValue.COMPLEX_UNIT_DIP,normalTextSize); setTextSize(TypedValue.COMPLEX_UNIT_SP,normalTextSize);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -111,7 +111,9 @@
android:clickable="true" android:clickable="true"
android:numStars="4" android:numStars="4"
android:rating="1" android:rating="1"
android:stepSize="1"/> android:stepSize="1"
android:scaleX="1.2"
android:scaleY="1.2"/>
<Button <Button
android:textColor="@color/white" android:textColor="@color/white"

View file

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="300dp"
android:orientation="vertical"
android:background="@color/white"
android:layout_gravity="center"
>
<LinearLayout
android:layout_width="250dp" android:layout_height="250dp"
android:background="@drawable/ic_trophy_black_48dp"
android:weightSum="5"
android:orientation="horizontal"
android:layout_gravity="center"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@color/transparent"
android:gravity="bottom"
android:orientation="vertical"
android:layout_gravity="bottom">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:background="@color/transparent"
android:src="@drawable/ic_trophy_award_black_48dp" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="@color/middleblue"
android:layout_gravity="bottom"
android:foregroundGravity="bottom"/>
</LinearLayout>
<LinearLayout
android:id="@+id/win_middle_linear"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:background="@color/transparent"
android:orientation="vertical"
android:weightSum="5"
>
<LinearLayout
android:layout_width="100dp"
android:layout_height="0dp"
android:layout_weight="4"
android:layout_marginTop="50dp"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/win_text"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:textColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/win_time"
android:layout_gravity="center"
android:textColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/win_time"
android:text=""
android:textColor="@color/white"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/win_hint"
android:textColor="@color/white"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/win_hints"
android:text=""
android:textColor="@color/white"
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/win_best_time"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:visibility="invisible"
android:id="@+id/win_new_besttime"
android:textColor="@color/white"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<View
android:layout_width="fill_parent"
android:layout_height="20dp"
android:background="@color/middleblue"
android:layout_gravity="bottom"
android:foregroundGravity="bottom"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@color/transparent"
android:orientation="vertical"
android:gravity="bottom">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:src="@drawable/ic_trophy_award_black_48dp"
android:background="@color/transparent" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="@color/middleblue"
android:layout_gravity="bottom"
android:foregroundGravity="bottom"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:weightSum="2">
<Button
android:id="@+id/win_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:textColor="@color/white"
android:layout_weight="1"
android:text="@string/win_button_text"
android:layout_marginRight="5dp"/>
<Button
android:id="@+id/win_button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:textColor="@color/white"
android:layout_weight="1"
android:text="@string/win_show_game"
android:layout_marginLeft="5dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout_main"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:weightSum="10"
style="?android:buttonBarStyle">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="4">
<android.support.v4.view.ViewPager
android:id="@+id/scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<ImageView
android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:padding="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
<ImageView
android:id="@+id/arrow_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_right_black_24dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:padding="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:onClick="onClick"/>
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@+id/scroller"
android:layout_weight="6"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
android:orientation="vertical"
android:weightSum="8"
android:divider="#000"
android:baselineAligned="false"
android:gravity="center_horizontal"
style="?android:buttonBarStyle">
<TextView
android:id="@+id/difficultyText"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/difficulty_easy"
android:textSize="@dimen/main_text_difficulty"/>
<RatingBar style="@style/BlueRatingBarSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/difficultyBar"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:numStars="4"
android:rating="1"
android:stepSize="1"
android:scaleX="3"
android:scaleY="3"
android:paddingTop="70dp"/>
<Button
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/main_button_padding"
android:layout_marginRight="@dimen/main_button_padding"
android:text="@string/new_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/playButton"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
android:elevation="10dp"
android:background="@drawable/standalone_button"/>
<Button
android:textColor="@color/white"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/main_button_padding"
android:layout_marginRight="@dimen/main_button_padding"
android:text="@string/menu_continue_game"
android:textStyle="normal"
android:textSize="@dimen/text_size"
android:id="@+id/continueButton"
android:layout_gravity="center_horizontal"
android:layout_weight="3"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"
android:background="@drawable/standalone_button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Win Debug"
android:visibility="invisible"
android:onClick="callFragment"/>
<!--
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_marginRight="1dp"
android:text="@string/menu_highscore"
android:textStyle="normal"
android:id="@+id/highscoreButton"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginRight="30dp"
android:text="@string/menu_settings"
android:textStyle="normal"
android:id="@+id/settingsButton"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_marginRight="1dp"
android:text="@string/menu_about"
android:textStyle="normal"
android:id="@+id/aboutButton"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"/>
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginRight="30dp"
android:text="@string/menu_help"
android:textStyle="normal"
android:id="@+id/helpButton"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:onClick="onClick"
android:capitalize="none"
android:clickable="false"/>
</LinearLayout>
-->
</LinearLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view_main"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
app:menu="@menu/menu_drawer_main"/>
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>

View file

@ -102,7 +102,7 @@
android:text="@string/difficulty_easy" android:text="@string/difficulty_easy"
android:textSize="@dimen/main_text_difficulty"/> android:textSize="@dimen/main_text_difficulty"/>
<RatingBar <RatingBar style="@style/BlueRatingBarSize"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/difficultyBar" android:id="@+id/difficultyBar"
@ -110,7 +110,9 @@
android:clickable="true" android:clickable="true"
android:numStars="4" android:numStars="4"
android:rating="1" android:rating="1"
android:stepSize="1"/> android:stepSize="1"
android:scaleX="1.2"
android:scaleY="1.2"/>
<Button <Button
android:textColor="@color/white" android:textColor="@color/white"

View file

@ -136,7 +136,8 @@
android:layout_width="250dp" android:layout_width="250dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="20dp" android:paddingBottom="20dp"
android:paddingTop="5dp"
android:weightSum="2"> android:weightSum="2">
<Button <Button
android:id="@+id/win_button" android:id="@+id/win_button"

View file

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

View file

@ -3,11 +3,11 @@
<PreferenceCategory android:title="@string/pref_help_keyboard"> <PreferenceCategory android:title="@string/pref_help_keyboard">
<Preference android:title="@string/pref_help_keyheighlited" <Preference android:title="@string/pref_help_keyheighlited"
android:selectable="false" android:selectable="false"
android:icon="@drawable/numpad_highlighted" android:icon="@drawable/numfirst"
android:summary="@string/pref_help_keyheighlited_summary"/> android:summary="@string/pref_help_keyheighlited_summary"/>
<Preference android:title="@string/pref_help_keyheighlited_yellow" <Preference android:title="@string/pref_help_keyheighlited_yellow"
android:selectable="false" android:selectable="false"
android:icon="@drawable/numpad_highlighted_three" android:icon="@drawable/numfull"
android:summary="@string/pref_help_keyheighlited_yellow_summary"/> android:summary="@string/pref_help_keyheighlited_yellow_summary"/>
<Preference android:title="@string/pref_help_do" <Preference android:title="@string/pref_help_do"