From 87ec3902a0f933b333e71a6b77737a8b5dfaa3f4 Mon Sep 17 00:00:00 2001 From: Gongxter Date: Thu, 19 Nov 2015 15:38:50 +0100 Subject: [PATCH] Timer and GameDescription added --- .../tu_darmstadt/sudoku/ui/GameActivity.java | 12 ++++++ app/src/main/res/layout/app_bar_game_view.xml | 39 +++++++++++++++---- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java index d560ee1..a48aa25 100644 --- a/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java +++ b/app/src/main/java/tu_darmstadt/sudoku/ui/GameActivity.java @@ -12,6 +12,7 @@ import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; +import android.widget.RatingBar; import android.widget.TextView; import java.util.List; @@ -21,6 +22,7 @@ import java.util.TimerTask; import tu_darmstadt.sudoku.controller.SaveLoadController; import tu_darmstadt.sudoku.controller.GameController; import tu_darmstadt.sudoku.controller.helper.GameInfoContainer; +import tu_darmstadt.sudoku.game.GameDifficulty; import tu_darmstadt.sudoku.game.GameType; import tu_darmstadt.sudoku.game.listeners.IGameSolvedListener; import tu_darmstadt.sudoku.ui.view.R; @@ -39,6 +41,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On SudokuTimer timerView; boolean isActive = true; TextView viewName ; + RatingBar ratingBar; @Override protected void onCreate(Bundle savedInstanceState) { @@ -124,6 +127,15 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On viewName.setText(getString(gameController.getGameType().getStringResID())); + //set Rating bar + List difficutyList = GameDifficulty.getValidDifficultyList(); + int numberOfStarts = difficutyList.size(); + ratingBar = (RatingBar) findViewById(R.id.gameModeStar); + ratingBar.setMax(numberOfStarts); + ratingBar.setNumStars(numberOfStarts); + ratingBar.setRating(difficutyList.indexOf(gameController.getDifficulty())+1); + ((TextView)findViewById(R.id.difficultyText)).setText(getString(gameController.getDifficulty().getStringResID())); + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( diff --git a/app/src/main/res/layout/app_bar_game_view.xml b/app/src/main/res/layout/app_bar_game_view.xml index 32c1294..a175dc4 100644 --- a/app/src/main/res/layout/app_bar_game_view.xml +++ b/app/src/main/res/layout/app_bar_game_view.xml @@ -18,26 +18,51 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" > - + android:layout_height="wrap_content" + android:weightSum="14" + android:orientation="horizontal" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:gravity="center_vertical"> + android:layout_weight="8"/> + + + + - + android:layout_centerVertical="true"/> +