Search in sources :

Example 6 with SwitchPreferenceEx

use of net.osmand.plus.settings.preferences.SwitchPreferenceEx in project Osmand by osmandapp.

the class MainSettingsFragment method setupAppProfiles.

private void setupAppProfiles(PreferenceCategory preferenceCategory) {
    OsmandApplication app = getMyApplication();
    if (app == null) {
        return;
    }
    for (ApplicationMode applicationMode : allAppModes) {
        boolean isAppProfileEnabled = availableAppModes.contains(applicationMode);
        SwitchPreferenceEx pref = new SwitchPreferenceEx(app);
        pref.setPersistent(false);
        pref.setKey(applicationMode.getStringKey());
        preferenceCategory.addPreference(pref);
        pref.setIcon(getAppProfilesIcon(applicationMode, isAppProfileEnabled));
        pref.setTitle(applicationMode.toHumanString());
        pref.setSummary(ProfileDataUtils.getAppModeDescription(getContext(), applicationMode));
        pref.setChecked(isAppProfileEnabled);
        pref.setLayoutResource(R.layout.preference_with_descr_dialog_and_switch);
        pref.setFragment(ConfigureProfileFragment.class.getName());
    }
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode) SwitchPreferenceEx(net.osmand.plus.settings.preferences.SwitchPreferenceEx)

Example 7 with SwitchPreferenceEx

use of net.osmand.plus.settings.preferences.SwitchPreferenceEx in project Osmand by osmandapp.

the class GeneralProfileSettingsFragment method setupVolumeButtonsAsZoom.

private void setupVolumeButtonsAsZoom() {
    SwitchPreferenceEx volumeButtonsPref = (SwitchPreferenceEx) findPreference(settings.USE_VOLUME_BUTTONS_AS_ZOOM.getId());
    volumeButtonsPref.setTitle(getString(R.string.use_volume_buttons_as_zoom));
    volumeButtonsPref.setDescription(getString(R.string.use_volume_buttons_as_zoom_descr));
    Drawable icon = getPersistentPrefIcon(R.drawable.ic_action_zoom_volume_buttons);
    volumeButtonsPref.setIcon(icon);
}
Also used : Drawable(android.graphics.drawable.Drawable) SwitchPreferenceEx(net.osmand.plus.settings.preferences.SwitchPreferenceEx)

Example 8 with SwitchPreferenceEx

use of net.osmand.plus.settings.preferences.SwitchPreferenceEx in project Osmand by osmandapp.

the class GeneralProfileSettingsFragment method setupKalmanFilterPref.

private void setupKalmanFilterPref() {
    SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
    kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));
    kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr));
}
Also used : SwitchPreferenceEx(net.osmand.plus.settings.preferences.SwitchPreferenceEx)

Example 9 with SwitchPreferenceEx

use of net.osmand.plus.settings.preferences.SwitchPreferenceEx in project Osmand by osmandapp.

the class MultimediaNotesFragment method setupExternalPhotoCamPref.

private void setupExternalPhotoCamPref(Camera cam, AudioVideoNotesPlugin plugin) {
    SwitchPreferenceEx externalPhotoCam = (SwitchPreferenceEx) findPreference(plugin.AV_EXTERNAL_PHOTO_CAM.getId());
    externalPhotoCam.setDescription(getString(R.string.av_use_external_camera_descr));
    externalPhotoCam.setIcon(getPersistentPrefIcon(R.drawable.ic_action_photo_dark));
    externalPhotoCam.setEnabled(cam != null);
}
Also used : SwitchPreferenceEx(net.osmand.plus.settings.preferences.SwitchPreferenceEx)

Example 10 with SwitchPreferenceEx

use of net.osmand.plus.settings.preferences.SwitchPreferenceEx in project Osmand by osmandapp.

the class MultimediaNotesFragment method setupPhotoPlaySoundPref.

private void setupPhotoPlaySoundPref(Camera cam, AudioVideoNotesPlugin plugin) {
    Drawable disabled = getContentIcon(R.drawable.ic_action_music_off);
    Drawable enabled = getActiveIcon(R.drawable.ic_type_audio);
    Drawable icon = getPersistentPrefIcon(enabled, disabled);
    SwitchPreferenceEx photoPlaySound = (SwitchPreferenceEx) findPreference(plugin.AV_PHOTO_PLAY_SOUND.getId());
    photoPlaySound.setDescription(getString(R.string.av_photo_play_sound_descr));
    photoPlaySound.setIcon(icon);
    photoPlaySound.setEnabled(cam != null);
}
Also used : Drawable(android.graphics.drawable.Drawable) SwitchPreferenceEx(net.osmand.plus.settings.preferences.SwitchPreferenceEx)

Aggregations

SwitchPreferenceEx (net.osmand.plus.settings.preferences.SwitchPreferenceEx)49 Drawable (android.graphics.drawable.Drawable)5 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)5 OsmandApplication (net.osmand.plus.OsmandApplication)3 Context (android.content.Context)2 View (android.view.View)2 Fragment (androidx.fragment.app.Fragment)2 Preference (androidx.preference.Preference)2 BaseBottomSheetItem (net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem)2 BottomSheetItemWithCompoundButton (net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton)2 TitleItem (net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem)2 BooleanPreference (net.osmand.plus.settings.backend.preferences.BooleanPreference)2 OsmandPreference (net.osmand.plus.settings.backend.preferences.OsmandPreference)2 OnConfirmPreferenceChange (net.osmand.plus.settings.fragments.OnConfirmPreferenceChange)2 ListPreferenceEx (net.osmand.plus.settings.preferences.ListPreferenceEx)2 MultiSelectBooleanPreference (net.osmand.plus.settings.preferences.MultiSelectBooleanPreference)2 TextView (android.widget.TextView)1 FragmentManager (androidx.fragment.app.FragmentManager)1 EditTextPreference (androidx.preference.EditTextPreference)1 PreferenceScreen (androidx.preference.PreferenceScreen)1