Add lost pref use trackball for movements to general profile settings
This commit is contained in:
parent
1c9497e9bd
commit
5411d472e1
4 changed files with 37 additions and 10 deletions
|
@ -107,4 +107,11 @@
|
|||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:title="@string/external_input_device" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="use_trackball_for_movements"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_off"
|
||||
android:summaryOn="@string/shared_string_on"
|
||||
android:title="@string/use_trackball" />
|
||||
|
||||
</PreferenceScreen>
|
|
@ -1370,7 +1370,7 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
||||
new BooleanPreference("use_trackball_for_movements", true).makeProfile().makeGeneral();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> ACCESSIBILITY_SMART_AUTOANNOUNCE =
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.OsmAndLocationSimulation;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.util.SunriseSunset;
|
||||
|
@ -29,23 +30,25 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
@SuppressLint("SimpleDateFormat")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
((OsmandApplication) getApplication()).applyTheme(this);
|
||||
OsmandApplication app = getMyApplication();
|
||||
app.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
getToolbar().setTitle(R.string.debugging_and_development);
|
||||
PreferenceScreen cat = getPreferenceScreen();
|
||||
Preference pref;
|
||||
|
||||
cat.addPreference(createCheckBoxPreference(settings.USE_OPENGL_RENDER,
|
||||
R.string.use_opengl_render,R.string.use_opengl_render_descr));
|
||||
R.string.use_opengl_render, R.string.use_opengl_render_descr));
|
||||
|
||||
CheckBoxPreference nativeCheckbox = createCheckBoxPreference(settings.SAFE_MODE, R.string.safe_mode,
|
||||
R.string.safe_mode_description);
|
||||
// disable the checkbox if the library cannot be used
|
||||
if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || settings.NATIVE_RENDERING_FAILED.get()) {
|
||||
nativeCheckbox.setEnabled(false);
|
||||
nativeCheckbox.setChecked(true);
|
||||
if (!Version.isBlackberry(app)) {
|
||||
CheckBoxPreference nativeCheckbox = createCheckBoxPreference(settings.SAFE_MODE, R.string.safe_mode, R.string.safe_mode_description);
|
||||
// disable the checkbox if the library cannot be used
|
||||
if ((NativeOsmandLibrary.isLoaded() && !NativeOsmandLibrary.isSupported()) || settings.NATIVE_RENDERING_FAILED.get()) {
|
||||
nativeCheckbox.setEnabled(false);
|
||||
nativeCheckbox.setChecked(true);
|
||||
}
|
||||
cat.addPreference(nativeCheckbox);
|
||||
}
|
||||
cat.addPreference(nativeCheckbox);
|
||||
|
||||
PreferenceCategory navigation = new PreferenceCategory(this);
|
||||
navigation.setTitle(R.string.routing_settings);
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.settings;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
|
@ -28,6 +29,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
|
||||
|
@ -61,6 +63,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
|||
setupMagneticFieldSensorPref();
|
||||
setupMapEmptyStateAllowedPref();
|
||||
setupExternalInputDevicePref();
|
||||
setupTrackballForMovementsPref();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -277,6 +280,20 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
|||
);
|
||||
}
|
||||
|
||||
private void setupTrackballForMovementsPref() {
|
||||
SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.USE_TRACKBALL_FOR_MOVEMENTS.getId());
|
||||
mapEmptyStateAllowedPref.setTitle(getString(R.string.use_trackball));
|
||||
mapEmptyStateAllowedPref.setDescription(getString(R.string.use_trackball_descr));
|
||||
|
||||
boolean visible = false;
|
||||
if (!Version.isBlackberry(app)) {
|
||||
int nav = getResources().getConfiguration().navigation;
|
||||
visible = nav == Configuration.NAVIGATION_DPAD || nav == Configuration.NAVIGATION_TRACKBALL ||
|
||||
nav == Configuration.NAVIGATION_WHEEL || nav == Configuration.NAVIGATION_UNDEFINED;
|
||||
}
|
||||
mapEmptyStateAllowedPref.setVisible(visible);
|
||||
}
|
||||
|
||||
private void showDrivingRegionDialog() {
|
||||
Context themedContext = UiUtilities.getThemedContext(getActivity(), isNightMode());
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(themedContext);
|
||||
|
|
Loading…
Reference in a new issue