Removes remaining scopes from switch statements

This commit is contained in:
Dominik Schürmann 2016-06-01 14:12:59 +02:00
parent 619c4f284b
commit b149cd64fd
2 changed files with 27 additions and 37 deletions

View File

@ -610,19 +610,17 @@ public class AppDetails extends AppCompatActivity {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) { switch (intent.getAction()) {
case Installer.ACTION_UNINSTALL_STARTED: { case Installer.ACTION_UNINSTALL_STARTED:
headerFragment.startProgress(); headerFragment.startProgress();
headerFragment.showIndeterminateProgress(getString(R.string.uninstalling)); headerFragment.showIndeterminateProgress(getString(R.string.uninstalling));
break; break;
} case Installer.ACTION_UNINSTALL_COMPLETE:
case Installer.ACTION_UNINSTALL_COMPLETE: {
headerFragment.removeProgress(); headerFragment.removeProgress();
onAppChanged(); onAppChanged();
localBroadcastManager.unregisterReceiver(this); localBroadcastManager.unregisterReceiver(this);
break; break;
} case Installer.ACTION_UNINSTALL_INTERRUPTED:
case Installer.ACTION_UNINSTALL_INTERRUPTED: {
headerFragment.removeProgress(); headerFragment.removeProgress();
String errorMessage = String errorMessage =
@ -640,8 +638,7 @@ public class AppDetails extends AppCompatActivity {
localBroadcastManager.unregisterReceiver(this); localBroadcastManager.unregisterReceiver(this);
break; break;
} case Installer.ACTION_UNINSTALL_USER_INTERACTION:
case Installer.ACTION_UNINSTALL_USER_INTERACTION: {
PendingIntent uninstallPendingIntent = PendingIntent uninstallPendingIntent =
intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI); intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);
@ -652,12 +649,10 @@ public class AppDetails extends AppCompatActivity {
} }
break; break;
} default:
default: {
throw new RuntimeException("intent action not handled!"); throw new RuntimeException("intent action not handled!");
} }
} }
}
}; };
private void onAppChanged() { private void onAppChanged() {

View File

@ -799,21 +799,18 @@ public class SwapWorkflowActivity extends AppCompatActivity {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) { switch (intent.getAction()) {
case Installer.ACTION_INSTALL_STARTED: { case Installer.ACTION_INSTALL_STARTED:
break; break;
} case Installer.ACTION_INSTALL_COMPLETE:
case Installer.ACTION_INSTALL_COMPLETE: {
localBroadcastManager.unregisterReceiver(this); localBroadcastManager.unregisterReceiver(this);
showRelevantView(true); showRelevantView(true);
break; break;
} case Installer.ACTION_INSTALL_INTERRUPTED:
case Installer.ACTION_INSTALL_INTERRUPTED: {
localBroadcastManager.unregisterReceiver(this); localBroadcastManager.unregisterReceiver(this);
// TODO: handle errors! // TODO: handle errors!
break; break;
} case Installer.ACTION_INSTALL_USER_INTERACTION:
case Installer.ACTION_INSTALL_USER_INTERACTION: {
PendingIntent installPendingIntent = PendingIntent installPendingIntent =
intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI); intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);
@ -824,12 +821,10 @@ public class SwapWorkflowActivity extends AppCompatActivity {
} }
break; break;
} default:
default: {
throw new RuntimeException("intent action not handled!"); throw new RuntimeException("intent action not handled!");
} }
} }
}
}; };
} }