mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
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 -->
|
||||
<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);
|
||||
|
||||
Reference in New Issue
Block a user