Label each custom sudoku displayed in the LoadGameActivity as such

This commit is contained in:
uykek 2020-08-24 17:00:30 +02:00
parent b270de08ea
commit f648e0ec88
3 changed files with 68 additions and 34 deletions

View file

@ -260,6 +260,7 @@ public class DailySudokuActivity<Database> extends AppCompatActivity {
TextView playedTime = (TextView)convertView.findViewById(R.id.loadgame_listentry_timeplayed);
TextView lastTimePlayed = (TextView)convertView.findViewById(R.id.loadgame_listentry_lasttimeplayed);
ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage);
ImageView customImage = (ImageView)convertView.findViewById(R.id.loadgame_listentry_custom_label);
image.setImageResource(R.drawable.icon_default_9x9);
@ -269,6 +270,7 @@ public class DailySudokuActivity<Database> extends AppCompatActivity {
difficultyBar.setNumStars(GameDifficulty.getValidDifficultyList().size());
difficultyBar.setMax(GameDifficulty.getValidDifficultyList().size());
difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(sudoku.getDifficulty())+1);
customImage.setVisibility(View.INVISIBLE);
Calendar currentDate = Calendar.getInstance();

View file

@ -229,6 +229,7 @@ public class LoadGameActivity extends BaseActivity implements IDeleteDialogFragm
TextView playedTime = (TextView)convertView.findViewById(R.id.loadgame_listentry_timeplayed);
TextView lastTimePlayed = (TextView)convertView.findViewById(R.id.loadgame_listentry_lasttimeplayed);
ImageView image = (ImageView)convertView.findViewById(R.id.loadgame_listentry_gametypeimage);
ImageView customImage = (ImageView)convertView.findViewById(R.id.loadgame_listentry_custom_label);
switch(gic.getGameType()) {
case Default_6x6:
@ -249,6 +250,10 @@ public class LoadGameActivity extends BaseActivity implements IDeleteDialogFragm
difficultyBar.setMax(GameDifficulty.getValidDifficultyList().size());
difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(gic.getDifficulty())+1);
if(!gic.isCustom()) {
customImage.setVisibility(View.INVISIBLE);
}
int time = gic.getTimePlayed();
int seconds = time % 60;
int minutes = ((time -seconds)/60)%60 ;

View file

@ -1,53 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp"
android:id="@+id/main_content"
android:weightSum="10"
android:orientation="horizontal">
android:weightSum="10">
<ImageView
android:id="@+id/loadgame_listentry_gametypeimage"
android:layout_height="match_parent"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:adjustViewBounds="true"
android:src="@drawable/icon_default_9x9"/>
android:src="@drawable/icon_default_9x9" />
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/loadgame_listentry_custom_label"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_gametype"
app:layout_constraintEnd_toEndOf="@+id/loadgame_listentry_difficultytext"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_gametype"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_gametype"
app:srcCompat="@drawable/create_game_src" />
<TextView
android:text="GameType"
android:id="@+id/loadgame_listentry_gametype"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/loadgame_listentry_gametype">
android:text="GameType"
app:layout_constraintBottom_toTopOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintEnd_toEndOf="@+id/loadgame_listentry_difficultytext"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<RatingBar
android:id="@+id/loadgame_listentry_difficultybar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/loadgame_listentry_difficultybar"
android:clickable="false"
android:numStars="3"
android:rating="3"
android:clickable="false"
style="?android:attr/ratingBarStyleSmall"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:text="Difficulty"
android:id="@+id/loadgame_listentry_difficultytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:text="Difficulty"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_difficultybar" />
</LinearLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="wrap_content"
@ -56,20 +83,20 @@
android:gravity="right">
<TextView
android:text="00:00"
android:textStyle="bold"
android:id="@+id/loadgame_listentry_timeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"/>
android:gravity="end"
android:text="00:00"
android:textStyle="bold" />
<TextView
android:text="1 second ago"
android:gravity="end"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:id="@+id/loadgame_listentry_lasttimeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:gravity="end"
android:text="1 second ago" />
</RelativeLayout>