Fix coding style problems
This commit is contained in:
parent
98e75fc313
commit
2393d4512c
|
@ -646,9 +646,9 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if(isDrawerOpen()) {
|
if (isDrawerOpen()) {
|
||||||
drawerLayout.closeDrawer(navDrawer);
|
drawerLayout.closeDrawer(navDrawer);
|
||||||
} else if(getSupportFragmentManager().getBackStackEntryCount() != 0) {
|
} else if (getSupportFragmentManager().getBackStackEntryCount() != 0) {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
switch (UserPreferences.getBackButtonBehavior()) {
|
switch (UserPreferences.getBackButtonBehavior()) {
|
||||||
|
@ -664,7 +664,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
||||||
.show();
|
.show();
|
||||||
break;
|
break;
|
||||||
case DOUBLE_TAP:
|
case DOUBLE_TAP:
|
||||||
if(lastBackButtonPressTime < System.currentTimeMillis() - 2000) {
|
if (lastBackButtonPressTime < System.currentTimeMillis() - 2000) {
|
||||||
Toast.makeText(this, R.string.double_tap_toast, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.double_tap_toast, Toast.LENGTH_SHORT).show();
|
||||||
lastBackButtonPressTime = System.currentTimeMillis();
|
lastBackButtonPressTime = System.currentTimeMillis();
|
||||||
} else {
|
} else {
|
||||||
|
@ -672,7 +672,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GO_TO_PAGE:
|
case GO_TO_PAGE:
|
||||||
if(getLastNavFragment().equals(UserPreferences.getBackButtonGoToPage())) {
|
if (getLastNavFragment().equals(UserPreferences.getBackButtonGoToPage())) {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
loadFragment(UserPreferences.getBackButtonGoToPage(), null);
|
loadFragment(UserPreferences.getBackButtonGoToPage(), null);
|
||||||
|
|
|
@ -229,7 +229,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
||||||
|
|
||||||
ui.findPreference(UserPreferences.PREF_BACK_BUTTON_BEHAVIOR)
|
ui.findPreference(UserPreferences.PREF_BACK_BUTTON_BEHAVIOR)
|
||||||
.setOnPreferenceChangeListener((preference, newValue) -> {
|
.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
if(newValue.equals("page")) {
|
if (newValue.equals("page")) {
|
||||||
final Context context = ui.getActivity();
|
final Context context = ui.getActivity();
|
||||||
final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages);
|
final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages);
|
||||||
final String[] navTags = new String[3];
|
final String[] navTags = new String[3];
|
||||||
|
@ -239,7 +239,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(R.string.back_button_go_to_page_title);
|
builder.setTitle(R.string.back_button_go_to_page_title);
|
||||||
builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags, UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> {
|
builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags, UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> {
|
||||||
if(i >= 0) {
|
if (i >= 0) {
|
||||||
choice[0] = navTags[i];
|
choice[0] = navTags[i];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue