Merge branch 'master' into import_export_data

This commit is contained in:
Vitaliy 2020-10-25 15:52:17 +02:00
commit 8338c4bd7c
69 changed files with 1473 additions and 2170 deletions

View file

@ -45,7 +45,7 @@ public interface IProgress {
public boolean isInterrupted() {return false;}
@Override
public boolean isIndeterminate() {return false;}
public boolean isIndeterminate() {return true;}
@Override
public void finishTask() {}

View file

@ -823,7 +823,7 @@ public class MapPoiTypes {
}
String name = keyName;
name = name.replace('_', ' ');
return Algorithms.capitalizeFirstLetterAndLowercase(name);
return Algorithms.capitalizeFirstLetter(name);
}
public boolean isRegisteredType(PoiCategory t) {

View file

@ -41,7 +41,7 @@ public class RenderingRule {
public void init(Map<String, String> attributes) {
ArrayList<RenderingRuleProperty> props = new ArrayList<RenderingRuleProperty>(attributes.size());
intProperties = new int[attributes.size()];
floatProperties = null;
floatProperties = new float[attributes.size()];
attributesRef = null;
int i = 0;
Iterator<Entry<String, String>> it = attributes.entrySet().iterator();
@ -58,14 +58,13 @@ public class RenderingRule {
attributesRef[i] = storage.getRenderingAttributeRule(vl.substring(1));
} else if (property.isString()) {
intProperties[i] = storage.getDictionaryValue(vl);
} else if (property.isFloat()) {
if (floatProperties == null) {
// lazy creates
floatProperties = new float[attributes.size()];
}
floatProperties[i] = property.parseFloatValue(vl);
intProperties[i] = property.parseIntValue(vl);
} else {
float floatVal = property.parseFloatValue(vl);
// if (floatProperties == null && floatVal != 0) {
// // lazy creates
// floatProperties = new float[attributes.size()];
floatProperties[i] = floatVal;
// }
intProperties[i] = property.parseIntValue(vl);
}
i++;
@ -95,7 +94,7 @@ public class RenderingRule {
public float getFloatPropertyValue(String property) {
int i = getPropertyIndex(property);
if(i >= 0 && floatProperties != null){
if (i >= 0) {
return floatProperties[i];
}
return 0;

View file

@ -155,12 +155,7 @@ public class RenderingRuleProperty {
try {
int colon = value.indexOf(':');
if(colon != -1) {
int c = 0;
if(colon > 0) {
c += (int) Float.parseFloat(value.substring(0, colon));
}
c += (int) Float.parseFloat(value.substring(colon + 1));
return c;
return (int) Float.parseFloat(value.substring(colon + 1));
}
return (int) Float.parseFloat(value);
} catch (NumberFormatException e) {
@ -190,30 +185,35 @@ public class RenderingRuleProperty {
} catch (NumberFormatException e) {
log.error("Rendering parse " + value + " in " + attrName);
}
return -1;
return 0;
} else {
return -1;
}
}
public float parseFloatValue(String value){
if(type == FLOAT_TYPE){
try {
public float parseFloatValue(String value) {
try {
if (type == FLOAT_TYPE) {
int colon = value.indexOf(':');
if(colon != -1) {
if(colon > 0) {
if (colon != -1) {
if (colon > 0) {
return Float.parseFloat(value.substring(0, colon));
}
}
return 0;
}
return Float.parseFloat(value);
} catch (NumberFormatException e) {
log.error("Rendering parse " + value + " in " + attrName);
} else if (type == INT_TYPE) {
int colon = value.indexOf(':');
if (colon != -1 && colon > 0) {
return Float.parseFloat(value.substring(0, colon));
}
return 0;
}
return -1;
} else {
return -1;
} catch (NumberFormatException e) {
log.error("Rendering parse " + value + " in " + attrName);
}
return 0;
}

View file

@ -244,8 +244,6 @@ public class RenderingRuleStorageProperties {
R_TEXT_HALO_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(TEXT_HALO_COLOR));
R_TEXT_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_SIZE));
R_TEXT_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(TEXT_ORDER));
R_ICON_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(ICON_ORDER));
R_ICON_VISIBLE_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(ICON_VISIBLE_SIZE));
R_TEXT_MIN_DISTANCE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(TEXT_MIN_DISTANCE));
R_TEXT_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(TEXT_SHIELD));
@ -265,7 +263,9 @@ public class RenderingRuleStorageProperties {
R_ICON_3 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_3"));
R_ICON_4 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_4"));
R_ICON_5 = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty("icon_5"));
R_ICON_ORDER = registerRuleInternal(RenderingRuleProperty.createOutputIntProperty(ICON_ORDER));
R_SHIELD = registerRuleInternal(RenderingRuleProperty.createOutputStringProperty(SHIELD));
R_ICON_VISIBLE_SIZE = registerRuleInternal(RenderingRuleProperty.createOutputFloatProperty(ICON_VISIBLE_SIZE));
// polygon/way
R_COLOR = registerRuleInternal(RenderingRuleProperty.createOutputColorProperty(COLOR));

View file

@ -269,4 +269,8 @@
<string name="last_response_duration">Sidste svar: %1$s siden</string>
<string name="duration_ago">%1$s siden</string>
<string name="shared_string_error_short">ERR</string>
<string name="shared_string_export">Eksporter</string>
<string name="logcat_buffer">Logcat-buffer</string>
<string name="logcat_buffer_descr">Kontroller og del detaljerede logfiler for programmet</string>
<string name="send_report">Send rapport</string>
</resources>

View file

@ -233,7 +233,7 @@
<string name="osmand_service_descr">OsmAnd Tracker, ekran kapalıyken arka planda çalışır.</string>
<string name="share_location">Konumu paylaş</string>
<string name="sharing_location">Konum paylaşılıyor</string>
<string name="process_service">OsmAnd Tracker servisi</string>
<string name="process_service">OsmAnd Tracker hizmeti</string>
<string name="osmand_logo">OsmAnd logosu</string>
<string name="install_osmand_dialog_message">Önce OsmAnd\'ın ücretsiz veya ücretli sürümünü yüklemeniz gerekmektedir</string>
<string name="install_osmand">OsmAnd\'ı yükle</string>

View file

@ -247,6 +247,7 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content"/>
<data android:scheme="file"/>
<data android:host="*"/>
<data android:pathPattern=".*\\.obf" />
@ -262,6 +263,7 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content"/>
<data android:scheme="file"/>
<data android:host="*"/>
<data android:mimeType="*/*"/>
@ -466,6 +468,13 @@
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="osmand-oauth" />
</intent-filter>
</activity>
<receiver android:name="net.osmand.plus.audionotes.MediaRemoteControlReceiver">
@ -478,28 +487,11 @@
<activity android:name="net.osmand.plus.activities.SettingsActivity" android:label="@string/shared_string_settings" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.activities.SettingsGeneralActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.activities.SettingsNavigationActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.monitoring.SettingsMonitoringActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.osmedit.SettingsOsmEditingActivity"
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="osmand-oauth" />
</intent-filter>
</activity>
<activity android:name="net.osmand.plus.development.SettingsDevelopmentActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.audionotes.SettingsAudioVideoActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.access.SettingsAccessibilityActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="net.osmand.plus.activities.search.SearchActivity" android:label="@string/search_activity" />
<activity android:name="net.osmand.plus.activities.FavoritesListActivity" android:label="@string/favourites_list_activity" />
<activity android:name=".myplaces.FavoritesActivity" android:windowSoftInputMode="adjustPan" />
<activity android:name="net.osmand.plus.activities.TrackActivity"/>
<activity android:name="net.osmand.plus.activities.PluginsActivity" />
<activity android:name="net.osmand.plus.activities.PluginActivity" />
<activity android:name="net.osmand.plus.activities.ContributionVersionActivity" android:configChanges="keyboardHidden|orientation" android:label="@string/contribution_activity" />

View file

@ -1,186 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical"
tools:context=".activities.PluginActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
<include layout="@layout/global_preference_toolbar" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical" >
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/plugin_image_placeholder"
android:layout_width="360dp"
android:layout_height="144dp"
android:layout_gravity="center"
android:scaleType="center"
android:background="@color/osmand_orange"
osmand:srcCompat="@drawable/ic_extension_dark"
android:visibility="gone"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/plugin_image"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/plugin_image_placeholder"
android:layout_width="360dp"
android:layout_height="144dp"
android:layout_gravity="center"
android:background="@color/osmand_orange"
android:scaleType="center"
android:visibility="gone"
osmand:srcCompat="@drawable/ic_extension_dark" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/plugin_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:maxWidth="360dp"
android:maxHeight="200dp"
android:scaleType="fitCenter" />
</FrameLayout>
<FrameLayout
android:id="@+id/plugin_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="?attr/expandable_list_item_background"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginTop="9dp"
android:layout_marginBottom="9dp"
android:background="?attr/expandable_list_item_background"
android:drawablePadding="10dp"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:text="@string/shared_string_settings"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" />
<FrameLayout
android:layout_width="139dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding">
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/switch_ex_background"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingStart="9.5dp"
android:paddingLeft="9.5dp"
android:paddingTop="8dp"
android:paddingEnd="9.5dp"
android:paddingRight="9.5dp"
android:paddingBottom="8dp"
android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/shared_string_off"
android:textOn="@string/shared_string_on"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_get"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/get_button_background"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingStart="9.5dp"
android:paddingLeft="9.5dp"
android:paddingTop="8dp"
android:paddingEnd="9.5dp"
android:paddingRight="9.5dp"
android:paddingBottom="8dp"
android:text="@string/get_plugin"
android:textColor="@color/color_white"
android:textSize="@dimen/default_sub_text_size"
android:visibility="gone"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" />
</FrameLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/plugin_install_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="?attr/plugin_details_install_header_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:visibility="gone"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ic_world_globe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@drawable/ic_world_globe_dark" />
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:text="@string/plugin_install_needs_network"
android:textColor="?android:textColorSecondary"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:maxWidth="360dp"
android:maxHeight="200dp"
android:scaleType="fitCenter" />
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:text="@string/shared_string_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" />
</FrameLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="14dp"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum" />
<FrameLayout
android:id="@+id/plugin_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="?attr/expandable_list_item_background"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
</LinearLayout>
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginBottom="9dp"
android:layout_marginTop="9dp"
android:background="?attr/expandable_list_item_background"
android:drawablePadding="10dp"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingLeft="0dp"
android:paddingRight="@dimen/content_padding"
android:text="@string/shared_string_settings"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="0dp" />
</ScrollView>
<FrameLayout
android:layout_width="139dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginBottom="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding">
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/switch_ex_background"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/shared_string_off"
android:textOn="@string/shared_string_on"
android:textSize="@dimen/default_sub_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
android:paddingStart="9.5dp"
android:paddingEnd="9.5dp" />
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_get"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/get_button_background"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:text="@string/get_plugin"
android:textColor="@color/color_white"
android:textSize="@dimen/default_sub_text_size"
android:visibility="gone"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
android:paddingStart="9.5dp"
android:paddingEnd="9.5dp" />
</FrameLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/plugin_install_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="?attr/plugin_details_install_header_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:visibility="gone"
tools:visibility="visible"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ic_world_globe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@drawable/ic_world_globe_dark"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:text="@string/plugin_install_needs_network"
android:textColor="?android:textColorSecondary"
osmand:typeface="@string/font_roboto_regular"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding" />
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding"
android:text="@string/shared_string_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginTop="14dp"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,14 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/global_preference_toolbar" />
</com.google.android.material.appbar.AppBarLayout>
<ListView
android:id="@android:id/list"
android:id="@+id/plugins_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/plugins_list_item"/>
</LinearLayout>
android:dividerHeight="1dp"
android:drawSelectorOnTop="true" />
</LinearLayout>

View file

@ -52,6 +52,7 @@
android:ellipsize="end"
android:lines="2"
android:maxLines="2"
android:scrollbars="none"
android:text="@string/lorem_ipsum"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"

View file

@ -17,13 +17,12 @@
android:layout_marginEnd="@dimen/content_padding">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
style="@style/Widget.MaterialComponents.AutoCompleteTextView.FilledBox"
android:id="@+id/tagEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:hint="@string/hint_tag"
android:gravity="bottom"
android:paddingBottom="@dimen/text_margin_small"
tools:text="Tag text"/>
</com.google.android.material.textfield.TextInputLayout>
@ -34,12 +33,11 @@
android:layout_weight="1">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
style="@style/Widget.MaterialComponents.AutoCompleteTextView.FilledBox"
android:id="@+id/valueEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:gravity="bottom"
android:paddingBottom="@dimen/text_margin_small"
android:hint="@string/hint_value"
tools:text="Value text"/>

View file

@ -64,6 +64,13 @@
tools:text="Some description" />
</LinearLayout>
<include
layout="@layout/profile_button_small"
android:layout_width="@dimen/list_header_height"
android:layout_height="@dimen/list_header_height"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>

View file

@ -3915,4 +3915,9 @@
<string name="osm_edit_logout_success">تسجيل الخروج بنجاح</string>
<string name="file_already_imported">تم استيراد الملف بالفعل في أوسماند</string>
<string name="use_two_phase_routing">استخدام خوارزمية توجيه من مرحلتين A*</string>
<string name="message_need_calculate_route_before_show_graph">%1$s البيانات المتوفرة فقط على الطرق ، تحتاج إلى حساب طريق باستخدام \"الطريق بين النقاط\" للحصول عليها.</string>
<string name="message_graph_will_be_available_after_recalculation">في انتظار إعادة حساب الطريق
\nسيتوفر الرسم البياني بعد إعادة الحساب.</string>
<string name="snowmobile_render_descr">للقيادة على الجليد مع طرق ومسارات مخصصة.</string>
<string name="shared_string_graph">رسم بياني</string>
</resources>

View file

@ -3925,4 +3925,8 @@
<string name="complex_routing_descr">Zwei-Phasen-Routenberechnung für die Autonavigation.</string>
<string name="use_native_pt">Native ÖPNV Entwicklung</string>
<string name="use_native_pt_desc">Wechseln zu Java (sicher) Berechnung des ÖPNV-Routings</string>
<string name="osm_edit_logout_success">Abmeldung erfolgreich</string>
<string name="file_already_imported">Datei wurde bereits in OsmAnd importiert</string>
<string name="perform_oauth_authorization">Anmelden über OAuth</string>
<string name="clear_osm_token">OpenStreetMap OAuth-Token löschen</string>
</resources>

View file

@ -73,7 +73,7 @@
<string name="lang_vo">Volapuko</string>
<string name="osmand_play_title_30_chars">OsmAnd Mapoj kaj Navigado</string>
<string name="shared_string_reverse_order">Inversa ordigo</string>
<string name="switch_start_finish">Anstataŭigi komencpunkton per finpunkto</string>
<string name="switch_start_finish">Anstataŭigi komencpunkton per celo</string>
<string name="rendering_attr_hideIcons_name">Emblemoj de interesejoj</string>
<string name="item_removed">Elemento forigita</string>
<string name="n_items_removed">elementoj forigitaj</string>
@ -742,7 +742,7 @@
<string name="osmo_edit_color">Vidiga koloro</string>
<string name="int_days">tagoj</string>
<string name="osmo_connect_menu">Konekti</string>
<string name="use_points_as_intermediates">Prikalkuli kurson inter punktojn</string>
<string name="use_points_as_intermediates">Kalkuli kurson inter punktoj</string>
<string name="always_center_position_on_map">Ĉiam montri centrigitan pozicion</string>
<string name="localization_pref_title">Loko</string>
<string name="index_item_nation_addresses">adresoj tutmondaj</string>
@ -3357,7 +3357,7 @@
<string name="file_import_error">Eraro dum enporti %1$s: %2$s</string>
<string name="file_imported_successfully">%1$s enportita.</string>
<string name="rendering_value_white_name">Blanka</string>
<string name="swap_two_places">Anstataŭigi %1$s per %2$s</string>
<string name="swap_two_places">Anstataŭigi: %1$s ⇄ %2$s</string>
<string name="route_start_point">Komencpunkto</string>
<string name="swap_start_and_destination">Anstataŭigi komencpunkton per celo</string>
<string name="simulate_your_location_gpx_descr">Simuli vian pozicion uzante registritan GPXkurson.</string>
@ -3925,4 +3925,11 @@
<string name="perform_oauth_authorization">Ensaluti per OAuth</string>
<string name="clear_osm_token">Forigi ĵetonon OpenStreetMap OAuth</string>
<string name="osm_edit_logout_success">Sukcese elsalutinta</string>
<string name="snowmobile_render_descr">Por veturi per motorsledo sur dediĉitaj vojoj.</string>
<string name="file_already_imported">Dosiero jam estas enportita al OsmAnd</string>
<string name="use_two_phase_routing">Uzi 2-fazan A* algoritmon de navigo</string>
<string name="shared_string_graph">Diagramo</string>
<string name="message_need_calculate_route_before_show_graph">Datumoj de %1$s estas disponeblaj nur por vojoj, vi devas kalkuli la kurson uzante “kalkuli kurson inter punktoj” por akiri ĝin.</string>
<string name="message_graph_will_be_available_after_recalculation">Atendado ĝis la kurso estos rekalkulita.
\nDiagramo estos videbla post rekalkulado.</string>
</resources>

View file

@ -3568,8 +3568,8 @@
<string name="poi_health_specialty_radiotheraphy_yes">Radioterapia</string>
<string name="poi_hazard">Advertencia de peligro</string>
<string name="poi_rtsa_scale_filter">Categoría de dificultad</string>
<string name="poi_rtsa_scale_nc">н/к (sin categoría)</string>
<string name="poi_rtsa_scale_nc_asterisk">н/к* (sin categoría, posible peligro)</string>
<string name="poi_rtsa_scale_nc">s/c (sin categoría)</string>
<string name="poi_rtsa_scale_nc_asterisk">s/c* (sin categoría, posible peligro)</string>
<string name="poi_rtsa_scale_1a">1A</string>
<string name="poi_rtsa_scale_1a_asterisk">1A*</string>
<string name="poi_rtsa_scale_1b">1B</string>

View file

@ -3929,4 +3929,11 @@
<string name="perform_oauth_authorization">Ingresar a través de OAuth</string>
<string name="clear_osm_token">Vaciar llave OAuth de OpenStreetMap</string>
<string name="osm_edit_logout_success">Sesión finalizada</string>
<string name="snowmobile_render_descr">Para caminos y senderos exclusivos de motos de nieve.</string>
<string name="file_already_imported">El archivo ya fue importado en OsmAnd</string>
<string name="use_two_phase_routing">Usar el algoritmo de enrutamiento A* de 2 fases</string>
<string name="shared_string_graph">Gráfico</string>
<string name="message_need_calculate_route_before_show_graph">%1$s datos disponibles sólo en los caminos, necesitas calcular una ruta usando «Ruta entre puntos» para obtenerla.</string>
<string name="message_graph_will_be_available_after_recalculation">Espera el recálculo de la ruta.
\nEl gráfico estará disponible después del recálculo.</string>
</resources>

View file

@ -3902,4 +3902,14 @@
<string name="osm_edit_logout_success">Déconnexion réussie</string>
<string name="file_already_imported">Le fichier est déjà importé dans OsmAnd</string>
<string name="use_two_phase_routing">Utiliser un algorithme de routage A* à 2 phases</string>
<string name="osm_live_payment_subscription_management_hw">Le paiement sera débité de votre compte AppGallery dès confirmation de l\'achat.
\n
\nA moins qu\'il ne soit annulé avant sa date de renouvellement, l\'abonnement sera automatiquement débité à chaque échéance (mensuelle / trimestrielle / annuelle).
\n
\nVous pouvez gérer et annuler vos abonnements dans vos paramètres AppGallery.</string>
<string name="message_need_calculate_route_before_show_graph">Seulement %1$s données disponibles sur les routes. Vous devez calculer l\'itinéraire via \"Itinéraire entre 2 points\".</string>
<string name="message_graph_will_be_available_after_recalculation">Recalcul de l\'itinéraire en cours.
\nLe graphique sera disponible à l\'issue du calcul.</string>
<string name="snowmobile_render_descr">Pour la conduite en motoneige avec des routes et des pistes dédiées.</string>
<string name="shared_string_graph">Graphique</string>
</resources>

View file

@ -3933,4 +3933,9 @@
<string name="osm_edit_logout_success">היציאה הצליחה</string>
<string name="file_already_imported">הקובץ כבר ייובא אל OsmAnd</string>
<string name="use_two_phase_routing">להשתמש באלגוריתם חישוב מסלול דו־שלבי A*</string>
<string name="snowmobile_render_descr">לנהיגה ברכבי שלג עם דרכים ומסלולים יעודיים.</string>
<string name="message_need_calculate_route_before_show_graph">הנתונים של %1$s זמינים בדרכים בלבד, עליך לחשב מסלול באמצעות „מסלול בין נקודות” כדי לקבל אותם.</string>
<string name="shared_string_graph">תרשים</string>
<string name="message_graph_will_be_available_after_recalculation">נא להמתין לחישוב המסלול מחדש.
\nהתרשים יהיה זמין לאחר החישוב מחדש.</string>
</resources>

View file

@ -50,8 +50,8 @@
<string name="poi_internet_access">インターネット有り</string>
<string name="poi_entertainment">レジャー</string>
<string name="poi_club">クラブ</string>
<string name="poi_sustenance">食堂</string>
<string name="poi_cafe_and_restaurant">軽食</string>
<string name="poi_sustenance">飲食店</string>
<string name="poi_cafe_and_restaurant">カフェ・レストラン</string>
<string name="poi_service">サービス</string>
<string name="poi_craft">工芸</string>
<string name="poi_finance">金融機関</string>
@ -568,9 +568,9 @@
<string name="poi_park">公園</string>
<string name="poi_recreation_ground">レクリエーション広場</string>
<string name="poi_village_green">共有地</string>
<string name="poi_cafe">喫茶店・カフェ</string>
<string name="poi_cafe">カフェ</string>
<string name="poi_biergarten">ビアガーデン</string>
<string name="poi_restaurant">レストラン・食堂</string>
<string name="poi_restaurant">レストラン</string>
<string name="poi_fast_food">ファーストフード</string>
<string name="poi_bar">バー・立ち呑み屋</string>
<string name="poi_food_court">フードコート</string>
@ -1012,7 +1012,7 @@
<string name="poi_entrance_main">正面玄関</string>
<string name="poi_entrance">入り口</string>
<string name="poi_entrance_exit">出口</string>
<string name="poi_highway_crossing">高速道路の横断歩道</string>
<string name="poi_highway_crossing">横断歩道</string>
<string name="poi_opening_hours">営業時間</string>
<string name="poi_collection_times">収集時間</string>
<string name="poi_description">詳細</string>
@ -3834,4 +3834,5 @@
<string name="poi_borough">行政区</string>
<string name="poi_give_box">ギブボックス(提供品置場)</string>
<string name="poi_fire_hydrant_type_pipe">簡易給水栓</string>
<string name="poi_fuel_lng">液化天然ガス</string>
</resources>

View file

@ -927,10 +927,10 @@ POIの更新は利用できません</string>
<string name="free_version_message">このOsmAnd 無料版はダウンロード数が%1$s個に制限されており、オフラインでのWikipedia記事利用もサポートしていません。</string>
<string name="free_version_title">無料版</string>
<string name="poi_context_menu_showdescription">POIの説明文を表示</string>
<string name="index_name_north_america"></string>
<string name="index_name_north_america">アメリカ</string>
<string name="index_name_us">アメリカ合衆国</string>
<string name="index_name_central_america"></string>
<string name="index_name_south_america"></string>
<string name="index_name_central_america">央アメリカ</string>
<string name="index_name_south_america">アメリカ</string>
<string name="index_name_europe">ヨーロッパ</string>
<string name="index_name_france">ヨーロッパ - フランス</string>
<string name="index_name_germany">ヨーロッパ - ドイツ</string>
@ -1936,7 +1936,7 @@ POIの更新は利用できません</string>
<string name="app_mode_bus">バス</string>
<string name="app_mode_train">鉄道</string>
<string name="current_track">現在の経路</string>
<string name="map_widget_battery">バッテリーレベル</string>
<string name="map_widget_battery">バッテリー残量</string>
<string name="change_markers_position">マーカーの位置を変更</string>
<string name="move_marker_bottom_sheet_title">マップ画面のドラッグでマーカー位置を調整できます</string>
<!-- string name="lat_lon_pattern">"緯度:%1$.5f 経度:%2$.5f"</string -->

View file

@ -3923,4 +3923,9 @@
<string name="osm_edit_logout_success">Saída bem sucedida</string>
<string name="file_already_imported">O arquivo já foi importado para OsmAnd</string>
<string name="use_two_phase_routing">Use o algoritmo de roteamento 2-phase A *</string>
<string name="snowmobile_render_descr">Para dirigir em motos de neve com estradas e trilhas exclusivas.</string>
<string name="shared_string_graph">Gráfico</string>
<string name="message_need_calculate_route_before_show_graph">Dados de %1$s disponíveis apenas nas estradas, você precisa calcular uma rota usando “Rota entre pontos” para obtê-la.</string>
<string name="message_graph_will_be_available_after_recalculation">Aguarde o recálculo da rota.
\nO gráfico estará disponível após o recálculo.</string>
</resources>

View file

@ -3930,4 +3930,9 @@
<string name="osm_edit_logout_success">Logout bem sucedido</string>
<string name="file_already_imported">O ficheiro já é importado em OsmAnd</string>
<string name="use_two_phase_routing">Usar algoritmo de roteamento de 2 fases A*</string>
<string name="snowmobile_render_descr">Para a condução de motos de neve com estradas e pistas dedicadas.</string>
<string name="shared_string_graph">Gráfico</string>
<string name="message_need_calculate_route_before_show_graph">%1$s dados disponíveis apenas nas estradas, precisa calcular uma rota a usar \"Rota entre pontos\" para obtê-la.</string>
<string name="message_graph_will_be_available_after_recalculation">Espere pelo recalculo da rota.
\nO gráfico estará disponível após o recalculo.</string>
</resources>

View file

@ -1737,7 +1737,7 @@
<string name="poi_animal_boarding_cat">Тип приюта: для кошек</string>
<string name="poi_animal_boarding_dog_cat">Тип приюта: для собак и кошек</string>
<string name="poi_animal_boarding_horse">Тип приюта: для лошадей</string>
<string name="poi_historic_aircraft">Исторический самолёт</string>
<string name="poi_historic_aircraft">Историческое воздушное судно</string>
<string name="poi_honey">Мёд</string>
<string name="poi_elevator_yes">С лифтом</string>
<string name="poi_elevator_no">Без лифта</string>

View file

@ -1336,7 +1336,7 @@
<string name="local_index_tile_data_name">Данные о тайлах: %1$s</string>
<string name="base_world_map">Обзорная карта мира</string>
<string name="edit_tilesource_expiration_time">Время действия (в минутах)</string>
<string name="app_mode_aircraft">Самолёт</string>
<string name="app_mode_aircraft">Воздушное судно</string>
<string name="app_mode_boat">Лодка</string>
<string name="app_mode_hiking">Пеший туризм</string>
<string name="app_mode_motorcycle">Мотоцикл</string>
@ -3242,8 +3242,8 @@
<string name="logcat_buffer">Буфер Logcat</string>
<string name="plugins_settings">Настройки плагинов</string>
<string name="language_and_output">Язык и вывод</string>
<string name="change_data_storage_full_description">Переместить файлы данных OsmAnd в новое место назначения\?
\n%1$s &gt; %2$s</string>
<string name="change_data_storage_full_description">Переместить файлы данных OsmAnd в новое место назначения\?
\n%1$s %2$s</string>
<string name="shared_string_by_default">По умолчанию</string>
<string name="data_storage_preference_summary">%1$s • %2$s</string>
<string name="data_storage_space_description">%1$s ГБ свободно (из %2$s ГБ)</string>
@ -3349,7 +3349,7 @@
<string name="select_color">Выберите цвет</string>
<string name="edit_profiles_descr">Вы не можете удалить стандартные профили OsmAnd, но вы можете отключить их на предыдущем экране или переместить вниз.</string>
<string name="edit_profiles">Редактировать профили</string>
<string name="select_nav_profile_dialog_message">Режим навигации определяет правила расчета маршрутов.</string>
<string name="select_nav_profile_dialog_message">Режим навигации определяет правила расчёта маршрутов.</string>
<string name="profile_appearance">Внешний вид профиля</string>
<string name="choose_icon_color_name">Значок, цвет и имя</string>
<string name="reorder_profiles">Редактировать список профилей</string>
@ -3922,4 +3922,6 @@
<string name="osm_edit_logout_success">Выход выполнен</string>
<string name="shared_string_graph">График</string>
<string name="file_already_imported">Файл уже импортирован</string>
<string name="message_graph_will_be_available_after_recalculation">Дождитесь пересчёта маршрута.
\nГрафик будет доступен после пересчёта.</string>
</resources>

View file

@ -89,7 +89,7 @@
<string name="routing_preferences_descr">Preferèntzias de càrculu de sàndala</string>
<string name="speech_rate_descr">Imposta sa lestresa de sa boghe de sintetizatzione vocale (TTS).</string>
<string name="speech_rate">Lestresa de sa boghe</string>
<string name="complex_route_calculation_failed">Càrculu lestru de sàndala fallidu (%s), rinviu a su càlculu lentu.</string>
<string name="complex_route_calculation_failed">Càrculu lestru de sàndala fallidu (%s), rinviu a su càrculu lentu.</string>
<string name="disable_complex_routing_descr">Istuda su carculu de sàndala in duas fases pro simpreu in màchina.</string>
<string name="disable_complex_routing">Istuta su carculu cumplessu de sàndala</string>
<string name="amenity_type_seamark">Pidagnu</string>
@ -1540,7 +1540,7 @@
<string name="routing_attr_height_description">Dislinda sartària de su veìculu permìtida pro sos caminos.</string>
<string name="routing_attr_avoid_borders_description">Non faghet rugrare sas fronteras intre sos istados</string>
<string name="use_fast_recalculation">Recàrculu intelligente de sàndala</string>
<string name="use_fast_recalculation_desc">Pro biàgios longos, torra a carculare petzi su cantu initziale de sàndala.</string>
<string name="use_fast_recalculation_desc">Torra a carculare petzi su cantu initziale de sàndala. Podet èssere impreadu pro biàgios longos.</string>
<string name="rendering_value_disabled_name">Disabilitadu</string>
<string name="shared_string_logoff">Essi</string>
<string name="rendering_value_walkingRoutesScopeOSMC_name">Coloratzione a segunda de sa casta (afiliatzione) de àndala</string>
@ -3824,8 +3824,8 @@
<string name="overwrite_track">Subraiscrie sa rasta</string>
<string name="save_as_new_track">Sarva comente una rasta noa</string>
<string name="reverse_route">Fùrria s\'àndala</string>
<string name="route_between_points_whole_track_button_desc">Sa rasta intrea at a èssere torrada a calculare impreende su profilu ischertadu.</string>
<string name="route_between_points_next_segment_button_desc">Petzi su segmentu imbeniente at a èssere torradu a calculare impreende su profilu ischertadu.</string>
<string name="route_between_points_whole_track_button_desc">Sa rasta intrea at a èssere torrada a carculare impreende su profilu ischertadu.</string>
<string name="route_between_points_next_segment_button_desc">Petzi su segmentu imbeniente at a èssere torradu a carculare impreende su profilu ischertadu.</string>
<string name="route_between_points_desc">Ischerta comente connètere sos puntos: cun una lìnia reta o calculende un\'àndala intre issos comente dislindadu inoghe in suta.</string>
<string name="whole_track">Rasta intrea</string>
<string name="next_segment">Segmentu imbeniente</string>
@ -3926,4 +3926,9 @@
<string name="osm_edit_logout_success">Essida fata chene problemas</string>
<string name="file_already_imported">Su documentu est giai importadu in OsmAnd</string>
<string name="use_two_phase_routing">Imprea un\'algoritmu de càrculu de s\'àndala A* a duas fases</string>
<string name="snowmobile_render_descr">Pro sa ghia de motoislitas cun caminos e rastas dedicados.</string>
<string name="message_need_calculate_route_before_show_graph">Datos %1$s a disponimentu in sos caminos ebbia. Depes carculare un\'àndala impreende \"Àndala intre puntos\" pro los otènnere.</string>
<string name="shared_string_graph">Gràficu</string>
<string name="message_graph_will_be_available_after_recalculation">Iseta su càrculu nou de s\'àndala.
\nSu gràficu at a èssere a disponimentu a pustis de su càrculu.</string>
</resources>

View file

@ -3926,4 +3926,11 @@
<string name="perform_oauth_authorization">Prihlásiť pomocou OAuth</string>
<string name="clear_osm_token">Vymazať token OpenStreetMap OAuth</string>
<string name="osm_edit_logout_success">Odhlásenie úspešné</string>
<string name="snowmobile_render_descr">Pre jazdu na snežnom vozidle po na to určených cestách.</string>
<string name="file_already_imported">Súbor je už importovaný v OsmAnd</string>
<string name="use_two_phase_routing">Použiť dvojfázový algoritmus A* na výpočet trasy</string>
<string name="shared_string_graph">Graf</string>
<string name="message_need_calculate_route_before_show_graph">Údaje %1$s sú dostupné len na cestách, pre ich získanie musíte vypočítať trasu pomocou “Trasa medzi bodmi”.</string>
<string name="message_graph_will_be_available_after_recalculation">Počkajte na prepočet trasy.
\nGraf bude dostupný po prepočte.</string>
</resources>

View file

@ -269,7 +269,7 @@
<string name="poi_motorway_junction">Otoyol kavşağı</string>
<string name="poi_junction">Birleşim</string>
<string name="poi_rest_area">Dinlenme alanı</string>
<string name="poi_water_well">Su kaynağı</string>
<string name="poi_water_well">Su kuyusu</string>
<string name="poi_standpipe">Yangın musluğu</string>
<string name="poi_water_works">Su işleri</string>
<string name="poi_boatyard">Tersane</string>
@ -841,7 +841,7 @@
<string name="poi_sinkhole">Düden</string>
<string name="poi_waterfall">Şelale</string>
<string name="poi_river">Irmak</string>
<string name="poi_stream">Akış</string>
<string name="poi_stream">Dere</string>
<string name="poi_rapids">Nehrin akıntılı yeri</string>
<string name="poi_stone">Değerli taş</string>
<string name="poi_cape">Pelerin</string>
@ -1068,7 +1068,7 @@
<string name="poi_takeaway">Paket servisi</string>
<string name="poi_cocktails">Kokteyller</string>
<string name="poi_microbrewery">Mikro bira imalathanesi</string>
<string name="poi_beauty_salon_service">Servis</string>
<string name="poi_beauty_salon_service">Hizmet</string>
<string name="poi_recycling_accepted_waste">Kabul edilen atık</string>
<string name="poi_fireplace">Şömine</string>
<string name="poi_seasonal">Mevsimlik</string>
@ -1184,7 +1184,7 @@
<string name="poi_climbing_crag_filter">Tırmanma kayalığı</string>
<string name="poi_climbing_crag">Evet</string>
<string name="poi_historic_tank">Tarihi tank</string>
<string name="poi_snowmobile_filter">Kar aracı erişimi</string>
<string name="poi_snowmobile_filter">Kar arabası erişimi</string>
<string name="poi_access_bus">Otobüs erişimi</string>
<string name="poi_access_caravan">Karavan erişimi</string>
<string name="poi_access_motorhome">Motokaravan erişimi</string>
@ -3047,4 +3047,87 @@
<string name="poi_counselling_type_child_guidance_yes">Danışma (çocuk rehberliği): evet</string>
<string name="poi_counselling_type_antenatal_yes">Danışma (doğum öncesi): evet</string>
<string name="poi_counselling_type_antenatal_no">Danışma (doğum öncesi): hayır</string>
<string name="poi_spaceport">Uzay üssü</string>
<string name="poi_animal_shelter_purpose_release_no">Doğaya salma: hayır</string>
<string name="poi_animal_shelter_purpose_release_yes">Doğaya salma: evet</string>
<string name="poi_animal_shelter_purpose_adoption_no">Sahiplenme: hayır</string>
<string name="poi_animal_shelter_purpose_adoption_yes">Sahiplenme: evet</string>
<string name="poi_owner">Sahibi</string>
<string name="poi_resort_kids_camp">Çocuk kampı</string>
<string name="poi_photo_studio">Fotoğraf stüdyosu</string>
<string name="poi_nutrition_supplements">Beslenme takviyeleri</string>
<string name="poi_feeding_place">Hayvan besleme yeri</string>
<string name="poi_support_tower">Destek: kule</string>
<string name="poi_support_roof">Destek: çatı</string>
<string name="poi_support_suspended">Destek: askıda</string>
<string name="poi_support_ceiling">Destek: tavan</string>
<string name="poi_support_billboard">Destek: reklam panosu</string>
<string name="poi_support_ground">Destek: zemin</string>
<string name="poi_support_pedestal">Destek: kaide</string>
<string name="poi_support_tree">Destek: ağaç</string>
<string name="poi_support_wall_mounted">Destek: duvar</string>
<string name="poi_support_pole">Destek: direk</string>
<string name="poi_date_no">Tarih ekranı: hayır</string>
<string name="poi_date_yes">Tarih ekranı</string>
<string name="poi_pumping_station">Pompa istasyonu</string>
<string name="poi_generator_output_biogas_yes">Çıkış: biyogaz</string>
<string name="poi_generator_output_biogas">Biyogazın çıkış gücü</string>
<string name="poi_generator_output_vacuum_yes">Çıkış: vakum</string>
<string name="poi_generator_output_compressed_air_yes">Çıkış: basınçlı hava</string>
<string name="poi_generator_output_compressed_air">Basınçlı havanın çıkış gücü</string>
<string name="poi_generator_output_cold_water_yes">Çıkış: soğuk su</string>
<string name="poi_generator_output_hot_air_yes">Çıkış: sıcak hava</string>
<string name="poi_generator_output_steam_yes">Çıkış: buhar</string>
<string name="poi_generator_output_hot_water_yes">Çıkış: sıcak su</string>
<string name="poi_generator_output_hot_water">Sıcak suyun çıkış gücü</string>
<string name="poi_generator_output_electricity_no">Çıkış (elektrik): hayır</string>
<string name="poi_generator_output_electricity_yes">Çıkış: elektrik</string>
<string name="poi_generator_output_electricity">Çıkış gücü</string>
<string name="poi_voltage">Gerilim</string>
<string name="poi_greenhouse_horticulture">Sera bahçeciliği</string>
<string name="poi_observatory_type_gravitational">Yer çekimi</string>
<string name="poi_observatory_type_meteorological">Meteorolojik</string>
<string name="poi_health_amenity_type_scales">Kamu kullanımı için ölçekler</string>
<string name="poi_free_flying_guest_guidelines_no">Konuk yönergeleri: hayır</string>
<string name="poi_free_flying_guest_guidelines_yes">Konuk yönergeleri: evet</string>
<string name="poi_free_flying_no_flight_time">Uçuşa yasak zaman (serbest uçuş)</string>
<string name="poi_free_flying_site_orientation_nw">Serbest uçuş alanı yönlendirmesi: KB</string>
<string name="poi_free_flying_site_orientation_w">Serbest uçuş alanı yönlendirmesi: B</string>
<string name="poi_free_flying_site_orientation_sw">Serbest uçuş alanı yönlendirmesi: GB</string>
<string name="poi_free_flying_site_orientation_s">Serbest uçuş alanı yönlendirmesi: G</string>
<string name="poi_free_flying_site_orientation_se">Serbest uçuş alanı yönlendirmesi: GD</string>
<string name="poi_free_flying_site_orientation_e">Serbest uçuş alanı yönlendirmesi: D</string>
<string name="poi_free_flying_site_orientation_ne">Serbest uçuş alanı yönlendirmesi: KD</string>
<string name="poi_free_flying_site_orientation_n">Serbest uçuş alanı yönlendirmesi: K</string>
<string name="poi_water_place_access_multifamilies">Birden çok aile</string>
<string name="poi_water_place_access_family">Aile</string>
<string name="poi_water_place_access_community">Topluluk</string>
<string name="poi_water_supply_bottled_water">Şişelenmiş su</string>
<string name="poi_water_supply_water_tank">Su deposu</string>
<string name="poi_water_supply_water_trucking">Su tankeri</string>
<string name="poi_water_supply_borehole">Sondaj</string>
<string name="poi_water_supply_pump">Pompa</string>
<string name="poi_water_supply_running_water">Akan su</string>
<string name="poi_water_supply_pipeline">Boru hattı</string>
<string name="poi_water_supply_water_well">Su kuyusu</string>
<string name="poi_water_purification_aquatabs">Su arıtma tabletleri</string>
<string name="poi_water_purification_reverse_osmosis">Ters osmoz</string>
<string name="poi_water_purification_chlorine">Klor</string>
<string name="poi_visibility_area">Görünürlük: alan</string>
<string name="poi_surface_tartan">Tartan</string>
<string name="poi_government_social_services">Sosyal hizmetler</string>
<string name="poi_government_social_security">Sosyal güvenlik</string>
<string name="poi_electronics_repair_appliance">Elektronik tamir: alet</string>
<string name="poi_display_sundial_yes">Güneş saati</string>
<string name="poi_display_digital_yes">Dijital ekran</string>
<string name="poi_display_analog_yes">Analog ekran</string>
<string name="poi_display_no">Ekran: hayır</string>
<string name="poi_display_yes">Ekran: evet</string>
<string name="poi_dispensing_yes">Evet</string>
<string name="poi_fire_hydrant_style_water_source_cistern">Su deposu</string>
<string name="poi_fire_hydrant_style_water_source_stream">Dere</string>
<string name="poi_fire_hydrant_type_dry_barrel">Kuru varil</string>
<string name="poi_fire_hydrant_type_pillar">Sütun</string>
<string name="poi_fire_hydrant_type_pond">Gölet</string>
<string name="poi_fire_hydrant_style_water_source_pond">Gölet</string>
</resources>

View file

@ -8,7 +8,7 @@
<string name="enable_plugin_monitoring_services">Konum günlüğü hizmetlerini kullanmak için \"Yolculuk kaydı\" eklentisini etkinleştirin (GPX günlüğü, çevrim içi izleme)</string>
<string name="non_optimal_route_calculation">Uzak hedefler için tahmini rotayı hesapla</string>
<string name="gps_not_available">Lütfen GPS\'yi ayarlardan açık konuma getirin</string>
<string name="map_widget_monitoring_services">Log servisi</string>
<string name="map_widget_monitoring_services">Günlük kayıt hizmetleri</string>
<string name="no_route">Rota yok</string>
<string name="delete_target_point">Varış Noktasını kaldır</string>
<string name="target_point">Varış noktası %1$s</string>
@ -78,7 +78,7 @@
<string name="safe_mode_description">Uygulamayı güvenli modda çalıştırın (yerel kod yerine daha yavaş Android kullanarak).</string>
<string name="safe_mode">Güvenli kip</string>
<string name="native_library_not_running">Uygulama güvenli modda çalışıyor (\'Ayarlar\'dan kapatın).</string>
<string name="background_service_is_enabled_question">OsmAnd arka plan hizmeti hala çalışıyor. Onu da durdur\?</string>
<string name="background_service_is_enabled_question">OsmAnd arka plan hizmeti hala çalışıyor. O da durdurulsun mu\?</string>
<string name="local_indexes_cat_av">Ses/Video verisi</string>
<string name="stop_routing_confirm">Navigasyonu durdurmak istediğinizden emin misiniz\?</string>
<string name="clear_dest_confirm">Hedefi (ve ara hedefleri) temizlemek istediğinizden emin misiniz\?</string>
@ -837,7 +837,7 @@
<string name="background_service_provider">Konum sağlayıcı</string>
<string name="background_router_service_descr">Ekran kapalıyken konumunuzu izler.</string>
<string name="background_router_service">Arka planda Osmand başlat</string>
<string name="off_router_service_no_gps_available">Arka plan navigasyon hizmetiık olması bir konum sağlayıcı gerektirir.</string>
<string name="off_router_service_no_gps_available">Arka plan navigasyon hizmeti, bir konum sağlayıcının açık olmasını gerektirir.</string>
<string name="hide_poi_filter">Süzgeci gizle</string>
<string name="show_poi_filter">Süzgeci göster</string>
<string name="search_poi_filter">Süzgeç</string>
@ -881,7 +881,7 @@
<string name="hint_search_online">Çevrim içi arama: Ev numarası, sokak, şehir</string>
<string name="search_offline_address">Çevrim dışı arama</string>
<string name="route_general_information">Toplam uzaklık %1$s, seyahat süresi %2$d s %3$d dak.</string>
<string name="router_service_descr">Çevrim içi veya çevrim dışı navigasyon servisi.</string>
<string name="router_service_descr">Çevrim içi veya çevrim dışı navigasyon hizmeti.</string>
<string name="sd_dir_not_accessible">Bellek kartındaki depolama klasörüne erişilemiyor!</string>
<string name="download_question">{0} - {1} indir ?</string>
<string name="download_question_exist">{0} için çevrim dışı veri zaten var ({1}). ({2}) güncellensin mi\?</string>
@ -1065,7 +1065,7 @@
<string name="try_again">Tekrar deneyin</string>
<string name="archive_wikipedia_data">Eski uyumsuz Wikipedia verileriniz var. Arşivle\?</string>
<string name="download_wikipedia_files">Ekstra Wikipedia verilerini indir (%1$s MB)\?</string>
<string name="gps_network_not_enabled">Konum servisi kapalı. Aç\?</string>
<string name="gps_network_not_enabled">Konum hizmeti kapalı. Açılsın mı\?</string>
<string name="shared_string_show_details">Ayrıntıları göster</string>
<string name="rendering_value_disabled_name">Devre dışı</string>
<string name="rendering_attr_hideHouseNumbers_name">Ev kapı numaraları</string>
@ -1457,8 +1457,8 @@
<string name="layer_osm_bugs">OSM notları (çevrim içi)</string>
<string name="use_trackball_descr">Haritayı hareket ettirmek için bir izleme topu aygıtı kullanın.</string>
<string name="use_trackball">İzleme topu kullan</string>
<string name="background_service_int_descr">Arka plan servisi tarafından kullanılan uyanma aralığı:</string>
<string name="background_service_provider_descr">Arka plan servisi tarafından kullanılan konum yöntemi:</string>
<string name="background_service_int_descr">Arka plan hizmeti tarafından kullanılan uyanma aralığı:</string>
<string name="background_service_provider_descr">Arka plan hizmeti tarafından kullanılan konum yöntemi:</string>
<string name="route_head">Düz gidin</string>
<string name="map_screen_orientation">Ekran yönlendirme</string>
<string name="no_address_found">Hiçbir adres belirlenmedi</string>
@ -1466,9 +1466,9 @@
<string name="transport_context_menu">Durakta ulaşım aracı ara</string>
<string name="rotate_map_to_bearing">Harita yönlendirme</string>
<string name="version_index_is_not_supported">\'\'{0}\'\' indeks sürümü desteklenmemektedir</string>
<string name="osmand_routing_experimental">OsmAnd çevrim dışı navigasyon deneysel bir özelliktir ve yaklaşık 20 km\'den daha uzun mesafelerde çalışmaz.
\n
\nNavigasyon geçici olarak çevrim içi CloudMade servisine geçti.</string>
<string name="osmand_routing_experimental">OsmAnd çevrim dışı navigasyon deneysel bir özelliktir ve yaklaşık 20 km\'den daha uzun mesafelerde çalışmaz.
\n
\nNavigasyon geçici olarak çevrim içi CloudMade hizmetine geçti.</string>
<string name="install_selected_build">OsmAnd Yükle - {1} {2} üzerinden {0} MB \?</string>
<string name="tiles_to_download_estimated_size">Yakınlaştırma {0} indirmek {1} fayans ({2} MB)</string>
<string name="select_max_zoom_preload_area">Önceden yükleme için en fazla yakınlaştırma</string>
@ -1595,7 +1595,7 @@
<string name="lang_eu">Baskça</string>
<string name="lang_be">Belarusça</string>
<string name="lang_bs">Boşnakça</string>
<string name="use_points_as_intermediates">Noktalar arasındaki rotayı hesaplamak</string>
<string name="use_points_as_intermediates">Noktalar arasındaki güzergahı hesapla</string>
<string name="always_center_position_on_map">Konumu sürekli ortada tut</string>
<string name="voice_pref_title">Ses</string>
<string name="misc_pref_title">Çeşitli</string>
@ -1791,7 +1791,7 @@
<string name="lang_sw">Svahili dili</string>
<string name="lang_he">İbranice</string>
<string name="forward">İleri</string>
<string name="live_monitoring_m_descr">GPX kaydııksa, izleme verilerini belirtilen bir web servisine gönder.</string>
<string name="live_monitoring_m_descr">GPX kaydııksa, izleme verilerini belirtilen bir web hizmetine gönder.</string>
<string name="live_monitoring_m">Online izleme (GPX gerekli)</string>
<string name="live_monitoring_start">Online izleme başlat</string>
<string name="live_monitoring_stop">Online izleme durdurun</string>
@ -2282,7 +2282,7 @@
<string name="show_passed">Geçilmiş-olanı göster</string>
<string name="hide_passed">Geçilmiş-olanı gizle</string>
<string name="marker_show_distance_descr">Haritada harita işaretleyicilerine olan uzaklık ve yönün nasıl belirtileceğini seçin:</string>
<string name="map_orientation_change_in_accordance_with_speed">Harita oryantasyon eşiği</string>
<string name="map_orientation_change_in_accordance_with_speed">Harita yönlendirme eşiği</string>
<string name="map_orientation_change_in_accordance_with_speed_descr">Harita yönünün \'Hareket yönü\'nden \'Pusula yönü\'ne geçiş hızını aşağıdan seçin.</string>
<string name="save_as_route_point">Rota noktaları olarak kaydet</string>
<string name="add_point_before">Öncesinde nokta ekle</string>
@ -2362,7 +2362,7 @@
<string name="shared_string_explore">Gezin</string>
<string name="shared_string_contents">İçerikler</string>
<string name="shared_string_result">Sonuç</string>
<string name="shared_string_travel_guides">Seyehat</string>
<string name="shared_string_travel_guides">Seyahat rehberleri</string>
<string name="shared_string_total">Toplam</string>
<string name="clear_all_intermediates">Tüm başlangıç noktalarını temizle</string>
<string name="group_deleted">Grup silindi</string>
@ -3883,4 +3883,9 @@
<string name="osm_edit_logout_success">Oturum kapatma başarılı</string>
<string name="file_already_imported">Dosya zaten OsmAnd\'da içe aktarıldı</string>
<string name="use_two_phase_routing">2 aşamalı A* yönlendirme algoritması kullan</string>
<string name="snowmobile_render_descr">Ayrılmış yollar ve parkurlarla kar arabası sürüşü için.</string>
<string name="shared_string_graph">Grafik</string>
<string name="message_need_calculate_route_before_show_graph">%1$s verileri yalnızca yollarda kullanılabilir, elde etmek için “Noktalar arasındaki güzergah” kullanarak bir rota hesaplamanız gerekir.</string>
<string name="message_graph_will_be_available_after_recalculation">Güzergahın yeniden hesaplanmasını bekleyin.
\nGrafik yeniden hesaplandıktan sonra kullanılabilir olacak.</string>
</resources>

View file

@ -1147,7 +1147,7 @@
<string name="gpx_selection_track">%1$s
\nТрек %2$s</string>
<string name="osmo_connect_menu">З’єднатись</string>
<string name="use_points_as_intermediates">Розрахувати маршрут між точками</string>
<string name="use_points_as_intermediates">Обчислити маршрут між точками</string>
<string name="always_center_position_on_map">Відображати позицію завжди в центрі</string>
<string name="voice_pref_title">Голос</string>
<string name="misc_pref_title">Різне</string>
@ -2293,17 +2293,17 @@
<string name="osmand_extended_description_part1">OsmAnd (OSM Automated Navigation Directions) — застосунок для мап і навігації з доступом до безкоштовних глобальних високоякісних даних OpenStreetMap (OSM).
\n
\nНасолоджуйтесь голосовою та візуальною навігацією, переглядом цікавих точок (англ. POI), створенням та керуванням GPX-треками, використовуючи відображення горизонталей та даних про висоту (за допомогою зовнішнього втулка), вибором між режимами автомобіліста, велосипедиста й пішохода, редагуванням OSM та ще багато чим іншим.</string>
<string name="osmand_extended_description_part2">GPS навігація
\n • Вибір між автономним режимом (без зборів за роумінг за кордоном) або через Інтернет (швидше)
\n • Покрокові голосові підказки доставить Вас до місця призначення (записані чи синтезовані голоси)
\n • Повторна маршрутизація кожен раз після відхилення від маршруту
\n • Смуги руху, назви вулиць і приблизний час прибуття допоможуть Вам на шляху
\n • Для того, щоб зробити Вашу подорож безпечнішою, режим дня/ночі автоматично перемикається
\n • Відображення обмежень швидкості та попередження про її перевищення
\n • Мапа масштабується відповідно до Вашої швидкості
\n • Шукати місця за адресою, типом (наприклад, паркування, ресторан, готель, заправна станція, музей) чи географічними координатами
\n • Підтримка проміжних точок на Вашому маршруті
\n • Запис свого власного GPX-треку чи вивантаження готового і слідування за ним
<string name="osmand_extended_description_part2">GPS навігація
\n • Вибір між автономним режимом (без зборів за роумінг за кордоном) або через Інтернет (швидше)
\n • Покрокові голосові підказки доставить Вас до місця призначення (записані чи синтезовані голоси)
\n • Повторна маршрутизація кожен раз після відхилення від маршруту
\n • Смуги руху, назви вулиць і приблизний час прибуття допоможуть Вам на шляху
\n • Для того, щоб зробити Вашу подорож безпечнішою, режим дня/ночі автоматично перемикається
\n • Показ обмежень швидкості та попередження про її перевищення
\n • Мапа масштабується відповідно до Вашої швидкості
\n • Шукати місця за адресою, типом (наприклад, паркування, ресторан, готель, заправна станція, музей) чи географічними координатами
\n • Підтримка проміжних точок на Вашому маршруті
\n • Запис свого власного GPX-треку чи вивантаження готового і слідування за ним
\n</string>
<string name="osmand_extended_description_part3">Мапа
\n• Відображає POI (цікаві точки) навколо вас
@ -3924,4 +3924,9 @@
<string name="development">Розробка</string>
<string name="file_already_imported">Файл уже імпортовано до OsmAnd</string>
<string name="use_two_phase_routing">Використання 2-фазного A* алгоритму маршрутизації</string>
<string name="snowmobile_render_descr">Для їзди на снігоходах із відведеними дорогами та трасами.</string>
<string name="shared_string_graph">Графік</string>
<string name="message_need_calculate_route_before_show_graph">%1$s дані доступні лише для доріг, вам потрібно обчислити маршрут за допомогою «Маршрут між точками», щоб отримати його.</string>
<string name="message_graph_will_be_available_after_recalculation">Дочекайтеся переобчислення маршруту.
\nГрафік буде доступний після переобчислення.</string>
</resources>

View file

@ -3561,20 +3561,20 @@
<string name="poi_hazard">危險</string>
<string name="poi_rtsa_scale_filter">難度分類</string>
<string name="poi_health_specialty_radiotherapy_yes">放射治療</string>
<string name="poi_rtsa_scale_nc">н/к</string>
<string name="poi_rtsa_scale_nc_asterisk">н/к*</string>
<string name="poi_rtsa_scale_1a">1А</string>
<string name="poi_rtsa_scale_1a_asterisk">1А*</string>
<string name="poi_rtsa_scale_1b">1Б</string>
<string name="poi_rtsa_scale_1b_asterisk">1Б*</string>
<string name="poi_rtsa_scale_2a">2А</string>
<string name="poi_rtsa_scale_2a_asterisk">2А*</string>
<string name="poi_rtsa_scale_2b">2Б</string>
<string name="poi_rtsa_scale_2b_asterisk">2Б*</string>
<string name="poi_rtsa_scale_3a">3А</string>
<string name="poi_rtsa_scale_3a_asterisk">3А*</string>
<string name="poi_rtsa_scale_3b">3Б</string>
<string name="poi_rtsa_scale_3b_asterisk">3Б*</string>
<string name="poi_rtsa_scale_nc">n/c</string>
<string name="poi_rtsa_scale_nc_asterisk">n/c*</string>
<string name="poi_rtsa_scale_1a">1A</string>
<string name="poi_rtsa_scale_1a_asterisk">1A*</string>
<string name="poi_rtsa_scale_1b">1B</string>
<string name="poi_rtsa_scale_1b_asterisk">1B*</string>
<string name="poi_rtsa_scale_2a">2A</string>
<string name="poi_rtsa_scale_2a_asterisk">2A*</string>
<string name="poi_rtsa_scale_2b">2B</string>
<string name="poi_rtsa_scale_2b_asterisk">2B*</string>
<string name="poi_rtsa_scale_3a">3A</string>
<string name="poi_rtsa_scale_3a_asterisk">3A*</string>
<string name="poi_rtsa_scale_3b">3B</string>
<string name="poi_rtsa_scale_3b_asterisk">3B*</string>
<string name="poi_flare">燃燒塔</string>
<string name="poi_change_delete">已刪除的物件</string>
<string name="poi_climbing_crag_filter">攀岩</string>

View file

@ -3921,4 +3921,11 @@
<string name="perform_oauth_authorization">透過 OAuth 登入</string>
<string name="clear_osm_token">清除 OpenStreetMap OAuth 權杖</string>
<string name="osm_edit_logout_success">成功登出</string>
<string name="snowmobile_render_descr">適用於有專用道路與軌道的雪地摩托車駕駛。</string>
<string name="file_already_imported">檔案已在 OsmAnd 匯入</string>
<string name="use_two_phase_routing">使用 2 相的 A* 路線演算法</string>
<string name="shared_string_graph">圖表</string>
<string name="message_need_calculate_route_before_show_graph">%1$s 資料僅供道路使用,您需要使用「兩點間的路線」來計算路線。</string>
<string name="message_graph_will_be_available_after_recalculation">等待路線重新計算。
\n重新計算後即可使用圖表。</string>
</resources>

View file

@ -4206,7 +4206,7 @@
<string name="poi_video_yes">Yes</string>
<string name="poi_video_no">No</string>
<string name="poi_internet_access_fee_customers">Signal to find the pole</string>
<string name="poi_internet_access_fee_customers">Internet access: customers</string>
<string name="poi_traffic_signals_sound_locate">Only when walking is allowed</string>
<string name="poi_tactile_paving_contrasted">Contrasted</string>
<string name="poi_tactile_paving_primitive">Primitive</string>
@ -4259,5 +4259,10 @@
<string name="poi_fuel_lng">LNG</string>
<string name="poi_gpx_point">GPX point</string>
<string name="poi_parking_rooftop">Rooftop</string>
<string name="poi_parking_sheds">Sheds</string>
<string name="poi_parking_layby">Layby</string>
</resources>

View file

@ -8,9 +8,9 @@ import androidx.annotation.NonNull;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import java.io.IOException;
import java.util.HashMap;
@ -66,13 +66,8 @@ public class AccessibilityPlugin extends OsmandPlugin {
}
@Override
public Class<? extends Activity> getSettingsActivity() {
return SettingsAccessibilityActivity.class;
}
@Override
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
return AccessibilitySettingsFragment.class;
public SettingsScreenType getSettingsScreenType() {
return SettingsScreenType.ACCESSIBILITY_SETTINGS;
}
@Override

View file

@ -4,6 +4,8 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;
import android.widget.ImageView;
@ -13,21 +15,24 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.access.RelativeDirectionStyle;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet.CopyAppModePrefsListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet;
import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet.ResetAppModePrefsListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO;
public class AccessibilitySettingsFragment extends BaseSettingsFragment implements OnPreferenceChanged, CopyAppModePrefsListener, ResetAppModePrefsListener {
private static final String ACCESSIBILITY_OPTIONS = "accessibility_options";
@ -36,6 +41,8 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
private AccessibilityStateChangeListener accessibilityListener;
boolean showSwitchProfile = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -47,6 +54,28 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
}
}
};
Bundle args = getArguments();
if (args != null) {
showSwitchProfile = args.getBoolean(PLUGIN_INFO, false);
}
}
@Override
protected void createToolbar(LayoutInflater inflater, View view) {
super.createToolbar(inflater, view);
View switchProfile = view.findViewById(R.id.profile_button);
if (switchProfile != null) {
AndroidUiHelper.updateVisibility(switchProfile, showSwitchProfile);
}
}
@Override
public Bundle buildArguments() {
Bundle args = super.buildArguments();
args.putBoolean(PLUGIN_INFO, showSwitchProfile);
return args;
}
@Override

View file

@ -1,128 +0,0 @@
package net.osmand.access;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.access.RelativeDirectionStyle;
import net.osmand.plus.activities.SettingsBaseActivity;
public class SettingsAccessibilityActivity extends SettingsBaseActivity {
private ListPreference accessibilityModePreference;
private ListPreference directionStylePreference;
private ListPreference autoannouncePeriodPreference;
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.shared_string_accessibility);
PreferenceScreen grp = getPreferenceScreen();
String[] entries = new String[AccessibilityMode.values().length];
for (int i = 0; i < entries.length; i++) {
entries[i] = AccessibilityMode.values()[i].toHumanString(getMyApplication());
}
accessibilityModePreference = createListPreference(settings.ACCESSIBILITY_MODE, entries, AccessibilityMode.values(),
R.string.accessibility_mode, R.string.accessibility_mode_descr);
accessibilityModePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private final OnPreferenceChangeListener committer = accessibilityModePreference.getOnPreferenceChangeListener();
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (committer != null)
committer.onPreferenceChange(preference, newValue);
updateAllSettings();
return true;
}
});
addSpeechRateSetting(grp);
grp.addPreference(accessibilityModePreference);
PreferenceCategory cat = new PreferenceCategory(this);
cat.setKey("accessibility_options");
cat.setTitle(R.string.accessibility_options);
cat.setEnabled(getMyApplication().accessibilityEnabled());
grp.addPreference(cat);
entries = new String[RelativeDirectionStyle.values().length];
for (int i = 0; i < entries.length; i++) {
entries[i] = RelativeDirectionStyle.values()[i].toHumanString(getMyApplication());
}
directionStylePreference = createListPreference(settings.DIRECTION_STYLE, entries, RelativeDirectionStyle.values(),
R.string.settings_direction_style, R.string.settings_direction_style_descr);
directionStylePreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private final OnPreferenceChangeListener committer = directionStylePreference.getOnPreferenceChangeListener();
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (committer != null)
committer.onPreferenceChange(preference, newValue);
updateAllSettings();
return true;
}
});
cat.addPreference(directionStylePreference);
cat.addPreference(createCheckBoxPreference(settings.ACCESSIBILITY_SMART_AUTOANNOUNCE, R.string.access_smart_autoannounce,
R.string.access_smart_autoannounce_descr));
final int[] seconds = new int[] {5, 10, 15, 20, 30, 45, 60, 90};
final int[] minutes = new int[] {2, 3, 5};
autoannouncePeriodPreference = createTimeListPreference(settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD, seconds, minutes, 1000,
R.string.access_autoannounce_period, R.string.access_autoannounce_period_descr);
autoannouncePeriodPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private final OnPreferenceChangeListener committer = autoannouncePeriodPreference.getOnPreferenceChangeListener();
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (committer != null)
committer.onPreferenceChange(preference, newValue);
updateAllSettings();
return true;
}
});
cat.addPreference(autoannouncePeriodPreference);
cat.addPreference(createCheckBoxPreference(settings.DIRECTION_AUDIO_FEEDBACK, R.string.access_direction_audio_feedback,
R.string.access_direction_audio_feedback_descr));
cat.addPreference(createCheckBoxPreference(settings.DIRECTION_HAPTIC_FEEDBACK, R.string.access_direction_haptic_feedback,
R.string.access_direction_haptic_feedback_descr));
}
protected void addSpeechRateSetting(PreferenceGroup grp) {
Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ;
String[] sprNames = new String[sprValues.length];
for(int i = 0; i < sprNames.length; i++) {
sprNames[i] = (int)(sprValues[i] * 100) + " %";
}
grp.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr));
}
public void updateAllSettings() {
super.updateAllSettings();
PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options")));
if (accessibilityOptions != null)
accessibilityOptions.setEnabled(getMyApplication().accessibilityEnabled());
if(accessibilityModePreference != null) {
accessibilityModePreference.setSummary(getString(R.string.accessibility_mode_descr) + " [" + settings.ACCESSIBILITY_MODE.get().toHumanString(getMyApplication()) + "]");
}
if(directionStylePreference != null) {
directionStylePreference.setSummary(getString(R.string.settings_direction_style_descr) + " [" + settings.DIRECTION_STYLE.get().toHumanString(getMyApplication()) + "]");
}
if(autoannouncePeriodPreference != null) {
autoannouncePeriodPreference.setSummary(getString(R.string.access_autoannounce_period_descr) + " [" + autoannouncePeriodPreference.getEntry() + "]");
}
}
}

View file

@ -48,7 +48,7 @@ import net.osmand.plus.search.QuickSearchDialogFragment;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.skimapsplugin.SkiMapsPlugin;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.plus.views.OsmandMapTileView;
@ -111,11 +111,7 @@ public abstract class OsmandPlugin {
return app.getUIUtilities().getIcon(getLogoResourceId());
}
public Class<? extends Activity> getSettingsActivity() {
return null;
}
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
public SettingsScreenType getSettingsScreenType() {
return null;
}

View file

@ -118,6 +118,7 @@ import net.osmand.plus.measurementtool.GpxData;
import net.osmand.plus.measurementtool.MeasurementEditingContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.measurementtool.SnapTrackWarningFragment;
import net.osmand.plus.osmedit.OsmEditingFragment;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
@ -2216,6 +2217,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(GpxApproximationFragment.TAG);
}
public OsmEditingFragment getOsmEditingFragment() {
return getFragment(SettingsScreenType.OPEN_STREET_MAP_EDITING.fragmentName);
}
public SnapTrackWarningFragment getSnapTrackWarningBottomSheet() {
return getFragment(SnapTrackWarningFragment.TAG);
}

View file

@ -974,10 +974,7 @@ public class MapActivityActions implements DialogProvider {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent("drawer_plugins_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity());
newIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
mapActivity.startActivity(newIntent);
PluginsFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;
}
}).createItem());

View file

@ -1,241 +0,0 @@
package net.osmand.plus.activities;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.srtmplugin.SRTMPlugin;
public class PluginActivity extends OsmandActionBarActivity implements DownloadIndexesThread.DownloadEvents, PluginInstalledBottomSheetDialog.PluginStateListener {
private static final String TAG = "PluginActivity";
public static final String EXTRA_PLUGIN_ID = "plugin_id";
private OsmandPlugin plugin;
@Override
protected void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent == null || !intent.hasExtra(EXTRA_PLUGIN_ID)) {
Log.e(TAG, "Required extra '" + EXTRA_PLUGIN_ID + "' is missing");
finish();
return;
}
String pluginId = intent.getStringExtra(EXTRA_PLUGIN_ID);
if (pluginId == null) {
Log.e(TAG, "Extra '" + EXTRA_PLUGIN_ID + "' is null");
finish();
return;
}
for (OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) {
if (!plugin.getId().equals(pluginId))
continue;
this.plugin = plugin;
break;
}
if (plugin == null) {
Log.e(TAG, "Plugin '" + EXTRA_PLUGIN_ID + "' not found");
finish();
return;
}
setContentView(R.layout.plugin);
//noinspection ConstantConditions
getSupportActionBar().setTitle(plugin.getName());
Drawable pluginImage = plugin.getAssetResourceImage();
if (pluginImage != null) {
ImageView img = (ImageView) findViewById(R.id.plugin_image);
img.setImageDrawable(pluginImage);
} else {
findViewById(R.id.plugin_image_placeholder).setVisibility(View.VISIBLE);
}
TextView descriptionView = (TextView) findViewById(R.id.plugin_description);
descriptionView.setText(plugin.getDescription());
boolean light = getMyApplication().getSettings().isLightContent();
int linkTextColor = ContextCompat.getColor(this,
light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
descriptionView.setLinkTextColor(linkTextColor);
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
AndroidUtils.removeLinkUnderline(descriptionView);
Button settingsButton = (Button) findViewById(R.id.plugin_settings);
settingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(PluginActivity.this, plugin.getSettingsActivity()));
}
});
CompoundButton enableDisableButton = (CompoundButton)findViewById(
R.id.plugin_enable_disable);
enableDisableButton.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (plugin.isActive() == isChecked) {
return;
}
boolean ok = OsmandPlugin.enablePlugin(PluginActivity.this, (OsmandApplication)getApplication(),
plugin, isChecked);
if (!ok) {
return;
}
updateState();
}
});
Button getButton = (Button)findViewById(R.id.plugin_get);
getButton.setText(plugin.isPaid() ? R.string.get_plugin : R.string.shared_string_install);
getButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if (plugin instanceof SRTMPlugin) {
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager != null) {
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager);
}
} else {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
} catch (Exception e) {
//ignored
}
}
});
updateState();
}
@Override
protected void onResume() {
super.onResume();
OsmandApplication app = getMyApplication();
OsmandPlugin.checkInstalledMarketPlugins(app, this);
app.getDownloadThread().setUiActivity(this);
updateState();
}
@Override
protected void onPause() {
super.onPause();
getMyApplication().getDownloadThread().resetUiActivity(this);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
switch (itemId) {
case android.R.id.home:
finish();
return true;
}
return false;
}
@SuppressLint("NewApi")
private void updateState() {
CompoundButton enableDisableButton = (CompoundButton)findViewById(
R.id.plugin_enable_disable);
Button getButton = (Button)findViewById(R.id.plugin_get);
Button settingsButton = (Button)findViewById(R.id.plugin_settings);
settingsButton.setCompoundDrawablesWithIntrinsicBounds(
getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_settings),
null, null, null);
View installHeader = findViewById(R.id.plugin_install_header);
if (plugin.needsInstallation()) {
getButton.setVisibility(View.VISIBLE);
enableDisableButton.setVisibility(View.GONE);
settingsButton.setVisibility(View.GONE);
installHeader.setVisibility(View.VISIBLE);
View worldGlobeIcon = installHeader.findViewById(R.id.ic_world_globe);
Drawable worldGlobeDrawable = getMyApplication().getUIUtilities().getThemedIcon(
R.drawable.ic_world_globe_dark);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
worldGlobeIcon.setBackground(worldGlobeDrawable);
} else {
//noinspection deprecation
worldGlobeIcon.setBackgroundDrawable(worldGlobeDrawable);
}
} else {
getButton.setVisibility(View.GONE);
enableDisableButton.setVisibility(View.VISIBLE);
enableDisableButton.setChecked(plugin.isActive());
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
if (settingsActivity == null || !plugin.isActive()) {
settingsButton.setVisibility(View.GONE);
} else {
settingsButton.setVisibility(View.VISIBLE);
}
installHeader.setVisibility(View.GONE);
}
}
// DownloadEvents
@Override
public void newDownloadIndexes() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).newDownloadIndexes();
}
}
}
@Override
public void downloadInProgress() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).downloadInProgress();
}
}
}
@Override
public void downloadHasFinished() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).downloadHasFinished();
}
}
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
updateState();
}
}

View file

@ -0,0 +1,258 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog.PluginStateListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import org.apache.commons.logging.Log;
public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStateListener {
private static final Log log = PlatformUtil.getLog(PluginInfoFragment.class);
private static final String TAG = PluginInfoFragment.class.getName();
public static final String EXTRA_PLUGIN_ID = "plugin_id";
public static final String PLUGIN_INFO = "plugin_info";
private OsmandPlugin plugin;
private OsmandApplication app;
private View mainView;
private boolean nightMode;
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentActivity activity = requireMyActivity();
activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
public void handleOnBackPressed() {
dismiss();
}
});
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
app = requireMyApplication();
Bundle args = getArguments();
if (args == null || !args.containsKey(EXTRA_PLUGIN_ID)) {
log.error("Required extra '" + EXTRA_PLUGIN_ID + "' is missing");
return null;
}
String pluginId = args.getString(EXTRA_PLUGIN_ID);
if (pluginId == null) {
log.error("Extra '" + EXTRA_PLUGIN_ID + "' is null");
return null;
}
plugin = OsmandPlugin.getPlugin(pluginId);
if (plugin == null) {
log.error("Plugin '" + EXTRA_PLUGIN_ID + "' not found");
return null;
}
Context context = requireContext();
nightMode = !app.getSettings().isLightContent();
LayoutInflater themedInflater = UiUtilities.getInflater(context, nightMode);
mainView = themedInflater.inflate(R.layout.plugin, container, false);
AndroidUtils.addStatusBarPadding21v(context, mainView);
TextView toolbarTitle = mainView.findViewById(R.id.toolbar_title);
toolbarTitle.setText(plugin.getName());
ImageView closeButton = mainView.findViewById(R.id.close_button);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = getMyActivity();
if (activity != null) {
activity.onBackPressed();
}
}
});
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
Drawable pluginImage = plugin.getAssetResourceImage();
if (pluginImage != null) {
ImageView img = mainView.findViewById(R.id.plugin_image);
img.setImageDrawable(pluginImage);
} else {
mainView.findViewById(R.id.plugin_image_placeholder).setVisibility(View.VISIBLE);
}
TextView descriptionView = mainView.findViewById(R.id.plugin_description);
descriptionView.setText(plugin.getDescription());
int linkTextColorId = nightMode ? R.color.ctx_menu_bottom_view_url_color_dark : R.color.ctx_menu_bottom_view_url_color_light;
int linkTextColor = ContextCompat.getColor(context, linkTextColorId);
descriptionView.setLinkTextColor(linkTextColor);
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
AndroidUtils.removeLinkUnderline(descriptionView);
Button settingsButton = mainView.findViewById(R.id.plugin_settings);
settingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentActivity activity = getActivity();
if (activity != null) {
SettingsScreenType settingsScreenType = plugin.getSettingsScreenType();
if (settingsScreenType != null) {
Bundle args = new Bundle();
args.putBoolean(PLUGIN_INFO, true);
BaseSettingsFragment.showInstance(activity, settingsScreenType, null, args);
}
}
}
});
CompoundButton enableDisableButton = mainView.findViewById(R.id.plugin_enable_disable);
enableDisableButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (plugin.isActive() == isChecked) {
return;
}
boolean ok = OsmandPlugin.enablePlugin(getActivity(), app, plugin, isChecked);
if (!ok) {
return;
}
updateState();
}
});
Button getButton = mainView.findViewById(R.id.plugin_get);
getButton.setText(plugin.isPaid() ? R.string.get_plugin : R.string.shared_string_install);
getButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if (plugin instanceof SRTMPlugin) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
if (fragmentManager != null) {
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager);
}
} else {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
} catch (Exception e) {
//ignored
}
}
});
updateState();
return mainView;
}
@Override
public void onResume() {
super.onResume();
OsmandPlugin.checkInstalledMarketPlugins(app, getActivity());
updateState();
}
private void updateState() {
CompoundButton enableDisableButton = mainView.findViewById(R.id.plugin_enable_disable);
Button getButton = mainView.findViewById(R.id.plugin_get);
Button settingsButton = mainView.findViewById(R.id.plugin_settings);
settingsButton.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_settings), null, null, null);
View installHeader = mainView.findViewById(R.id.plugin_install_header);
if (plugin.needsInstallation()) {
getButton.setVisibility(View.VISIBLE);
enableDisableButton.setVisibility(View.GONE);
settingsButton.setVisibility(View.GONE);
installHeader.setVisibility(View.VISIBLE);
View worldGlobeIcon = installHeader.findViewById(R.id.ic_world_globe);
Drawable worldGlobeDrawable = app.getUIUtilities().getThemedIcon(R.drawable.ic_world_globe_dark);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
worldGlobeIcon.setBackground(worldGlobeDrawable);
} else {
worldGlobeIcon.setBackgroundDrawable(worldGlobeDrawable);
}
} else {
getButton.setVisibility(View.GONE);
enableDisableButton.setVisibility(View.VISIBLE);
enableDisableButton.setChecked(plugin.isActive());
if (plugin.getSettingsScreenType() == null || !plugin.isActive()) {
settingsButton.setVisibility(View.GONE);
} else {
settingsButton.setVisibility(View.VISIBLE);
}
installHeader.setVisibility(View.GONE);
}
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
updateState();
}
public void dismiss() {
FragmentActivity activity = getActivity();
if (activity != null) {
try {
activity.getSupportFragmentManager().popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
} catch (Exception e) {
log.error(e);
}
}
}
public static boolean showInstance(FragmentManager fragmentManager, OsmandPlugin plugin) {
try {
Bundle args = new Bundle();
args.putString(EXTRA_PLUGIN_ID, plugin.getId());
PluginInfoFragment fragment = new PluginInfoFragment();
fragment.setArguments(args);
fragmentManager.beginTransaction()
.add(R.id.fragmentContainer, fragment, TAG)
.addToBackStack(TAG)
.commitAllowingStateLoss();
return true;
} catch (Exception e) {
return false;
}
}
}

View file

@ -1,296 +0,0 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import net.osmand.AndroidUtils;
import net.osmand.aidl.ConnectedApp;
import net.osmand.plus.CustomOsmandPlugin;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
import net.osmand.plus.download.DownloadIndexesThread;
import java.util.ArrayList;
public class PluginsActivity extends OsmandListActivity implements DownloadIndexesThread.DownloadEvents, PluginInstalledBottomSheetDialog.PluginStateListener {
public static final int ACTIVE_PLUGINS_LIST_MODIFIED = 1;
private boolean listModified = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.plugins);
getSupportActionBar().setTitle(R.string.plugins_screen);
setListAdapter(new PluginsListAdapter());
}
@Override
public PluginsListAdapter getListAdapter() {
return (PluginsListAdapter) super.getListAdapter();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Object tag = view.getTag();
if (tag instanceof OsmandPlugin) {
Intent intent = new Intent(this, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, ((OsmandPlugin) tag).getId());
startActivity(intent);
} else if (tag instanceof ConnectedApp) {
switchEnabled((ConnectedApp) tag);
}
}
@Override
protected void onResume() {
super.onResume();
OsmandApplication app = getMyApplication();
OsmandPlugin.checkInstalledMarketPlugins(app, this);
app.getDownloadThread().setUiActivity(this);
getListAdapter().notifyDataSetChanged();
}
@Override
protected void onPause() {
super.onPause();
getMyApplication().getDownloadThread().resetUiActivity(this);
}
private void enableDisablePlugin(OsmandPlugin plugin, boolean enable) {
OsmandApplication app = getMyApplication();
if (OsmandPlugin.enablePlugin(this, app, plugin, enable)) {
if (!listModified) {
setResult(ACTIVE_PLUGINS_LIST_MODIFIED);
listModified = true;
}
getListAdapter().notifyDataSetChanged();
}
}
private void switchEnabled(@NonNull ConnectedApp app) {
getMyApplication().getAidlApi().switchEnabled(app);
getListAdapter().notifyDataSetChanged();
}
// DownloadEvents
@Override
public void newDownloadIndexes() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).newDownloadIndexes();
}
}
}
@Override
public void downloadInProgress() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).downloadInProgress();
}
}
}
@Override
public void downloadHasFinished() {
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) {
((DownloadIndexesThread.DownloadEvents) fragment).downloadHasFinished();
}
}
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
getListAdapter().notifyDataSetChanged();
}
protected class PluginsListAdapter extends ArrayAdapter<Object> {
PluginsListAdapter() {
super(PluginsActivity.this, R.layout.plugins_list_item, new ArrayList<>());
addAll(getMyApplication().getAidlApi().getConnectedApps());
addAll(OsmandPlugin.getVisiblePlugins());
}
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View view = convertView;
if (view == null) {
view = getLayoutInflater().inflate(R.layout.plugins_list_item, parent, false);
}
final Object item = getItem(position);
boolean active = false;
int logoContDescId = R.string.shared_string_disable;
String name = "";
boolean isLightTheme = getMyApplication().getSettings().isLightContent();
ImageButton pluginLogo = (ImageButton) view.findViewById(R.id.plugin_logo);
ImageView pluginOptions = (ImageView) view.findViewById(R.id.plugin_options);
TextView pluginDescription = (TextView) view.findViewById(R.id.plugin_description);
if (item instanceof ConnectedApp) {
final ConnectedApp app = (ConnectedApp) item;
active = app.isEnabled();
if (!active) {
logoContDescId = R.string.shared_string_enable;
}
name = app.getName();
pluginDescription.setText(R.string.third_party_application);
pluginLogo.setImageDrawable(app.getIcon());
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchEnabled(app);
}
});
pluginOptions.setVisibility(View.GONE);
pluginOptions.setOnClickListener(null);
view.setTag(app);
} else if (item instanceof OsmandPlugin) {
final OsmandPlugin plugin = (OsmandPlugin) item;
active = plugin.isActive();
if (!active) {
logoContDescId = plugin.needsInstallation()
? R.string.access_shared_string_not_installed : R.string.shared_string_enable;
}
name = plugin.getName();
pluginDescription.setText(plugin.getDescription());
boolean light = getMyApplication().getSettings().isLightContent();
int linkTextColor = ContextCompat.getColor(PluginsActivity.this,
light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
pluginDescription.setLinkTextColor(linkTextColor);
pluginDescription.setMovementMethod(LinkMovementMethod.getInstance());
AndroidUtils.removeLinkUnderline(pluginDescription);
OsmandApplication app = getMyApplication();
int color = AndroidUtils.getColorFromAttr(PluginsActivity.this, R.attr.list_background_color);
pluginLogo.setImageDrawable(UiUtilities.tintDrawable(plugin.getLogoResource(), color));
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (plugin.isActive() || !plugin.needsInstallation()) {
enableDisablePlugin(plugin, !plugin.isActive());
}
}
});
pluginOptions.setVisibility(View.VISIBLE);
pluginOptions.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
pluginOptions.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showOptionsMenu(v, plugin);
}
});
view.setTag(plugin);
}
pluginLogo.setContentDescription(getString(logoContDescId));
if (active) {
pluginLogo.setBackgroundResource(isLightTheme ? R.drawable.bg_plugin_logo_enabled_light : R.drawable.bg_plugin_logo_enabled_dark);
} else {
TypedArray attributes = getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}
TextView pluginName = (TextView) view.findViewById(R.id.plugin_name);
pluginName.setText(name);
pluginName.setContentDescription(name + " " + getString(active
? R.string.item_checked
: R.string.item_unchecked));
return view;
}
}
private void showOptionsMenu(View v, final OsmandPlugin plugin) {
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
final PopupMenu optionsMenu = new PopupMenu(this, v);
if (plugin.isActive() || !plugin.needsInstallation()) {
MenuItem enableDisableItem = optionsMenu.getMenu().add(
plugin.isActive() ? R.string.shared_string_disable
: R.string.shared_string_enable);
enableDisableItem
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
enableDisablePlugin(plugin, !plugin.isActive());
optionsMenu.dismiss();
return true;
}
});
}
if (settingsActivity != null && plugin.isActive()) {
MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_settings);
settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
startActivity(new Intent(PluginsActivity.this, settingsActivity));
optionsMenu.dismiss();
return true;
}
});
}
if (plugin instanceof CustomOsmandPlugin) {
MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_delete);
settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
showDeletePluginDialog((CustomOsmandPlugin) plugin);
optionsMenu.dismiss();
return true;
}
});
}
optionsMenu.show();
}
private void showDeletePluginDialog(final CustomOsmandPlugin plugin) {
AlertDialog.Builder builder = new AlertDialog.Builder(PluginsActivity.this);
builder.setTitle(getString(R.string.delete_confirmation_msg, plugin.getName()));
builder.setMessage(R.string.are_you_sure);
builder.setNegativeButton(R.string.shared_string_cancel, null);
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
OsmandApplication app = getMyApplication();
OsmandPlugin.removeCustomPlugin(app, plugin);
getListAdapter().remove(plugin);
}
});
builder.show();
}
}

View file

@ -0,0 +1,338 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.aidl.ConnectedApp;
import net.osmand.plus.CustomOsmandPlugin;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog.PluginStateListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
public class PluginsFragment extends BaseOsmAndFragment implements PluginStateListener {
private static final Log log = PlatformUtil.getLog(PluginsFragment.class);
public static final String TAG = PluginsFragment.class.getName();
public static final String OPEN_PLUGINS = "open_plugins";
private OsmandApplication app;
private PluginsListAdapter adapter;
private LayoutInflater themedInflater;
private boolean nightMode;
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentActivity activity = requireMyActivity();
activity.getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
public void handleOnBackPressed() {
FragmentActivity activity = getActivity();
if (activity instanceof MapActivity) {
dismissImmediate();
MapActivity mapActivity = (MapActivity) activity;
mapActivity.launchPrevActivityIntent();
}
}
});
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
themedInflater = UiUtilities.getInflater(getContext(), nightMode);
View view = themedInflater.inflate(R.layout.plugins, container, false);
AndroidUtils.addStatusBarPadding21v(getContext(), view);
TextView toolbarTitle = view.findViewById(R.id.toolbar_title);
toolbarTitle.setText(R.string.plugins_screen);
ImageView closeButton = view.findViewById(R.id.close_button);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = getMyActivity();
if (activity != null) {
activity.onBackPressed();
}
}
});
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
adapter = new PluginsListAdapter(requireContext());
ListView listView = view.findViewById(R.id.plugins_list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Object tag = view.getTag();
if (tag instanceof OsmandPlugin) {
FragmentActivity activity = getActivity();
if (activity != null) {
PluginInfoFragment.showInstance(activity.getSupportFragmentManager(), (OsmandPlugin) tag);
}
} else if (tag instanceof ConnectedApp) {
switchEnabled((ConnectedApp) tag);
}
}
});
return view;
}
@Override
public void onResume() {
super.onResume();
OsmandPlugin.checkInstalledMarketPlugins(app, getActivity());
adapter.notifyDataSetChanged();
}
private void enableDisablePlugin(OsmandPlugin plugin, boolean enable) {
if (OsmandPlugin.enablePlugin(getActivity(), app, plugin, enable)) {
adapter.notifyDataSetChanged();
}
}
private void switchEnabled(@NonNull ConnectedApp connectedApp) {
app.getAidlApi().switchEnabled(connectedApp);
adapter.notifyDataSetChanged();
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
adapter.notifyDataSetChanged();
}
protected class PluginsListAdapter extends ArrayAdapter<Object> {
PluginsListAdapter(Context context) {
super(context, R.layout.plugins_list_item, new ArrayList<>());
addAll(app.getAidlApi().getConnectedApps());
addAll(OsmandPlugin.getVisiblePlugins());
}
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View view = convertView;
if (view == null) {
view = themedInflater.inflate(R.layout.plugins_list_item, parent, false);
}
Context context = view.getContext();
boolean active = false;
int logoContDescId = R.string.shared_string_disable;
String name = "";
ImageButton pluginLogo = view.findViewById(R.id.plugin_logo);
ImageView pluginOptions = view.findViewById(R.id.plugin_options);
TextView pluginDescription = view.findViewById(R.id.plugin_description);
Object item = getItem(position);
if (item instanceof ConnectedApp) {
final ConnectedApp app = (ConnectedApp) item;
active = app.isEnabled();
if (!active) {
logoContDescId = R.string.shared_string_enable;
}
name = app.getName();
pluginDescription.setText(R.string.third_party_application);
pluginLogo.setImageDrawable(app.getIcon());
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchEnabled(app);
}
});
pluginOptions.setVisibility(View.GONE);
pluginOptions.setOnClickListener(null);
view.setTag(app);
} else if (item instanceof OsmandPlugin) {
final OsmandPlugin plugin = (OsmandPlugin) item;
active = plugin.isActive();
if (!active) {
logoContDescId = plugin.needsInstallation()
? R.string.access_shared_string_not_installed : R.string.shared_string_enable;
}
name = plugin.getName();
pluginDescription.setText(plugin.getDescription());
int linkTextColorId = nightMode ? R.color.ctx_menu_bottom_view_url_color_dark : R.color.ctx_menu_bottom_view_url_color_light;
int linkTextColor = ContextCompat.getColor(context, linkTextColorId);
pluginDescription.setLinkTextColor(linkTextColor);
pluginDescription.setMovementMethod(LinkMovementMethod.getInstance());
AndroidUtils.removeLinkUnderline(pluginDescription);
int color = AndroidUtils.getColorFromAttr(context, R.attr.list_background_color);
pluginLogo.setImageDrawable(UiUtilities.tintDrawable(plugin.getLogoResource(), color));
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (plugin.isActive() || !plugin.needsInstallation()) {
enableDisablePlugin(plugin, !plugin.isActive());
}
}
});
pluginOptions.setVisibility(View.VISIBLE);
pluginOptions.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
pluginOptions.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showOptionsMenu(v, plugin);
}
});
view.setTag(plugin);
}
pluginLogo.setContentDescription(getString(logoContDescId));
if (active) {
pluginLogo.setBackgroundResource(nightMode ? R.drawable.bg_plugin_logo_enabled_dark : R.drawable.bg_plugin_logo_enabled_light);
} else {
TypedArray attributes = context.getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}
TextView pluginName = view.findViewById(R.id.plugin_name);
pluginName.setText(name);
pluginName.setContentDescription(name + " " + getString(active
? R.string.item_checked
: R.string.item_unchecked));
return view;
}
}
private void showOptionsMenu(View view, final OsmandPlugin plugin) {
final PopupMenu optionsMenu = new PopupMenu(view.getContext(), view);
if (plugin.isActive() || !plugin.needsInstallation()) {
MenuItem enableDisableItem = optionsMenu.getMenu().add(
plugin.isActive() ? R.string.shared_string_disable
: R.string.shared_string_enable);
enableDisableItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
enableDisablePlugin(plugin, !plugin.isActive());
optionsMenu.dismiss();
return true;
}
});
}
final SettingsScreenType settingsScreenType = plugin.getSettingsScreenType();
if (settingsScreenType != null && plugin.isActive()) {
MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_settings);
settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
FragmentActivity activity = getActivity();
if (activity != null) {
BaseSettingsFragment.showInstance(activity, settingsScreenType);
}
optionsMenu.dismiss();
return true;
}
});
}
if (plugin instanceof CustomOsmandPlugin) {
MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_delete);
settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
showDeletePluginDialog((CustomOsmandPlugin) plugin);
optionsMenu.dismiss();
return true;
}
});
}
optionsMenu.show();
}
private void showDeletePluginDialog(final CustomOsmandPlugin plugin) {
Context context = getContext();
if (context != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(getString(R.string.delete_confirmation_msg, plugin.getName()));
builder.setMessage(R.string.are_you_sure);
builder.setNegativeButton(R.string.shared_string_cancel, null);
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
OsmandPlugin.removeCustomPlugin(app, plugin);
adapter.remove(plugin);
}
});
builder.show();
}
}
public void dismissImmediate() {
FragmentActivity activity = getActivity();
if (activity != null) {
try {
activity.getSupportFragmentManager().popBackStackImmediate(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
} catch (Exception e) {
log.error(e);
}
}
}
public static boolean showInstance(FragmentManager fragmentManager) {
try {
PluginsFragment fragment = new PluginsFragment();
fragmentManager.beginTransaction()
.add(R.id.fragmentContainer, fragment, TAG)
.addToBackStack(TAG)
.commitAllowingStateLoss();
return true;
} catch (Exception e) {
return false;
}
}
}

View file

@ -1,11 +1,9 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
@ -59,33 +57,24 @@ public class SettingsActivity extends SettingsBaseActivity {
}
PreferenceCategory plugins = (PreferenceCategory) screen.findPreference("plugin_settings");
for(OsmandPlugin op : OsmandPlugin.getEnabledPlugins()) {
final Class<? extends Activity> sa = op.getSettingsActivity();
if(sa != null) {
Preference preference = new Preference(this);
preference.setTitle(op.getName());
preference.setKey(op.getId());
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(new Intent(SettingsActivity.this, sa));
return false;
}
});
plugins.addPreference(preference);
}
// final Class<? extends Activity> sa = op.getSettingsActivity();
// if(sa != null) {
// Preference preference = new Preference(this);
// preference.setTitle(op.getName());
// preference.setKey(op.getId());
// preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
//
// @Override
// public boolean onPreferenceClick(Preference preference) {
// startActivity(new Intent(SettingsActivity.this, sa));
// return false;
// }
// });
// plugins.addPreference(preference);
// }
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == PLUGINS_SELECTION_REQUEST) && (resultCode == PluginsActivity.ACTIVE_PLUGINS_LIST_MODIFIED)) {
finish();
startActivity(getIntent());
}
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == general) {

View file

@ -66,7 +66,7 @@ import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.layers.MapInfoLayer;
@ -1811,13 +1811,8 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
@Override
public Class<? extends Activity> getSettingsActivity() {
return SettingsAudioVideoActivity.class;
}
@Override
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
return MultimediaNotesFragment.class;
public SettingsScreenType getSettingsScreenType() {
return SettingsScreenType.MULTIMEDIA_NOTES;
}
@Override

View file

@ -13,6 +13,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.StatFs;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
@ -22,17 +24,18 @@ import androidx.preference.PreferenceViewHolder;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet.CopyAppModePrefsListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet;
import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet.ResetAppModePrefsListener;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
@ -43,6 +46,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AUDIO_BITRATE_DEFAULT;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_AUTO;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_CONTINUOUS;
@ -66,6 +70,35 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
private static final String RESET_TO_DEFAULT = "reset_to_default";
private static final String OPEN_NOTES = "open_notes";
boolean showSwitchProfile = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null) {
showSwitchProfile = args.getBoolean(PLUGIN_INFO, false);
}
}
@Override
protected void createToolbar(LayoutInflater inflater, View view) {
super.createToolbar(inflater, view);
View switchProfile = view.findViewById(R.id.profile_button);
if (switchProfile != null) {
AndroidUiHelper.updateVisibility(switchProfile, showSwitchProfile);
}
}
@Override
public Bundle buildArguments() {
Bundle args = super.buildArguments();
args.putBoolean(PLUGIN_INFO, showSwitchProfile);
return args;
}
@Override
protected void setupPreferences() {
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);

View file

@ -1,334 +0,0 @@
package net.osmand.plus.audionotes;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Bundle;
import android.os.StatFs;
import android.preference.ListPreference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import org.apache.commons.logging.Log;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AUDIO_BITRATE_DEFAULT;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_AUTO;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_CONTINUOUS;
import static net.osmand.plus.audionotes.AudioVideoNotesPlugin.AV_CAMERA_FOCUS_EDOF;
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_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.cameraPictureSizeDefault;
// camera picture size:
// support camera focus select:
////
public class SettingsAudioVideoActivity extends SettingsBaseActivity {
private static final Log log = PlatformUtil.getLog(AudioVideoNotesPlugin.class);
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.av_settings);
PreferenceScreen grp = getPreferenceScreen();
AudioVideoNotesPlugin p = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
if (p != null) {
String[] entries;
Integer[] intValues;
entries = new String[]{getString(R.string.av_def_action_choose), getString(R.string.av_def_action_audio),
getString(R.string.av_def_action_video), getString(R.string.av_def_action_picture)};
intValues = new Integer[]{AV_DEFAULT_ACTION_CHOOSE, AV_DEFAULT_ACTION_AUDIO, AV_DEFAULT_ACTION_VIDEO,
AV_DEFAULT_ACTION_TAKEPICTURE};
ListPreference defAct = createListPreference(p.AV_DEFAULT_ACTION, entries, intValues, R.string.av_widget_action,
R.string.av_widget_action_descr);
grp.addPreference(defAct);
PreferenceCategory photo = new PreferenceCategory(this);
photo.setTitle(R.string.shared_string_photo);
grp.addPreference(photo);
final Camera cam = openCamera();
if (cam != null) {
// camera type settings
photo.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_PHOTO_CAM, R.string.av_use_external_camera,
R.string.av_use_external_camera_descr));
Parameters parameters = cam.getParameters();
createCameraPictureSizesPref(p, photo, parameters);
createCameraFocusModesPref(p, photo, parameters);
// play sound on success photo
photo.addPreference(createCheckBoxPreference(p.AV_PHOTO_PLAY_SOUND, R.string.av_photo_play_sound,
R.string.av_photo_play_sound_descr));
cam.release();
}
// video settings
PreferenceCategory video = new PreferenceCategory(this);
video.setTitle(R.string.shared_string_video);
grp.addPreference(video);
video.addPreference(createCheckBoxPreference(p.AV_EXTERNAL_RECORDER, R.string.av_use_external_recorder,
R.string.av_use_external_recorder_descr));
// entries = new String[] { "3GP", "MP4" };
// intValues = new Integer[] { VIDEO_OUTPUT_3GP, VIDEO_OUTPUT_MP4 };
// ListPreference lp = createListPreference(p.AV_VIDEO_FORMAT, entries, intValues, R.string.av_video_format,
// R.string.av_video_format_descr);
// video.addPreference(lp);
List<String> qNames = new ArrayList<>();
List<Integer> qValues = new ArrayList<>();
if (Build.VERSION.SDK_INT < 11 || CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_LOW)) {
qNames.add(getString(R.string.av_video_quality_low));
qValues.add(CamcorderProfile.QUALITY_LOW);
}
if (Build.VERSION.SDK_INT >= 11 && CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)) {
qNames.add("720 x 480 (480p)");
qValues.add(CamcorderProfile.QUALITY_480P);
}
if (Build.VERSION.SDK_INT >= 11 && CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) {
qNames.add("1280 x 720 (720p)");
qValues.add(CamcorderProfile.QUALITY_720P);
}
if (Build.VERSION.SDK_INT >= 11 && CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P)) {
qNames.add("1920 x 1080 (1080p)");
qValues.add(CamcorderProfile.QUALITY_1080P);
}
if (Build.VERSION.SDK_INT >= 21 && CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2160P)) {
qNames.add("3840x2160 (2160p)");
qValues.add(CamcorderProfile.QUALITY_2160P);
}
if (Build.VERSION.SDK_INT < 11 || CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_HIGH)) {
qNames.add(getString(R.string.av_video_quality_high));
qValues.add(CamcorderProfile.QUALITY_HIGH);
}
ListPreference lp = createListPreference(p.AV_VIDEO_QUALITY,
qNames.toArray(new String[qNames.size()]),
qValues.toArray(new Integer[qValues.size()]),
R.string.av_video_quality,
R.string.av_video_quality_descr);
video.addPreference(lp);
// Recorder Split settings
PreferenceCategory recSplit = new PreferenceCategory(this);
recSplit.setTitle(R.string.rec_split);
grp.addPreference(recSplit);
recSplit.addPreference(createCheckBoxPreference(p.AV_RECORDER_SPLIT, R.string.rec_split_title,
R.string.rec_split_desc));
intValues = new Integer[]{1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30};
entries = new String[intValues.length];
int i = 0;
String minStr = getString(R.string.int_min);
for (int v : intValues) {
entries[i++] = String.valueOf(v) + " " + minStr;
}
lp = createListPreference(p.AV_RS_CLIP_LENGTH, entries, intValues,
R.string.rec_split_clip_length,
R.string.rec_split_clip_length_desc);
recSplit.addPreference(lp);
File dir = getMyApplication().getAppPath("").getParentFile();
long size = 0;
if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath());
size = ((long) fs.getBlockSize() * (long) fs.getBlockCount()) / (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);
}
entries = new String[gbList.size()];
intValues = new Integer[gbList.size()];
i = 0;
for (int v : gbList) {
intValues[i] = v;
entries[i] = AndroidUtils.formatSize(this, v * (1l << 30));
i++;
}
lp = createListPreference(p.AV_RS_STORAGE_SIZE, entries, intValues,
R.string.rec_split_storage_size,
R.string.rec_split_storage_size_desc);
recSplit.addPreference(lp);
}
// audio settings
PreferenceCategory audio = new PreferenceCategory(this);
audio.setTitle(R.string.shared_string_audio);
grp.addPreference(audio);
entries = new String[]{"Default", "AAC"};
intValues = new Integer[]{MediaRecorder.AudioEncoder.DEFAULT, MediaRecorder.AudioEncoder.AAC};
lp = createListPreference(p.AV_AUDIO_FORMAT, entries, intValues,
R.string.av_audio_format,
R.string.av_audio_format_descr);
audio.addPreference(lp);
entries = new String[]{"Default", "16 kbps", "32 kbps", "48 kbps", "64 kbps", "96 kbps", "128 kbps"};
intValues = new Integer[]{AUDIO_BITRATE_DEFAULT, 16 * 1024, 32 * 1024, 48 * 1024, 64 * 1024, 96 * 1024, 128 * 1024};
lp = createListPreference(p.AV_AUDIO_BITRATE, entries, intValues,
R.string.av_audio_bitrate,
R.string.av_audio_bitrate_descr);
audio.addPreference(lp);
}
}
private void createCameraPictureSizesPref(AudioVideoNotesPlugin p, PreferenceCategory photo, Parameters parameters) {
String[] entries;
Integer[] intValues;
// Photo picture size
// get supported sizes
List<Camera.Size> psps = parameters.getSupportedPictureSizes();
if (psps == null) {
return;
}
// list of megapixels of each resolution
List<Integer> mpix = new ArrayList<Integer>();
// list of index each resolution in list, returned by getSupportedPictureSizes()
List<Integer> picSizesValues = new ArrayList<Integer>();
// fill lists for sort
for (int index = 0; index < psps.size(); index++) {
mpix.add((psps.get(index)).width * (psps.get(index)).height);
picSizesValues.add(index);
}
// sort list for max resolution in begining of list
for (int i = 0; i < mpix.size(); i++) {
for (int j = 0; j < mpix.size() - i - 1; j++) {
if (mpix.get(j) < mpix.get(j + 1)) {
// change elements
int tmp = mpix.get(j + 1);
mpix.set(j + 1, mpix.get(j));
mpix.set(j, tmp);
tmp = picSizesValues.get(j + 1);
picSizesValues.set(j + 1, picSizesValues.get(j));
picSizesValues.set(j, tmp);
}
}
}
// set default photo size to max resolution (set index of element with max resolution in List, returned by getSupportedPictureSizes() )
cameraPictureSizeDefault = picSizesValues.get(0);
log.debug("onCreate() set cameraPictureSizeDefault=" + cameraPictureSizeDefault);
List<String> itemsPicSizes = new ArrayList<String>();
String prefix;
for (int index = 0; index < psps.size(); index++) {
float px = (float) ((psps.get(picSizesValues.get(index))).width * (psps.get(picSizesValues.get(index))).height);
if (px > 102400) // 100 K
{
px = px / 1048576;
prefix = "Mpx";
} else {
px = px / 1024;
prefix = "Kpx";
}
itemsPicSizes.add((psps.get(picSizesValues.get(index))).width +
"x" +
(psps.get(picSizesValues.get(index))).height +
" ( " +
String.format("%.2f", px) +
" " +
prefix +
" )");
}
log.debug("onCreate() set default size: width=" + psps.get(cameraPictureSizeDefault).width + " height="
+ psps.get(cameraPictureSizeDefault).height + " index in ps=" + cameraPictureSizeDefault);
entries = itemsPicSizes.toArray(new String[itemsPicSizes.size()]);
intValues = picSizesValues.toArray(new Integer[picSizesValues.size()]);
if (entries.length > 0) {
ListPreference camSizes = createListPreference(p.AV_CAMERA_PICTURE_SIZE, entries, intValues, R.string.av_camera_pic_size,
R.string.av_camera_pic_size_descr);
photo.addPreference(camSizes);
}
}
private void createCameraFocusModesPref(AudioVideoNotesPlugin p, PreferenceCategory photo, Parameters parameters) {
String[] entries;
Integer[] intValues;
// focus mode settings
// show in menu only suppoted modes
List<String> sfm = parameters.getSupportedFocusModes();
if (sfm == null) {
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);
}
}
entries = items.toArray(new String[items.size()]);
intValues = itemsValues.toArray(new Integer[itemsValues.size()]);
if (entries.length > 0) {
ListPreference camFocus = createListPreference(p.AV_CAMERA_FOCUS_TYPE, entries, intValues, R.string.av_camera_focus,
R.string.av_camera_focus_descr);
photo.addPreference(camFocus);
}
}
protected Camera openCamera() {
try {
return Camera.open();
} catch (Exception e) {
log.error("Error open camera", e);
return null;
}
}
}

View file

@ -14,11 +14,12 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
@ -68,9 +69,10 @@ public class DashPluginsFragment extends DashBaseFragment {
return new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId());
startActivity(intent);
FragmentActivity activity = getActivity();
if (activity != null) {
PluginsFragment.showInstance(activity.getSupportFragmentManager());
}
closeDashboard();
}
};
@ -84,7 +86,10 @@ public class DashPluginsFragment extends DashBaseFragment {
view.findViewById(R.id.show_all).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getActivity(), getMyApplication().getAppCustomization().getPluginsActivity()));
FragmentActivity activity = getActivity();
if (activity != null) {
PluginsFragment.showInstance(activity.getSupportFragmentManager());
}
closeDashboard();
}
});

View file

@ -14,7 +14,7 @@ import net.osmand.plus.Version;
import net.osmand.plus.activities.ContributionVersionActivity;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.views.layers.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
@ -122,13 +122,8 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
}
@Override
public Class<? extends Activity> getSettingsActivity() {
return SettingsDevelopmentActivity.class;
}
@Override
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
return DevelopmentSettingsFragment.class;
public SettingsScreenType getSettingsScreenType() {
return SettingsScreenType.DEVELOPMENT_SETTINGS;
}
@Override

View file

@ -1,212 +0,0 @@
package net.osmand.plus.development;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Debug;
import android.os.Debug.MemoryInfo;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import net.osmand.plus.OsmAndLocationSimulation;
import net.osmand.plus.OsmandApplication;
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.plus.settings.backend.OsmandSettings;
import net.osmand.util.SunriseSunset;
import java.text.SimpleDateFormat;
//import net.osmand.plus.development.OsmandDevelopmentPlugin;
public class SettingsDevelopmentActivity extends SettingsBaseActivity {
@SuppressLint("SimpleDateFormat")
@Override
public void onCreate(Bundle savedInstanceState) {
OsmandApplication app = getMyApplication();
app.applyTheme(this);
super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.debugging_and_development);
PreferenceScreen category = getPreferenceScreen();
Preference pref;
if (Version.isOpenGlAvailable(app)) {
category.addPreference(createCheckBoxPreference(settings.USE_OPENGL_RENDER,
R.string.use_opengl_render, R.string.use_opengl_render_descr));
}
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);
}
category.addPreference(nativeCheckbox);
}
PreferenceCategory navigation = new PreferenceCategory(this);
navigation.setTitle(R.string.routing_settings);
category.addPreference(navigation);
pref = new Preference(this);
final Preference simulate = pref;
final OsmAndLocationSimulation sim = getMyApplication().getLocationProvider().getLocationSimulation();
final Runnable updateTitle = new Runnable(){
@Override
public void run() {
simulate.setSummary(sim.isRouteAnimating() ?
R.string.simulate_your_location_stop_descr : R.string.simulate_your_location_gpx_descr);
}
};
pref.setTitle(R.string.simulate_your_location);
updateTitle.run();
pref.setKey("simulate_your_location");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
updateTitle.run();
sim.startStopRouteAnimation(SettingsDevelopmentActivity.this, true, updateTitle);
return true;
}
});
navigation.addPreference(pref);
PreferenceCategory debug = new PreferenceCategory(this);
debug.setTitle(R.string.debugging_and_development);
category.addPreference(debug);
CheckBoxPreference dbg = createCheckBoxPreference(settings.DEBUG_RENDERING_INFO,
R.string.trace_rendering, R.string.trace_rendering_descr);
debug.addPreference(dbg);
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle(R.string.simulate_initial_startup);
firstRunPreference.setSummary(R.string.simulate_initial_startup_descr);
firstRunPreference.setSelectable(true);
firstRunPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
getMyApplication().getAppInitializer().resetFirstTimeRun();
OsmandSettings settings = getMyApplication().getSettings();
settings.FIRST_MAP_IS_DOWNLOADED.set(false);
settings.MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
settings.WEBGL_SUPPORTED.set(true);
settings.WIKI_ARTICLE_SHOW_IMAGES_ASKED.set(false);
getMyApplication().showToastMessage(R.string.shared_string_ok);
return true;
}
});
debug.addPreference(firstRunPreference);
debug.addPreference(createCheckBoxPreference(settings.SHOULD_SHOW_FREE_VERSION_BANNER,
R.string.show_free_version_banner,
R.string.show_free_version_banner_description));
pref = new Preference(this);
pref.setTitle(R.string.test_voice_prompts);
pref.setSummary(R.string.play_commands_of_currently_selected_voice);
pref.setKey("test_voice_commands");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(new Intent(SettingsDevelopmentActivity.this, TestVoiceActivity.class));
return true;
}
});
category.addPreference(pref);
pref = new Preference(this);
pref.setTitle(R.string.logcat_buffer);
pref.setSummary(R.string.logcat_buffer_descr);
pref.setKey("logcat_buffer");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(new Intent(SettingsDevelopmentActivity.this, LogcatActivity.class));
return true;
}
});
category.addPreference(pref);
PreferenceCategory info = new PreferenceCategory(this);
info.setTitle(R.string.info_button);
category.addPreference(info);
pref = new Preference(this);
pref.setTitle(R.string.global_app_allocated_memory);
long javaAvailMem = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/ (1024*1024l);
long javaTotal = Runtime.getRuntime().totalMemory() / (1024*1024l);
long dalvikSize = android.os.Debug.getNativeHeapAllocatedSize() / (1024*1024l);
pref.setSummary(getString(R.string.global_app_allocated_memory_descr, javaAvailMem, javaTotal, dalvikSize));
pref.setSelectable(false);
//setEnabled(false) creates bad readability on some devices
//pref.setEnabled(false);
info.addPreference(pref);
// ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
// ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
// activityManager.getMemoryInfo(memoryInfo);
// long totalSize = memoryInfo.availMem / (1024*1024l);
MemoryInfo mem = new Debug.MemoryInfo();
Debug.getMemoryInfo(mem);
pref = new Preference(this);
pref.setTitle(R.string.native_app_allocated_memory);
pref.setSummary(getString(R.string.native_app_allocated_memory_descr
, mem.nativePrivateDirty / 1024, mem.dalvikPrivateDirty / 1024 , mem.otherPrivateDirty / 1024
, mem.nativePss / 1024, mem.dalvikPss / 1024 , mem.otherPss / 1024));
pref.setSelectable(false);
//setEnabled(false) creates bad readability on some devices
//pref.setEnabled(false);
info.addPreference(pref);
final Preference agpspref = new Preference(this);
agpspref.setTitle(R.string.agps_info);
if (settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get() != 0L) {
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
agpspref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get())));
} else {
agpspref.setSummary(getString(R.string.agps_data_last_downloaded, "--"));
}
agpspref.setSelectable(true);
//setEnabled(false) creates bad readability on some devices
//pref.setEnabled(false);
agpspref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if(getMyApplication().getSettings().isInternetConnectionAvailable(true)) {
getMyApplication().getLocationProvider().redownloadAGPS();
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
agpspref.setSummary(getString(R.string.agps_data_last_downloaded, prt.format(settings.AGPS_DATA_LAST_TIME_DOWNLOADED.get())));
}
return true;
}
});
info.addPreference(agpspref);
SunriseSunset sunriseSunset = getMyApplication().getDaynightHelper().getSunriseSunset();
pref = new Preference(this);
pref.setTitle(R.string.day_night_info);
if (sunriseSunset != null && sunriseSunset.getSunrise() != null && sunriseSunset.getSunset() != null) {
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
pref.setSummary(getString(R.string.day_night_info_description, prt.format(sunriseSunset.getSunrise()),
prt.format(sunriseSunset.getSunset())));
} else {
pref.setSummary(getString(R.string.day_night_info_description, "null", "null"));
}
pref.setSelectable(false);
//setEnabled(false) creates bad readability on some devices
//pref.setEnabled(false);
info.addPreference(pref);
}
}

View file

@ -1,7 +1,6 @@
package net.osmand.plus.dialogs;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
@ -20,7 +19,7 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.poi.PoiUIFilter;
@ -149,9 +148,7 @@ final class MapLayerMenuListener extends OnRowItemClick {
settings.SHOW_MAP_MARKERS.set(isChecked);
} else if (itemId == R.string.layer_map) {
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) {
Intent intent = new Intent(mapActivity, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID);
mapActivity.startActivity(intent);
PluginsFragment.showInstance(mapActivity.getSupportFragmentManager());
} else {
ContextMenuItem it = adapter.getItem(pos);
mapActivity.getMapLayers().selectMapLayer(mapActivity.getMapView(), it, adapter);

View file

@ -6,6 +6,7 @@ import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
@ -25,6 +26,8 @@ import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
import net.osmand.plus.download.CityItem;
import net.osmand.plus.download.CustomIndexItem;
@ -343,8 +346,7 @@ public class ItemViewHolder {
ChoosePlanDialogFragment.showSeaDepthMapsInstance(context.getSupportFragmentManager());
break;
case ASK_FOR_SEAMARKS_PLUGIN:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
showPluginsScreen();
Toast.makeText(context.getApplicationContext(),
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
break;
@ -352,8 +354,7 @@ public class ItemViewHolder {
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(context.getSupportFragmentManager());
break;
case ASK_FOR_SRTM_PLUGIN_ENABLE:
context.startActivity(new Intent(context, context.getMyApplication().getAppCustomization()
.getPluginsActivity()));
showPluginsScreen();
Toast.makeText(context, context.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show();
break;
@ -361,6 +362,13 @@ public class ItemViewHolder {
break;
}
}
private void showPluginsScreen() {
Bundle params = new Bundle();
params.putBoolean(PluginsFragment.OPEN_PLUGINS, true);
Intent intent = context.getIntent();
MapActivity.launchMapActivityMoveToTop(context, intent != null ? intent.getExtras() : null, null, params);
}
};
} else {
final boolean isDownloading = context.getDownloadThread().isDownloading(item);

View file

@ -13,6 +13,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.view.ContextThemeWrapper;
@ -80,6 +81,7 @@ import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.helpers.enums.MetricsConstants;
import net.osmand.plus.helpers.enums.SpeedConstants;
import net.osmand.plus.settings.backend.CommonPreference;
@ -90,7 +92,6 @@ import net.osmand.plus.Version;
import net.osmand.plus.activities.ActivityResultListener;
import net.osmand.plus.activities.ActivityResultListener.OnActivityResultListener;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
@ -649,9 +650,9 @@ public class GpxUiHelper {
confirm.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(activity, PluginActivity.class);
intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandMonitoringPlugin.ID);
activity.startActivity(intent);
Bundle params = new Bundle();
params.putBoolean(PluginsFragment.OPEN_PLUGINS, true);
MapActivity.launchMapActivityMoveToTop(activity, null, null, params);
}
});
confirm.setNegativeButton(R.string.shared_string_cancel, null);

View file

@ -11,16 +11,18 @@ import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.search.QuickSearchDialogFragment;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.osmedit.OsmEditingFragment;
import net.osmand.plus.search.QuickSearchDialogFragment;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.util.Algorithms;
@ -58,6 +60,9 @@ public class IntentHelper {
if (!applied) {
applied = parseSendIntent();
}
if (!applied) {
applied = parseOAuthIntent();
}
return applied;
}
@ -207,10 +212,22 @@ public class IntentHelper {
mapActivity.setIntent(null);
}
if (intent.hasExtra(BaseSettingsFragment.OPEN_SETTINGS)) {
String settingsType = intent.getStringExtra(BaseSettingsFragment.OPEN_SETTINGS);
String appMode = intent.getStringExtra(BaseSettingsFragment.APP_MODE_KEY);
if (BaseSettingsFragment.OPEN_CONFIG_PROFILE.equals(settingsType)) {
BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.CONFIGURE_PROFILE, ApplicationMode.valueOfStringKey(appMode, null));
String settingsTypeName = intent.getStringExtra(BaseSettingsFragment.OPEN_SETTINGS);
if (!Algorithms.isEmpty(settingsTypeName)) {
try {
SettingsScreenType screenType = SettingsScreenType.valueOf(settingsTypeName);
BaseSettingsFragment.showInstance(mapActivity, screenType, ApplicationMode.valueOfStringKey(appMode, null));
} catch (IllegalArgumentException e) {
LOG.error("error", e);
}
}
mapActivity.setIntent(null);
}
if (intent.hasExtra(PluginsFragment.OPEN_PLUGINS)) {
boolean openPlugins = intent.getBooleanExtra(PluginsFragment.OPEN_PLUGINS, false);
if (openPlugins) {
PluginsFragment.showInstance(mapActivity.getSupportFragmentManager());
}
mapActivity.setIntent(null);
}
@ -271,6 +288,23 @@ public class IntentHelper {
return false;
}
private boolean parseOAuthIntent() {
Intent intent = mapActivity.getIntent();
if (intent != null && intent.getData() != null) {
Uri uri = intent.getData();
if (uri.toString().startsWith("osmand-oauth")) {
OsmEditingFragment fragment = mapActivity.getOsmEditingFragment();
if (fragment != null) {
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
fragment.authorize(oauthVerifier);
mapActivity.setIntent(null);
return true;
}
}
}
return false;
}
private boolean handleSendText(Intent intent) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (!Algorithms.isEmpty(sharedText)) {

View file

@ -34,6 +34,7 @@ class FavoritesImportTask extends BaseImportAsyncTask<Void, Void, GPXFile> {
protected GPXFile doInBackground(Void... nothing) {
List<FavouritePoint> favourites = asFavourites(app, gpxFile.getPoints(), fileName, forceImportFavourites);
FavouritesDbHelper favoritesHelper = app.getFavorites();
checkDuplicateNames(favourites);
for (FavouritePoint favourite : favourites) {
favoritesHelper.deleteFavourite(favourite, false);
favoritesHelper.addFavourite(favourite, false);
@ -43,6 +44,27 @@ class FavoritesImportTask extends BaseImportAsyncTask<Void, Void, GPXFile> {
return null;
}
public void checkDuplicateNames(List<FavouritePoint> favourites) {
for (FavouritePoint fp : favourites) {
int number = 1;
String index;
String name = fp.getName();
boolean duplicatesFound = false;
for (FavouritePoint fp2 : favourites) {
if (name.equals(fp2.getName()) && fp.getCategory().equals(fp2.getCategory()) && !fp.equals(fp2)) {
if (!duplicatesFound) {
index = " (" + number + ")";
fp.setName(name + index);
}
duplicatesFound = true;
number++;
index = " (" + number + ")";
fp2.setName(fp2.getName() + index);
}
}
}
}
@Override
protected void onPostExecute(GPXFile result) {
hideProgress();

View file

@ -22,6 +22,7 @@ import net.osmand.plus.activities.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadValidationManager;
@ -110,8 +111,7 @@ public class MapDataMenuController extends MenuController {
activity.getString(R.string.activate_srtm_plugin), Toast.LENGTH_LONG).show();
}
} else {
activity.startActivity(new Intent(activity, activity.getMyApplication().getAppCustomization()
.getPluginsActivity()));
PluginsFragment.showInstance(activity.getSupportFragmentManager());
Toast.makeText(activity, activity.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show();
}

View file

@ -6,10 +6,13 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.view.LayoutInflater;
import android.view.View;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.OsmandPlugin;
@ -32,6 +35,7 @@ import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import java.util.HashMap;
import java.util.LinkedHashMap;
import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO;
import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY;
import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY;
import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES;
@ -46,6 +50,35 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment
private static final String OPEN_TRACKS = "open_tracks";
private static final String SAVE_GLOBAL_TRACK_INTERVAL = "save_global_track_interval";
boolean showSwitchProfile = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null) {
showSwitchProfile = args.getBoolean(PLUGIN_INFO, false);
}
}
@Override
protected void createToolbar(LayoutInflater inflater, View view) {
super.createToolbar(inflater, view);
View switchProfile = view.findViewById(R.id.profile_button);
if (switchProfile != null) {
AndroidUiHelper.updateVisibility(switchProfile, showSwitchProfile);
}
}
@Override
public Bundle buildArguments() {
Bundle args = super.buildArguments();
args.putBoolean(PLUGIN_INFO, showSwitchProfile);
return args;
}
@Override
protected void setupPreferences() {
setupSaveTrackToGpxPref();

View file

@ -42,7 +42,7 @@ import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.layers.MapInfoLayer;
@ -166,15 +166,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
public static final int[] MINUTES = new int[] {2, 3, 5};
public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60, 90, 2 * 60, 3 * 60, 4 * 60, 6 * 60, 12 * 60, 24 * 60};
@Override
public Class<? extends Activity> getSettingsActivity() {
return SettingsMonitoringActivity.class;
}
@Override
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
return MonitoringSettingsFragment.class;
public SettingsScreenType getSettingsScreenType() {
return SettingsScreenType.MONITORING_SETTINGS;
}
@Override

View file

@ -1,325 +0,0 @@
package net.osmand.plus.monitoring;
import android.content.BroadcastReceiver;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.util.Algorithms;
import java.util.Map;
import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY;
import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY;
public class SettingsMonitoringActivity extends SettingsBaseActivity {
public static final String PROFILE_STRING_KEY = "string_key";
private CheckBoxPreference routeServiceEnabled;
private BroadcastReceiver broadcastReceiver;
public static final int[] BG_SECONDS = new int[]{0, 30, 60, 90};
public static final int[] BG_MINUTES = new int[]{2, 3, 5, 10, 15, 30, 60, 90};
private static final int[] SECONDS = OsmandMonitoringPlugin.SECONDS;
private static final int[] MINUTES = OsmandMonitoringPlugin.MINUTES;
private static final int[] MAX_INTERVAL_TO_SEND_MINUTES = OsmandMonitoringPlugin.MAX_INTERVAL_TO_SEND_MINUTES;
public SettingsMonitoringActivity() {
super(true);
}
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
requestWindowFeature(Window.FEATURE_PROGRESS);
super.onCreate(savedInstanceState);
setProgressVisibility(false);
getToolbar().setTitle(R.string.monitoring_settings);
PreferenceScreen grp = getPreferenceScreen();
createLoggingSection(grp);
createLiveSection(grp);
createNotificationSection(grp);
Intent intent = getIntent();
if (intent != null && intent.hasExtra(PROFILE_STRING_KEY)) {
String modeName = intent.getStringExtra(PROFILE_STRING_KEY);
selectedAppMode = ApplicationMode.valueOfStringKey(modeName, ApplicationMode.CAR);
} else {
selectAppModeDialog().show();
}
}
private void createLoggingSection(PreferenceScreen grp) {
PreferenceCategory cat = new PreferenceCategory(this);
cat.setTitle(R.string.save_track_to_gpx_globally);
grp.addPreference(cat);
Preference globalrecord = new Preference(this);
globalrecord.setTitle(R.string.save_track_to_gpx_globally_headline);
globalrecord.setSummary(R.string.save_track_to_gpx_globally_descr);
globalrecord.setSelectable(false);
//setEnabled(false) creates bad readability on some devices
//globalrecord.setEnabled(false);
cat.addPreference(globalrecord);
if(settings.SAVE_GLOBAL_TRACK_REMEMBER.get()) {
cat.addPreference(createTimeListPreference(settings.SAVE_GLOBAL_TRACK_INTERVAL, SECONDS,
MINUTES, 1000, settings.SAVE_GLOBAL_TRACK_REMEMBER, R.string.save_global_track_interval, R.string.save_global_track_interval_descr));
}
Preference pref = new Preference(this);
pref.setTitle(R.string.save_current_track);
pref.setSummary(getMyApplication().getString(R.string.save_current_track_descr)
+ " (" + OsmAndFormatter.getFormattedDistance(getMyApplication().getSavingTrackHelper().getDistance(), getMyApplication()) + ")");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SavingTrackHelper helper = getMyApplication().getSavingTrackHelper();
if (helper.hasDataToSave()) {
saveCurrentTracks(helper);
} else {
helper.close();
}
return true;
}
});
cat.addPreference(pref);
cat.addPreference(createCheckBoxPreference(settings.SAVE_TRACK_TO_GPX, R.string.save_track_to_gpx,
R.string.save_track_to_gpx_descrp));
cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS,
MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr));
String[] names;
Float[] floatValues;
floatValues = new Float[] {0.f, 2.0f, 5.0f, 10.0f, 20.0f, 30.0f, 50.0f};
names = new String[floatValues.length];
names[0] = getString(R.string.shared_string_not_selected);
for(int i = 1; i < floatValues.length; i++) {
names[i] = floatValues[i].intValue() + " " + getString(R.string.m);
}
cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_DISTANCE, names, floatValues,
R.string.save_track_min_distance, R.string.save_track_min_distance_descr));
floatValues = new Float[] {0.f, 1.0f, 2.0f, 5.0f, 10.0f, 15.0f, 20.0f, 50.0f, 100.0f};
names = new String[floatValues.length];
names[0] = getString(R.string.shared_string_not_selected);
for(int i = 1; i < floatValues.length; i++) {
names[i] = floatValues[i].intValue() + " " + getString(R.string.m) + " (" + Math.round(floatValues[i]/0.3048f) + " " + getString(R.string.foot) + ")";
}
cat.addPreference(createListPreference(settings.SAVE_TRACK_PRECISION, names, floatValues,
R.string.save_track_precision, R.string.save_track_precision_descr));
floatValues = new Float[] {0.f, 0.000001f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
names = new String[floatValues.length];
names[0] = getString(R.string.shared_string_not_selected);
names[1] = "> 0"; // This option for the GPS chipset motion detection
for(int i = 2; i < floatValues.length; i++) {
names[i] = floatValues[i].intValue() + " " + getString(R.string.km_h);
floatValues[i] = floatValues[i] / 3.6f;
}
cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_SPEED, names, floatValues,
R.string.save_track_min_speed, R.string.save_track_min_speed_descr));
cat.addPreference(createCheckBoxPreference(settings.AUTO_SPLIT_RECORDING, R.string.auto_split_recording_title,
R.string.auto_split_recording_descr));
cat.addPreference(createCheckBoxPreference(settings.DISABLE_RECORDING_ONCE_APP_KILLED, R.string.disable_recording_once_app_killed,
R.string.disable_recording_once_app_killed_descrp));
cat.addPreference(createCheckBoxPreference(settings.SAVE_HEADING_TO_GPX, R.string.save_heading,
R.string.save_heading_descr));
Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY};
names = new String[intValues.length];
names[0] = getString(R.string.store_tracks_in_rec_directory);
names[1] = getString(R.string.store_tracks_in_monthly_directories);
// names[2] = getString(R.string.store_tracks_in_daily_directories);
cat.addPreference(createListPreference(settings.TRACK_STORAGE_DIRECTORY, names, intValues,
R.string.track_storage_directory, R.string.track_storage_directory_descrp));
}
private void createLiveSection(PreferenceScreen grp) {
PreferenceCategory cat;
cat = new PreferenceCategory(this);
cat.setTitle(R.string.live_monitoring_m);
grp.addPreference(cat);
EditTextPreference urlPreference = createEditTextPreference(settings.LIVE_MONITORING_URL, R.string.live_monitoring_url,
R.string.live_monitoring_url_descr);
urlPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (Algorithms.isValidMessageFormat((String) newValue)) {
return SettingsMonitoringActivity.super.onPreferenceChange(preference, newValue);
} else {
Toast.makeText(SettingsMonitoringActivity.this, R.string.wrong_format, Toast.LENGTH_SHORT).show();
return false;
}
}
});
cat.addPreference(urlPreference);
final CheckBoxPreference liveMonitoring = createCheckBoxPreference(settings.LIVE_MONITORING, R.string.live_monitoring_m,
R.string.live_monitoring_m_descr);
cat.addPreference(liveMonitoring);
cat.addPreference(createTimeListPreference(settings.LIVE_MONITORING_INTERVAL, SECONDS,
MINUTES, 1000, R.string.live_monitoring_interval, R.string.live_monitoring_interval_descr));
cat.addPreference(createTimeListPreference(settings.LIVE_MONITORING_MAX_INTERVAL_TO_SEND, null,
MAX_INTERVAL_TO_SEND_MINUTES, 1000, R.string.live_monitoring_max_interval_to_send, R.string.live_monitoring_max_interval_to_send_desrc));
}
private void createNotificationSection(PreferenceScreen grp) {
PreferenceCategory cat;
cat = new PreferenceCategory(this);
cat.setTitle(R.string.shared_string_notifications);
grp.addPreference(cat);
final CheckBoxPreference tripRecording = createCheckBoxPreference(settings.SHOW_TRIP_REC_NOTIFICATION, R.string.trip_rec_notification_settings,
R.string.trip_rec_notification_settings_desc);
cat.addPreference(tripRecording);
}
public void updateAllSettings() {
super.updateAllSettings();
if(routeServiceEnabled != null) {
routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null);
}
}
private void saveCurrentTracks(final SavingTrackHelper helper) {
setProgressVisibility(true);
getMyApplication().getTaskManager().runInBackground(new OsmAndTaskRunnable<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
SavingTrackHelper helper = getMyApplication().getSavingTrackHelper();
helper.saveDataToGpx(getMyApplication().getAppCustomization().getTracksDir());
helper.close();
return null;
}
@Override
protected void onPostExecute(Void result) {
setProgressVisibility(false);
}
}, (Void) null);
}
@Override
protected void onDestroy() {
super.onDestroy();
if(broadcastReceiver != null) {
unregisterReceiver(broadcastReceiver);
broadcastReceiver = null;
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String prefId = preference.getKey();
if (preference instanceof ListPreference) {
int ind = ((ListPreference) preference).findIndexOfValue((String) newValue);
CharSequence entry = ((ListPreference) preference).getEntries()[ind];
Map<String, ?> map = getListPrefValues().get(prefId);
if (map != null) {
newValue = map.get(entry);
}
}
showConfirmDialog(prefId, newValue);
return false;
}
protected void showConfirmDialog(final String prefId, final Object newValue) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
String appModeName = selectedAppMode.toHumanString();
String currentModeText = getString(R.string.apply_to_current_profile, appModeName);
int start = currentModeText.indexOf(appModeName);
SpannableString[] strings = new SpannableString[2];
strings[0] = new SpannableString(getString(R.string.apply_to_all_profiles));
strings[1] = new SpannableString(currentModeText);
strings[1].setSpan(new StyleSpan(Typeface.BOLD), start, start + appModeName.length(), 0);
final int[] icons = new int[2];
icons[0] = R.drawable.ic_action_copy;
icons[1] = selectedAppMode.getIconRes();
final boolean nightMode = !settings.isLightContent();
final OsmandApplication app = getMyApplication();
final LayoutInflater themedInflater = UiUtilities.getInflater(this, nightMode);
//set up dialog title
View dialogTitle = themedInflater.inflate(R.layout.bottom_sheet_item_simple, null);
dialogTitle.findViewById(R.id.icon).setVisibility(View.GONE);
TextView tvTitle = dialogTitle.findViewById(R.id.title);
tvTitle.setText(R.string.change_default_settings);
int textSize = (int) app.getResources().getDimension(R.dimen.dialog_header_text_size);
tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
builder.setCustomTitle(dialogTitle);
final ArrayAdapter<SpannableString> singleChoiceAdapter = new ArrayAdapter<SpannableString>(this, R.layout.bottom_sheet_item_simple, R.id.title, strings) {
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View v = convertView;
if (v == null) {
v = themedInflater.inflate(R.layout.bottom_sheet_item_simple, parent, false);
}
int activeColor = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
Drawable icon = app.getUIUtilities().getIcon(icons[position], activeColor);
((TextView) v.findViewById(R.id.title)).setText(getItem(position));
((ImageView) v.findViewById(R.id.icon)).setImageDrawable(icon);
return v;
}
};
builder.setAdapter(singleChoiceAdapter, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
settings.setPreferenceForAllModes(prefId, newValue);
} else {
settings.setPreference(prefId, newValue);
}
updateAllSettings();
}
});
builder.setNegativeButton(R.string.discard_changes, null);
AlertDialog dialog = builder.create();
dialog.getListView().setDividerHeight(0);
dialog.show();
}
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.osmedit;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
@ -7,31 +8,50 @@ import android.os.Bundle;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.PlatformUtil;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import net.osmand.plus.settings.bottomsheets.OsmLoginDataBottomSheet;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
import net.osmand.plus.settings.bottomsheets.OsmLoginDataBottomSheet;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import org.apache.commons.logging.Log;
import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID;
import static net.osmand.plus.osmedit.OsmEditingPlugin.OSM_EDIT_TAB;
public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged {
private static final Log log = PlatformUtil.getLog(OsmEditingFragment.class);
private static final String OSM_EDITING_INFO = "osm_editing_info";
private static final String OPEN_OSM_EDITS = "open_osm_edits";
private static final String OSM_LOGIN_DATA = "osm_login_data";
private static final String OSM_OAUTH_SUCCESS = "osm_oauth_success";
private static final String OSM_OAUTH_CLEAR = "osm_oauth_clear";
private static final String OSM_OAUTH_LOGIN = "osm_oauth_login";
private OsmOAuthAuthorizationAdapter client;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
client = new OsmOAuthAuthorizationAdapter(app);
}
@Override
protected void setupPreferences() {
@ -42,6 +62,7 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
setupOfflineEditingPref();
setupOsmEditsDescrPref();
setupOsmEditsPref();
setupOAuthPrefs();
}
@Override
@ -73,7 +94,7 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
Drawable enabled = getActiveIcon(R.drawable.ic_world_globe_dark);
Drawable icon = getPersistentPrefIcon(enabled, disabled);
SwitchPreferenceEx offlineEditingPref = (SwitchPreferenceEx) findPreference(settings.OFFLINE_EDITION.getId());
SwitchPreferenceEx offlineEditingPref = findPreference(settings.OFFLINE_EDITION.getId());
offlineEditingPref.setDescription(getString(R.string.offline_edition_descr));
offlineEditingPref.setIcon(icon);
}
@ -101,9 +122,37 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
createProfile.setIcon(getActiveIcon(R.drawable.ic_action_folder));
}
private void setupOAuthPrefs() {
Context ctx = getContext();
if (ctx != null) {
PreferenceScreen screen = getPreferenceScreen();
if (client.isValidToken()) {
Preference prefOAuth = new Preference(ctx);
prefOAuth.setTitle(R.string.osm_authorization_success);
prefOAuth.setSummary(R.string.osm_authorization_success);
prefOAuth.setKey(OSM_OAUTH_SUCCESS);
Preference prefClearToken = new Preference(ctx);
prefClearToken.setTitle(R.string.shared_string_logoff);
prefClearToken.setSummary(R.string.clear_osm_token);
prefClearToken.setKey(OSM_OAUTH_CLEAR);
screen.addPreference(prefOAuth);
screen.addPreference(prefClearToken);
} else {
Preference prefOAuth = new Preference(ctx);
prefOAuth.setTitle(R.string.perform_oauth_authorization);
prefOAuth.setSummary(R.string.perform_oauth_authorization_description);
prefOAuth.setKey(OSM_OAUTH_LOGIN);
screen.addPreference(prefOAuth);
}
}
}
@Override
public boolean onPreferenceClick(Preference preference) {
if (OPEN_OSM_EDITS.equals(preference.getKey())) {
String prefId = preference.getKey();
if (OPEN_OSM_EDITS.equals(prefId)) {
Bundle bundle = new Bundle();
bundle.putInt(TAB_ID, OSM_EDIT_TAB);
@ -113,12 +162,29 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
favorites.putExtra(MapActivity.INTENT_PARAMS, bundle);
startActivity(favorites);
return true;
} else if (OSM_LOGIN_DATA.equals(preference.getKey())) {
} else if (OSM_LOGIN_DATA.equals(prefId)) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
OsmLoginDataBottomSheet.showInstance(fragmentManager, OSM_LOGIN_DATA, this, false, getSelectedAppMode());
return true;
}
} else if (OSM_OAUTH_CLEAR.equals(prefId)) {
settings.USER_ACCESS_TOKEN.set("");
settings.USER_ACCESS_TOKEN_SECRET.set("");
client.resetToken();
client = new OsmOAuthAuthorizationAdapter(app);
app.showShortToastMessage(R.string.osm_edit_logout_success);
updateAllSettings();
return true;
} else if (OSM_OAUTH_LOGIN.equals(prefId)) {
View view = getView();
if (view != null) {
ViewGroup appBarLayout = view.findViewById(R.id.appbar);
client.startOAuth(appBarLayout);
}
return true;
}
return super.onPreferenceClick(preference);
}
@ -130,4 +196,11 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
nameAndPasswordPref.setSummary(settings.USER_NAME.get());
}
}
public void authorize(String oauthVerifier) {
if (client != null) {
client.authorize(oauthVerifier);
}
updateAllSettings();
}
}

View file

@ -13,9 +13,11 @@ import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.data.Amenity;
@ -23,13 +25,11 @@ import net.osmand.data.MapObject;
import net.osmand.data.TransportStop;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Entity;
import net.osmand.plus.*;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.EnumAdapter;
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
@ -42,16 +42,21 @@ import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.osmedit.OsmPoint.Action;
import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.*;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CREATE_POI;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_OPEN_OSM_NOTE;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_EDITS;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.OSM_NOTES;
import static net.osmand.plus.ContextMenuAdapter.makeDeleteAction;
@ -193,13 +198,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
}
@Override
public Class<? extends Activity> getSettingsActivity() {
return SettingsOsmEditingActivity.class;
}
@Override
public Class<? extends BaseSettingsFragment> getSettingsFragment() {
return OsmEditingFragment.class;
public SettingsScreenType getSettingsScreenType() {
return SettingsScreenType.OPEN_STREET_MAP_EDITING;
}
@Override

View file

@ -1,189 +0,0 @@
package net.osmand.plus.osmedit;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.preference.CheckBoxPreference;
import android.preference.DialogPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.github.scribejava.core.model.OAuthAsyncRequestCallback;
import com.github.scribejava.core.model.Response;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.osmedit.oauth.OsmOAuthAuthorizationAdapter;
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
import org.apache.commons.logging.Log;
import java.io.IOException;
public class SettingsOsmEditingActivity extends SettingsBaseActivity {
private OsmOAuthAuthorizationAdapter client;
private static final Log log = PlatformUtil.getLog(SettingsOsmEditingActivity.class);
@Override
public void onCreate(Bundle savedInstanceState) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
client = new OsmOAuthAuthorizationAdapter(getMyApplication());
getToolbar().setTitle(R.string.osm_settings);
@SuppressWarnings("deprecation")
PreferenceScreen grp = getPreferenceScreen();
DialogPreference loginDialogPreference = new OsmLoginDataDialogPreference(this, null);
grp.addPreference(loginDialogPreference);
CheckBoxPreference poiEdit = createCheckBoxPreference(settings.OFFLINE_EDITION,
R.string.offline_edition, R.string.offline_edition_descr);
grp.addPreference(poiEdit);
final Preference pref = new Preference(this);
pref.setTitle(R.string.local_openstreetmap_settings);
pref.setSummary(R.string.local_openstreetmap_settings_descr);
pref.setKey("local_openstreetmap_points");
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(SettingsOsmEditingActivity.this,
appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
getMyApplication().getSettings().FAVORITES_TAB.set(R.string.osm_edits);
startActivity(favorites);
return true;
}
});
grp.addPreference(pref);
final Preference prefOAuth = new Preference(this);
if (client.isValidToken()){
prefOAuth.setTitle(R.string.osm_authorization_success);
prefOAuth.setSummary(R.string.osm_authorization_success);
prefOAuth.setKey("local_openstreetmap_oauth_success");
final Preference prefClearToken = new Preference(this);
prefClearToken.setTitle(R.string.shared_string_logoff);
prefClearToken.setSummary(R.string.clear_osm_token);
prefClearToken.setKey("local_openstreetmap_oauth_clear");
prefClearToken.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
settings.USER_ACCESS_TOKEN.set("");
settings.USER_ACCESS_TOKEN_SECRET.set("");
client.resetToken();
Toast.makeText(SettingsOsmEditingActivity.this, R.string.osm_edit_logout_success, Toast.LENGTH_SHORT).show();
finish();
startActivity(getIntent());
return true;
}
});
grp.addPreference(prefClearToken);
}
else {
prefOAuth.setTitle(R.string.perform_oauth_authorization);
prefOAuth.setSummary(R.string.perform_oauth_authorization_description);
prefOAuth.setKey("local_openstreetmap_oauth_login");
prefOAuth.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
ViewGroup preferenceView = (ViewGroup)getListView().getChildAt(preference.getOrder());
client.startOAuth(preferenceView);
return true;
}
});
}
grp.addPreference(prefOAuth);
}
public class OsmLoginDataDialogPreference extends DialogPreference {
private TextView userNameEditText;
private TextView passwordEditText;
public OsmLoginDataDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setDialogLayoutResource(R.layout.osm_user_login_details);
setPositiveButtonText(android.R.string.ok);
setNegativeButtonText(android.R.string.cancel);
setDialogTitle(R.string.open_street_map_login_and_pass);
setTitle(R.string.open_street_map_login_and_pass);
setSummary(R.string.open_street_map_login_descr);
setDialogIcon(null);
}
@Override
protected void onBindDialogView(View view) {
userNameEditText = (TextView) view.findViewById(R.id.user_name_field);
userNameEditText.setText(settings.USER_NAME.get());
passwordEditText = (TextView) view.findViewById(R.id.password_field);
passwordEditText.setText(settings.USER_PASSWORD.get());
super.onBindDialogView(view);
}
@Override
protected void onDialogClosed(boolean positiveResult) {
if (positiveResult) {
settings.USER_NAME.set(userNameEditText.getText().toString());
settings.USER_PASSWORD.set(passwordEditText.getText().toString());
new ValidateOsmLoginDetailsTask(SettingsOsmEditingActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}
public static class ValidateOsmLoginDetailsTask extends AsyncTask<Void, Void, OsmBugsUtil.OsmBugResult> {
private final Context context;
public ValidateOsmLoginDetailsTask(Context context) {
this.context = context;
}
@Override
protected OsmBugsUtil.OsmBugResult doInBackground(Void... params) {
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
assert plugin != null;
OsmBugsRemoteUtil remoteUtil = plugin.getOsmNotesRemoteUtil();
return remoteUtil.validateLoginDetails();
}
@Override
protected void onPostExecute(OsmBugsUtil.OsmBugResult osmBugResult) {
String text = osmBugResult.warning != null ? osmBugResult.warning : context.getString(R.string.osm_authorization_success);
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Uri uri = intent.getData();
if (uri != null && uri.toString().startsWith("osmand-oauth")) {
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
client.authorize(oauthVerifier);
finish();
startActivity(getIntent());
}
}
}

View file

@ -0,0 +1,34 @@
package net.osmand.plus.osmedit;
import android.os.AsyncTask;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.osmedit.OsmBugsUtil.OsmBugResult;
public class ValidateOsmLoginDetailsTask extends AsyncTask<Void, Void, OsmBugResult> {
private OsmandApplication app;
public ValidateOsmLoginDetailsTask(OsmandApplication app) {
this.app = app;
}
@Override
protected OsmBugResult doInBackground(Void... params) {
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
assert plugin != null;
OsmBugsRemoteUtil remoteUtil = plugin.getOsmNotesRemoteUtil();
return remoteUtil.validateLoginDetails();
}
@Override
protected void onPostExecute(OsmBugResult osmBugResult) {
if (osmBugResult.warning != null) {
app.showToastMessage(osmBugResult.warning);
} else {
app.showToastMessage(R.string.osm_authorization_success);
}
}
}

View file

@ -27,12 +27,11 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.Version;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.importfiles.ImportHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.importfiles.ImportHelper;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.routing.RouteCalculationResult;
import net.osmand.plus.views.OsmandMapTileView;
@ -195,10 +194,6 @@ public class OsmAndAppCustomization {
return DownloadActivity.class;
}
public Class<? extends Activity> getPluginsActivity() {
return PluginsActivity.class;
}
public Class<? extends Activity> getDownloadActivity() {
return DownloadActivity.class;
}

View file

@ -12,13 +12,13 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import net.osmand.plus.osmedit.ValidateOsmLoginDetailsTask;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.osmedit.SettingsOsmEditingActivity;
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
public class OsmLoginDataBottomSheet extends BasePreferenceBottomSheet {
@ -84,7 +84,7 @@ public class OsmLoginDataBottomSheet extends BasePreferenceBottomSheet {
app.getSettings().USER_NAME.set(userNameEditText.getText().toString());
app.getSettings().USER_PASSWORD.set(passwordEditText.getText().toString());
new SettingsOsmEditingActivity.ValidateOsmLoginDetailsTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new ValidateOsmLoginDetailsTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Fragment target = getTargetFragment();
Preference preference = getPreference();

View file

@ -53,11 +53,7 @@ import com.google.android.material.snackbar.Snackbar;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibilitySettingsFragment;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
@ -69,6 +65,10 @@ import net.osmand.plus.monitoring.MonitoringSettingsFragment;
import net.osmand.plus.osmedit.OsmEditingFragment;
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment.AppModeChangedListener;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
import net.osmand.plus.settings.bottomsheets.EditTextPreferenceBottomSheet;
@ -112,7 +112,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
public enum SettingsScreenType {
MAIN_SETTINGS(MainSettingsFragment.TAG, false, null, R.xml.settings_main_screen, R.layout.global_preference_toolbar),
MAIN_SETTINGS(MainSettingsFragment.class.getName(), false, null, R.xml.settings_main_screen, R.layout.global_preference_toolbar),
GLOBAL_SETTINGS(GlobalSettingsFragment.class.getName(), false, null, R.xml.global_settings, R.layout.global_preference_toolbar),
CONFIGURE_PROFILE(ConfigureProfileFragment.class.getName(), true, null, R.xml.configure_profile, R.layout.profile_preference_toolbar_with_switch),
PROXY_SETTINGS(ProxySettingsFragment.class.getName(), false, null, R.xml.proxy_preferences, R.layout.global_preferences_toolbar_with_switch),
@ -899,9 +899,13 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
}
public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode) {
return showInstance(activity, screenType, null, new Bundle());
}
public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType,
@Nullable ApplicationMode appMode, @NonNull Bundle args) {
try {
Fragment fragment = Fragment.instantiate(activity, screenType.fragmentName);
Bundle args = new Bundle();
if (appMode != null) {
args.putString(APP_MODE_KEY, appMode.getStringKey());
}

View file

@ -1,7 +1,6 @@
package net.osmand.plus.settings.fragments;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
@ -22,13 +21,13 @@ import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication;
@ -36,14 +35,14 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityActions;
import net.osmand.plus.activities.PluginsActivity;
import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
@ -229,8 +228,7 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment {
if (holder instanceof DescriptionHolder) {
DescriptionHolder descriptionHolder = (DescriptionHolder) holder;
String plugins = getString(R.string.prefs_plugins);
setupClickableText(
descriptionHolder.description, (String) currentItem, plugins, new Intent(app, PluginsActivity.class));
setupClickableText(descriptionHolder.description, (String) currentItem, plugins);
descriptionHolder.image.setVisibility(View.GONE);
} else {
final ScreenType item = (ScreenType) currentItem;
@ -253,12 +251,15 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment {
return items.size();
}
private void setupClickableText(TextView textView, String text, String clickableText, final Intent intent) {
private void setupClickableText(TextView textView, String text, String clickableText) {
SpannableString spannableString = new SpannableString(text);
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(@NonNull View view) {
startActivity(intent);
FragmentActivity activity = getActivity();
if (activity != null) {
PluginsFragment.showInstance(activity.getSupportFragmentManager());
}
}
};
try {

View file

@ -369,7 +369,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
}
List<OsmandPlugin> plugins = OsmandPlugin.getVisiblePlugins();
for (OsmandPlugin plugin : plugins) {
if (plugin instanceof SkiMapsPlugin || plugin instanceof NauticalMapsPlugin || plugin.getSettingsFragment() == null) {
if (plugin instanceof SkiMapsPlugin || plugin instanceof NauticalMapsPlugin || plugin.getSettingsScreenType() == null) {
continue;
}
Preference preference = new Preference(ctx);
@ -379,7 +379,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
preference.setSummary(plugin.getPrefsDescription());
preference.setIcon(getContentIcon(plugin.getLogoResourceId()));
preference.setLayoutResource(R.layout.preference_with_descr);
preference.setFragment(plugin.getSettingsFragment().getName());
preference.setFragment(plugin.getSettingsScreenType().fragmentName);
preferenceCategory.addPreference(preference);
}