Timer and GameDescription added
This commit is contained in:
parent
327f9a6c66
commit
87ec3902a0
2 changed files with 44 additions and 7 deletions
|
@ -12,6 +12,7 @@ import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -21,6 +22,7 @@ import java.util.TimerTask;
|
||||||
import tu_darmstadt.sudoku.controller.SaveLoadController;
|
import tu_darmstadt.sudoku.controller.SaveLoadController;
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
import tu_darmstadt.sudoku.controller.helper.GameInfoContainer;
|
||||||
|
import tu_darmstadt.sudoku.game.GameDifficulty;
|
||||||
import tu_darmstadt.sudoku.game.GameType;
|
import tu_darmstadt.sudoku.game.GameType;
|
||||||
import tu_darmstadt.sudoku.game.listeners.IGameSolvedListener;
|
import tu_darmstadt.sudoku.game.listeners.IGameSolvedListener;
|
||||||
import tu_darmstadt.sudoku.ui.view.R;
|
import tu_darmstadt.sudoku.ui.view.R;
|
||||||
|
@ -39,6 +41,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
SudokuTimer timerView;
|
SudokuTimer timerView;
|
||||||
boolean isActive = true;
|
boolean isActive = true;
|
||||||
TextView viewName ;
|
TextView viewName ;
|
||||||
|
RatingBar ratingBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -124,6 +127,15 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
viewName.setText(getString(gameController.getGameType().getStringResID()));
|
viewName.setText(getString(gameController.getGameType().getStringResID()));
|
||||||
|
|
||||||
|
|
||||||
|
//set Rating bar
|
||||||
|
List<GameDifficulty> 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);
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
|
|
|
@ -18,26 +18,51 @@
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" >
|
app:popupTheme="@style/AppTheme.PopupOverlay" >
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
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">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="testMode"
|
android:text="testMode"
|
||||||
android:id="@+id/gameModeText"
|
android:id="@+id/gameModeText"
|
||||||
android:gravity="center"
|
android:layout_weight="8"/>
|
||||||
android:layout_centerHorizontal="true"/>
|
<RelativeLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="lable"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:id="@+id/difficultyText"
|
||||||
|
/>
|
||||||
|
<RatingBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:id="@+id/gameModeStar"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_below="@+id/difficultyText"
|
||||||
|
style="?android:attr/ratingBarStyleSmall"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<tu_darmstadt.sudoku.ui.view.SudokuTimer
|
<tu_darmstadt.sudoku.ui.view.SudokuTimer
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="test"
|
android:text="test"
|
||||||
|
android:layout_weight="2"
|
||||||
android:id="@+id/timerView"
|
android:id="@+id/timerView"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginRight="@dimen/activity_horizontal_margin"/>
|
android:layout_centerVertical="true"/>
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
Loading…
Reference in a new issue