use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.
the class GeneralProfileSettingsFragment method setupAppThemePref.
private void setupAppThemePref() {
final ListPreferenceEx appTheme = (ListPreferenceEx) findPreference(settings.OSMAND_THEME.getId());
ArrayList<String> entries = new ArrayList<>();
entries.add(getString(R.string.dark_theme));
entries.add(getString(R.string.light_theme));
ArrayList<Integer> values = new ArrayList<>();
values.add(OsmandSettings.OSMAND_DARK_THEME);
values.add(OsmandSettings.OSMAND_LIGHT_THEME);
if (settings.isSupportSystemDefaultTheme()) {
entries.add(getString(R.string.system_default_theme));
values.add(OsmandSettings.SYSTEM_DEFAULT_THEME);
}
String[] entriesStrings = new String[entries.size()];
appTheme.setEntries(entries.toArray(entriesStrings));
appTheme.setEntryValues(values.toArray());
appTheme.setIcon(getOsmandThemeIcon());
}
use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.
the class GeneralProfileSettingsFragment method setupRotateMapPref.
private void setupRotateMapPref() {
final ListPreferenceEx rotateMap = (ListPreferenceEx) findPreference(settings.ROTATE_MAP.getId());
rotateMap.setEntries(new String[] { getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt) });
rotateMap.setEntryValues(new Integer[] { OsmandSettings.ROTATE_MAP_NONE, OsmandSettings.ROTATE_MAP_BEARING, OsmandSettings.ROTATE_MAP_COMPASS });
rotateMap.setIcon(getRotateMapIcon());
}
use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.
the class GeneralProfileSettingsFragment method setupAngularUnitsPref.
private void setupAngularUnitsPref() {
AngularConstants[] ac = AngularConstants.values();
String[] entries = new String[ac.length];
Integer[] entryValues = new Integer[ac.length];
for (int i = 0; i < entries.length; i++) {
if (ac[i] == AngularConstants.DEGREES) {
entries[i] = AngularConstants.DEGREES.toHumanString(app) + " 180";
entryValues[i] = AngularConstants.DEGREES.ordinal();
} else if (ac[i] == AngularConstants.DEGREES360) {
entries[i] = AngularConstants.DEGREES.toHumanString(app) + " 360";
entryValues[i] = AngularConstants.DEGREES360.ordinal();
} else {
entries[i] = ac[i].toHumanString(app);
entryValues[i] = AngularConstants.MILLIRADS.ordinal();
}
}
ListPreferenceEx angularUnits = (ListPreferenceEx) findPreference(settings.ANGULAR_UNITS.getId());
angularUnits.setEntries(entries);
angularUnits.setEntryValues(entryValues);
angularUnits.setIcon(getActiveIcon(R.drawable.ic_action_angular_unit));
}
use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.
the class MultimediaNotesFragment method setupCameraFocusTypePref.
private void setupCameraFocusTypePref(Camera cam, AudioVideoNotesPlugin plugin) {
ListPreferenceEx cameraFocusType = (ListPreferenceEx) findPreference(plugin.AV_CAMERA_FOCUS_TYPE.getId());
cameraFocusType.setDescription(R.string.av_camera_focus_descr);
cameraFocusType.setIcon(getPersistentPrefIcon(R.drawable.ic_action_camera_focus));
if (cam == null) {
cameraFocusType.setEnabled(false);
return;
}
Camera.Parameters parameters = cam.getParameters();
// focus mode settings
// show in menu only suppoted modes
List<String> sfm = parameters.getSupportedFocusModes();
if (sfm == null) {
cameraFocusType.setVisible(false);
return;
}
List<String> items = new ArrayList<String>();
List<Integer> itemsValues = new ArrayList<Integer>();
// filtering known types for translate and set index
for (int index = 0; index < sfm.size(); index++) {
if (sfm.get(index).equals("auto")) {
items.add(getString(R.string.av_camera_focus_auto));
itemsValues.add(AV_CAMERA_FOCUS_AUTO);
} else if (sfm.get(index).equals("fixed")) {
items.add(getString(R.string.av_camera_focus_hiperfocal));
itemsValues.add(AV_CAMERA_FOCUS_HIPERFOCAL);
} else if (sfm.get(index).equals("edof")) {
items.add(getString(R.string.av_camera_focus_edof));
itemsValues.add(AV_CAMERA_FOCUS_EDOF);
} else if (sfm.get(index).equals("infinity")) {
items.add(getString(R.string.av_camera_focus_infinity));
itemsValues.add(AV_CAMERA_FOCUS_INFINITY);
} else if (sfm.get(index).equals("macro")) {
items.add(getString(R.string.av_camera_focus_macro));
itemsValues.add(AV_CAMERA_FOCUS_MACRO);
} else if (sfm.get(index).equals("continuous-picture")) {
items.add(getString(R.string.av_camera_focus_continuous));
itemsValues.add(AV_CAMERA_FOCUS_CONTINUOUS);
}
}
String[] entries = items.toArray(new String[0]);
Integer[] entryValues = itemsValues.toArray(new Integer[0]);
if (entries.length > 0) {
cameraFocusType.setEntries(entries);
cameraFocusType.setEntryValues(entryValues);
} else {
cameraFocusType.setVisible(false);
}
}
use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.
the class MultimediaNotesFragment method setupStorageSizePref.
private void setupStorageSizePref(AudioVideoNotesPlugin plugin) {
ListPreferenceEx storageSize = (ListPreferenceEx) findPreference(plugin.AV_RS_STORAGE_SIZE.getId());
long size = AndroidUtils.getTotalSpace(app) / (1 << 30);
if (size > 0) {
int value = 1;
ArrayList<Integer> gbList = new ArrayList<>();
while (value < size) {
gbList.add(value);
if (value < 5) {
value++;
} else {
value += 5;
}
}
if (value != size) {
gbList.add((int) size);
}
String[] entries = new String[gbList.size()];
Integer[] entryValues = new Integer[gbList.size()];
int i = 0;
for (int v : gbList) {
entryValues[i] = v;
entries[i] = AndroidUtils.formatSize(getActivity(), v * (1l << 30));
i++;
}
storageSize.setEntries(entries);
storageSize.setEntryValues(entryValues);
storageSize.setDescription(R.string.rec_split_storage_size_desc);
storageSize.setIcon(getActiveIcon(R.drawable.ic_sdcard));
} else {
storageSize.setVisible(false);
}
}
Aggregations