Fixed titles not setting to activity toolbar

This commit is contained in:
Viktor De Pasquale 2019-04-18 15:51:02 +02:00
parent bcd1064e94
commit 7e5e14163c
4 changed files with 21 additions and 3 deletions

View File

@ -56,6 +56,14 @@ open class MainActivity : MagiskActivity<MainViewModel, ActivityMainBinding>() {
}
override fun setTitle(title: CharSequence?) {
supportActionBar?.title = title
}
override fun setTitle(titleId: Int) {
supportActionBar?.setTitle(titleId)
}
override fun onBackPressed() {
if (binding.drawerLayout.isDrawerOpen(binding.navView)) {
binding.drawerLayout.closeDrawer(binding.navView)

View File

@ -46,6 +46,11 @@ class MagiskFragment : NewMagiskFragment<HomeViewModel, FragmentMagiskBinding>()
setHasOptionsMenu(true)
}
override fun onStart() {
super.onStart()
requireActivity().setTitle(R.string.magisk)
}
private fun installMagisk() {
// Show Manager update first
if (Config.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {

View File

@ -40,11 +40,16 @@ public class SettingsFragment extends BasePreferenceFragment {
private ListPreference updateChannel, autoRes, suNotification,
requestTimeout, rootConfig, multiuserConfig, nsConfig;
@Override
public void onStart() {
super.onStart();
requireActivity().setTitle(R.string.settings);
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
getPreferenceManager().setStorageDeviceProtected();
setPreferencesFromResource(R.xml.app_settings, rootKey);
requireActivity().setTitle(R.string.settings);
boolean showSuperuser = Utils.showSuperUser();
app.getPrefs().edit()
@ -100,7 +105,7 @@ public class SettingsFragment extends BasePreferenceFragment {
.setTitle(R.string.settings_update_custom)
.setView(v)
.setPositiveButton(R.string.ok, (d, i) ->
Config.set(Config.Key.CUSTOM_CHANNEL, url.getText().toString()))
Config.set(Config.Key.CUSTOM_CHANNEL, url.getText().toString()))
.setNegativeButton(R.string.close, (d, i) ->
Config.set(Config.Key.UPDATE_CHANNEL, prev))
.setOnCancelListener(d ->

View File

@ -13,7 +13,7 @@ class SuperuserFragment :
override fun onStart() {
super.onStart()
magiskActivity.supportActionBar?.title = getString(R.string.superuser)
requireActivity().setTitle(R.string.superuser)
}
override fun onResume() {