Fixed a crash with the WelcomeDialog. Also merged.

This commit is contained in:
Christopher Beckmann 2016-02-20 21:53:44 +01:00
parent a522f18d13
commit b3218873fe
5 changed files with 19 additions and 28 deletions

View file

@ -1,6 +1,5 @@
package org.secuso.privacyfriendlysudoku.ui; package org.secuso.privacyfriendlysudoku.ui;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -383,8 +382,8 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
public void onDialogNegativeClick() { public void onDialogNegativeClick() {
// do nothing // do nothing
} }
@SuppressLint("ValidFragment")
public class ResetConfirmationDialog extends DialogFragment { public static class ResetConfirmationDialog extends DialogFragment {
LinkedList<IResetDialogFragmentListener> listeners = new LinkedList<>(); LinkedList<IResetDialogFragmentListener> listeners = new LinkedList<>();

View file

@ -1,6 +1,5 @@
package org.secuso.privacyfriendlysudoku.ui; package org.secuso.privacyfriendlysudoku.ui;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -9,9 +8,9 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -23,18 +22,18 @@ import android.widget.ListView;
import android.widget.RatingBar; import android.widget.RatingBar;
import android.widget.TextView; 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.GameStateManager;
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer; import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
import org.secuso.privacyfriendlysudoku.game.GameDifficulty; import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
import org.secuso.privacyfriendlysudoku.ui.listener.IDeleteDialogFragmentListener; import org.secuso.privacyfriendlysudoku.ui.listener.IDeleteDialogFragmentListener;
import org.secuso.privacyfriendlysudoku.ui.view.R; 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 { public class LoadGameActivity extends AppCompatActivity implements IDeleteDialogFragmentListener {
List<GameInfoContainer> loadableGameList; List<GameInfoContainer> loadableGameList;
@ -114,8 +113,7 @@ public class LoadGameActivity extends AppCompatActivity implements IDeleteDialog
// do nothing // do nothing
} }
@SuppressLint("ValidFragment") public static class DeleteDialogFragment extends DialogFragment {
public class DeleteDialogFragment extends DialogFragment {
private int position = 0; private int position = 0;

View file

@ -1,6 +1,5 @@
package org.secuso.privacyfriendlysudoku.ui; package org.secuso.privacyfriendlysudoku.ui;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -24,7 +23,6 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RatingBar; import android.widget.RatingBar;
@ -73,7 +71,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
SharedPreferences.Editor editor = settings.edit(); SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("firstStart", false); editor.putBoolean("firstStart", false);
editor.apply(); editor.commit();
} }
// check if we need to pre generate levels. // check if we need to pre generate levels.
@ -377,8 +375,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
@SuppressLint("ValidFragment") public static class WelcomeDialog extends DialogFragment {
public class WelcomeDialog extends DialogFragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {

View file

@ -4,7 +4,7 @@
android:gravity="center" android:gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:weightSum="3"> android:padding="@dimen/activity_horizontal_margin">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -21,9 +21,7 @@
style="@style/Base.DialogWindowTitle.AppCompat"/> style="@style/Base.DialogWindowTitle.AppCompat"/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1.25"
android:weightSum="1"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -34,7 +32,6 @@
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/icon_default_9x9"/> android:src="@drawable/icon_default_9x9"/>
<ImageView <ImageView
@ -62,7 +59,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/difficultyBar" android:id="@+id/difficultyBar"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:clickable="false" android:isIndicator="true"
android:numStars="3" android:numStars="3"
android:rating="1" android:rating="1"
android:stepSize="1" android:stepSize="1"

View file

@ -87,10 +87,10 @@
<string name="reset_confirmation_confirm">Reset</string> <string name="reset_confirmation_confirm">Reset</string>
<!-- ### Welcome Dialog ### --> <!-- ### Welcome Dialog ### -->
<string name="welcome">Welcome to Privacy Friendly Sudoku.</string> <string name="welcome">Welcome to Privacy Friendly Sudoku. </string>
<string name="field_select_description">Swipe or press the arrow buttons on the left nd right to change the game filed mode</string> <string name="field_select_description">Swipe or press the arrow buttons on the left and right to change the game mode.</string>
<string name="field_select_description_headline">Field mode:</string> <string name="field_select_description_headline">Game mode:</string>
<string name="difficulty_description">Press or swipe the stars to change the difficulty</string> <string name="difficulty_description">Press or swipe the stars to change the difficulty.</string>
<string name="difficulty_description_headline">Difficulty:</string> <string name="difficulty_description_headline">Difficulty:</string>
<!-- ### Continue Game ### --> <!-- ### Continue Game ### -->