mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 05:25:31 +03:00
replace menu switch statements with if/else
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
3c0ef1d1e0
commit
45a88c0722
5 changed files with 70 additions and 81 deletions
|
@ -145,13 +145,11 @@ public abstract class BrowserController extends BaseController implements Listin
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.files_selection_done:
|
||||
if (item.getItemId() == R.id.files_selection_done) {
|
||||
onFileSelectionDone();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -436,20 +436,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
getRouter().popCurrentController();
|
||||
return true;
|
||||
case R.id.contacts_selection_done:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
return getRouter().popCurrentController();
|
||||
} else if (itemId == R.id.contacts_selection_done) {
|
||||
selectionDone();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, @NonNull MenuInflater inflater) {
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_contacts, menu);
|
||||
searchItem = menu.findItem(R.id.action_search);
|
||||
|
|
|
@ -157,8 +157,7 @@ public class ProfileController extends BaseController {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.edit:
|
||||
if (item.getItemId() == R.id.edit) {
|
||||
if (edit) {
|
||||
save();
|
||||
}
|
||||
|
@ -217,10 +216,8 @@ public class ProfileController extends BaseController {
|
|||
adapter.notifyDataSetChanged();
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,12 +116,10 @@ public class RingtoneSelectionController extends BaseController implements Flexi
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
return getRouter().popCurrentController();
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void prepareViews() {
|
||||
|
|
|
@ -84,13 +84,11 @@ public abstract class BaseController extends ButterKnifeController {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
getRouter().popCurrentController();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void cleanTempCertPreference() {
|
||||
|
|
Loading…
Reference in a new issue