forked from upstream-mirrors/OpenTracks
Renamed omit_illegal_state to android.intent.extra.IGNORE_ILLEGAL_STATE
Code comment and code style change.
This commit is contained in:
@@ -50,5 +50,5 @@ limitations under the License.
|
|||||||
<!-- Intent actions -->
|
<!-- Intent actions -->
|
||||||
<string name="save_intent_action">android.intent.action.SAVE</string>
|
<string name="save_intent_action">android.intent.action.SAVE</string>
|
||||||
<string name="open_settings_screen">android.intent.action.settings.OPEN</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>
|
</resources>
|
||||||
|
|||||||
@@ -300,10 +300,9 @@ public class TrackRecordingService extends Service {
|
|||||||
} else if (getString(R.string.end_current_track_action).equals(action)) {
|
} else if (getString(R.string.end_current_track_action).equals(action)) {
|
||||||
endCurrentTrack();
|
endCurrentTrack();
|
||||||
}
|
}
|
||||||
}
|
} catch (IllegalStateException e) {
|
||||||
catch (IllegalStateException e) {
|
if (!intent.getBooleanExtra(getString(R.string.ignore_illegal_state), false))
|
||||||
if (!intent.getBooleanExtra(getString(R.string.omit_illegal_state), false))
|
throw e;
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,11 @@ public class TrackWidgetProvider
|
|||||||
private void setButtonIntent(
|
private void setButtonIntent(
|
||||||
RemoteViews views, Context context, int action, int icon, int extra) {
|
RemoteViews views, Context context, int action, int icon, int extra) {
|
||||||
Intent intent = new Intent(context, TrackRecordingService.class);
|
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));
|
intent.setAction(context.getString(action));
|
||||||
if (extra != -1) {
|
if (extra != -1) {
|
||||||
intent.putExtra(context.getString(extra), true);
|
intent.putExtra(context.getString(extra), true);
|
||||||
|
|||||||
Reference in New Issue
Block a user