Design fixes: Added dialog to clear update files.
This commit is contained in:
parent
fb437260d0
commit
86a465c291
18 changed files with 73 additions and 34 deletions
|
@ -25,4 +25,5 @@
|
|||
<string name="tag_poi_name">name</string>
|
||||
<string name="hint_tag">Tag</string>
|
||||
<string name="hint_value">Value</string>
|
||||
<string name="clear_updates_proposition_message">"You can remove downloaded updates and free "</string>
|
||||
</resources>
|
||||
|
|
|
@ -157,17 +157,24 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="16dp">
|
||||
android:layout_marginRight="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sizeTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"
|
||||
tools:text="Updates: 65NB"/>
|
||||
android:text="@string/updates_size"/>
|
||||
<TextView
|
||||
android:id="@+id/sizeTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
tools:text="64NB"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -2081,6 +2081,6 @@
|
|||
<string name="impassable_road_desc">Выберыце дарогі, якія вы хочаце пазьбягаць падчас навігацыі</string>
|
||||
<string name="update_date_pattern">Абнаўленьне: %s</string>
|
||||
<string name="update_time">Час абнаўленьня</string>
|
||||
<string name="updates_size_pattern">Абнаўленьні: %s</string>
|
||||
<string name="updates_size">Абнаўленьні: %s</string>
|
||||
<string name="last_map_change">Апошняя зьмена мапы: %s</string>
|
||||
</resources>
|
||||
|
|
|
@ -2029,6 +2029,6 @@
|
|||
<string name="rec_split_clip_length_desc">Всеки записан видео клип ще бъде ограничен от този размер</string>
|
||||
<string name="rec_split_storage_size">Място за съхранение</string>
|
||||
<string name="rec_split_storage_size_desc">Големина на определената за видео клипове памет</string>
|
||||
<string name="updates_size_pattern">Актуализации: %s</string>
|
||||
<string name="updates_size">Актуализации: %s</string>
|
||||
<string name="last_map_change">Последна промяна на картата: %s</string>
|
||||
</resources>
|
||||
|
|
|
@ -1893,7 +1893,7 @@ Per retornar a l\'estil habitual dels mapes d\'OsmAnd, només cal desactivar aqu
|
|||
<string name="select_voice_provider">Seleccioneu guiatge de veu</string>
|
||||
<string name="select_voice_provider_descr">Seleccioneu o baixeu el guiatge de veu per al vostre idioma</string>
|
||||
<string name="last_update">Darrera actualització: %s</string>
|
||||
<string name="updates_size_pattern">Actualitzacions: %s</string>
|
||||
<string name="updates_size">Actualitzacions: %s</string>
|
||||
<string name="last_map_change">Darrer canvi del mapa: %s</string>
|
||||
<string name="rec_split_storage_size">Mida per l\'emmagatzematge</string>
|
||||
</resources>
|
||||
|
|
|
@ -2203,7 +2203,7 @@
|
|||
<string name="update_date_pattern">Opdateret: %s</string>
|
||||
<string name="update_time">Opdateringstidspunkt</string>
|
||||
<string name="size_pattern">Størrelse: %s</string>
|
||||
<string name="updates_size_pattern">Opdateringer: %s</string>
|
||||
<string name="updates_size">Opdateringer: %s</string>
|
||||
<string name="last_map_change">Sidste kortændring: %s</string>
|
||||
<string name="rec_split">Optager opdel</string>
|
||||
<string name="rec_split_title">Brug optager opdel</string>
|
||||
|
|
|
@ -2064,7 +2064,7 @@
|
|||
<string name="last_update">Letzte Aktualisierung: %s</string>
|
||||
<string name="update_date_pattern">Aktualisierung: %s</string>
|
||||
<string name="update_time">Aktualisierungszeitpunkt</string>
|
||||
<string name="updates_size_pattern">Aktualisierungen: %s</string>
|
||||
<string name="updates_size">Aktualisierungen: %s</string>
|
||||
<string name="last_map_change">Letzte Kartenänderung: %s</string>
|
||||
<string name="rec_split_storage_size_desc">Menge des Speicherplatzes, der von allen aufgezeichneten Clips belegt werden kann</string>
|
||||
<string name="rec_split_desc">Clips neu schreiben, wenn der benutzte Platz den Speicherplatz überschreitet</string>
|
||||
|
|
|
@ -2030,7 +2030,7 @@
|
|||
<string name="rec_split_clip_length_desc">La duración de cada clip grabado, no excederá el tiempo de intervalo determinado</string>
|
||||
<string name="rec_split_storage_size">Tamaño de almacenamiento</string>
|
||||
<string name="rec_split_storage_size_desc">La cantidad de espacio que pueden ocupar todos los clips grabados</string>
|
||||
<string name="updates_size_pattern">Actualizaciones: %s</string>
|
||||
<string name="updates_size">Actualizaciones: %s</string>
|
||||
<string name="last_map_change">Último cambio de mapa: %s</string>
|
||||
<string name="hourly">Cada hora</string>
|
||||
<string name="daily">Diariamente</string>
|
||||
|
|
|
@ -2023,7 +2023,7 @@
|
|||
<string name="update_time">Tiempo de actualización</string>
|
||||
<string name="size_pattern">Tamaño: %s</string>
|
||||
<string name="rec_split_storage_size">Tamaño del almacenamiento</string>
|
||||
<string name="updates_size_pattern">Actualizaciones: %s</string>
|
||||
<string name="updates_size">Actualizaciones: %s</string>
|
||||
<string name="last_map_change">Último cambio de mapa: %s</string>
|
||||
<string name="rec_split">Dividir grabación</string>
|
||||
<string name="rec_split_title">Usar la división de grabación</string>
|
||||
|
|
|
@ -2089,7 +2089,7 @@
|
|||
<string name="last_update">Dernière mise à jour : %s</string>
|
||||
<string name="update_date_pattern">Mise à jour : %s</string>
|
||||
<string name="update_time">Heure de mise à jour</string>
|
||||
<string name="updates_size_pattern">Mises à jour : %s</string>
|
||||
<string name="updates_size">Mises à jour : %s</string>
|
||||
<string name="last_map_change">Dernier carte modifiée : %s</string>
|
||||
<string name="shared_string_not_selected">Non sélectionné</string>
|
||||
</resources>
|
||||
|
|
|
@ -2123,7 +2123,7 @@
|
|||
<string name="rec_split_storage_size">Dimensione della memoria</string>
|
||||
<string name="rec_split_storage_size_desc">Quantità di spazio che può essere occupato dal totale delle note</string>
|
||||
<string name="update_time">Ora di aggiornamento</string>
|
||||
<string name="updates_size_pattern">Aggiornamenti: %s</string>
|
||||
<string name="updates_size">Aggiornamenti: %s</string>
|
||||
<string name="last_map_change">Ultimo cambiamento della mappa: %s</string>
|
||||
<string name="hourly">Orario</string>
|
||||
<string name="daily">Giornaliero</string>
|
||||
|
|
|
@ -2141,7 +2141,7 @@
|
|||
<string name="last_update">Laatste controle: %s</string>
|
||||
<string name="update_date_pattern">Update: %s</string>
|
||||
<string name="update_time">Controle-tijdstip</string>
|
||||
<string name="updates_size_pattern">Updates: %s</string>
|
||||
<string name="updates_size">Updates: %s</string>
|
||||
<string name="last_map_change">Laatste kaart-update: %s</string>
|
||||
<string name="rec_split">Video-opname automatisch splitsen</string>
|
||||
<string name="rec_split_title">Gebruik automatische splitsing</string>
|
||||
|
|
|
@ -2099,5 +2099,5 @@
|
|||
<string name="available_maps">Dostępne mapy</string>
|
||||
<string name="last_update">Ostatnia aktualizacja: %s</string>
|
||||
<string name="update_time">Czas aktualizacj</string>
|
||||
<string name="updates_size_pattern">Aktualizacje: %s</string>
|
||||
<string name="updates_size">Aktualizacje: %s</string>
|
||||
</resources>
|
||||
|
|
|
@ -1970,7 +1970,7 @@
|
|||
<string name="last_update">Última atualização: %s</string>
|
||||
<string name="update_date_pattern">Atualização: %s</string>
|
||||
<string name="update_time">Tempo de atualização</string>
|
||||
<string name="updates_size_pattern">Atualizações: %s</string>
|
||||
<string name="updates_size">Atualizações: %s</string>
|
||||
<string name="rec_split">Dividir gravação</string>
|
||||
<string name="rec_split_title">Usar o separador de gravação</string>
|
||||
<string name="rec_split_desc">Sobrescrever clipes quando o espaço usado exceder o limite de armazenamento</string>
|
||||
|
|
|
@ -2050,7 +2050,7 @@
|
|||
<string name="update_time">Uppdateringstid</string>
|
||||
<string name="update_date_pattern">Uppdatering: %s</string>
|
||||
<string name="size_pattern">Storlek: %s</string>
|
||||
<string name="updates_size_pattern">Uppdateringar: %s</string>
|
||||
<string name="updates_size">Uppdateringar: %s</string>
|
||||
<string name="last_map_change">Senaste kartändring: %s</string>
|
||||
<string name="Night">Natt</string>
|
||||
<string name="hourly">Varje timma</string>
|
||||
|
|
|
@ -2049,7 +2049,7 @@
|
|||
<string name="update_date_pattern">更新:%s</string>
|
||||
<string name="update_time">更新時間</string>
|
||||
<string name="size_pattern">大小:%s</string>
|
||||
<string name="updates_size_pattern">更新:%s</string>
|
||||
<string name="updates_size">更新:%s</string>
|
||||
<string name="last_map_change">上次地圖的更改:%s</string>
|
||||
<string name="rec_split">錄製分割</string>
|
||||
<string name="rec_split_title">使用錄製分割</string>
|
||||
|
|
|
@ -2140,7 +2140,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="missing_write_external_storage_permission">App have no permission to use SD card</string>
|
||||
<string name="last_update">Last update: %s</string>
|
||||
<string name="update_time">Update time</string>
|
||||
<string name="updates_size_pattern">"Updates: %s"</string>
|
||||
<string name="updates_size">Update size</string>
|
||||
<string name="last_map_change">"Last map change: %s"</string>
|
||||
<string name="hourly">Hourly</string>
|
||||
<string name="daily">Daily</string>
|
||||
|
|
|
@ -66,7 +66,6 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
final Spinner updateTimesOfDaySpinner = (Spinner) view.findViewById(R.id.updateTimesOfDaySpinner);
|
||||
final View updateTimesOfDayLayout = view.findViewById(R.id.updateTimesOfDayLayout);
|
||||
final TextView sizeTextView = (TextView) view.findViewById(R.id.sizeTextView);
|
||||
// final Button removeUpdatesButton = (Button) view.findViewById(R.id.removeUpdatesButton);
|
||||
|
||||
regionNameTextView.setText(getNameToDisplay(localIndexInfo, getMyActivity()));
|
||||
final String fileNameWithoutExtension =
|
||||
|
@ -91,7 +90,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
|
||||
downloadOverWiFiCheckBox.setChecked(!liveUpdatePreference.get() || downloadViaWiFiPreference.get());
|
||||
|
||||
updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
|
||||
sizeTextView.setText(getUpdatesSize(fileNameWithoutExtension, changesManager));
|
||||
|
||||
updateTimesOfDaySpinner.setAdapter(new ArrayAdapter<String>(getActivity(),
|
||||
R.layout.action_spinner_item,
|
||||
|
@ -122,15 +121,6 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
|
||||
}
|
||||
});
|
||||
// removeUpdatesButton.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// changesManager.deleteUpdates(fileNameWithoutExtension);
|
||||
// getLiveUpdatesFragment().notifyLiveUpdatesChanged();
|
||||
// preferenceLastCheck(localIndexInfo, getSettings()).resetToDefault();
|
||||
// updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
|
||||
// }
|
||||
// });
|
||||
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
|
@ -140,6 +130,12 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
liveUpdatePreference.set(liveUpdatesSwitch.isChecked());
|
||||
if (liveUpdatesSwitch.isChecked()) {
|
||||
runLiveUpdate(localIndexInfo, false);
|
||||
} else {
|
||||
long updatesSize = changesManager.getUpdatesSize(fileNameWithoutExtension);
|
||||
if (updatesSize != 0) {
|
||||
ClearUpdatesDialogFragment.createInstance(localIndexInfo)
|
||||
.show(getParentFragment().getChildFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
downloadViaWiFiPreference.set(downloadOverWiFiCheckBox.isChecked());
|
||||
|
@ -169,7 +165,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
runLiveUpdate(localIndexInfo, true);
|
||||
updateSize(fileNameWithoutExtension, changesManager, sizeTextView);
|
||||
sizeTextView.setText(getUpdatesSize(fileNameWithoutExtension, changesManager));
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
|
@ -180,9 +176,8 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
new PerformLiveUpdateAsyncTask(getActivity(), info, forceUpdate).execute(new String[]{fnExt});
|
||||
}
|
||||
|
||||
private void updateSize(String fileNameWithoutExtension,
|
||||
IncrementalChangesManager changesManager,
|
||||
TextView sizeTextView) {
|
||||
private static String getUpdatesSize(String fileNameWithoutExtension,
|
||||
IncrementalChangesManager changesManager) {
|
||||
String size;
|
||||
long updatesSize = changesManager.getUpdatesSize(fileNameWithoutExtension);
|
||||
updatesSize /= (1 << 10);
|
||||
|
@ -191,7 +186,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
} else {
|
||||
size = updatesSize + " KB";
|
||||
}
|
||||
sizeTextView.setText(getString(R.string.updates_size_pattern, size));
|
||||
return size;
|
||||
}
|
||||
|
||||
private LiveUpdatesFragment getLiveUpdatesFragment() {
|
||||
|
@ -217,4 +212,40 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
|
|||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public static class ClearUpdatesDialogFragment extends DialogFragment {
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final LocalIndexInfo localIndexInfo = getArguments().getParcelable(LOCAL_INDEX);
|
||||
final IncrementalChangesManager changesManager =
|
||||
getMyApplication().getResourceManager().getChangesManager();
|
||||
final String fileNameWithoutExtension =
|
||||
Algorithms.getFileNameWithoutExtension(new File(localIndexInfo.getFileName()));
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setMessage(getString(R.string.clear_updates_proposition_message)
|
||||
+ getUpdatesSize(fileNameWithoutExtension, changesManager))
|
||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
changesManager.deleteUpdates(fileNameWithoutExtension);
|
||||
preferenceLastCheck(localIndexInfo, getMyApplication().getSettings()).resetToDefault();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
public static ClearUpdatesDialogFragment createInstance(LocalIndexInfo localIndexInfo) {
|
||||
ClearUpdatesDialogFragment fragment = new ClearUpdatesDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(LOCAL_INDEX, localIndexInfo);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue