Renamed omit_illegal_state to android.intent.extra.IGNORE_ILLEGAL_STATE

Code comment and code style change.
This commit is contained in:
Josh Kasten
2011-09-27 22:49:53 -05:00
parent af550a7104
commit 2deded2d88
3 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -50,5 +50,5 @@ limitations under the License.
<!-- Intent actions -->
<string name="save_intent_action">android.intent.action.SAVE</string>
<string name="open_settings_screen">android.intent.action.settings.OPEN</string>
<string name="omit_illegal_state">android.intent.state.illegal.omit</string>
<string name="ignore_illegal_state">android.intent.extra.IGNORE_ILLEGAL_STATE</string>
</resources>
@@ -300,10 +300,9 @@ public class TrackRecordingService extends Service {
} else if (getString(R.string.end_current_track_action).equals(action)) {
endCurrentTrack();
}
}
catch (IllegalStateException e) {
if (!intent.getBooleanExtra(getString(R.string.omit_illegal_state), false))
throw e;
} catch (IllegalStateException e) {
if (!intent.getBooleanExtra(getString(R.string.ignore_illegal_state), false))
throw e;
}
}
}
@@ -198,7 +198,11 @@ public class TrackWidgetProvider
private void setButtonIntent(
RemoteViews views, Context context, int action, int icon, int extra) {
Intent intent = new Intent(context, TrackRecordingService.class);
intent.putExtra(context.getString(R.string.omit_illegal_state), true);
/* Keeps the TrackRecordingService from throwing back an exception in cases where
* two of the same intents are sent from the user double taping on the widget. */
intent.putExtra(context.getString(R.string.ignore_illegal_state), true);
intent.setAction(context.getString(action));
if (extra != -1) {
intent.putExtra(context.getString(extra), true);