move all home references to base activity

This commit is contained in:
dkanada 2021-05-21 08:31:05 +09:00
commit d8d8ad96e4
10 changed files with 11 additions and 62 deletions

View file

@ -103,16 +103,6 @@ public class AboutActivity extends AbsBaseActivity implements View.OnClickListen
thanksBinding.adrianWebsite.setOnClickListener(this);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
private static String getCurrentVersionName(@NonNull final Context context) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;

View file

@ -67,16 +67,6 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
binding.select.setOnClickListener(this);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
if (v == binding.select) {

View file

@ -134,15 +134,6 @@ public class SearchActivity extends AbsMusicContentActivity implements SearchVie
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
}
return super.onOptionsItemSelected(item);
}
private void search(@NonNull String query) {
this.query = query;

View file

@ -59,14 +59,4 @@ public class SelectActivity extends AbsBaseActivity {
super.onPause();
overridePendingTransition(0, R.anim.fade_quick);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -3,7 +3,6 @@ package com.dkanada.gramophone.activities;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.ColorInt;
@ -77,16 +76,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
public void onColorChooserDismissed(@NonNull ColorChooserDialog dialog) {
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
public static class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
public void onCreatePreferences(Bundle bundle, String s) {

View file

@ -9,6 +9,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
@ -83,6 +84,16 @@ public abstract class AbsBaseActivity extends AbsThemeActivity {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
protected View getPermissionWindow() {
return getWindow().getDecorView();
}

View file

@ -191,9 +191,6 @@ public class AlbumDetailActivity extends AbsMusicContentActivity implements Pale
case R.id.action_add_to_playlist:
AddToPlaylistDialog.create(songs).show(getSupportFragmentManager(), "ADD_PLAYLIST");
return true;
case android.R.id.home:
super.onBackPressed();
return true;
case R.id.action_go_to_artist:
NavigationUtil.startArtist(this, new Artist(album), null);
return true;

View file

@ -221,9 +221,6 @@ public class ArtistDetailActivity extends AbsMusicContentActivity implements Pal
case R.id.action_download:
NavigationUtil.startDownload(this, songs);
return true;
case android.R.id.home:
super.onBackPressed();
return true;
case R.id.action_colored_footers:
item.setChecked(!item.isChecked());
setUsePalette(item.isChecked());

View file

@ -112,9 +112,6 @@ public class GenreDetailActivity extends AbsMusicContentActivity implements CabH
case R.id.action_download:
NavigationUtil.startDownload(this, adapter.getDataSet());
return true;
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);

View file

@ -136,9 +136,6 @@ public class PlaylistDetailActivity extends AbsMusicContentActivity implements C
case R.id.action_download:
NavigationUtil.startDownload(this, adapter.getDataSet());
return true;
case android.R.id.home:
onBackPressed();
return true;
}
return PlaylistMenuHelper.handleMenuClick(this, playlist, item);