Override the onResume() and onBackPressed() methods of the CreateSudokuActivity

This commit is contained in:
uykek 2020-06-24 19:18:45 +02:00
parent 9b9670c965
commit b30ae90237

View file

@ -3,11 +3,21 @@ package org.secuso.privacyfriendlysudoku.ui;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import org.secuso.privacyfriendlysudoku.controller.Symbol;
import org.secuso.privacyfriendlysudoku.ui.view.R; 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 { public class CreateSudokuActivity extends BaseActivity {
SudokuFieldLayout layout;
SudokuKeyboardLayout keyboard;
SudokuSpecialButtonLayout specialButtonLayout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -19,4 +29,30 @@ public class CreateSudokuActivity extends BaseActivity {
setContentView(R.layout.activity_game_view); 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();
}
} }