Added default widget action item to av settings fragment
This commit is contained in:
parent
ef21e94aaa
commit
77e316f8e6
2 changed files with 36 additions and 0 deletions
|
@ -3,6 +3,13 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:title="@string/audionotes_plugin_name">
|
android:title="@string/audionotes_plugin_name">
|
||||||
|
|
||||||
|
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||||
|
android:icon="@drawable/ic_action_camera_focus"
|
||||||
|
android:key="av_default_action"
|
||||||
|
android:layout="@layout/preference_with_descr"
|
||||||
|
android:title="@string/av_widget_action"
|
||||||
|
tools:summary="@string/av_widget_action_descr" />
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="photo_notes"
|
android:key="photo_notes"
|
||||||
android:layout="@layout/preference_category_with_descr"
|
android:layout="@layout/preference_category_with_descr"
|
||||||
|
|
|
@ -52,6 +52,10 @@ import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_E
|
||||||
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_HIPERFOCAL;
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_HIPERFOCAL;
|
||||||
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_INFINITY;
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_INFINITY;
|
||||||
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_MACRO;
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_MACRO;
|
||||||
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_DEFAULT_ACTION_AUDIO;
|
||||||
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_DEFAULT_ACTION_CHOOSE;
|
||||||
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_DEFAULT_ACTION_TAKEPICTURE;
|
||||||
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_DEFAULT_ACTION_VIDEO;
|
||||||
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.NOTES_TAB;
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.NOTES_TAB;
|
||||||
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.cameraPictureSizeDefault;
|
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.cameraPictureSizeDefault;
|
||||||
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
|
||||||
|
@ -72,6 +76,8 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
|
||||||
protected void setupPreferences() {
|
protected void setupPreferences() {
|
||||||
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
|
setupDefaultWidgetActionPref(plugin);
|
||||||
|
|
||||||
setupCameraPhotoPrefs(plugin);
|
setupCameraPhotoPrefs(plugin);
|
||||||
|
|
||||||
setupAudioFormatPref(plugin);
|
setupAudioFormatPref(plugin);
|
||||||
|
@ -92,6 +98,29 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupDefaultWidgetActionPref(AudioVideoNotesPlugin plugin) {
|
||||||
|
ListPreferenceEx defaultWidgetActions = (ListPreferenceEx) findPreference(plugin.AV_DEFAULT_ACTION.getId());
|
||||||
|
defaultWidgetActions.setDescription(R.string.av_widget_action_descr);
|
||||||
|
defaultWidgetActions.setIcon(getPersistentPrefIcon(R.drawable.ic_action_camera_focus));
|
||||||
|
|
||||||
|
List<String> items = new ArrayList<String>();
|
||||||
|
List<Integer> itemsValues = new ArrayList<Integer>();
|
||||||
|
items.add(getString(R.string.av_def_action_choose));
|
||||||
|
itemsValues.add(AV_DEFAULT_ACTION_CHOOSE);
|
||||||
|
items.add(getString(R.string.av_def_action_audio));
|
||||||
|
itemsValues.add(AV_DEFAULT_ACTION_AUDIO);
|
||||||
|
items.add(getString(R.string.av_def_action_video));
|
||||||
|
itemsValues.add(AV_DEFAULT_ACTION_VIDEO);
|
||||||
|
items.add(getString(R.string.av_def_action_picture));
|
||||||
|
itemsValues.add(AV_DEFAULT_ACTION_TAKEPICTURE);
|
||||||
|
|
||||||
|
String[] entries = items.toArray(new String[0]);
|
||||||
|
Integer[] entryValues = itemsValues.toArray(new Integer[0]);
|
||||||
|
|
||||||
|
defaultWidgetActions.setEntries(entries);
|
||||||
|
defaultWidgetActions.setEntryValues(entryValues);
|
||||||
|
}
|
||||||
|
|
||||||
private void setupCameraPhotoPrefs(AudioVideoNotesPlugin plugin) {
|
private void setupCameraPhotoPrefs(AudioVideoNotesPlugin plugin) {
|
||||||
Camera cam = openCamera();
|
Camera cam = openCamera();
|
||||||
setupCameraPermissionPref(cam);
|
setupCameraPermissionPref(cam);
|
||||||
|
|
Loading…
Reference in a new issue