Fixed #32 and added the Tutorial to the NavigationDrawer. Some string files still need to be translated.
This commit is contained in:
parent
7a00ba4aaf
commit
84995affe5
8 changed files with 48 additions and 7 deletions
|
@ -27,6 +27,7 @@ import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RatingBar;
|
import android.widget.RatingBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.secuso.privacyfriendlysudoku.controller.GameController;
|
import org.secuso.privacyfriendlysudoku.controller.GameController;
|
||||||
import org.secuso.privacyfriendlysudoku.controller.GameStateManager;
|
import org.secuso.privacyfriendlysudoku.controller.GameStateManager;
|
||||||
|
@ -45,6 +46,7 @@ import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
|
import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
|
||||||
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
|
import org.secuso.privacyfriendlysudoku.ui.view.WinDialog;
|
||||||
|
|
||||||
|
import java.util.IllegalFormatCodePointException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.RunnableFuture;
|
import java.util.concurrent.RunnableFuture;
|
||||||
|
@ -244,7 +246,12 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
Symbol s = Symbol.valueOf(Symbol.class, sharedPref.getString("pref_symbols", "Default"));
|
Symbol s;
|
||||||
|
try {
|
||||||
|
s = Symbol.valueOf(sharedPref.getString("pref_symbols", Symbol.Default.name()));
|
||||||
|
} catch(IllegalArgumentException e) {
|
||||||
|
s = Symbol.Default;
|
||||||
|
}
|
||||||
layout.setSymbols(s);
|
layout.setSymbols(s);
|
||||||
keyboard.setSymbols(s);
|
keyboard.setSymbols(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ import java.io.Serializable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.secuso.privacyfriendlysudoku.ui.TutorialActivity.ACTION_SHOW_ANYWAYS;
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener{
|
public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener{
|
||||||
|
|
||||||
RatingBar difficultyBar;
|
RatingBar difficultyBar;
|
||||||
|
@ -326,6 +328,14 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.menu_tutorial_main:
|
||||||
|
intent = new Intent(this, TutorialActivity.class);
|
||||||
|
intent.setAction(ACTION_SHOW_ANYWAYS);
|
||||||
|
startActivity(intent);
|
||||||
|
overridePendingTransition(0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -29,6 +29,9 @@ import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||||
|
|
||||||
public class TutorialActivity extends AppCompatActivity {
|
public class TutorialActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private static final String TAG = TutorialActivity.class.getSimpleName();
|
||||||
|
public static final String ACTION_SHOW_ANYWAYS = TAG + ".ACTION_SHOW_ANYWAYS";
|
||||||
|
|
||||||
private ViewPager viewPager;
|
private ViewPager viewPager;
|
||||||
private MyViewPagerAdapter myViewPagerAdapter;
|
private MyViewPagerAdapter myViewPagerAdapter;
|
||||||
private LinearLayout dotsLayout;
|
private LinearLayout dotsLayout;
|
||||||
|
@ -41,11 +44,15 @@ public class TutorialActivity extends AppCompatActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// Checking for first time launch - before calling setContentView()
|
|
||||||
prefManager = new PrefManager(this);
|
prefManager = new PrefManager(this);
|
||||||
if (!prefManager.isFirstTimeLaunch()) {
|
|
||||||
launchHomeScreen();
|
Intent i = getIntent();
|
||||||
finish();
|
if(i == null || !ACTION_SHOW_ANYWAYS.equals(i.getAction())) {
|
||||||
|
// Checking for first time launch - before calling setContentView()
|
||||||
|
if (!prefManager.isFirstTimeLaunch()) {
|
||||||
|
launchHomeScreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Making notification bar transparent
|
// Making notification bar transparent
|
||||||
|
@ -126,7 +133,10 @@ public class TutorialActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private void launchHomeScreen() {
|
private void launchHomeScreen() {
|
||||||
prefManager.setFirstTimeLaunch(false);
|
prefManager.setFirstTimeLaunch(false);
|
||||||
startActivity(new Intent(TutorialActivity.this, MainActivity.class));
|
Intent intent = new Intent(TutorialActivity.this, MainActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
//intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
app/src/main/res/drawable/ic_school_black_24dp.xml
Normal file
10
app/src/main/res/drawable/ic_school_black_24dp.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M5,13.18v4L12,21l7,-3.82v-4L12,17l-7,-3.82zM12,3L1,9l11,6 9,-4.91V17h2V9L12,3z"/>
|
||||||
|
</vector>
|
|
@ -4,7 +4,7 @@
|
||||||
android:title="@string/menu_reset" />
|
android:title="@string/menu_reset" />
|
||||||
|
|
||||||
<group android:id="@+id/group4">
|
<group android:id="@+id/group4">
|
||||||
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
|
<item android:id="@+id/nav_newgame" android:icon="@drawable/ic_menu_home"
|
||||||
android:title="@string/menu_main" />
|
android:title="@string/menu_main" />
|
||||||
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
||||||
android:title="@string/menu_highscore" />
|
android:title="@string/menu_highscore" />
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
android:checkableBehavior="all">
|
android:checkableBehavior="all">
|
||||||
<item android:id="@+id/menu_settings_main" android:icon="@drawable/ic_menu_settings"
|
<item android:id="@+id/menu_settings_main" android:icon="@drawable/ic_menu_settings"
|
||||||
android:title="@string/menu_settings" />
|
android:title="@string/menu_settings" />
|
||||||
|
<item android:id="@+id/menu_tutorial_main" android:icon="@drawable/ic_school_black_24dp"
|
||||||
|
android:title="@string/menu_tutorial"/>
|
||||||
<item android:id="@+id/menu_help_main" android:icon="@drawable/ic_menu_help"
|
<item android:id="@+id/menu_help_main" android:icon="@drawable/ic_menu_help"
|
||||||
android:title="@string/menu_help" />
|
android:title="@string/menu_help" />
|
||||||
<item android:id="@+id/menu_about_main" android:icon="@drawable/ic_menu_about"
|
<item android:id="@+id/menu_about_main" android:icon="@drawable/ic_menu_about"
|
||||||
|
|
|
@ -95,5 +95,6 @@
|
||||||
|
|
||||||
<string name="next">Weiter</string>
|
<string name="next">Weiter</string>
|
||||||
<string name="skip">Skip</string>
|
<string name="skip">Skip</string>
|
||||||
|
<string name="menu_tutorial">Tutorial</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -145,4 +145,5 @@
|
||||||
|
|
||||||
<string name="next">Next</string>
|
<string name="next">Next</string>
|
||||||
<string name="skip">Skip</string>
|
<string name="skip">Skip</string>
|
||||||
|
<string name="menu_tutorial">Tutorial</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue