Fix issue 442. Provide settings for bluetooth audio stream

This commit is contained in:
Victor Shcherb 2011-06-13 13:23:57 +02:00
parent 20af4e4dfc
commit 96f9782e9b
9 changed files with 42 additions and 4 deletions

View file

@ -10,7 +10,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait">
<activity android:name=".activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait"
android:launchMode="singleTop">
<intent-filter>
<data android:scheme="http" android:host="download.osmand.net" path="go"/>
<action android:name="android.intent.action.VIEW" />

View file

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="choose_audio_stream">Голосовые инструкции</string>
<string name="choose_audio_stream_descr">Выберите канал для голосовых инструкций (зависит от системы)</string>
<string name="voice_stream_voice_call">Поток голосовых звонков</string>
<string name="voice_stream_notification">Потом нотификаций</string>
<string name="voice_stream_music">Поток музыки</string>
<string name="warning_tile_layer_not_downloadable">Слой карты %1$s не может быть загружен приложением, попробуйте установить его заново.</string>
<string name="overlay_transparency_descr">Изменить прозрачность карты покрытия</string>
<string name="overlay_transparency">Прозрачность покрытия</string>
<string name="map_transparency_descr">Изменить прозрачность основной карты</string>

View file

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="choose_audio_stream">Voice guidance stream</string>
<string name="choose_audio_stream_descr">Choose channel to provide voice guidance (depends on system configuration)</string>
<string name="voice_stream_voice_call">Voice call stream</string>
<string name="voice_stream_notification">Notification stream</string>
<string name="voice_stream_music">Music stream</string>
<string name="warning_tile_layer_not_downloadable">Map layer %1$s is not downloadable by the application, please try to reinstall it.</string>
<string name="overlay_transparency_descr">Modify overlay transparency</string>
<string name="overlay_transparency">Overlay transparency</string>

View file

@ -31,6 +31,8 @@
<CheckBoxPreference android:summary="@string/fast_route_mode_descr" android:title="@string/fast_route_mode"
android:key="fast_route_mode"></CheckBoxPreference>
<ListPreference android:title="@string/voice_provider" android:key="voice_provider" android:summary="@string/voice_provider_descr"></ListPreference>
<ListPreference android:key="audio_stream" android:title="@string/choose_audio_stream"
android:summary="@string/choose_audio_stream_descr"></ListPreference>
<CheckBoxPreference android:summary="@string/use_osmand_routing_service_descr" android:title="@string/use_osmand_routing_service"
android:key="use_osmand_routing_service"></CheckBoxPreference>
@ -48,6 +50,8 @@
<ListPreference android:key="service_off_interval" android:title="@string/background_service_int" android:summary="@string/background_service_int_descr"></ListPreference>
<ListPreference android:key="service_off_wait_interval" android:title="@string/background_service_wait_int"
android:summary="@string/background_service_wait_int_descr"></ListPreference>
</PreferenceScreen>

View file

@ -25,9 +25,11 @@ import android.content.pm.ActivityInfo;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.location.LocationManager;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Environment;
import android.provider.MediaStore.Audio;
import android.widget.Toast;
public class OsmandSettings {
@ -502,6 +504,10 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> MAP_VIEW_3D = new BooleanPreference("map_view_3d", false, false);
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Integer> AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream",
AudioManager.STREAM_MUSIC, true);
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> USE_ENGLISH_NAMES = new BooleanPreference("use_english_names", false, true);

View file

@ -148,8 +148,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = ((OsmandApplication) getApplication()).getSettings();
// for voice navigation
setVolumeControlStream(AudioManager.STREAM_MUSIC);
requestWindowFeature(Window.FEATURE_NO_TITLE);
// Full screen is not used here
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
@ -751,6 +749,13 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
}
currentScreenOrientation = getWindow().getWindowManager().getDefaultDisplay().getOrientation();
// for voice navigation
if(settings.AUDIO_STREAM_GUIDANCE.get() != null){
setVolumeControlStream(settings.AUDIO_STREAM_GUIDANCE.get());
} else {
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
mapLayers.updateMapSource(mapView, null);
updateApplicationModeSettings();

View file

@ -36,6 +36,7 @@ import android.content.IntentFilter;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.ActivityInfo;
import android.location.LocationManager;
import android.media.AudioManager;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
@ -182,6 +183,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
new String[] {getString(R.string.position_on_map_center), getString(R.string.position_on_map_bottom)},
new Integer[] {OsmandSettings.CENTER_CONSTANT, OsmandSettings.BOTTOM_CONSTANT});
registerListPreference(osmandSettings.AUDIO_STREAM_GUIDANCE, screen,
new String[] {getString(R.string.voice_stream_music), getString(R.string.voice_stream_notification),
getString(R.string.voice_stream_voice_call)},
new Integer[] {AudioManager.STREAM_MUSIC, AudioManager.STREAM_NOTIFICATION, AudioManager.STREAM_VOICE_CALL});
entries = new String[DayNightMode.values().length];
for(int i=0; i<entries.length; i++){
entries[i] = DayNightMode.values()[i].toHumanString(this);

View file

@ -0,0 +1,5 @@
package net.osmand.plus.views;
public class MapTileAdapter {
}

View file

@ -62,7 +62,6 @@ public class MapTileLayer extends BaseMapLayer {
return;
}
drawTileMap(canvas, tilesRect);
}
public void drawTileMap(Canvas canvas, RectF tilesRect) {