Added the Welcome Dialog. Content still has to be done.
This commit is contained in:
parent
815b962fe8
commit
fa54fe0a87
6 changed files with 63 additions and 17 deletions
|
@ -1,39 +1,35 @@
|
||||||
package org.secuso.privacyfriendlysudoku.ui;
|
package org.secuso.privacyfriendlysudoku.ui;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.PorterDuff;
|
import android.os.Bundle;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
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.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
|
||||||
import android.support.v4.view.ViewPager;
|
|
||||||
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;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RatingBar;
|
import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.controller.GameStateManager;
|
import org.secuso.privacyfriendlysudoku.controller.GameStateManager;
|
||||||
import org.secuso.privacyfriendlysudoku.controller.NewLevelManager;
|
import org.secuso.privacyfriendlysudoku.controller.NewLevelManager;
|
||||||
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
|
import org.secuso.privacyfriendlysudoku.controller.helper.GameInfoContainer;
|
||||||
|
@ -41,6 +37,10 @@ import org.secuso.privacyfriendlysudoku.game.GameDifficulty;
|
||||||
import org.secuso.privacyfriendlysudoku.game.GameType;
|
import org.secuso.privacyfriendlysudoku.game.GameType;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
|
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
|
||||||
|
|
||||||
RatingBar difficultyBar;
|
RatingBar difficultyBar;
|
||||||
|
@ -67,11 +67,19 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
// preload some levels so we don't have to generate as many and we can start playing right away.
|
// preload some levels so we don't have to generate as many and we can start playing right away.
|
||||||
newLevelManager.loadFirstStartLevels();
|
newLevelManager.loadFirstStartLevels();
|
||||||
|
|
||||||
|
WelcomeDialog welcomeDialog = new WelcomeDialog();
|
||||||
|
welcomeDialog.show(getFragmentManager(), "WelcomeDialog");
|
||||||
|
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putBoolean("firstStart", false);
|
editor.putBoolean("firstStart", false);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove this after testing
|
||||||
|
WelcomeDialog welcomeDialog = new WelcomeDialog();
|
||||||
|
welcomeDialog.show(getFragmentManager(), "WelcomeDialog");
|
||||||
|
|
||||||
|
|
||||||
// check if we need to pre generate levels.
|
// check if we need to pre generate levels.
|
||||||
newLevelManager.checkAndRestock();
|
newLevelManager.checkAndRestock();
|
||||||
|
|
||||||
|
@ -372,4 +380,27 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ValidFragment")
|
||||||
|
public class WelcomeDialog extends DialogFragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
LayoutInflater i = getActivity().getLayoutInflater();
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
|
||||||
|
builder.setView(i.inflate(R.layout.welcome_dialog, null));
|
||||||
|
builder.setIcon(R.mipmap.ic_launcher);
|
||||||
|
builder.setTitle(getActivity().getString(R.string.app_name_long));
|
||||||
|
builder.setPositiveButton(getActivity().getString(R.string.win_button_text), null);
|
||||||
|
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
12
app/src/main/res/layout/welcome_dialog.xml
Normal file
12
app/src/main/res/layout/welcome_dialog.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/welcome1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -79,5 +79,7 @@
|
||||||
<string name="help_delete">Löschen</string>
|
<string name="help_delete">Löschen</string>
|
||||||
<string name="header_help">Hilfe</string>
|
<string name="header_help">Hilfe</string>
|
||||||
<string name="help_privacyInfo">Privatsphäre Information</string>
|
<string name="help_privacyInfo">Privatsphäre Information</string>
|
||||||
|
<string name="pref_timer_reset">Zeit zurücksetzen</string>
|
||||||
|
<string name="pref_timer_reset_summary">Beim zurücksetzen des Spielfeldes wird die Zeit auch zurückgesetzt.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -5,7 +5,6 @@
|
||||||
<string name="about_qqwing">Данное приложение использует модифицированную версию QQWing v1.3.4.</string>
|
<string name="about_qqwing">Данное приложение использует модифицированную версию QQWing v1.3.4.</string>
|
||||||
<string name="average_time">Среднее время:</string>
|
<string name="average_time">Среднее время:</string>
|
||||||
<string name="cancel">Отмена</string>
|
<string name="cancel">Отмена</string>
|
||||||
<string name="description"></string>
|
|
||||||
<string name="difficulty_easy">Легкий</string>
|
<string name="difficulty_easy">Легкий</string>
|
||||||
<string name="difficulty_hard">Сложный</string>
|
<string name="difficulty_hard">Сложный</string>
|
||||||
<string name="difficulty_moderate">Средний</string>
|
<string name="difficulty_moderate">Средний</string>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name" translatable="false">数独</string>
|
|
||||||
<string name="win_time">时间:</string>
|
<string name="win_time">时间:</string>
|
||||||
<string name="win_button_text">继续</string>
|
<string name="win_button_text">继续</string>
|
||||||
<string name="about_author">作者:</string>
|
<string name="about_author">作者:</string>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<string name="pref_timer_reset_summary">Also reset the timer, when resetting the game board.</string>
|
<string name="pref_timer_reset_summary">Also reset the timer, when resetting the game board.</string>
|
||||||
|
|
||||||
<!-- ###ABOUT### -->
|
<!-- ###ABOUT### -->
|
||||||
<string name="app_name_long" translatable="false">Privacy friendly Sudoku</string>
|
<string name="app_name_long" translatable="false">Privacy Friendly Sudoku</string>
|
||||||
<string name="version_number" translatable="false">v1.0</string>
|
<string name="version_number" translatable="false">v1.0</string>
|
||||||
<string name="about_author">Author:</string>
|
<string name="about_author">Author:</string>
|
||||||
<string name="about_author_names" translatable="false">Christopher Beckmann, Timm Lippert</string>
|
<string name="about_author_names" translatable="false">Christopher Beckmann, Timm Lippert</string>
|
||||||
|
@ -86,6 +86,9 @@
|
||||||
<string name="reset_confirmation">Are you sure you want to reset the game board?</string>
|
<string name="reset_confirmation">Are you sure you want to reset the game board?</string>
|
||||||
<string name="reset_confirmation_confirm">Reset</string>
|
<string name="reset_confirmation_confirm">Reset</string>
|
||||||
|
|
||||||
|
<!-- ### Welcome Dialog ### -->
|
||||||
|
<string name="welcome1">Welcome to Privacy Friendly Sudoku.</string>
|
||||||
|
|
||||||
<!-- ### Continue Game ### -->
|
<!-- ### Continue Game ### -->
|
||||||
<string name="loadgame_delete_confirmation">Are you sure you want to delete this save?</string>
|
<string name="loadgame_delete_confirmation">Are you sure you want to delete this save?</string>
|
||||||
<string name="loadgame_delete_confirm">Delete</string>
|
<string name="loadgame_delete_confirm">Delete</string>
|
||||||
|
|
Loading…
Reference in a new issue