add option to keep playing music
This commit is contained in:
parent
fb83b64ac4
commit
1be1c0e639
5 changed files with 26 additions and 3 deletions
|
@ -447,6 +447,8 @@
|
|||
<string name="auto_zoom_map">Auto zoom map</string>
|
||||
<string name="snap_to_road_descr">Snap position to roads during navigation</string>
|
||||
<string name="snap_to_road">Snap to road</string>
|
||||
<string name="interrupt_music_descr">Interrupt music when making announcement</string>
|
||||
<string name="interrupt_music">Interrupt Music</string>
|
||||
<string name="tip_recent_changes_0_8_2_t">Changes in 0.8.2:
|
||||
\n\t* Improved Routing
|
||||
\n\t* Dynamic map widgets
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<ListPreference android:key="auto_zoom_map_new" android:title="@string/auto_zoom_map"
|
||||
android:summary="@string/auto_zoom_map_descr"></ListPreference>
|
||||
<CheckBoxPreference android:title="@string/snap_to_road" android:summary="@string/snap_to_road_descr" android:key="snap_to_road"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:title="@string/interrupt_music" android:summary="@string/interrupt_music_descr" android:key="interrupt_music"></CheckBoxPreference>
|
||||
<Preference android:title="@string/show_warnings_title" android:summary="@string/show_warnings_descr" android:key="show_routing_alarms"/>
|
||||
<Preference android:title="@string/speak_title" android:summary="@string/speak_descr" android:key="speak_routing_alarms"/>
|
||||
<CheckBoxPreference android:summary="@string/use_compass_navigation_descr" android:title="@string/use_compass_navigation"
|
||||
|
|
|
@ -715,6 +715,12 @@ public class OsmandSettings {
|
|||
SNAP_TO_ROAD.setModeDefaultValue(ApplicationMode.BICYCLE, true);
|
||||
}
|
||||
|
||||
public final CommonPreference<Boolean> INTERRUPT_MUSIC = new BooleanPreference("interrupt_music", false).makeProfile().cache();
|
||||
{
|
||||
INTERRUPT_MUSIC.setModeDefaultValue(ApplicationMode.CAR, true);
|
||||
INTERRUPT_MUSIC.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
|
||||
}
|
||||
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String SAVE_CURRENT_TRACK = "save_current_track"; //$NON-NLS-1$
|
||||
|
|
|
@ -85,6 +85,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
|
||||
|
||||
registerBooleanPreference(settings.SNAP_TO_ROAD, screen);
|
||||
registerBooleanPreference(settings.INTERRUPT_MUSIC, screen);
|
||||
registerBooleanPreference(settings.USE_COMPASS_IN_NAVIGATION, screen);
|
||||
|
||||
Integer[] intValues = new Integer[] { 0, 5, 10, 15, 20, 25, 30, 45, 60, 90};
|
||||
|
|
|
@ -20,14 +20,27 @@ public class AudioFocusHelperImpl implements AudioManager.OnAudioFocusChangeList
|
|||
@Override
|
||||
public boolean requestFocus(ClientContext context, int streamType) {
|
||||
AudioManager mAudioManager = (AudioManager) ((Context) context).getSystemService(Context.AUDIO_SERVICE);
|
||||
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this, streamType,
|
||||
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
|
||||
if (context.getSettings().INTERRUPT_MUSIC.get())
|
||||
{
|
||||
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this, streamType, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean abandonFocus(ClientContext context, int streamType) {
|
||||
AudioManager mAudioManager = (AudioManager) ((Context) context).getSystemService(Context.AUDIO_SERVICE);
|
||||
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this);
|
||||
if (context.getSettings().INTERRUPT_MUSIC.get())
|
||||
{
|
||||
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue