Check shortcut action for null

Этот коммит содержится в:
Anton Tananaev
2017-04-23 12:00:58 +12:00
родитель d632c7cdfa
Коммит 96a75f02a7
+18 -16
Просмотреть файл
@@ -93,22 +93,24 @@ public class ShortcutActivity extends Activity {
} else { } else {
action = intent.getStringExtra(EXTRA_ACTION); action = intent.getStringExtra(EXTRA_ACTION);
} }
switch (action) { if (action != null) {
case EXTRA_ACTION_START: switch (action) {
PreferenceManager.getDefaultSharedPreferences(this) case EXTRA_ACTION_START:
.edit().putBoolean(MainActivity.KEY_STATUS, true).commit(); PreferenceManager.getDefaultSharedPreferences(this)
startService(new Intent(this, TrackingService.class)); .edit().putBoolean(MainActivity.KEY_STATUS, true).commit();
Toast.makeText(this, R.string.status_service_create, Toast.LENGTH_SHORT).show(); startService(new Intent(this, TrackingService.class));
break; Toast.makeText(this, R.string.status_service_create, Toast.LENGTH_SHORT).show();
case EXTRA_ACTION_STOP: break;
PreferenceManager.getDefaultSharedPreferences(this) case EXTRA_ACTION_STOP:
.edit().putBoolean(MainActivity.KEY_STATUS, false).commit(); PreferenceManager.getDefaultSharedPreferences(this)
stopService(new Intent(this, TrackingService.class)); .edit().putBoolean(MainActivity.KEY_STATUS, false).commit();
Toast.makeText(this, R.string.status_service_destroy, Toast.LENGTH_SHORT).show(); stopService(new Intent(this, TrackingService.class));
break; Toast.makeText(this, R.string.status_service_destroy, Toast.LENGTH_SHORT).show();
case EXTRA_ACTION_SOS: break;
sendAlarm(); case EXTRA_ACTION_SOS:
break; sendAlarm();
break;
}
} }
finish(); finish();
} }