Replaced if/else with switch

This commit is contained in:
camo0112 2021-04-19 10:52:52 +05:30
parent c12ac64678
commit fc4dd4524a
1 changed files with 9 additions and 8 deletions

View File

@ -190,15 +190,16 @@ public class ErrorActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
final int id = item.getItemId();
if (id == android.R.id.home) {
onBackPressed();
} else if (id == R.id.menu_item_share_error) {
ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson());
} else {
return false;
switch (item.getItemId()) {
case R.id.home:
onBackPressed();
return true;
case R.id.menu_item_share_error:
ShareUtils.shareText(this, getString(R.string.error_report_title), buildJson());
return true;
default:
return false;
}
return true;
}
private void openPrivacyPolicyDialog(final Context context, final String action) {