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). 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 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="gpx_file_desc">GPX - suitable for export to JOSM or other OSM editors.</string>
<string name="osc_file_desc">OSC - suitable for import to OpenStreetMap.</string> <string name="osc_file_desc">OSC - suitable for export to OpenStreetMap.</string>
<string name="gpx_file">GPX file</string> <string name="gpx_file">GPX file</string>
<string name="osc_file">OSC file</string> <string name="osc_file">OSC file</string>
<string name="choose_file_type">Choose file type</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="all_data">All data</string>
<string name="osm_notes">OSM Notes</string> <string name="osm_notes">OSM Notes</string>
<string name="will_open_tomorrow_at">Will open tomorrow at</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.osm_notes_count_text_view)).setText(String.valueOf(osmNotesCount));
((TextView) mainView.findViewById(R.id.all_data_count_text_view)).setText(String.valueOf(poiCount + 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() { View poiRow = mainView.findViewById(R.id.poi_row);
@Override if (poiCount > 0) {
public void onClick(View v) { poiRow.setOnClickListener(new View.OnClickListener() {
if (listener != null) { @Override
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI); 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() { View osmNotesRow = mainView.findViewById(R.id.osm_notes_row);
@Override if (osmNotesCount > 0) {
public void onClick(View v) { osmNotesRow.setOnClickListener(new View.OnClickListener() {
if (listener != null) { @Override
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES); 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() { View allDataRow = mainView.findViewById(R.id.all_data_row);
@Override if ((poiCount + osmNotesCount) > 0) {
public void onClick(View v) { allDataRow.setOnClickListener(new View.OnClickListener() {
if (listener != null) { @Override
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL); 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() { mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -96,6 +111,11 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
return mainView; return mainView;
} }
private void disable(View view) {
view.setEnabled(false);
view.setAlpha(.5f);
}
public interface ExportOptionsFragmentListener { public interface ExportOptionsFragmentListener {
void onClick(@ExportTypesDef int type); void onClick(@ExportTypesDef int type);