Skip to content

Commit

Permalink
Fixed broken continue game item entry
Browse files Browse the repository at this point in the history
Fixed custom games not being flagged as custom when using links
  • Loading branch information
Kamuno committed Oct 5, 2020
1 parent f346dc2 commit 63912ff
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ as a part of the getExtras() bundle. Instead, it needs to be saved as an URI obj
}
else if (data.getHost().equals(validUris.get(i).getHost())) {
input = data.getPath();
input =input.replace("/", "");
input = input.replace("/", "");
break;
}
}
Expand All @@ -200,7 +200,9 @@ else if (data.getHost().equals(validUris.get(i).getHost())) {
QQWing difficultyCheck;
GameInfoContainer container = new GameInfoContainer(0, GameDifficulty.Unspecified,
GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
container.setCustom(extras != null && extras.getBoolean("isCustom", false));
// always set custom sudokus as custom
// TODO: maybe introduce a setting in the settings page to let the user decide
container.setCustom(true);

try {
container.parseGameType("Default_" + sectionSize + "x" + sectionSize);
Expand Down
171 changes: 85 additions & 86 deletions app/src/main/res/layout/list_entry_layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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"
Expand All @@ -13,100 +13,99 @@
android:id="@+id/loadgame_listentry_gametypeimage"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:adjustViewBounds="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/icon_default_9x9" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/loadgame_listentry_custom_icon"
android:layout_width="12dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@id/loadgame_listentry_gametype"
app:layout_constraintEnd_toStartOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="@id/loadgame_listentry_difficultybar"
app:layout_constraintBottom_toBottomOf="@id/loadgame_listentry_difficultybar"
app:srcCompat="@drawable/create_game_src" />

<TextView
android:id="@+id/loadgame_listentry_gametype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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" />

<TextView
android:id="@+id/loadgame_listentry_custom_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/difficulty_custom"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/loadgame_listentry_gametype"
app:layout_constraintTop_toTopOf="@id/loadgame_listentry_gametype"
app:layout_constraintBottom_toBottomOf="@id/loadgame_listentry_gametype"
android:layout_marginLeft="16dp" />

<RatingBar
android:id="@+id/loadgame_listentry_difficultybar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:numStars="4"
android:rating="3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/loadgame_listentry_custom_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<TextView
android:id="@+id/loadgame_listentry_difficultytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="Difficulty"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_difficultybar"
android:layout_marginLeft="8dp" />
<ImageView
android:id="@+id/loadgame_listentry_custom_icon"
android:layout_width="12dp"
android:layout_height="15dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_gametypeimage"
app:layout_constraintTop_toBottomOf="@+id/loadgame_listentry_gametype"
app:srcCompat="@drawable/create_game_src" />

<TextView
android:id="@+id/loadgame_listentry_gametype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:text="GameType"
app:layout_constraintEnd_toEndOf="@+id/loadgame_listentry_difficultytext"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_gametypeimage"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/loadgame_listentry_custom_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:text="@string/difficulty_custom"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/loadgame_listentry_gametype"
app:layout_constraintStart_toEndOf="@id/loadgame_listentry_gametype"
app:layout_constraintTop_toTopOf="@id/loadgame_listentry_gametype" />

<RelativeLayout
<RatingBar
android:id="@+id/loadgame_listentry_difficultybar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity="right">
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:clickable="false"
android:numStars="4"
android:rating="3"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_custom_icon"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_custom_icon"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_custom_icon" />

<TextView
android:id="@+id/loadgame_listentry_timeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="00:00"
android:textStyle="bold" />
<TextView
android:id="@+id/loadgame_listentry_difficultytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Difficulty"
app:layout_constraintBottom_toBottomOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintStart_toEndOf="@+id/loadgame_listentry_difficultybar"
app:layout_constraintTop_toTopOf="@+id/loadgame_listentry_difficultybar" />

<TextView
android:id="@+id/loadgame_listentry_lasttimeplayed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:gravity="end"
android:text="1 second ago" />
<TextView
android:id="@+id/loadgame_listentry_timeplayed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:text="00:00"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/loadgame_listentry_lasttimeplayed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />

</RelativeLayout>
<TextView
android:id="@+id/loadgame_listentry_lasttimeplayed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/loadgame_listentry_timeplayed"
android:gravity="end"
android:text="1 second ago"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loadgame_listentry_timeplayed" />

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 63912ff

Please sign in to comment.