From b3218873fe8a783b2e5914472e9a68d0d838fe51 Mon Sep 17 00:00:00 2001 From: Christopher Beckmann Date: Sat, 20 Feb 2016 21:53:44 +0100 Subject: [PATCH] Fixed a crash with the WelcomeDialog. Also merged. --- .../privacyfriendlysudoku/ui/GameActivity.java | 5 ++--- .../ui/LoadGameActivity.java | 18 ++++++++---------- .../privacyfriendlysudoku/ui/MainActivity.java | 7 ++----- app/src/main/res/layout/welcome_dialog.xml | 9 +++------ app/src/main/res/values/strings.xml | 8 ++++---- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index b1bf555..00478b2 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -1,6 +1,5 @@ package org.secuso.privacyfriendlysudoku.ui; -import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -383,8 +382,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On public void onDialogNegativeClick() { // do nothing } - @SuppressLint("ValidFragment") - public class ResetConfirmationDialog extends DialogFragment { + + public static class ResetConfirmationDialog extends DialogFragment { LinkedList listeners = new LinkedList<>(); diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java index 48988f3..80b50a9 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/LoadGameActivity.java @@ -1,6 +1,5 @@ package org.secuso.privacyfriendlysudoku.ui; -import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -9,9 +8,9 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -23,18 +22,18 @@ import android.widget.ListView; import android.widget.RatingBar; import android.widget.TextView; -import java.text.DateFormat; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; -import java.util.TimeZone; - import org.secuso.privacyfriendlysudoku.controller.GameStateManager; import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer; import org.secuso.privacyfriendlysudoku.game.GameDifficulty; import org.secuso.privacyfriendlysudoku.ui.listener.IDeleteDialogFragmentListener; import org.secuso.privacyfriendlysudoku.ui.view.R; +import java.text.DateFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.TimeZone; + public class LoadGameActivity extends AppCompatActivity implements IDeleteDialogFragmentListener { List loadableGameList; @@ -114,8 +113,7 @@ public class LoadGameActivity extends AppCompatActivity implements IDeleteDialog // do nothing } - @SuppressLint("ValidFragment") - public class DeleteDialogFragment extends DialogFragment { + public static class DeleteDialogFragment extends DialogFragment { private int position = 0; diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 644d671..857350d 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -1,6 +1,5 @@ package org.secuso.privacyfriendlysudoku.ui; -import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -24,7 +23,6 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.RatingBar; @@ -73,7 +71,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("firstStart", false); - editor.apply(); + editor.commit(); } // check if we need to pre generate levels. @@ -377,8 +375,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On } } - @SuppressLint("ValidFragment") - public class WelcomeDialog extends DialogFragment { + public static class WelcomeDialog extends DialogFragment { @Override public void onAttach(Activity activity) { diff --git a/app/src/main/res/layout/welcome_dialog.xml b/app/src/main/res/layout/welcome_dialog.xml index f445fac..08f5912 100644 --- a/app/src/main/res/layout/welcome_dialog.xml +++ b/app/src/main/res/layout/welcome_dialog.xml @@ -4,7 +4,7 @@ android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" - android:weightSum="3"> + android:padding="@dimen/activity_horizontal_margin"> Reset - Welcome to Privacy Friendly Sudoku. - Swipe or press the arrow buttons on the left nd right to change the game filed mode - Field mode: - Press or swipe the stars to change the difficulty + Welcome to Privacy Friendly Sudoku. + Swipe or press the arrow buttons on the left and right to change the game mode. + Game mode: + Press or swipe the stars to change the difficulty. Difficulty: