mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Show toolbar back button on subsettings pages
Test: Back button displayed and functional on subsettings Bug: 187732263 Change-Id: I6a3679de3a00480f5a0861f966d178be25f001d4
This commit is contained in:
@@ -24,6 +24,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -86,8 +87,12 @@ public class SettingsActivity extends FragmentActivity
|
||||
setActionBar(findViewById(R.id.action_bar));
|
||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent.hasExtra(EXTRA_FRAGMENT) || intent.hasExtra(EXTRA_FRAGMENT_ARGS)) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
Intent intent = getIntent();
|
||||
Bundle args = intent.getBundleExtra(EXTRA_FRAGMENT_ARGS);
|
||||
if (args == null) {
|
||||
args = new Bundle();
|
||||
@@ -164,6 +169,15 @@ public class SettingsActivity extends FragmentActivity
|
||||
return startPreference(getString(R.string.settings_fragment_name), args, pref.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* This fragment shows the launcher preferences.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user