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

View File

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