Merge pull request #8450 from osmandapp/plugins_prefs_fixes

Plugins prefs fixes
This commit is contained in:
vshcherb 2020-02-13 15:40:01 +01:00 committed by GitHub
commit ad41588386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 294 additions and 115 deletions

View file

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:ellipsize="end"
android:gravity="bottom"
android:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:minHeight="@dimen/bottom_sheet_title_height"

View file

@ -6,7 +6,7 @@
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="@dimen/route_info_list_text_padding">
android:paddingBottom="@dimen/dialog_button_height">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"

View file

@ -27,15 +27,18 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/dialog_content_margin"
android:paddingLeft="@dimen/dialog_content_margin">
android:layout_marginStart="@dimen/dialog_content_margin"
android:layout_marginLeft="@dimen/dialog_content_margin"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding_small"
android:layout_marginBottom="@dimen/content_padding_small"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/content_padding_small"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/permission_is_required" />
@ -47,7 +50,6 @@
android:letterSpacing="@dimen/description_letter_spacing"
android:maxLines="1"
android:paddingTop="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_small"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"

View file

@ -3379,9 +3379,6 @@
<string name="monitoring_min_speed">الحد الأدنى للسرعة</string>
<string name="monitoring_min_accuracy">دقة الحد الأدنى</string>
<string name="monitoring_min_distance">الحد الأدنى للإزاحة</string>
<string name="tracks_view_path">القائمة - الأماكن الخاصة بي - المسارات</string>
<string name="multimedia_notes_view_path">القائمة - الأماكن الخاصة بي - ملاحظات</string>
<string name="osm_edits_view_path">القائمة - أماكني - تعديلات OSM</string>
<string name="reset_plugin_to_default">إعادة تعيين إعدادات البرنامج المساعد الافتراضي</string>
<string name="multimedia_rec_split_title">تقسيم المسجل</string>
<string name="multimedia_use_system_camera">استخدام تطبيق النظام</string>

View file

@ -3466,9 +3466,6 @@ Lon %2$s</string>
<string name="monitoring_min_speed">Mindesttempo</string>
<string name="monitoring_min_accuracy">Minimale Genauigkeit</string>
<string name="monitoring_min_distance">Minimale Verschiebung</string>
<string name="tracks_view_path">\'Menü → Meine Orte → Tracks\'</string>
<string name="multimedia_notes_view_path">\'Menü → Meine Orte → Notizen\'</string>
<string name="osm_edits_view_path">\'Menü → Meine Orte → OSM-Änderungen\'</string>
<string name="reset_plugin_to_default">Plugin-Einstellungen auf Voreinstellung zurücksetzen</string>
<string name="osm_authorization_success">Autorisierung ist erfolgreich</string>
<string name="shared_string_available">Verfügbar</string>

View file

@ -3456,9 +3456,6 @@
<string name="monitoring_min_speed">Ελάχιστη ταχύτητα</string>
<string name="monitoring_min_accuracy">Ελάχιστη ακρίβεια</string>
<string name="monitoring_min_distance">Ελάχιστη μετατόπιση</string>
<string name="tracks_view_path">Μενού — Οι τοποθεσίες μου — Ίχνη</string>
<string name="multimedia_notes_view_path">Μενού — Οι τοποθεσίες μου — Σημειώσεις</string>
<string name="osm_edits_view_path">Μενού — Οι τοποθεσίες μου — Επεξεργασίες OSM</string>
<string name="reset_plugin_to_default">Επαναφορά ρυθμίσεων προσθέτου στην προεπιλογή</string>
<string name="multimedia_rec_split_title">Καταγραφή διαίρεσης</string>
<string name="multimedia_use_system_camera">Χρήση εφαρμογής συστήματος</string>

View file

@ -3447,9 +3447,6 @@ Indikas lokon: %1$s x %2$s"</string>
<string name="monitoring_min_speed">Minimuma rapido</string>
<string name="monitoring_min_accuracy">Minimuma precizo</string>
<string name="monitoring_min_distance">Minimuma delokiĝo</string>
<string name="tracks_view_path">menuo → miaj ejoj → spuroj</string>
<string name="multimedia_notes_view_path">menuo → mia ejoj → notoj</string>
<string name="osm_edits_view_path">menuo → miaj ejoj → OSMredaktoj</string>
<string name="reset_plugin_to_default">Restarigi implicitajn agordojn de kromprogramo</string>
<string name="multimedia_rec_split_title">Dividilo de registraĵoj</string>
<string name="multimedia_use_system_camera">Uzi sisteman aplikaĵon</string>

View file

@ -3475,9 +3475,6 @@ Lon %2$s</string>
<string name="monitoring_min_speed">Velocidad mínima</string>
<string name="monitoring_min_accuracy">Precisión mínima</string>
<string name="monitoring_min_distance">Desplazamiento mínimo</string>
<string name="tracks_view_path">Menú → Mis sitios → Trazas</string>
<string name="multimedia_notes_view_path">Menú → Mis sitios → Notas multimedia</string>
<string name="osm_edits_view_path">Menú → Mis sitios → Ediciones de OSM</string>
<string name="reset_plugin_to_default">Restablecer ajustes del complemento a valores predefinidos</string>
<string name="multimedia_rec_split_title">División de grabación</string>
<string name="multimedia_use_system_camera">Usar la aplicación del sistema</string>

View file

@ -3474,9 +3474,6 @@ Lon %2$s</string>
<string name="monitoring_min_speed">Velocidad mínima</string>
<string name="monitoring_min_accuracy">Precisión mínima</string>
<string name="monitoring_min_distance">Desplazamiento mínimo</string>
<string name="tracks_view_path">Menú — Mis sitios — Trazas</string>
<string name="multimedia_notes_view_path">Menú — Mis sitios — Notas</string>
<string name="osm_edits_view_path">Menú — Mis sitios — Ediciones de OSM</string>
<string name="reset_plugin_to_default">Restablecer ajustes del complemento a valores predefinidos</string>
<string name="multimedia_rec_split_title">División de grabación</string>
<string name="multimedia_use_system_camera">Usar la aplicación del sistema</string>

View file

@ -3400,9 +3400,6 @@
<string name="monitoring_min_speed">Vähim kiirus</string>
<string name="monitoring_min_accuracy">Vähim täpsus</string>
<string name="monitoring_min_distance">Vähim kõrvalekalle</string>
<string name="tracks_view_path">Menüü — Minu kohad — Rajad</string>
<string name="multimedia_notes_view_path">Menüü — Minu kohad — Märkmed</string>
<string name="osm_edits_view_path">Menüü — Minu kohad — OSM Muudatused</string>
<string name="reset_plugin_to_default">Lähtesta lisaprogrammi seaded vaikeväärtustele</string>
<string name="multimedia_rec_split_title">Salvesti jagamine</string>
<string name="multimedia_use_system_camera">Kasuta süsteemi rakendust</string>

View file

@ -3472,9 +3472,6 @@
<string name="monitoring_min_speed">کمترین سرعت</string>
<string name="monitoring_min_accuracy">کمترین صحت</string>
<string name="monitoring_min_distance">کمترین جابجایی</string>
<string name="tracks_view_path">منو — مکان‌های من — ردها</string>
<string name="multimedia_notes_view_path">منو — مکان‌های من — یادداشت‌ها</string>
<string name="osm_edits_view_path">منو — مکان‌های من — ویرایش‌های OSM</string>
<string name="reset_plugin_to_default">بازنشانی تنظیمات افزونه به پیشفرض</string>
<string name="button_rate">امتیاز بدهید</string>
<string name="monitoring_prefs_descr">ناوبری، صحت ردنگاری</string>

View file

@ -3448,9 +3448,6 @@ représentant la zone : %1$s x %2$s</string>
<string name="monitoring_min_accuracy_descr">Seuls les points mesurés avec un minimum de précision en mètres/pieds (information communiquée par votre puce GPS) seront enregistrés. La précision fait référence à la dispersion de plusieurs mesures successives et n\'est pas directement liée à la distance entre ces mesures et votre position réelle.</string>
<string name="monitoring_min_accuracy_descr_side_effect">Effet secondaire : avec le filtrage par précision certains points peuvent manquer ; par exemple : sous un pont, en forêt, entre de hauts bâtiments ou dans certaines conditions météorologiques.</string>
<string name="monitoring_min_accuracy_descr_remark">Remarque : si la localisation GPS est activée juste avant le début d\'enregistrement, la première position peut être imprécise. L\'application pourrait attendre quelques secondes avant d\'enregistrer un point (ou enregistrer le meilleur de 3 points successifs, etc), mais ces évolutions ne sont pas encore disponibles.</string>
<string name="tracks_view_path">Menu &gt; Mes lieux favoris &gt; Traces</string>
<string name="multimedia_notes_view_path">Menu &gt; Mes lieux favoris &gt; Notes</string>
<string name="osm_edits_view_path">Menu &gt; Mes lieux favoris &gt; Modifications OSM</string>
<string name="monitoring_min_speed_descr_remark">Remarque : vérification de vitesse &gt; 0. La plupart des puces GPS fournissent une vitesse uniquement lorsque vous êtes en mouvement. Par conséquent, l\'indication du paramètre &gt; 0 pour ce filtre utilise la détection de mouvement par la puce GPS. Mais même s\'il n\'est pas filtré ici au moment de l\'enregistrement, nous utilisons toujours cette fonctionnalité dans notre analyse des traces GPX pour déterminer la distance corrigée, c\'est-à-dire que la valeur affichée dans ce champ est la distance enregistrée en déplacement.</string>
<string name="monitoring_min_distance_descr_side_effect">Effet secondaire : les périodes de repos ne seront pas enregistrées ou seulement par un point. De petits mouvements, comme des pas sur le côté, pourront être ignorés. Votre fichier contiendra moins d\'informations exploitables en post-traitement et aura des statistiques moins exactes (éliminant les points redondants mais conservant les erreurs de position dues à une mauvaise réception ou aux artefacts de la puce GPS).</string>
<string name="shared_string_available">Disponible</string>

View file

@ -3525,9 +3525,6 @@ Lon %2$s</string>
<string name="monitoring_min_speed">Velocidade mínima</string>
<string name="monitoring_min_accuracy">Precisión mínima</string>
<string name="monitoring_min_distance">Desprazamiento mínimo</string>
<string name="tracks_view_path">Menú — Os meus lugares — Pistas</string>
<string name="multimedia_notes_view_path">Menú — Os meus lugares — Notas</string>
<string name="osm_edits_view_path">Menú — Os meus lugares — Edicións do OSM</string>
<string name="reset_plugin_to_default">Restabelecer a configuración do plugin ós valores por defecto</string>
<string name="multimedia_rec_split_title">División de gravación</string>
<string name="multimedia_use_system_camera">Empregar aplicación do sistema</string>

View file

@ -3472,9 +3472,6 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="monitoring_min_speed">Lágmarkshraði</string>
<string name="monitoring_min_accuracy">Lágmarksnákvæmni</string>
<string name="monitoring_min_distance">Minnsta hreyfing</string>
<string name="tracks_view_path">Valmynd — Staðirnir mínir — Ferlar</string>
<string name="multimedia_notes_view_path">Valmynd — Staðirnir mínir — Minnispunktar</string>
<string name="osm_edits_view_path">Valmynd — Staðirnir mínir — OSM-breytingar</string>
<string name="reset_plugin_to_default">Frumstilla stillingar viðbótar á sjálfgefin gildi</string>
<string name="multimedia_rec_split_title">Uppskipting upptöku</string>
<string name="multimedia_use_system_camera">Nota kerfisforrit</string>

View file

@ -3474,9 +3474,6 @@ POIの更新は利用できません</string>
<string name="app_mode_osm">OSM</string>
<string name="select_nav_icon_descr">ナビゲーションまたは移動中にアイコンが表示されます。</string>
<string name="select_map_icon_descr">静止時にアイコンが表示されます</string>
<string name="tracks_view_path">メニュー — ブックマーク — 経路</string>
<string name="multimedia_notes_view_path">メニュー — ブックマーク — メモ</string>
<string name="osm_edits_view_path">メニュー — ブックマーク — OSM編集</string>
<string name="reset_plugin_to_default">プラグイン設定を初期値に戻す</string>
<string name="multimedia_rec_split_title">記録を分割</string>
<string name="multimedia_use_system_camera">システムアプリを使用</string>

View file

@ -3456,9 +3456,6 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="monitoring_min_distance_descr">Ten filtr zapobiega zapisywaniu zduplikowanych punktów, w których mógł wystąpić zbyt mały rzeczywisty ruch, zapewnia ładniejszy przestrzenny wygląd ścieżek, które nie są później przetwarzane.</string>
<string name="search_offline_geo_error">Nie można przeanalizować intencji geograficznej \'%s\'.</string>
<string name="multimedia_notes_view_descr">Twoje uwagi OSM są w %1$s.</string>
<string name="tracks_view_path">Menu — Miejsca — Ślady</string>
<string name="multimedia_notes_view_path">Menu — Miejsca — Uwagi</string>
<string name="osm_edits_view_path">Menu — Miejsca — Edycje OSM</string>
<string name="osm_authorization_success">Autoryzacja zakończyła się pomyślnie</string>
<string name="monitoring_min_speed_descr_side_effect">Efekt uboczny: Twoja trasa nie będzie zawierać sekcji, w których nie zostało spełnione kryterium minimalnej prędkości (np. gdy pchałeś rower pod strome wzgórze). Również nie będzie informacji o okresach odpoczynku, np. przerwach. Ma to efekt na analizy i przetwarzanie końcowe, np. przy próbie określenia całkowitej długości wycieczki, czasu w ruchu lub średniej prędkości.</string>
<string name="rearrange_categories">Zmień układ kategorii</string>

View file

@ -3462,9 +3462,6 @@ Pôr do Sol: %2$s</string>
<string name="monitoring_min_speed">Velocidade mínima</string>
<string name="monitoring_min_accuracy">Precisão mínima</string>
<string name="monitoring_min_distance">Deslocamento mínimo</string>
<string name="tracks_view_path">Menu - Meus lugares - Faixas</string>
<string name="multimedia_notes_view_path">Menu - Meus lugares - Notas</string>
<string name="osm_edits_view_path">Menu - Meus lugares - Edições OSM</string>
<string name="reset_plugin_to_default">Redefinir as configurações do plug-in para o padrão</string>
<string name="multimedia_rec_split_title">Divisão do gravador</string>
<string name="multimedia_use_system_camera">Usar aplicativo do sistema</string>

View file

@ -3459,9 +3459,6 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="monitoring_min_speed">Lestresa mìnima</string>
<string name="monitoring_min_accuracy">Acuradesa mìnima</string>
<string name="monitoring_min_distance">Movimentu mìnimu</string>
<string name="tracks_view_path">Menù — Logos meos — Rastas</string>
<string name="multimedia_notes_view_path">Menù — Logos meos — Notas</string>
<string name="osm_edits_view_path">Menù — Logos meos — Modìficas de OSM</string>
<string name="reset_plugin_to_default">Riprìstina sas impostatziones predefinidas de s\'estensione</string>
<string name="multimedia_use_system_camera">Imprea s\'aplicatzione de sistema</string>
<string name="multimedia_photo_play_sound">Sonu de s\'oturadore de sa fotocàmera</string>

View file

@ -3445,9 +3445,6 @@ Zodpovedá oblasti: %1$s x %2$s</string>
<string name="monitoring_min_speed">Minimálna rýchlosť</string>
<string name="monitoring_min_accuracy">Minimálna presnosť</string>
<string name="monitoring_min_distance">Minimálny posun</string>
<string name="tracks_view_path">Menu — Moje miesta — Stopy</string>
<string name="multimedia_notes_view_path">Menu — Moje miesta — Poznámky</string>
<string name="osm_edits_view_path">Menu — Moje miesta — Zmeny v OSM</string>
<string name="reset_plugin_to_default">Resetovať modul do východzieho stavu</string>
<string name="multimedia_rec_split_title">Rozdelenie nahrávania</string>
<string name="multimedia_use_system_camera">Použiť systémovú aplikáciu</string>

View file

@ -3465,9 +3465,6 @@
<string name="monitoring_min_speed">Минимална брзина</string>
<string name="monitoring_min_accuracy">Минимална прецизност</string>
<string name="monitoring_min_distance">Минимални померај</string>
<string name="tracks_view_path">Мени — Моја места — Стазе</string>
<string name="multimedia_notes_view_path">Мени — Моја места — Белешке</string>
<string name="osm_edits_view_path">Мени — Моја места — OSM измене</string>
<string name="reset_plugin_to_default">Ресетуј поставке додатака на подразумеване вредности</string>
<string name="multimedia_rec_split_title">Издељивање снимања</string>
<string name="multimedia_use_system_camera">Користи системску апликацију</string>

View file

@ -3430,9 +3430,6 @@
<string name="monitoring_min_speed">Minimum hız</string>
<string name="monitoring_min_accuracy">Minimum doğruluk</string>
<string name="monitoring_min_distance">Minimum yer değiştirme</string>
<string name="tracks_view_path">Menü — Yerlerim — İzlenen yollar</string>
<string name="multimedia_notes_view_path">Menü — Yerlerim — Notlar</string>
<string name="osm_edits_view_path">Menü — Yerlerim — OSM Düzenlemeleri</string>
<string name="reset_plugin_to_default">Eklenti ayarlarını varsayılana sıfırla</string>
<string name="multimedia_rec_split_title">Kaydedici bölmesi</string>
<string name="multimedia_use_system_camera">Sistem uygulamasını kullan</string>

View file

@ -3465,9 +3465,6 @@
<string name="monitoring_min_speed">Найменша швидкість</string>
<string name="monitoring_min_accuracy">Найменша точність</string>
<string name="monitoring_min_distance">Найменше зміщення</string>
<string name="tracks_view_path">Меню - Мої місця - Треки</string>
<string name="multimedia_notes_view_path">Меню — Мої місця — Примітки</string>
<string name="osm_edits_view_path">Меню — Мої місця — OSM правки</string>
<string name="reset_plugin_to_default">Скинути налаштування втулка до усталених</string>
<string name="multimedia_rec_split_title">Розділений записувач</string>
<string name="multimedia_use_system_camera">Використовувати системний застосунок</string>

View file

@ -3465,9 +3465,6 @@
<string name="monitoring_min_speed">最低速度</string>
<string name="monitoring_min_accuracy">最低精密度</string>
<string name="monitoring_min_distance">最小偏移</string>
<string name="tracks_view_path">選單 — 我的收藏 — 軌跡</string>
<string name="multimedia_notes_view_path">選單 — 我的收藏 — 註記</string>
<string name="osm_edits_view_path">選單 — 我的收藏 — OSM 編輯</string>
<string name="reset_plugin_to_default">重設外掛程式設定為預設值</string>
<string name="multimedia_rec_split_title">記錄器分黎</string>
<string name="multimedia_use_system_camera">使用系統應用程式</string>

View file

@ -11,6 +11,11 @@
Thx - Hardy
-->
<string name="open_settings">Open settings</string>
<string name="plugin_disabled">Plugin disabled</string>
<string name="plugin_disabled_descr">This plugin is a separate application, you will need to remove it separately if you no longer plan to use it.\n\nThe plugin will remain on the device after removing OsmAnd.</string>
<string name="shared_string_menu">Menu</string>
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
<string name="routing_profile_direct_to">Direct-to-point</string>
<string name="clear_recorded_data">Clear recorded data</string>
<string name="release_3_6">
@ -66,9 +71,6 @@
<string name="monitoring_min_speed">Minimum speed</string>
<string name="monitoring_min_accuracy">Minimum accuracy</string>
<string name="monitoring_min_distance">Minimum displacement</string>
<string name="tracks_view_path">Menu — My places — Tracks</string>
<string name="multimedia_notes_view_path">Menu — My places — Notes</string>
<string name="osm_edits_view_path">Menu — My places — OSM Edits</string>
<string name="reset_plugin_to_default">Reset plugin settings to default</string>
<string name="multimedia_rec_split_title">Recorder split</string>
<string name="multimedia_use_system_camera">Use system app</string>

View file

@ -12,10 +12,10 @@
android:title="@string/accessibility_mode_disabled" />
<net.osmand.plus.settings.preferences.ListPreferenceEx
android:icon="@drawable/ic_action_android"
android:key="accessibility_mode"
android:layout="@layout/preference_with_descr"
android:title="@string/accessibility_mode"
tools:icon="@drawable/ic_action_android"
tools:summary="@string/accessibility_default" />
<net.osmand.plus.settings.preferences.ListPreferenceEx

View file

@ -4,6 +4,7 @@ package net.osmand;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
@ -158,6 +159,10 @@ public class AndroidUtils {
}
}
public static boolean isIntentSafe(Context context, Intent intent) {
return intent.resolveActivity(context.getPackageManager()) != null;
}
public static Spannable replaceCharsWithIcon(String text, Drawable icon, String[] chars) {
Spannable spannable = new SpannableString(text);
for (String entry : chars) {

View file

@ -14,6 +14,7 @@ import android.support.v7.preference.PreferenceViewHolder;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import net.osmand.AndroidUtils;
@ -126,6 +127,7 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
ListPreferenceEx accessibilityMode = (ListPreferenceEx) findPreference(settings.ACCESSIBILITY_MODE.getId());
accessibilityMode.setEntries(entries);
accessibilityMode.setEntryValues(entryValues);
accessibilityMode.setIcon(getPersistentPrefIcon(R.drawable.ic_action_android));
accessibilityMode.setDescription(R.string.accessibility_mode_descr);
}
@ -222,7 +224,8 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
@Override
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
super.onBindPreferenceViewHolder(preference, holder);
if (ACCESSIBILITY_OPTIONS.equals(preference.getKey())) {
String prefId = preference.getKey();
if (ACCESSIBILITY_OPTIONS.equals(prefId)) {
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
if (selectableView != null) {
int color = AndroidUtils.getColorFromAttr(app, R.attr.activity_background_color);
@ -240,6 +243,12 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) selectableView.getLayoutParams();
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(app, 6), params.rightMargin, params.bottomMargin);
}
} else if (settings.ACCESSIBILITY_MODE.getId().equals(prefId)) {
ImageView imageView = (ImageView) holder.findViewById(android.R.id.icon);
if (imageView != null) {
boolean enabled = preference.isEnabled() && app.accessibilityEnabledForMode(getSelectedAppMode());
imageView.setEnabled(enabled);
}
}
}

View file

@ -24,9 +24,9 @@ import net.osmand.plus.activities.TabActivity.TabItem;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.PluginDisabledBottomSheet;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapillary.MapillaryPlugin;
@ -166,6 +166,15 @@ public abstract class OsmandPlugin {
}
}
public void showDisableDialog(@Nullable Activity activity) {
if (activity instanceof FragmentActivity) {
FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
if (fragmentManager != null) {
PluginDisabledBottomSheet.showInstance(fragmentManager, getId(), activity instanceof MapActivity);
}
}
}
public void disable(OsmandApplication app) {
}
@ -247,7 +256,7 @@ public abstract class OsmandPlugin {
private static boolean updateMarketPlugin(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins, @NonNull OsmandPlugin plugin) {
boolean marketEnabled = Version.isMarketEnabled(app);
boolean pckg = checkPluginPackage(app, plugin);
boolean pckg = plugin.pluginAvailable(app);
boolean paid = plugin.isPaid();
if ((Version.isDeveloperVersion(app) || !Version.isProductionVersion(app)) && !paid) {
// for test reasons
@ -276,7 +285,7 @@ public abstract class OsmandPlugin {
public static void checkInstalledMarketPlugins(@NonNull OsmandApplication app, @Nullable Activity activity) {
Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
for (OsmandPlugin plugin : OsmandPlugin.getMarketPlugins()) {
if (plugin.getInstallURL() != null && checkPluginPackage(app, plugin)) {
if (plugin.getInstallURL() != null && plugin.pluginAvailable(app)) {
plugin.onInstall(app, activity);
initPlugin(app, plugin);
}
@ -284,13 +293,12 @@ public abstract class OsmandPlugin {
}
}
private static boolean checkPluginPackage(OsmandApplication app, OsmandPlugin plugin) {
return plugin.checkPluginPackage(app);
protected boolean pluginAvailable(OsmandApplication app) {
return checkPluginPackage(app, this);
}
protected boolean checkPluginPackage(OsmandApplication app) {
return isPackageInstalled(getComponentId1(), app) || isPackageInstalled(getComponentId2(), app);
public static boolean checkPluginPackage(@NonNull OsmandApplication app, @NonNull OsmandPlugin plugin) {
return isPackageInstalled(plugin.getComponentId1(), app) || isPackageInstalled(plugin.getComponentId2(), app);
}
public static boolean enablePlugin(@Nullable Activity activity, OsmandApplication app, OsmandPlugin plugin, boolean enable) {
@ -306,7 +314,8 @@ public abstract class OsmandPlugin {
plugin.setActive(false);
}
app.getSettings().enablePlugin(plugin.getId(), enable);
if (activity != null && activity instanceof MapActivity) {
if (activity != null) {
if (activity instanceof MapActivity) {
final MapActivity mapActivity = (MapActivity) activity;
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
mapActivity.getDashboard().refreshDashboardFragments();
@ -320,6 +329,15 @@ public abstract class OsmandPlugin {
}
}
}
if (plugin.isMarketPlugin()) {
if (plugin.isActive()) {
plugin.showInstallDialog(activity);
} else if (OsmandPlugin.checkPluginPackage(app, plugin)) {
plugin.showDisableDialog(activity);
}
}
}
return true;
}

View file

@ -20,10 +20,11 @@ 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 {
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";
@ -214,4 +215,9 @@ public class PluginActivity extends OsmandActionBarActivity implements Download
}
}
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
updateState();
}
}

View file

@ -21,11 +21,12 @@ import net.osmand.aidl.ConnectedApp;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
import net.osmand.plus.download.DownloadIndexesThread;
import java.util.ArrayList;
public class PluginsActivity extends OsmandListActivity implements DownloadIndexesThread.DownloadEvents {
public class PluginsActivity extends OsmandListActivity implements DownloadIndexesThread.DownloadEvents, PluginInstalledBottomSheetDialog.PluginStateListener {
public static final int ACTIVE_PLUGINS_LIST_MODIFIED = 1;
@ -80,9 +81,6 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
listModified = true;
}
getListAdapter().notifyDataSetChanged();
if (plugin.isActive() && plugin.isMarketPlugin()) {
plugin.showInstallDialog(this);
}
}
}
@ -119,6 +117,11 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
}
}
@Override
public void onPluginStateChanged(OsmandPlugin plugin) {
getListAdapter().notifyDataSetChanged();
}
protected class PluginsListAdapter extends ArrayAdapter<Object> {
PluginsListAdapter() {
@ -200,7 +203,7 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
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});
TypedArray attributes = getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}

View file

@ -62,6 +62,7 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
private static final Log log = PlatformUtil.getLog(MultimediaNotesFragment.class);
private static final String OPEN_NOTES_DESCRIPTION = "open_notes_description";
private static final String CAMERA_PERMISSION = "camera_permission";
private static final String COPY_PLUGIN_SETTINGS = "copy_plugin_settings";
private static final String RESET_TO_DEFAULT = "reset_to_default";
@ -244,9 +245,13 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
}
private void setupPhotoPlaySoundPref(Camera cam, AudioVideoNotesPlugin plugin) {
Drawable disabled = getContentIcon(R.drawable.ic_action_music_off);
Drawable enabled = getActiveIcon(R.drawable.ic_type_audio);
Drawable icon = getPersistentPrefIcon(enabled, disabled);
SwitchPreferenceEx photoPlaySound = (SwitchPreferenceEx) findPreference(plugin.AV_PHOTO_PLAY_SOUND.getId());
photoPlaySound.setDescription(getString(R.string.av_photo_play_sound_descr));
photoPlaySound.setIcon(getPersistentPrefIcon(R.drawable.ic_action_music_off));
photoPlaySound.setIcon(icon);
photoPlaySound.setEnabled(cam != null);
}
@ -376,7 +381,10 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
}
private void setupOpenNotesDescrPref() {
String multimediaNotesPath = getString(R.string.multimedia_notes_view_path);
String menu = getString(R.string.shared_string_menu);
String myPlaces = getString(R.string.shared_string_my_places);
String notes = getString(R.string.notes);
String multimediaNotesPath = getString(R.string.ltr_or_rtl_triple_combine_via_dash, menu, myPlaces, notes);
String multimediaNotesPathDescr = getString(R.string.multimedia_notes_view_descr, multimediaNotesPath);
int startIndex = multimediaNotesPathDescr.indexOf(multimediaNotesPath);
@ -384,7 +392,7 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
Typeface typeface = FontCache.getRobotoMedium(getContext());
titleSpan.setSpan(new CustomTypefaceSpan(typeface), startIndex, startIndex + multimediaNotesPath.length(), 0);
Preference osmEditsDescription = findPreference("open_notes_description");
Preference osmEditsDescription = findPreference(OPEN_NOTES_DESCRIPTION);
osmEditsDescription.setTitle(titleSpan);
}
@ -444,7 +452,8 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
@Override
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
super.onBindPreferenceViewHolder(preference, holder);
if (CAMERA_PERMISSION.equals(preference.getKey())) {
String prefId = preference.getKey();
if (CAMERA_PERMISSION.equals(prefId)) {
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
if (selectableView != null) {
int color = AndroidUtils.getColorFromAttr(app, R.attr.activity_background_color);
@ -460,6 +469,9 @@ public class MultimediaNotesFragment extends BaseSettingsFragment implements Cop
AndroidUtils.setBackground(selectableView, bgDrawable);
}
}
} else if (OPEN_NOTES_DESCRIPTION.equals(prefId)) {
int minHeight = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_list_item_height);
holder.itemView.setMinimumHeight(minHeight);
}
}

View file

@ -32,7 +32,7 @@ public class BottomSheetItemTitleWithDescrAndButton extends BottomSheetItemWithD
int position,
Drawable icon,
Drawable background,
String title,
CharSequence title,
@ColorRes int titleColorId,
CharSequence description,
@ColorRes int descriptionColorId,

View file

@ -37,7 +37,7 @@ public class BottomSheetItemWithCompoundButton extends BottomSheetItemWithDescri
int position,
Drawable icon,
Drawable background,
String title,
CharSequence title,
@ColorRes int titleColorId,
CharSequence description,
@ColorRes int descriptionColorId,

View file

@ -30,7 +30,7 @@ public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
int position,
Drawable icon,
Drawable background,
String title,
CharSequence title,
@ColorRes int titleColorId,
CharSequence description,
@ColorRes int descriptionColorId,

View file

@ -17,7 +17,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
private Drawable background;
private Drawable icon;
protected String title;
protected CharSequence title;
@ColorRes
protected int titleColorId = INVALID_ID;
@ -32,7 +32,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
int position,
Drawable icon,
Drawable background,
String title,
CharSequence title,
@ColorRes int titleColorId) {
super(customView, layoutId, tag, disabled, onClickListener, position);
this.icon = icon;
@ -83,7 +83,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
protected Drawable icon;
protected Drawable background;
protected String title;
protected CharSequence title;
@ColorRes
protected int titleColorId = INVALID_ID;
@ -97,7 +97,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
return this;
}
public Builder setTitle(String title) {
public Builder setTitle(CharSequence title) {
this.title = title;
return this;
}

View file

@ -0,0 +1,147 @@
package net.osmand.plus.dialogs;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.text.SpannableString;
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.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import org.apache.commons.logging.Log;
import static net.osmand.plus.OsmandPlugin.PLUGIN_ID_KEY;
public class PluginDisabledBottomSheet extends MenuBottomSheetDialogFragment {
public static final String TAG = PluginDisabledBottomSheet.class.getName();
private static final Log LOG = PlatformUtil.getLog(PluginDisabledBottomSheet.class);
private String pluginId;
@Override
public void createMenuItems(Bundle savedInstanceState) {
final OsmandApplication app = getMyApplication();
Context context = getContext();
if (context == null || app == null) {
return;
}
if (savedInstanceState != null) {
pluginId = savedInstanceState.getString(PLUGIN_ID_KEY);
} else {
Bundle args = getArguments();
if (args != null) {
pluginId = args.getString(PLUGIN_ID_KEY);
}
}
OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);
if (plugin == null) {
return;
}
BaseBottomSheetItem titleItem = new TitleItem.Builder()
.setTitle(getString(R.string.plugin_disabled))
.setLayoutId(R.layout.bottom_sheet_item_title_big)
.create();
items.add(titleItem);
Typeface typeface = FontCache.getRobotoMedium(getContext());
SpannableString pluginTitleSpan = new SpannableString(plugin.getName());
pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
.setTitle(pluginTitleSpan)
.setTitleColorId(nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light)
.setIcon(getContentIcon(R.drawable.ic_extension_dark))
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
.create();
items.add(pluginTitle);
BaseBottomSheetItem descrItem = new SimpleBottomSheetItem.Builder()
.setTitle(getString(R.string.plugin_disabled_descr))
.setLayoutId(R.layout.bottom_sheet_item_title_long)
.create();
items.add(descrItem);
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.open_settings;
}
@Override
protected void onRightBottomButtonClick() {
OsmandApplication app = getMyApplication();
Intent intent = getPluginSettingsIntent();
if (app != null && AndroidUtils.isIntentSafe(app, intent)) {
startActivity(intent);
}
dismiss();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(PLUGIN_ID_KEY, pluginId);
}
private Intent getPluginSettingsIntent() {
Intent intent = null;
OsmandApplication app = getMyApplication();
OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);
if (plugin != null && app != null) {
String installedPackage = null;
if (OsmandPlugin.isPackageInstalled(plugin.getComponentId1(), app)) {
installedPackage = plugin.getComponentId1();
}
if (OsmandPlugin.isPackageInstalled(plugin.getComponentId2(), app)) {
installedPackage = plugin.getComponentId2();
}
if (installedPackage != null) {
intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromParts("package", installedPackage, null);
intent.setData(uri);
}
}
return intent;
}
public static void showInstance(@NonNull FragmentManager fm, String pluginId, Boolean usedOnMap) {
try {
Bundle args = new Bundle();
args.putString(PLUGIN_ID_KEY, pluginId);
PluginDisabledBottomSheet dialog = new PluginDisabledBottomSheet();
dialog.setArguments(args);
dialog.setUsedOnMap(usedOnMap);
dialog.show(fm, PluginDisabledBottomSheet.TAG);
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
}
}

View file

@ -2,9 +2,11 @@ package net.osmand.plus.dialogs;
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
import android.text.SpannableString;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -29,7 +31,9 @@ import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
import org.apache.commons.logging.Log;
@ -79,8 +83,12 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
.create();
items.add(titleItem);
Typeface typeface = FontCache.getRobotoMedium(getContext());
SpannableString pluginTitleSpan = new SpannableString(plugin.getName());
pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
.setTitle(plugin.getName())
.setTitle(pluginTitleSpan)
.setTitleColorId(nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light)
.setIcon(getContentIcon(R.drawable.ic_extension_dark))
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
@ -162,6 +170,20 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
return R.string.shared_string_turn_off;
}
@Override
protected void onDismissButtonClickAction() {
OsmandApplication app = getMyApplication();
OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);
if (app != null && plugin != null) {
Activity activity = getActivity();
OsmandPlugin.enablePlugin(activity, app, plugin, false);
if (activity instanceof PluginStateListener) {
((PluginStateListener) activity).onPluginStateChanged(plugin);
}
}
}
@Override
protected int getRightBottomButtonTextId() {
return R.string.shared_string_ok;
@ -307,4 +329,10 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
LOG.error("showInstance", e);
}
}
public interface PluginStateListener {
void onPluginStateChanged(OsmandPlugin plugin);
}
}

View file

@ -229,7 +229,10 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment
}
private void setupOpenNotesDescrPref() {
String tracksPath = getString(R.string.tracks_view_path);
String menu = getString(R.string.shared_string_menu);
String myPlaces = getString(R.string.shared_string_my_places);
String tracks = getString(R.string.shared_string_tracks);
String tracksPath = getString(R.string.ltr_or_rtl_triple_combine_via_dash, menu, myPlaces, tracks);
String tracksPathDescr = getString(R.string.tracks_view_descr, tracksPath);
int startIndex = tracksPathDescr.indexOf(tracksPath);

View file

@ -78,7 +78,10 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer
}
private void setupOsmEditsDescrPref() {
String osmEditsPath = getString(R.string.osm_edits_view_path);
String menu = getString(R.string.shared_string_menu);
String myPlaces = getString(R.string.shared_string_my_places);
String osmEdits = getString(R.string.osm_edits);
String osmEditsPath = getString(R.string.ltr_or_rtl_triple_combine_via_dash, menu, myPlaces, osmEdits);
String osmEditsPathDescr = getString(R.string.osm_edits_view_descr, osmEditsPath);
int startIndex = osmEditsPathDescr.indexOf(osmEditsPath);

View file

@ -118,6 +118,7 @@ public class NavigationFragment extends BaseSettingsFragment {
}
bundle.putString(DIALOG_TYPE, TYPE_NAV_PROFILE);
dialog.setArguments(bundle);
dialog.setUsedOnMap(false);
if (getActivity() != null) {
getActivity().getSupportFragmentManager().beginTransaction()
.add(dialog, "select_nav_type").commitAllowingStateLoss();

View file

@ -53,7 +53,7 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet {
RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout);
if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams();
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 19), params.rightMargin, params.bottomMargin);
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 9), params.rightMargin, params.bottomMargin);
}
items.add(new SimpleBottomSheetItem.Builder().setCustomView(view).create());

View file

@ -89,8 +89,8 @@ public class SRTMPlugin extends OsmandPlugin {
}
@Override
protected boolean checkPluginPackage(OsmandApplication app) {
return super.checkPluginPackage(app) || InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
protected boolean pluginAvailable(OsmandApplication app) {
return super.pluginAvailable(app) || InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
}
@Override