Update download screen

This commit is contained in:
Victor Shcherb 2012-05-28 13:53:36 +02:00
parent c22685f2db
commit c2b3df063a
19 changed files with 49 additions and 82 deletions

View file

@ -11,7 +11,7 @@
<!-- Button android:id="@+id/DownloadButton" android:layout_width="wrap_content" android:layout_gravity="right" android:layout_height="wrap_content" android:text="@string/local_index_download"
android:layout_marginLeft = "3dp" android:layout_marginTop ="3dp" android:layout_marginRight = "3dp"/-->
<TextView android:id="@+id/DescriptionText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:text="@string/local_index_description"/>
android:layout_marginRight="10dp" android:text="@string/download_link_and_local_description"/>
<LinearLayout android:id="@+id/FillLayoutStart" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:visibility="gone"/>
<Button android:id="@+id/ActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/local_index_download"
android:layout_marginLeft = "3dp" android:layout_marginTop ="3dp" android:layout_marginRight = "3dp" android:visibility="gone"/>

View file

@ -327,7 +327,6 @@
<string name="poi_filter_nominatim">Online Nominatim</string>
<string name="search_select_point">Vybrat</string>
<string name="local_index_description">Stahnout nová, zálohovat nebo smazat existující data. \nOffline data na zařízení (%1$s dostupné):</string>
<string name="search_position_current_location_search">Hledané polohy…</string>
<string name="search_position_current_location_found">Poloha [nalezeno]</string>
<string name="search_position_address">Adresy…</string>

View file

@ -335,7 +335,6 @@
<string name="local_index_no_items_to_do">Aktion %1$s: Keine Dateien vorhanden</string>
<string name="local_index_action_do">%1$s: %2$s Datei(en). Fortfahren?</string>
<string name="local_index_descr_title">Offline-Daten Manager</string>
<string name="local_index_description">Herunterladen, (De-)Aktivieren und Löschen von Offline-Daten.\nLokal vorhandene Dateien (%1$s frei):</string>
<string name="local_index_mi_restore">Aktivieren</string>
<string name="local_index_mi_backup">Deaktivieren</string>
<string name="local_index_mi_delete">Löschen</string>

View file

@ -186,7 +186,6 @@
<string name="show_gpx_route">Mostrar en el mapa</string>
<string name="poi_filter_nominatim">Nominatim en línea</string>
<string name="search_select_point">Seleccionar</string>
<string name="local_index_description">Descargar, (des-)activar, o borrar datos descargados. \nDatos actuales en el dispositivo (disponible %1$s):</string>
<string name="search_position_current_location_search">Buscando posición&#8230;</string>
<string name="search_position_current_location_found">Posición (Encontrado)</string>
<string name="search_position_address">Dirección&#8230;</string>

View file

@ -164,7 +164,6 @@
\n\t- Corrections des instructions vocales (sur l\'emplacement GPS et supprimer la première instruction)
\n\t- Petites améliorations diverses
</string>
<string name="local_index_description">Télécharger, déplacer ou supprimer données actuelles. \nDonnées hors ligne actuellement présente sur l\'appareil (%1$s espace libre):</string>
<string name="file_can_not_be_renamed">Fichier ne peut être renommé.</string>
<string name="file_with_name_already_exists">Un fichier avec ce nom existe déjà.</string>
<string name="gpx_navigation">Itinéraire GPX</string>

View file

@ -269,7 +269,6 @@
<string name="show_gpx_route">Mutasd a térképen</string>
<string name="poi_filter_nominatim">Online Nominatim</string>
<string name="search_select_point">Választás</string>
<string name="local_index_description">Új offline adat letöltése, aktiválása/deaktiválása, törlése.\nJelenlegi adatok az eszközön (szabad hely: %1$s):</string>
<string name="search_position_current_location_search">Pozíció keresése&#8230;</string>
<string name="search_position_current_location_found">Pozíció [Megtalálva]</string>
<string name="search_position_address">Cím&#8230;</string>

View file

@ -170,7 +170,6 @@
<string name="show_gpx_route">Visualizza</string>
<string name="poi_filter_nominatim">Nominatim Online</string>
<string name="search_select_point">Seleziona</string>
<string name="local_index_description">Scarica nuovi dati, sposta, salva o cancella dati esistenti. \nDati attualmente nel dispositivo (%1$s disponibile):</string>
<string name="search_position_current_location_search">Cerca posizione…</string>
<string name="search_position_current_location_found">Posizione [Trovata]</string>
<string name="search_position_address">Indirizzi…</string>

View file

@ -275,7 +275,6 @@
<string name="show_gpx_route">맵 상에 표시</string>
<string name="poi_filter_nominatim">온라인 지명</string>
<string name="search_select_point">선택</string>
<string name="local_index_description">오프라인 데이터를 다운로드, 활성화, 비활성화, 또는 삭제합니다. \n장치의 현재 데이터 (%1$s 빈 공간):</string>
<string name="search_position_current_location_search">위치 검색&#8230;</string>
<string name="search_position_current_location_found">위치 (발견)</string>
<string name="search_position_address">주소&#8230;</string>

View file

@ -259,13 +259,6 @@
<string name="show_gpx_route">Toon op kaart</string>
<string name="poi_filter_nominatim">Online Zoeken</string>
<string name="search_select_point">Selecteer</string>
<string name="local_index_description">Download, activeer, deactiveer, of verwijder locale gegevens. \nHuidige gegevens op het apparaat (%1$s vrije ruimte):</string>
<string name="search_position_current_location_search">Positie zoeken&#8230;</string>
<string name="search_position_current_location_found">Positie (gevonden)</string>
<string name="search_position_address">Adres&#8230;</string>
<string name="search_position_favorites">Favorieten&#8230;</string>
<string name="search_position_undefined">Ongedefinieerd</string>
<string name="search_position_fixed">Verankerd</string>
<string name="search_position_current_location">Huidige positie&#8230;</string>
<string name="search_position_map_view">Laatste kaartweergave</string>
<string name="select_search_position">Zoek dichtbij :</string>

View file

@ -68,7 +68,6 @@
<string name="show_gpx_route">Pokaż na mapie</string>
<string name="poi_filter_nominatim">Online Nominatim</string>
<string name="search_select_point">Wybierz</string>
<string name="local_index_description">Pobierz nowe, zarchiwizuj lub usuń istniejące dane. \nIstniejące dane offline na urządzeniu (%1$s jest dostępne):</string>
<string name="search_position_current_location_search">Ustal pozycję GPS…</string>
<string name="search_position_current_location_found">Pozycja [ustalona]</string>
<string name="search_position_address">Adres…</string>

View file

@ -143,7 +143,6 @@
<string name="show_gpx_route">Показать на карте</string>
<string name="poi_filter_nominatim">Nominatim (интернет)</string>
<string name="search_select_point">Выбрать</string>
<string name="local_index_description">Офлайн данные доступные на SD карточке. Вы можете загрузить новые, архивировать и удалить данные. Доступно %1$s.</string>
<string name="search_position_current_location_search">Поиск позиции…</string>
<string name="search_position_current_location_found">Точка [Найдена]</string>
<string name="search_position_address">Адрес…</string>

View file

@ -259,7 +259,6 @@
<string name="poi_filter_nominatim">Online Nominatim</string>
<string name="search_select_point">Vybrať</string>
<string name="local_index_description">Stiahnite nové, zálohujte alebo zmažte existujúce údaje. \nAktuálne offline údaje v zariadení (%1$s dostupných):</string>
<string name="search_position_current_location_search">Hľadám umiestnenie…</string>
<string name="search_position_current_location_found">Umiestnenie [Nájdené]</string>
<string name="search_position_address">Adresa…</string>

View file

@ -54,7 +54,6 @@ Translator: Le Viet Thanh; email: lethanhx2k@gmail.com -->
<string name="show_gpx_route">Hiển thị trên bản đồ</string>
<string name="poi_filter_nominatim">Online Nominatim</string>
<string name="search_select_point">Chọn</string>
<string name="local_index_description">Tải mới hoặc di chuyển để sao lưu hoặc xóa dữ liệu hiện tại.\nDữ liệu offline hiện có trên máy (%1$s không gian trống):</string>
<string name="search_position_current_location_search">Đang tìm vị trí…</string>
<string name="search_position_current_location_found">Vị trí (Đã tìm thấy)</string>
<string name="search_position_address">Địa chỉ…</string>

View file

@ -8,6 +8,7 @@
If you are making/correcting english translations make sure :
1. All your modified/created strings are in the top of the file (to make easier find what's translated).
-->
<string name="download_link_and_local_description">Download or update offline data. \nTo see more details click on the item, to deactivate or delete offline data press and hold. \nCurrent data on device (%1$s free):</string>
<string name="unknown_from_location">Start location is not determined yet</string>
<string name="unknown_location">Location is not found yet</string>
<string name="context_menu_item_directions">Directions to here</string>
@ -20,7 +21,6 @@
<string name="local_indexes_cat_map">Offline Map data</string>
<string name="gpx_index_settings_descr"> (includes GPX analyzer)</string>
<string name="index_settings_descr">Download, view details and manage offline maps</string>
<string name="local_index_description">Download or update offline data. \nTo see more details click on the item, to deactivate or delete offline data press and hold. \nCurrent data on device (%1$s free):</string>
<string name="map_online_plugin_is_not_installed">Enable online maps plugin to select different map sources</string>
<string name="map_online_data">Online maps</string>
<string name="map_online_data_descr">Use online maps (download and cache them on SD card)</string>

View file

@ -158,31 +158,32 @@ public class DownloadOsmandIndexesHelper {
String s = ""; //$NON-NLS-1$
if (fileName.endsWith(IndexConstants.BINARY_MAP_INDEX_EXT)
|| fileName.endsWith(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP)) {
String lowerCase = description.toLowerCase();
if (lowerCase.contains("map")) { //$NON-NLS-1$
if (s.length() > 0) {
s += ", "; //$NON-NLS-1$
}
s += ctx.getString(R.string.map_index);
}
if (lowerCase.contains("poi")) { //$NON-NLS-1$
if (s.length() > 0) {
s += ", "; //$NON-NLS-1$
}
s += ctx.getString(R.string.poi);
}
if (lowerCase.contains("transport")) { //$NON-NLS-1$
if (s.length() > 0) {
s += ", "; //$NON-NLS-1$
}
s += ctx.getString(R.string.transport);
}
if (lowerCase.contains("address")) { //$NON-NLS-1$
if (s.length() > 0 ) {
s += ", "; //$NON-NLS-1$
}
s += ctx.getString(R.string.address);
}
// Takes too much space
// String lowerCase = description.toLowerCase();
// if (lowerCase.contains("map")) { //$NON-NLS-1$
// if (s.length() > 0) {
// s += ", "; //$NON-NLS-1$
// }
// s += ctx.getString(R.string.map_index);
// }
// if (lowerCase.contains("poi")) { //$NON-NLS-1$
// if (s.length() > 0) {
// s += ", "; //$NON-NLS-1$
// }
// s += ctx.getString(R.string.poi);
// }
// if (lowerCase.contains("transport")) { //$NON-NLS-1$
// if (s.length() > 0) {
// s += ", "; //$NON-NLS-1$
// }
// s += ctx.getString(R.string.transport);
// }
// if (lowerCase.contains("address")) { //$NON-NLS-1$
// if (s.length() > 0 ) {
// s += ", "; //$NON-NLS-1$
// }
// s += ctx.getString(R.string.address);
// }
} else if (fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)) {
s = ctx.getString(R.string.voice);
} else if (fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {

View file

@ -407,41 +407,12 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
if (entry != null) {
// if(!fileToUnzip.exists()){
// builder.setMessage(MessageFormat.format(getString(R.string.download_question), baseName, extractDateAndSize(e.getValue())));
if (entry.fileToUnzip.exists()) {
Builder builder = new AlertDialog.Builder(this);
MessageFormat format;
if (entry.fileToUnzip.isDirectory()) {
format = new MessageFormat("{0,date,dd.MM.yyyy}", Locale.US); //$NON-NLS-1$
} else {
format = new MessageFormat("{0,date,dd.MM.yyyy}, {1, number,##.#} MB", Locale.US); //$NON-NLS-1$
}
String description = format.format(new Object[] { new Date(entry.fileToUnzip.lastModified()),
((float) entry.fileToUnzip.length() / MB) });
String descriptionEx = e.getDate() + ", " +e.getSize() + " MB";
builder.setMessage(MessageFormat.format(getString(R.string.download_question_exist), entry.baseName, description,
descriptionEx));
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
entriesToDownload.put(e.getFileName(), entry);
int x = getListView().getScrollX();
int y = getListView().getScrollY();
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
getListView().scrollTo(x, y);
ch.setChecked(!ch.isChecked());
}
});
builder.setNegativeButton(R.string.default_buttons_no, null);
builder.show();
} else {
entriesToDownload.put(e.getFileName(), entry);
int x = getListView().getScrollX();
int y = getListView().getScrollY();
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
getListView().scrollTo(x, y);
ch.setChecked(!ch.isChecked());
}
entriesToDownload.put(e.getFileName(), entry);
int x = getListView().getScrollX();
int y = getListView().getScrollY();
findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE);
getListView().scrollTo(x, y);
ch.setChecked(!ch.isChecked());
}
return true;
}

View file

@ -679,7 +679,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
}
TextView ds = (TextView) findViewById(R.id.DescriptionText);
String text = getString(R.string.local_index_description, size);
String text = getString(R.string.download_link_and_local_description, size);
int l = text.indexOf('.');
if(l == -1) {
l = text.length();

View file

@ -1,5 +1,6 @@
package net.osmand.plus.activities;
import android.app.Activity;
import net.osmand.plus.activities.search.SearchActivity;
public class OsmandIntents {
@ -23,5 +24,13 @@ public class OsmandIntents {
public static Class<MainMenuActivity> getMainMenuActivity() {
return MainMenuActivity.class;
}
public static Class<? extends Activity> getDownloadIndexActivity() {
return DownloadIndexActivity.class;
}
public static Class<? extends Activity> getLocalIndexActivity() {
return DownloadIndexActivity.class;
}
}

View file

@ -674,7 +674,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
@Override
public boolean onPreferenceClick(Preference preference) {
if(preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)){
startActivity(new Intent(this, LocalIndexesActivity.class));
if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
startActivity(new Intent(this, OsmandIntents.getDownloadIndexActivity()));
} else {
startActivity(new Intent(this, OsmandIntents.getLocalIndexActivity()));
}
return true;
} else if(preference == bidforfix){
startActivity(new Intent(this, OsmandBidForFixActivity.class));