Fix strings; disable rows without needed data

This commit is contained in:
Alexander Sytnyk 2018-01-31 13:41:41 +02:00
parent 0d378f1570
commit 7f41c6a542
2 changed files with 47 additions and 27 deletions

View file

@ -9,12 +9,12 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="gpx_file_desc">GPX - suitable for import to JOSM or other OSM editors.</string>
<string name="osc_file_desc">OSC - suitable for import to OpenStreetMap.</string>
<string name="gpx_file_desc">GPX - suitable for export to JOSM or other OSM editors.</string>
<string name="osc_file_desc">OSC - suitable for export to OpenStreetMap.</string>
<string name="gpx_file">GPX file</string>
<string name="osc_file">OSC file</string>
<string name="choose_file_type">Choose file type</string>
<string name="osm_edits_export_desc">Select the import type: OSM notes, POI, or both.</string>
<string name="osm_edits_export_desc">Select the export type: OSM notes, POI, or both.</string>
<string name="all_data">All data</string>
<string name="osm_notes">OSM Notes</string>
<string name="will_open_tomorrow_at">Will open tomorrow at</string>

View file

@ -54,35 +54,50 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
((TextView) mainView.findViewById(R.id.osm_notes_count_text_view)).setText(String.valueOf(osmNotesCount));
((TextView) mainView.findViewById(R.id.all_data_count_text_view)).setText(String.valueOf(poiCount + osmNotesCount));
mainView.findViewById(R.id.poi_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);
View poiRow = mainView.findViewById(R.id.poi_row);
if (poiCount > 0) {
poiRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);
}
dismiss();
}
dismiss();
}
});
});
} else {
disable(poiRow);
}
mainView.findViewById(R.id.osm_notes_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);
View osmNotesRow = mainView.findViewById(R.id.osm_notes_row);
if (osmNotesCount > 0) {
osmNotesRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);
}
dismiss();
}
dismiss();
}
});
});
} else {
disable(osmNotesRow);
}
mainView.findViewById(R.id.all_data_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);
View allDataRow = mainView.findViewById(R.id.all_data_row);
if ((poiCount + osmNotesCount) > 0) {
allDataRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);
}
dismiss();
}
dismiss();
}
});
});
} else {
disable(allDataRow);
}
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
@ -96,6 +111,11 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
return mainView;
}
private void disable(View view) {
view.setEnabled(false);
view.setAlpha(.5f);
}
public interface ExportOptionsFragmentListener {
void onClick(@ExportTypesDef int type);