Override the onResume() and onBackPressed() methods of the CreateSudokuActivity
This commit is contained in:
parent
9b9670c965
commit
b30ae90237
1 changed files with 36 additions and 0 deletions
|
@ -3,11 +3,21 @@ package org.secuso.privacyfriendlysudoku.ui;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import org.secuso.privacyfriendlysudoku.controller.Symbol;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.R;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuKeyboardLayout;
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.SudokuSpecialButtonLayout;
|
||||
|
||||
public class CreateSudokuActivity extends BaseActivity {
|
||||
|
||||
SudokuFieldLayout layout;
|
||||
SudokuKeyboardLayout keyboard;
|
||||
SudokuSpecialButtonLayout specialButtonLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -19,4 +29,30 @@ public class CreateSudokuActivity extends BaseActivity {
|
|||
|
||||
setContentView(R.layout.activity_game_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
||||
View mainContent = findViewById(R.id.main_content);
|
||||
if (mainContent != null) {
|
||||
mainContent.animate().alpha(1).setDuration(MAIN_CONTENT_FADEOUT_DURATION);
|
||||
}
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Symbol s;
|
||||
try {
|
||||
s = Symbol.valueOf(sharedPref.getString("pref_symbols", Symbol.Default.name()));
|
||||
} catch(IllegalArgumentException e) {
|
||||
s = Symbol.Default;
|
||||
}
|
||||
layout.setSymbols(s);
|
||||
keyboard.setSymbols(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
finish();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue