Merge pull request #7717 from osmandapp/DataStorage
Data Storage improvements
This commit is contained in:
commit
a29ee08874
36 changed files with 421 additions and 288 deletions
|
@ -9,7 +9,8 @@
|
|||
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
||||
android:id="@+id/edit_text_otfb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dialog_button_ex_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/dialog_button_ex_height"
|
||||
android:layout_marginTop="@dimen/text_margin_small"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
|
@ -19,10 +20,11 @@
|
|||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/text"
|
||||
android:inputType="textMultiLine|textNoSuggestions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:maxLines="10"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="Folder path ... " />
|
||||
|
||||
|
|
|
@ -2,46 +2,71 @@
|
|||
<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:background="?attr/list_background_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/card_row_min_height"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/list_background_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:src="@drawable/mm_storage_tank"
|
||||
android:tint="?attr/default_icon_color"
|
||||
tools:tint="?attr/default_icon_color" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/card_row_min_height">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="0dp"
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:src="@drawable/mm_storage_tank"
|
||||
android:tint="?attr/default_icon_color"
|
||||
tools:tint="?attr/default_icon_color" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Internal application memory" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/memory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@null"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="6.7 GB" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Internal application memory" />
|
||||
android:background="?attr/list_background_color"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/memory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="6.7 GB" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/content_padding_half" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/list_background_color">
|
||||
|
||||
<View
|
||||
android:id="@+id/topSpace"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/content_padding_half" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:focusable="false" />
|
||||
|
||||
<View
|
||||
android:id="@+id/bottomSpace"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/content_padding_half" />
|
||||
|
||||
</LinearLayout>
|
|
@ -3290,8 +3290,6 @@
|
|||
<string name="shared_string_by_default">Прадвызначана</string>
|
||||
<string name="change_data_storage_full_description">Перамясціць файлы даных OsmAnd у новае месца\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • выкарыстоўваецца %2$s Гб</string>
|
||||
<string name="data_storage_space_description">Вольна %1$s • %2$s / %3$s Гб</string>
|
||||
<string name="enter_path_to_folder">Увядзіце шлях да каталога</string>
|
||||
<string name="shared_string_select_folder">Абраць каталог</string>
|
||||
</resources>
|
|
@ -3268,8 +3268,6 @@ Abasta l\'àrea: %1$s x %2$s</string>
|
|||
<string name="route_parameters">Paràmetres de la ruta</string>
|
||||
<string name="change_data_storage_full_description">Voleu moure els arxius de dades OsmAnd a una nova destinació\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usat %2$s GB</string>
|
||||
<string name="data_storage_space_description">Lliure %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Introduïu el camí a la carpeta</string>
|
||||
<string name="shared_string_select_folder">Seleccioneu la carpeta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Enganxa el camí a la carpeta amb les dades d\'OsmAnd</string>
|
||||
|
|
|
@ -3299,8 +3299,6 @@ Repræsenterer område: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Hent detaljeret %s kort, for at se området.</string>
|
||||
<string name="change_data_storage_full_description">Flyt datafiler til den nye destination\?
|
||||
\n%1$s>%2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Anvendt %2$s GB</string>
|
||||
<string name="data_storage_space_description">Tilgængeligt %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Indtast sti til mappen</string>
|
||||
<string name="shared_string_select_folder">Vælg mappe</string>
|
||||
<string name="paste_Osmand_data_folder_path">Indsæt sti til mappen med data</string>
|
||||
|
|
|
@ -3304,8 +3304,6 @@ Abgedeckte Fläche: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Laden Sie die detaillierte %s-Karte herunter, um diesen Bereich zu sehen.</string>
|
||||
<string name="change_data_storage_full_description">OsmAnd-Datendateien an das neue Ziel verschieben\?
|
||||
\n%1 s > %2 s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Verwendet %2$s GB</string>
|
||||
<string name="data_storage_space_description">Frei %1$s GB • Insgesamt %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Geben Sie den Pfad zum Ordner ein</string>
|
||||
<string name="shared_string_select_folder">Ordner auswählen</string>
|
||||
<string name="paste_Osmand_data_folder_path">Einfügen des Pfades zum Ordner mit OsmAnd-Daten</string>
|
||||
|
|
|
@ -3274,8 +3274,6 @@ Indikas lokon: %1$s x %2$s"</string>
|
|||
<string name="download_detailed_map">Elŝutu la detalan mapon %s, por vidi tiun ĉi areon.</string>
|
||||
<string name="change_data_storage_full_description">Ĉu movi datum‑dosierojn OsmAnd al la nova loko\?
|
||||
\n%1$s → %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • uzita: %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libera: %1$s GB • Tute: %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Entajpu dosier‑indikon</string>
|
||||
<string name="shared_string_select_folder">Elektu dosierujon</string>
|
||||
<string name="paste_Osmand_data_folder_path">Algluu dosier‑indikon por dosierujo de OsmAnd‑datumoj</string>
|
||||
|
|
|
@ -3293,8 +3293,6 @@ Lon %2$s</string>
|
|||
<string name="download_detailed_map">Descarga el mapa detallado de «%s», para ver esta área.</string>
|
||||
<string name="change_data_storage_full_description">¿Mover los archivos de datos de OsmAnd al nuevo destino\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libre %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Ingresa la ruta a la carpeta</string>
|
||||
<string name="shared_string_select_folder">Elegir carpeta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Pegar la ruta a la carpeta con los datos de OsmAnd</string>
|
||||
|
|
|
@ -3294,8 +3294,6 @@ Lon %2$s</string>
|
|||
<string name="download_detailed_map">Descarga el mapa detallado de «%s», para ver esta área.</string>
|
||||
<string name="change_data_storage_full_description">¿Mover los archivos de datos de OsmAnd al nuevo destino\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libre %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Ingresa la ruta a la carpeta</string>
|
||||
<string name="shared_string_select_folder">Elegir carpeta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Pegar la ruta a la carpeta con los datos de OsmAnd</string>
|
||||
|
|
|
@ -3309,8 +3309,6 @@
|
|||
<string name="plugins_settings">Ajustes de plugin</string>
|
||||
<string name="shared_string_by_default">Por defecto</string>
|
||||
<string name="download_detailed_map">Descarga el mapa detallado de %s para ver este área.</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libre %1$s • %2$s / %3$s GB</string>
|
||||
<string name="shared_string_select_folder">Seleccionar carpeta</string>
|
||||
<string name="move_maps_to_new_destination">Mover al nuevo destino</string>
|
||||
<string name="change_data_storage_folder">Cambiar la carpeta de almacenamiento de datos</string>
|
||||
|
|
|
@ -3279,8 +3279,6 @@ Area honi dagokio: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Deskargatu %s(e)ko mapa xehetsua ingurune hau ikusteko.</string>
|
||||
<string name="change_data_storage_full_description">Eraman OsmAnd datu fitxategiak xede berrira\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Erabilita %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libre %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Sartu karpetara bidea</string>
|
||||
<string name="shared_string_select_folder">Hautatu karpeta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Itsatsi OsmAnd datuak dituen karpetara bidea</string>
|
||||
|
|
|
@ -3335,8 +3335,6 @@
|
|||
<string name="download_detailed_map">برای دیدن این منطقه، نقشهٔ باجزئیات %s را دانلود کنید.</string>
|
||||
<string name="change_data_storage_full_description">فایلهای دادهٔ OsmAnd را به مقصد جدید انتقال میدهید؟
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • %2$s گب استفاده شده</string>
|
||||
<string name="data_storage_space_description">خالی %1$s • %2$s از %3$s گب</string>
|
||||
<string name="enter_path_to_folder">مسیر پوشه را وارد کنید</string>
|
||||
<string name="shared_string_select_folder">انتخاب پوشه</string>
|
||||
<string name="paste_Osmand_data_folder_path">مسیر پوشهٔ دادههای OsmAnd را درج کنید</string>
|
||||
|
|
|
@ -3261,8 +3261,6 @@ représentant la zone : %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Télécharger la carte détaillée %s pour voir cette zone.</string>
|
||||
<string name="change_data_storage_full_description">Déplacer les fichiers de données OsmAnd vers la nouvelle destination \?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • %2$s GB utilisés</string>
|
||||
<string name="data_storage_space_description">Libre %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Saisissez le chemin du dossier</string>
|
||||
<string name="shared_string_select_folder">Sélectionner le dossier</string>
|
||||
<string name="paste_Osmand_data_folder_path">Coller le chemin du dossier contenant les données OsmAnd</string>
|
||||
|
|
|
@ -3334,8 +3334,6 @@ Lon %2$s</string>
|
|||
<string name="download_detailed_map">Baixa o mapa detallado de %s para ollar esta área.</string>
|
||||
<string name="change_data_storage_full_description">Mover os ficheiros de datos do OsmAnd ó novo destino\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Empregado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Libre %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Insire a ruta do cartafol</string>
|
||||
<string name="shared_string_select_folder">Escoller cartafol</string>
|
||||
<string name="paste_Osmand_data_folder_path">Colar ou pegar a ruta do cartafol cos datos do OsmAnd</string>
|
||||
|
|
|
@ -3279,8 +3279,6 @@
|
|||
<string name="routing_attr_freeride_policy_name">ללא מסלול</string>
|
||||
<string name="change_data_storage_full_description">להעביר את קובצי הנתונים של OsmAnd ליעד החדש\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • %2$s ג״ב מנוצלים</string>
|
||||
<string name="data_storage_space_description">%1$s ג״ב פנויים • סה״כ %2$s ג״ב</string>
|
||||
<string name="enter_path_to_folder">נא לספק נתיב לתיקייה</string>
|
||||
<string name="shared_string_select_folder">בחירת תיקייה</string>
|
||||
<string name="paste_Osmand_data_folder_path">נא להדביק את הנתיב לתיקייה עם הנתונים של OsmAnd</string>
|
||||
|
|
|
@ -3306,8 +3306,6 @@ Stendur fyrir svæði: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Sæktu nákvæma %s kortið til að skoða þetta svæði.</string>
|
||||
<string name="change_data_storage_full_description">Færa gagnaskrár OsmAnd á nýjan stað\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Notuð %2$s GB</string>
|
||||
<string name="data_storage_space_description">Laust %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Settu inn slóð á möppu</string>
|
||||
<string name="shared_string_select_folder">Veldu möppu</string>
|
||||
<string name="paste_Osmand_data_folder_path">Límdu slóð á möppuna með OsmAnd-gögnum</string>
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
<string name="configure_profile">ပရိုဖိုင်းကိုပြုပြင်မြည်</string>
|
||||
<string name="switch_profile">ပရိုဖိုင်းကိုပြောင်းလဲမည်</string>
|
||||
<string name="change_data_storage_full_description">OsmAnd အချက်အလက်ဖိုင်များကိုနေရာအသစ်သို့ရွှေ့ပါ။ \n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • သုံးပြီး %2$s GB</string>
|
||||
<string name="data_storage_space_description">"နေရာလွပ် %1$s • %2$s / %3$s GB"</string>
|
||||
<string name="enter_path_to_folder">folder ကိုရှိနေရာကိုရိုက်ထည့်ပါ</string>
|
||||
<string name="shared_string_select_folder">ဖိုလ်ဒါကိုရွေးပါ</string>
|
||||
<string name="paste_Osmand_data_folder_path">OsmAnd ဒေတာရှိသော ဖိုလ်ဒါနေရာကိုကူးထည့်ပါ</string>
|
||||
|
|
|
@ -3299,8 +3299,6 @@ Reprezentuje obszar: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Pobierz szczegółową mapę %S, aby zobaczyć ten obszar.</string>
|
||||
<string name="change_data_storage_full_description">Przenieść pliki danych OsmAnd do nowego położenia\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Zajęte %2$s GB</string>
|
||||
<string name="data_storage_space_description">Wolne %1$s GB • Ogółem %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Proszę wprowadzić ścieżkę do katalogu</string>
|
||||
<string name="shared_string_select_folder">Wybierz katalog</string>
|
||||
<string name="paste_Osmand_data_folder_path">Wklej ścieżkę do katalogu z danymi OsmAnd</string>
|
||||
|
|
|
@ -3279,8 +3279,6 @@ Pôr do Sol: %2$s</string>
|
|||
<string name="download_detailed_map">Faça o download do mapa %s detalhado, para visualizar esta área.</string>
|
||||
<string name="change_data_storage_full_description">Mover arquivos de dados OsmAnd para o novo destino\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Livre %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Digite o caminho para a pasta</string>
|
||||
<string name="shared_string_select_folder">Selecionar pasta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Cole o caminho para a pasta com os dados OsmAnd</string>
|
||||
|
|
|
@ -3290,8 +3290,6 @@
|
|||
<string name="download_detailed_map">Descarregue o mapa detalhado de %s para ver esta área.</string>
|
||||
<string name="change_data_storage_full_description">Mover ficheiros de dados OsmAnd para o novo destino\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Usado %2$s GB</string>
|
||||
<string name="data_storage_space_description">Livre %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Insira o caminho para a pasta</string>
|
||||
<string name="shared_string_select_folder">Selecionar pasta</string>
|
||||
<string name="paste_Osmand_data_folder_path">Colar caminho para a pasta com dados OsmAnd</string>
|
||||
|
|
|
@ -3300,8 +3300,6 @@ Pro praghere iscrie su còdighe intreu</string>
|
|||
<string name="download_detailed_map">Iscàrriga sa mapa de %s fata a sa minuda pro pompiare cust\'àrea.</string>
|
||||
<string name="change_data_storage_full_description">Tramudare sos datos de OsmAnd in sa destinatzione noa\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Impreados: %2$s GB</string>
|
||||
<string name="data_storage_space_description">Lìberos: %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Inserta s\'àndala pro sa cartella</string>
|
||||
<string name="shared_string_select_folder">Ischerta sa cartella</string>
|
||||
<string name="paste_Osmand_data_folder_path">Incolla s\'àndala pro sa cartella cun sos datos de OsmAnd</string>
|
||||
|
|
|
@ -3280,8 +3280,6 @@ Zodpovedá oblasti: %1$s x %2$s</string>
|
|||
<string name="download_detailed_map">Pre zobrazenie tejto oblasti si stiahnite podrobnú mapu %s.</string>
|
||||
<string name="change_data_storage_full_description">Presunúť dátové súbory OsmAnd do nového umiestnenia\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Použité %2$s GB</string>
|
||||
<string name="data_storage_space_description">Voľné %1$s • %2$s / %3$s GB</string>
|
||||
<string name="enter_path_to_folder">Zadajte cestu k priečinku</string>
|
||||
<string name="shared_string_select_folder">Zvoľte priečinok</string>
|
||||
<string name="paste_Osmand_data_folder_path">Vložte cestu k priečinku s dátami OsmAnd</string>
|
||||
|
|
|
@ -3243,8 +3243,6 @@
|
|||
\nHesaplama: %.1f sn, %d yol, %d döşeme)</string>
|
||||
<string name="change_data_storage_full_description">OsmAnd veri dosyaları yeni hedefe taşınsın mı\?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Kullanılan %2$s GB</string>
|
||||
<string name="data_storage_space_description">Boş %1$s GB • Toplam %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Klasörün yolunu girin</string>
|
||||
<string name="shared_string_select_folder">Klasör seç</string>
|
||||
<string name="paste_Osmand_data_folder_path">OsmAnd verilerinin bulunduğu klasörün yolunu yapıştırın</string>
|
||||
|
|
|
@ -3282,8 +3282,6 @@
|
|||
<string name="download_detailed_map">下載更詳細的 %s 地圖以檢視此區域。</string>
|
||||
<string name="change_data_storage_full_description">移動 OsmAnd 資料檔案到新目的地?
|
||||
\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • 已使用 %2$s GB</string>
|
||||
<string name="data_storage_space_description">剩餘 %1$s GB • 總共 %2$s GB</string>
|
||||
<string name="enter_path_to_folder">輸入到資料夾的路徑</string>
|
||||
<string name="shared_string_select_folder">選取資料夾</string>
|
||||
<string name="paste_Osmand_data_folder_path">貼上有 OsmAnd 資料的資料夾路徑</string>
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
|
||||
<string name="shared_string_memory_used_tb_desc">Used %1$s TB</string>
|
||||
<string name="shared_string_memory_used_gb_desc">Used %1$s GB</string>
|
||||
<string name="shared_string_memory_used_mb_desc">Used %1$s MB</string>
|
||||
<string name="shared_string_memory_used_kb_desc">Used %1$s kB</string>
|
||||
<string name="contour_lines_and_hillshade">Contour lines and Hillshade</string>
|
||||
<string name="routing_attr_prefer_unpaved_name">Prefer unpaved roads</string>
|
||||
<string name="routing_attr_prefer_unpaved_description">Prefer unpaved roads.</string>
|
||||
<string name="update_all_maps">Update all maps</string>
|
||||
|
@ -27,14 +33,14 @@
|
|||
<string name="shared_string_memory_tb_desc">%1$s TB</string>
|
||||
<string name="shared_string_memory_gb_desc">%1$s GB</string>
|
||||
<string name="shared_string_memory_mb_desc">%1$s MB</string>
|
||||
<string name="shared_string_memory_kb_desc">%1$s KB</string>
|
||||
<string name="shared_string_memory_kb_desc">%1$s kB</string>
|
||||
<string name="app_mode_utv">Side by Side</string>
|
||||
<string name="rendering_attr_piste_difficulty_aerialway_name">Aerialway</string>
|
||||
<string name="rendering_attr_piste_difficulty_connection_name">Connection</string>
|
||||
<string name="avoid_in_routing_descr_">Avoid certain routes and road types</string>
|
||||
<string name="change_data_storage_full_description">Move OsmAnd data files to the new destination?\n%1$s > %2$s</string>
|
||||
<string name="data_storage_preference_summary">%1$s • Used %2$s GB</string>
|
||||
<string name="data_storage_space_description">Free %1$s GB • Total %2$s GB</string>
|
||||
<string name="data_storage_preference_summary">%1$s • %2$s</string>
|
||||
<string name="data_storage_space_description">Free %1$s GB • Total %2$s GB</string>
|
||||
<string name="enter_path_to_folder">Enter path to the folder</string>
|
||||
<string name="shared_string_select_folder">Select folder</string>
|
||||
<string name="paste_Osmand_data_folder_path">Paste path to the folder with OsmAnd data</string>
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
android:icon="@drawable/ic_map"
|
||||
android:title="@string/shared_string_maps"/>
|
||||
|
||||
<Preference
|
||||
android:key="contour_lines_and_hillshade_memory"
|
||||
android:layout="@layout/data_storage_memory_used_item"
|
||||
android:icon="@drawable/ic_map"
|
||||
android:title="@string/contour_lines_and_hillshade"/>
|
||||
|
||||
<Preference
|
||||
android:key="tracks_memory_used"
|
||||
android:layout="@layout/data_storage_memory_used_item"
|
||||
|
@ -36,9 +42,6 @@
|
|||
android:layout="@layout/data_storage_memory_used_item"
|
||||
android:icon="@drawable/ic_action_folder"
|
||||
android:title="@string/shared_string_other"/>
|
||||
|
||||
<Preference
|
||||
android:layout="@layout/divider_padding_half" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="application_profiles"
|
||||
|
|
|
@ -1984,6 +1984,7 @@ public class OsmandSettings {
|
|||
public static final int EXTERNAL_STORAGE_TYPE_INTERNAL_FILE = 2; // ctx.getFilesDir()
|
||||
public static final int EXTERNAL_STORAGE_TYPE_OBB = 3; // ctx.getObbDirs
|
||||
public static final int EXTERNAL_STORAGE_TYPE_SPECIFIED = 4;
|
||||
public final OsmandPreference<Long> OSMAND_USAGE_SPACE = new LongPreference("osmand_usage_space", 0).makeGlobal();
|
||||
|
||||
|
||||
public void freezeExternalStorageDirectory() {
|
||||
|
|
|
@ -128,6 +128,7 @@ import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
|||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
|
||||
import net.osmand.plus.settings.DataStorageFragment;
|
||||
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.MapControlsLayer;
|
||||
|
@ -1868,7 +1869,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
mcl.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
if (requestCode == DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE
|
||||
if (requestCode == DataStorageFragment.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE
|
||||
&& grantResults.length > 0 && permissions.length > 0
|
||||
&& Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) {
|
||||
if (grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
Toast.makeText(this,
|
||||
R.string.missing_write_external_storage_permission,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else if (requestCode == DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE
|
||||
&& grantResults.length > 0 && permissions.length > 0
|
||||
&& Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permissions[0])) {
|
||||
permissionAsked = true;
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.annotation.SuppressLint;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -27,6 +28,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.ProgressImplementation;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.settings.bottomsheets.ChangeDataStorageBottomSheet;
|
||||
|
@ -43,16 +45,18 @@ import java.text.MessageFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import static net.osmand.plus.settings.DataStorageItemsHolder.INTERNAL_STORAGE;
|
||||
import static net.osmand.plus.settings.DataStorageItemsHolder.MANUALLY_SPECIFIED;
|
||||
import static net.osmand.plus.settings.DataStorageItemsHolder.TILES_MEMORY;
|
||||
import static net.osmand.plus.settings.DataStorageHelper.INTERNAL_STORAGE;
|
||||
import static net.osmand.plus.settings.DataStorageHelper.MANUALLY_SPECIFIED;
|
||||
import static net.osmand.plus.settings.DataStorageHelper.OTHER_MEMORY;
|
||||
import static net.osmand.plus.settings.DataStorageHelper.TILES_MEMORY;
|
||||
import static net.osmand.plus.settings.bottomsheets.ChangeDataStorageBottomSheet.CHOSEN_DIRECTORY;
|
||||
import static net.osmand.plus.settings.bottomsheets.ChangeDataStorageBottomSheet.MOVE_DATA;
|
||||
import static net.osmand.plus.settings.bottomsheets.SelectFolderBottomSheet.PATH_CHANGED;
|
||||
import static net.osmand.plus.settings.bottomsheets.SelectFolderBottomSheet.NEW_PATH;
|
||||
|
||||
public class DataStorageFragment extends BaseSettingsFragment implements DataStorageItemsHolder.UpdateMemoryInfoUIAdapter {
|
||||
|
||||
public class DataStorageFragment extends BaseSettingsFragment implements DataStorageHelper.UpdateMemoryInfoUIAdapter {
|
||||
public final static int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 500;
|
||||
|
||||
private final static String CHANGE_DIRECTORY_BUTTON = "change_directory";
|
||||
private final static String OSMAND_USAGE = "osmand_usage";
|
||||
private final static String CALCULATE_TILES_BTN_PRESSED = "calculate_tiles_btn_pressed";
|
||||
|
@ -64,11 +68,11 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
private Preference changeButton;
|
||||
private DataStorageMenuItem currentDataStorage;
|
||||
private String tmpManuallySpecifiedPath;
|
||||
private DataStorageItemsHolder itemsHolder;
|
||||
private DataStorageHelper itemsHolder;
|
||||
private boolean calculateTilesBtnPressed;
|
||||
|
||||
private DataStorageItemsHolder.RefreshMemoryUsedInfo calculateMemoryTask;
|
||||
private DataStorageItemsHolder.RefreshMemoryUsedInfo calculateTilesMemoryTask;
|
||||
private DataStorageHelper.RefreshMemoryUsedInfo calculateMemoryTask;
|
||||
private DataStorageHelper.RefreshMemoryUsedInfo calculateTilesMemoryTask;
|
||||
|
||||
private OsmandApplication app;
|
||||
private OsmandActionBarActivity activity;
|
||||
|
@ -180,7 +184,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
&& !DownloadActivity.hasPermissionToWriteExternalStorage(activity)) {
|
||||
ActivityCompat.requestPermissions(activity,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
DownloadActivity.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
|
||||
DataStorageFragment.PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
|
||||
} else if (key.equals(MANUALLY_SPECIFIED)) {
|
||||
showFolderSelectionDialog();
|
||||
} else {
|
||||
|
@ -212,6 +216,14 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
int activeColor = ContextCompat.getColor(app, activeColorResId);
|
||||
int primaryTextColorResId = isNightMode() ? R.color.text_color_primary_dark : R.color.text_color_primary_light;
|
||||
int primaryTextColor = ContextCompat.getColor(app, primaryTextColorResId);
|
||||
|
||||
String[] memoryUnitsFormats = new String[] {
|
||||
getString(R.string.shared_string_memory_kb_desc),
|
||||
getString(R.string.shared_string_memory_mb_desc),
|
||||
getString(R.string.shared_string_memory_gb_desc),
|
||||
getString(R.string.shared_string_memory_tb_desc)
|
||||
};
|
||||
|
||||
final View itemView = holder.itemView;
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
DataStorageMenuItem item = itemsHolder.getStorage(key);
|
||||
|
@ -243,7 +255,13 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
divider.setVisibility(View.VISIBLE);
|
||||
secondPart.setVisibility(View.VISIBLE);
|
||||
String space = getSpaceDescription(item.getDirectory());
|
||||
tvSummary.setText(space);
|
||||
if (!space.equals("")) {
|
||||
space = space.replaceAll(" • ", " • ");
|
||||
tvSummary.setText(space);
|
||||
tvSummary.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tvSummary.setVisibility(View.GONE);
|
||||
}
|
||||
if (currentKey.equals(INTERNAL_STORAGE)) {
|
||||
tvAdditionalDescription.setText(item.getDescription());
|
||||
} else {
|
||||
|
@ -259,12 +277,9 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
icon.setVisibility(View.INVISIBLE);
|
||||
title.setText(R.string.shared_string_change);
|
||||
} else if(key.equals(OSMAND_USAGE)) {
|
||||
long totalUsageBytes = 0;
|
||||
for (DataStorageMemoryItem mi : memoryItems) {
|
||||
totalUsageBytes += mi.getUsedMemoryBytes();
|
||||
}
|
||||
long totalUsageBytes = itemsHolder.getTotalUsedBytes();
|
||||
TextView tvSummary = itemView.findViewById(R.id.summary);
|
||||
tvSummary.setText(getFormattedMemoryUsedInfo(totalUsageBytes));
|
||||
tvSummary.setText(DataStorageHelper.getFormattedMemoryInfo(totalUsageBytes, memoryUnitsFormats));
|
||||
} else {
|
||||
for (DataStorageMemoryItem mi : memoryItems) {
|
||||
if (key.equals(mi.getKey())) {
|
||||
|
@ -285,7 +300,13 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
} else {
|
||||
tvMemory.setOnClickListener(null);
|
||||
color = primaryTextColor;
|
||||
summary = getFormattedMemoryUsedInfo(mi.getUsedMemoryBytes());
|
||||
summary = DataStorageHelper.getFormattedMemoryInfo(mi.getUsedMemoryBytes(), memoryUnitsFormats);
|
||||
}
|
||||
View divider = itemView.findViewById(R.id.divider);
|
||||
if (mi.getKey().equals(OTHER_MEMORY)) {
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
divider.setVisibility(View.GONE);
|
||||
}
|
||||
tvMemory.setTextColor(color);
|
||||
tvMemory.setText(summary);
|
||||
|
@ -416,7 +437,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
app.setExternalStorageDirectory(type, newDirectory);
|
||||
reloadData();
|
||||
if (silentRestart) {
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
MapActivity.doRestart(activity);
|
||||
} else {
|
||||
app.restartApp(activity);
|
||||
}
|
||||
|
@ -430,7 +451,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
|
||||
private void refreshDataInfo() {
|
||||
calculateTilesBtnPressed = false;
|
||||
itemsHolder = DataStorageItemsHolder.refreshInfo(app);
|
||||
itemsHolder = DataStorageHelper.refreshInfo(app);
|
||||
calculateMemoryTask = itemsHolder.calculateMemoryUsedInfo(this);
|
||||
}
|
||||
|
||||
|
@ -443,29 +464,14 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
}
|
||||
if (dir.exists()) {
|
||||
DecimalFormat formatter = new DecimalFormat("#.##");
|
||||
float freeSpace = AndroidUtils.getFreeSpaceGb(dir);
|
||||
float totalSpace = AndroidUtils.getTotalSpaceGb(dir);
|
||||
if (freeSpace < 0 || totalSpace < 0) {
|
||||
return "";
|
||||
}
|
||||
return String.format(getString(R.string.data_storage_space_description),
|
||||
formatter.format(AndroidUtils.getFreeSpaceGb(dir)),
|
||||
formatter.format(AndroidUtils.getTotalSpaceGb(dir)));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getFormattedMemoryUsedInfo(long bytes) {
|
||||
int type = 1;
|
||||
double used = (double) bytes / 1024;
|
||||
while (used > 1024) {
|
||||
++type;
|
||||
used = used / 1024;
|
||||
}
|
||||
String formattedUsed = new DecimalFormat("#.##").format(used);
|
||||
if (type == 1) {
|
||||
return String.format(getString(R.string.shared_string_memory_kb_desc), formattedUsed);
|
||||
} else if (type == 2) {
|
||||
return String.format(getString(R.string.shared_string_memory_mb_desc), formattedUsed);
|
||||
} else if (type == 3){
|
||||
return String.format(getString(R.string.shared_string_memory_gb_desc), formattedUsed);
|
||||
} else if (type == 4){
|
||||
return String.format(getString(R.string.shared_string_memory_tb_desc), formattedUsed);
|
||||
formatter.format(freeSpace),
|
||||
formatter.format(totalSpace));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -477,6 +483,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
|||
@Override
|
||||
public void onMemoryInfoUpdate() {
|
||||
updateAllSettings();
|
||||
app.getSettings().OSMAND_USAGE_SPACE.set(itemsHolder.getTotalUsedBytes());
|
||||
}
|
||||
|
||||
public static class MoveFilesToDifferentDirectory extends AsyncTask<Void, Void, Boolean> {
|
||||
|
|
|
@ -12,9 +12,14 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DataStorageItemsHolder implements Parcelable {
|
||||
import static net.osmand.plus.settings.DataStorageMemoryItem.Directory;
|
||||
import static net.osmand.plus.settings.DataStorageMemoryItem.EXTENSIONS;
|
||||
import static net.osmand.plus.settings.DataStorageMemoryItem.PREFIX;
|
||||
|
||||
public class DataStorageHelper implements Parcelable {
|
||||
public final static String INTERNAL_STORAGE = "internal_storage";
|
||||
public final static String EXTERNAL_STORAGE = "external_storage";
|
||||
public final static String SHARED_STORAGE = "shared_storage";
|
||||
|
@ -22,6 +27,7 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
public final static String MANUALLY_SPECIFIED = "manually_specified";
|
||||
|
||||
public final static String MAPS_MEMORY = "maps_memory_used";
|
||||
public final static String SRTM_AND_HILLSHADE_MEMORY = "contour_lines_and_hillshade_memory";
|
||||
public final static String TRACKS_MEMORY = "tracks_memory_used";
|
||||
public final static String NOTES_MEMORY = "notes_memory_used";
|
||||
public final static String TILES_MEMORY = "tiles_memory_used";
|
||||
|
@ -33,6 +39,7 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
|
||||
private ArrayList<DataStorageMemoryItem> memoryItems = new ArrayList<>();
|
||||
private DataStorageMemoryItem mapsMemory;
|
||||
private DataStorageMemoryItem srtmAndHillshadeMemory;
|
||||
private DataStorageMemoryItem tracksMemory;
|
||||
private DataStorageMemoryItem notesMemory;
|
||||
private DataStorageMemoryItem tilesMemory;
|
||||
|
@ -41,12 +48,12 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
private int currentStorageType;
|
||||
private String currentStoragePath;
|
||||
|
||||
private DataStorageItemsHolder(OsmandApplication app) {
|
||||
private DataStorageHelper(OsmandApplication app) {
|
||||
prepareData(app);
|
||||
}
|
||||
|
||||
public static DataStorageItemsHolder refreshInfo(OsmandApplication app) {
|
||||
return new DataStorageItemsHolder(app);
|
||||
public static DataStorageHelper refreshInfo(OsmandApplication app) {
|
||||
return new DataStorageHelper(app);
|
||||
}
|
||||
|
||||
private void prepareData(OsmandApplication app) {
|
||||
|
@ -169,35 +176,47 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
private void initMemoryUsed(OsmandApplication app) {
|
||||
mapsMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(MAPS_MEMORY)
|
||||
.setExtensions(IndexConstants.BINARY_MAP_INDEX_EXT, IndexConstants.BINARY_MAP_INDEX_EXT_ZIP)
|
||||
.setExtensions(IndexConstants.BINARY_MAP_INDEX_EXT)
|
||||
.setDirectories(
|
||||
app.getAppPath(IndexConstants.MAPS_PATH).getAbsolutePath(),
|
||||
app.getAppPath(IndexConstants.ROADS_INDEX_DIR).getAbsolutePath(),
|
||||
app.getAppPath(IndexConstants.SRTM_INDEX_DIR).getAbsolutePath(),
|
||||
app.getAppPath(IndexConstants.WIKI_INDEX_DIR).getAbsolutePath(),
|
||||
app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR).getAbsolutePath(),
|
||||
app.getAppPath(IndexConstants.BACKUP_INDEX_DIR).getAbsolutePath())
|
||||
new Directory(app.getAppPath(IndexConstants.MAPS_PATH).getAbsolutePath(), false, EXTENSIONS, false),
|
||||
new Directory(app.getAppPath(IndexConstants.ROADS_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false),
|
||||
new Directory(app.getAppPath(IndexConstants.WIKI_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false),
|
||||
new Directory(app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false),
|
||||
new Directory(app.getAppPath(IndexConstants.BACKUP_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false))
|
||||
.createItem();
|
||||
memoryItems.add(mapsMemory);
|
||||
|
||||
srtmAndHillshadeMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(SRTM_AND_HILLSHADE_MEMORY)
|
||||
.setExtensions(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT)
|
||||
.setDirectories(
|
||||
new Directory(app.getAppPath(IndexConstants.SRTM_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false),
|
||||
new Directory(app.getAppPath(IndexConstants.TILES_INDEX_DIR).getAbsolutePath(), false, PREFIX, true))
|
||||
.setPrefixes("Hillshade")
|
||||
.createItem();
|
||||
memoryItems.add(srtmAndHillshadeMemory);
|
||||
|
||||
tracksMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(TRACKS_MEMORY)
|
||||
// .setExtensions(".gpx", ".gpx.bz2")
|
||||
.setDirectories(app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath())
|
||||
.setDirectories(
|
||||
new Directory(app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false))
|
||||
.createItem();
|
||||
memoryItems.add(tracksMemory);
|
||||
|
||||
notesMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(NOTES_MEMORY)
|
||||
// .setExtensions("")
|
||||
.setDirectories(app.getAppPath(IndexConstants.AV_INDEX_DIR).getAbsolutePath())
|
||||
.setDirectories(
|
||||
new Directory(app.getAppPath(IndexConstants.AV_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false))
|
||||
.createItem();
|
||||
memoryItems.add(notesMemory);
|
||||
|
||||
tilesMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(TILES_MEMORY)
|
||||
// .setExtensions("")
|
||||
.setDirectories(app.getAppPath(IndexConstants.TILES_INDEX_DIR).getAbsolutePath())
|
||||
.setDirectories(
|
||||
new Directory(app.getAppPath(IndexConstants.TILES_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false))
|
||||
.createItem();
|
||||
memoryItems.add(tilesMemory);
|
||||
|
||||
|
@ -255,14 +274,14 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
|
||||
public RefreshMemoryUsedInfo calculateMemoryUsedInfo(UpdateMemoryInfoUIAdapter listener) {
|
||||
File rootDir = new File(currentStoragePath);
|
||||
RefreshMemoryUsedInfo task = new RefreshMemoryUsedInfo(listener, otherMemory, rootDir, tilesMemory.getDirectories());
|
||||
task.execute(mapsMemory, tracksMemory, notesMemory);
|
||||
RefreshMemoryUsedInfo task = new RefreshMemoryUsedInfo(listener, otherMemory, rootDir, null, null);
|
||||
task.execute(mapsMemory, srtmAndHillshadeMemory, tracksMemory, notesMemory);
|
||||
return task;
|
||||
}
|
||||
|
||||
public RefreshMemoryUsedInfo calculateTilesMemoryUsed(UpdateMemoryInfoUIAdapter listener) {
|
||||
File rootDir = new File(tilesMemory.getDirectories()[0]);
|
||||
RefreshMemoryUsedInfo task = new RefreshMemoryUsedInfo(listener, otherMemory, rootDir);
|
||||
File rootDir = new File(tilesMemory.getDirectories()[0].getAbsolutePath());
|
||||
RefreshMemoryUsedInfo task = new RefreshMemoryUsedInfo(listener, otherMemory, rootDir, null, srtmAndHillshadeMemory.getPrefixes());
|
||||
task.execute(tilesMemory);
|
||||
return task;
|
||||
}
|
||||
|
@ -272,77 +291,123 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
private File rootDir;
|
||||
private DataStorageMemoryItem otherMemory;
|
||||
private String[] directoriesToAvoid;
|
||||
private String[] prefixesToAvoid;
|
||||
|
||||
public RefreshMemoryUsedInfo(UpdateMemoryInfoUIAdapter listener, DataStorageMemoryItem otherMemory, File rootDir, String... directoriesToAvoid) {
|
||||
public RefreshMemoryUsedInfo(UpdateMemoryInfoUIAdapter listener, DataStorageMemoryItem otherMemory, File rootDir, String[] directoriesToAvoid, String[] prefixesToAvoid) {
|
||||
this.listener = listener;
|
||||
this.otherMemory = otherMemory;
|
||||
this.rootDir = rootDir;
|
||||
this.directoriesToAvoid = directoriesToAvoid;
|
||||
this.prefixesToAvoid = prefixesToAvoid;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(DataStorageMemoryItem... items) {
|
||||
if (items.length == 1) {
|
||||
DataStorageMemoryItem item = items[0];
|
||||
item.addBytes(getDirectorySize(rootDir, item.getExtensions()));
|
||||
} else {
|
||||
calculateMultiTypes(items);
|
||||
if (rootDir.canRead()) {
|
||||
calculateMultiTypes(rootDir, items);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void calculateMultiTypes(DataStorageMemoryItem[] items) {
|
||||
File[] files = rootDir.listFiles();
|
||||
private void calculateMultiTypes(File rootDir, DataStorageMemoryItem... items) {
|
||||
File[] subFiles = rootDir.listFiles();
|
||||
|
||||
for (File f : files) {
|
||||
boolean matched = false;
|
||||
if (f.isDirectory()) {
|
||||
boolean avoid = false;
|
||||
for (String directoryToAvoid : directoriesToAvoid) {
|
||||
if (f.getAbsolutePath().equals(directoryToAvoid)) {
|
||||
avoid = true;
|
||||
break;
|
||||
for (File file : subFiles) {
|
||||
if (isCancelled()) {
|
||||
break;
|
||||
}
|
||||
nextFile : {
|
||||
if (file.isDirectory()) {
|
||||
//check current directory should be avoid
|
||||
if (directoriesToAvoid != null) {
|
||||
for (String directoryToAvoid : directoriesToAvoid) {
|
||||
if (file.getAbsolutePath().equals(directoryToAvoid)) {
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!avoid) {
|
||||
//check current directory matched items type
|
||||
for (DataStorageMemoryItem item : items) {
|
||||
String[] directories = item.getDirectories();
|
||||
if (directories != null) {
|
||||
for (String directory : directories) {
|
||||
if (f.getAbsolutePath().equals(directory)) {
|
||||
item.addBytes(getDirectorySize(f, item.getExtensions()));
|
||||
matched = true;
|
||||
break;
|
||||
Directory[] directories = item.getDirectories();
|
||||
if (directories == null) {
|
||||
continue;
|
||||
}
|
||||
for (Directory dir : directories) {
|
||||
if (file.getAbsolutePath().equals(dir.getAbsolutePath())
|
||||
|| (file.getAbsolutePath().startsWith(dir.getAbsolutePath()) && dir.isGoDeeper())) {
|
||||
calculateMultiTypes(file, items);
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
//current directory did not match to any type
|
||||
otherMemory.addBytes(getDirectorySize(file));
|
||||
} else if (file.isFile()) {
|
||||
//check current file should be avoid
|
||||
if (prefixesToAvoid != null) {
|
||||
for (String prefixToAvoid : prefixesToAvoid) {
|
||||
if (file.getName().toLowerCase().startsWith(prefixToAvoid.toLowerCase())) {
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
//check current file matched items type
|
||||
for (DataStorageMemoryItem item : items) {
|
||||
Directory[] directories = item.getDirectories();
|
||||
if (directories == null) {
|
||||
continue;
|
||||
}
|
||||
for (Directory dir : directories) {
|
||||
if (rootDir.getAbsolutePath().equals(dir.getAbsolutePath())
|
||||
|| (rootDir.getAbsolutePath().startsWith(dir.getAbsolutePath()) && dir.isGoDeeper())) {
|
||||
int checkingType = dir.getCheckingType();
|
||||
switch (checkingType) {
|
||||
case EXTENSIONS : {
|
||||
String[] extensions = item.getExtensions();
|
||||
if (extensions != null) {
|
||||
for (String extension : extensions) {
|
||||
if (file.getAbsolutePath().endsWith(extension)) {
|
||||
item.addBytes(file.length());
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.addBytes(file.length());
|
||||
break nextFile;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
case PREFIX : {
|
||||
String[] prefixes = item.getPrefixes();
|
||||
if (prefixes != null) {
|
||||
for (String prefix : prefixes) {
|
||||
if (file.getName().toLowerCase().startsWith(prefix.toLowerCase())) {
|
||||
item.addBytes(file.length());
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.addBytes(file.length());
|
||||
break nextFile;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (dir.isSkipOther()) {
|
||||
break nextFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
otherMemory.addBytes(getDirectorySize(f, null));
|
||||
}
|
||||
//current file did not match any type
|
||||
otherMemory.addBytes(file.length());
|
||||
}
|
||||
} else if (f.isFile()) {
|
||||
for (DataStorageMemoryItem item : items) {
|
||||
String[] extensions = item.getExtensions();
|
||||
if (extensions != null) {
|
||||
for (String extension : extensions) {
|
||||
if (f.getAbsolutePath().endsWith(extension)) {
|
||||
item.addBytes(f.length());
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
otherMemory.addBytes(f.length());
|
||||
}
|
||||
publishProgress();
|
||||
}
|
||||
publishProgress();
|
||||
}
|
||||
}
|
||||
|
||||
private long getDirectorySize(File dir, String[] extensions) {
|
||||
private long getDirectorySize(File dir) {
|
||||
long bytes = 0;
|
||||
if (dir.isDirectory()) {
|
||||
File[] files = dir.listFiles();
|
||||
|
@ -351,26 +416,9 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
break;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
bytes += getDirectorySize(file, extensions);
|
||||
bytes += getDirectorySize(file);
|
||||
} else if (file.isFile()) {
|
||||
//check file extension
|
||||
boolean matched = false;
|
||||
if (extensions != null) {
|
||||
for (String extension : extensions) {
|
||||
if (file.getName().endsWith(extension)) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
matched = true;
|
||||
}
|
||||
if (matched) {
|
||||
bytes += file.length();
|
||||
} else {
|
||||
otherMemory.addBytes(file.length());
|
||||
}
|
||||
publishProgress();
|
||||
bytes += file.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,6 +442,28 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
}
|
||||
}
|
||||
|
||||
public long getTotalUsedBytes() {
|
||||
long total = 0;
|
||||
if (memoryItems != null && memoryItems.size() > 0) {
|
||||
for (DataStorageMemoryItem mi : memoryItems) {
|
||||
total += mi.getUsedMemoryBytes();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static String getFormattedMemoryInfo(long bytes, String[] formatStrings) {
|
||||
int type = 0;
|
||||
double memory = (double) bytes / 1024;
|
||||
while (memory > 1024 && type < formatStrings.length) {
|
||||
++type;
|
||||
memory = memory / 1024;
|
||||
}
|
||||
String formattedUsed = new DecimalFormat("#.##").format(memory);
|
||||
return String.format(formatStrings[type], formattedUsed);
|
||||
}
|
||||
|
||||
public interface UpdateMemoryInfoUIAdapter {
|
||||
|
||||
void onMemoryInfoUpdate();
|
||||
|
@ -405,7 +475,7 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private DataStorageItemsHolder(Parcel in) {
|
||||
private DataStorageHelper(Parcel in) {
|
||||
menuItems = in.readArrayList(DataStorageMenuItem.class.getClassLoader());
|
||||
currentDataStorage = in.readParcelable(DataStorageMenuItem.class.getClassLoader());
|
||||
memoryItems = in.readArrayList(DataStorageMemoryItem.class.getClassLoader());
|
||||
|
@ -422,16 +492,16 @@ public class DataStorageItemsHolder implements Parcelable {
|
|||
dest.writeString(currentStoragePath);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DataStorageItemsHolder> CREATOR = new Parcelable.Creator<DataStorageItemsHolder>() {
|
||||
public static final Parcelable.Creator<DataStorageHelper> CREATOR = new Parcelable.Creator<DataStorageHelper>() {
|
||||
|
||||
@Override
|
||||
public DataStorageItemsHolder createFromParcel(Parcel source) {
|
||||
return new DataStorageItemsHolder(source);
|
||||
public DataStorageHelper createFromParcel(Parcel source) {
|
||||
return new DataStorageHelper(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStorageItemsHolder[] newArray(int size) {
|
||||
return new DataStorageItemsHolder[size];
|
||||
public DataStorageHelper[] newArray(int size) {
|
||||
return new DataStorageHelper[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -4,14 +4,19 @@ import android.os.Parcel;
|
|||
import android.os.Parcelable;
|
||||
|
||||
public class DataStorageMemoryItem implements Parcelable {
|
||||
public final static int EXTENSIONS = 0;
|
||||
public final static int PREFIX = 1;
|
||||
|
||||
private String key;
|
||||
private String[] extensions;
|
||||
private String[] directories;
|
||||
private String[] prefixes;
|
||||
private Directory[] directories;
|
||||
private long usedMemoryBytes;
|
||||
|
||||
private DataStorageMemoryItem(String key, String[] extensions, long usedMemoryBytes, String[] directories) {
|
||||
private DataStorageMemoryItem(String key, String[] extensions, String[] prefixes, long usedMemoryBytes, Directory[] directories) {
|
||||
this.key = key;
|
||||
this.extensions = extensions;
|
||||
this.prefixes = prefixes;
|
||||
this.usedMemoryBytes = usedMemoryBytes;
|
||||
this.directories = directories;
|
||||
}
|
||||
|
@ -19,7 +24,8 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
private DataStorageMemoryItem(Parcel in) {
|
||||
key = in.readString();
|
||||
in.readStringArray(extensions);
|
||||
in.readStringArray(directories);
|
||||
in.writeStringArray(prefixes);
|
||||
directories = (Directory[]) in.readArray(Directory.class.getClassLoader());
|
||||
usedMemoryBytes = in.readLong();
|
||||
}
|
||||
|
||||
|
@ -35,10 +41,6 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
this.key = key;
|
||||
}
|
||||
|
||||
public void setUsedMemoryBytes(long usedMemoryBytes) {
|
||||
this.usedMemoryBytes = usedMemoryBytes;
|
||||
}
|
||||
|
||||
public static DataStorageMemoryItemBuilder builder() {
|
||||
return new DataStorageMemoryItemBuilder();
|
||||
}
|
||||
|
@ -47,16 +49,16 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
return extensions;
|
||||
}
|
||||
|
||||
public void setExtensions(String[] extensions) {
|
||||
this.extensions = extensions;
|
||||
public String[] getPrefixes() {
|
||||
return prefixes;
|
||||
}
|
||||
|
||||
public String[] getDirectories() {
|
||||
public Directory[] getDirectories() {
|
||||
return directories;
|
||||
}
|
||||
|
||||
public void setDirectories(String[] directories) {
|
||||
this.directories = directories;
|
||||
public void addBytes(long bytes) {
|
||||
this.usedMemoryBytes += bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +70,8 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(key);
|
||||
dest.writeStringArray(extensions);
|
||||
dest.writeStringArray(directories);
|
||||
dest.writeStringArray(prefixes);
|
||||
dest.writeArray(directories);
|
||||
dest.writeLong(usedMemoryBytes);
|
||||
}
|
||||
|
||||
|
@ -88,7 +91,8 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
public static class DataStorageMemoryItemBuilder {
|
||||
private String key;
|
||||
private String[] extensions;
|
||||
private String[] directories;
|
||||
private String[] prefixes;
|
||||
private Directory[] directories;
|
||||
private long usedMemoryBytes;
|
||||
|
||||
public DataStorageMemoryItemBuilder setKey(String key) {
|
||||
|
@ -100,8 +104,13 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
this.extensions = extensions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataStorageMemoryItemBuilder setPrefixes(String ... prefixes) {
|
||||
this.prefixes = prefixes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataStorageMemoryItemBuilder setDirectories(String ... directories) {
|
||||
public DataStorageMemoryItemBuilder setDirectories(Directory ... directories) {
|
||||
this.directories = directories;
|
||||
return this;
|
||||
}
|
||||
|
@ -112,11 +121,70 @@ public class DataStorageMemoryItem implements Parcelable {
|
|||
}
|
||||
|
||||
public DataStorageMemoryItem createItem() {
|
||||
return new DataStorageMemoryItem(key, extensions, usedMemoryBytes, directories);
|
||||
return new DataStorageMemoryItem(key, extensions, prefixes, usedMemoryBytes, directories);
|
||||
}
|
||||
}
|
||||
|
||||
public void addBytes(long bytes) {
|
||||
this.usedMemoryBytes += bytes;
|
||||
public static class Directory implements Parcelable {
|
||||
private String absolutePath;
|
||||
private boolean goDeeper;
|
||||
private int checkingType;
|
||||
private boolean skipOther;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(absolutePath);
|
||||
dest.writeInt(goDeeper ? 1 : 0);
|
||||
dest.writeInt(checkingType);
|
||||
dest.writeInt(skipOther ? 1 : 0);
|
||||
}
|
||||
|
||||
public Directory(String absolutePath, boolean goDeeper, int checkingType, boolean skipOther) {
|
||||
this.absolutePath = absolutePath;
|
||||
this.goDeeper = goDeeper;
|
||||
this.checkingType = checkingType;
|
||||
this.skipOther = skipOther;
|
||||
}
|
||||
|
||||
public String getAbsolutePath() {
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
public boolean isGoDeeper() {
|
||||
return goDeeper;
|
||||
}
|
||||
|
||||
public int getCheckingType() {
|
||||
return checkingType;
|
||||
}
|
||||
|
||||
public boolean isSkipOther() {
|
||||
return skipOther;
|
||||
}
|
||||
|
||||
private Directory(Parcel in) {
|
||||
absolutePath = in.readString();
|
||||
goDeeper = in.readInt() == 1;
|
||||
checkingType = in.readInt();
|
||||
skipOther = in.readInt() == 1;
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Directory> CREATOR = new Parcelable.Creator<Directory>() {
|
||||
|
||||
@Override
|
||||
public Directory createFromParcel(Parcel source) {
|
||||
return new Directory(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory[] newArray(int size) {
|
||||
return new Directory[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.support.v7.preference.Preference;
|
|||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.util.Pair;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -17,9 +16,6 @@ import net.osmand.plus.dialogs.SendAnalyticsBottomSheetDialogFragment;
|
|||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
||||
public class GlobalSettingsFragment extends BaseSettingsFragment implements SendAnalyticsBottomSheetDialogFragment.OnSendAnalyticsPrefsUpdate, OnPreferenceChanged {
|
||||
|
||||
|
@ -141,14 +137,25 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
|
|||
Preference externalStorageDir = (Preference) findPreference(OsmandSettings.EXTERNAL_STORAGE_DIR);
|
||||
externalStorageDir.setIcon(getContentIcon(R.drawable.ic_action_folder));
|
||||
|
||||
DataStorageItemsHolder holder = DataStorageItemsHolder.refreshInfo(app);
|
||||
DataStorageHelper holder = DataStorageHelper.refreshInfo(app);
|
||||
DataStorageMenuItem currentStorage = holder.getCurrentStorage();
|
||||
File dir = new File(currentStorage.getDirectory());
|
||||
DecimalFormat formatter = new DecimalFormat("#.##");
|
||||
String summary = String.format(getString(R.string.data_storage_preference_summary),
|
||||
currentStorage.getTitle(),
|
||||
formatter.format(AndroidUtils.getUsedSpaceGb(dir)));
|
||||
externalStorageDir.setSummary(summary);
|
||||
long totalUsed = app.getSettings().OSMAND_USAGE_SPACE.get();
|
||||
if (totalUsed > 0) {
|
||||
String[] usedMemoryFormats = new String[] {
|
||||
getString(R.string.shared_string_memory_used_kb_desc),
|
||||
getString(R.string.shared_string_memory_used_mb_desc),
|
||||
getString(R.string.shared_string_memory_used_gb_desc),
|
||||
getString(R.string.shared_string_memory_used_tb_desc)
|
||||
};
|
||||
String sTotalUsed = DataStorageHelper.getFormattedMemoryInfo(totalUsed, usedMemoryFormats);
|
||||
String summary = String.format(getString(R.string.data_storage_preference_summary),
|
||||
currentStorage.getTitle(),
|
||||
sTotalUsed);
|
||||
summary = summary.replaceAll(" • ", " • ");
|
||||
externalStorageDir.setSummary(summary);
|
||||
} else {
|
||||
externalStorageDir.setSummary(currentStorage.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSendAnonymousDataPref() {
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.commons.logging.Log;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import static net.osmand.plus.settings.DataStorageItemsHolder.MANUALLY_SPECIFIED;
|
||||
import static net.osmand.plus.settings.DataStorageHelper.MANUALLY_SPECIFIED;
|
||||
|
||||
public class ChangeDataStorageBottomSheet extends BasePreferenceBottomSheet {
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ public class SelectFolderBottomSheet extends BasePreferenceBottomSheet {
|
|||
protected void onRightBottomButtonClick() {
|
||||
Fragment fragment = getTargetFragment();
|
||||
if (fragment instanceof BaseSettingsFragment) {
|
||||
String newPath = editText.getText().toString();
|
||||
String newPath = editText.getText().toString().trim();
|
||||
if (!newPath.equals("")) {
|
||||
boolean pathChanged = !newPath.equals(currentPath);
|
||||
Bundle bundle = new Bundle();
|
||||
|
|
|
@ -1278,21 +1278,25 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (grantResults.length > 0) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION:
|
||||
onNavigationClick();
|
||||
break;
|
||||
case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION:
|
||||
navigateButton();
|
||||
break;
|
||||
case REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION:
|
||||
addDestination(requestedLatLon);
|
||||
break;
|
||||
if ((requestCode == REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION
|
||||
|| requestCode == REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION
|
||||
|| requestCode == REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION)) {
|
||||
if (grantResults.length > 0) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_LOCATION_FOR_NAVIGATION_PERMISSION:
|
||||
onNavigationClick();
|
||||
break;
|
||||
case REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION:
|
||||
navigateButton();
|
||||
break;
|
||||
case REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION:
|
||||
addDestination(requestedLatLon);
|
||||
break;
|
||||
}
|
||||
} else if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
|
||||
app.showToastMessage(R.string.ask_for_location_permission);
|
||||
}
|
||||
} else if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
|
||||
app.showToastMessage(R.string.ask_for_location_permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue