Add back button to CreateSudokuActivity

This commit is contained in:
uykek 2020-08-22 15:20:41 +02:00
parent 07552a1089
commit 762d7d19a2

View file

@ -34,6 +34,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.Toolbar;
import org.secuso.privacyfriendlysudoku.controller.GameController; import org.secuso.privacyfriendlysudoku.controller.GameController;
import org.secuso.privacyfriendlysudoku.controller.Symbol; import org.secuso.privacyfriendlysudoku.controller.Symbol;
@ -89,6 +90,11 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
private void setUpLayout() { private void setUpLayout() {
setContentView(R.layout.activity_create_sudoku); setContentView(R.layout.activity_create_sudoku);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout); layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
layout.setSettingsAndGame(sharedPref, gameController); layout.setSettingsAndGame(sharedPref, gameController);
@ -113,6 +119,12 @@ public class CreateSudokuActivity extends BaseActivity implements IFinalizeDialo
gameController.notifyHighlightChangedListeners(); gameController.notifyHighlightChangedListeners();
} }
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
@Override @Override
public void onResume(){ public void onResume(){
super.onResume(); super.onResume();