diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index db168b37b9..22662354c1 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -12,7 +12,7 @@ Rota yok Hedef kaldırmak Ara nokta %1$s - Intermediate hedef % 1 $ s + Intermediate hedef %1$s Son ara nokta olarak ekle İlk ara hedef eklemek Son ara nokta olarak ekle diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0780ce670c..5a8f3da395 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 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 --> + Data is not available Remove "You can remove downloaded updates and get back to the original map edition" Add time span @@ -2153,5 +2154,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Select month and country Number of contributors Number of edits - Report for: + Report for diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java index 4a74179cb8..b5cbd5d9ae 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java @@ -147,10 +147,24 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti disableProgress(); } }; + GetJsonAsyncTask.OnErrorListener onErrorListener = + new GetJsonAsyncTask.OnErrorListener() { + @Override + public void onError(String error) { + if (contributorsTextView != null) { + contributorsTextView.setText(R.string.data_is_not_available); + } + if (editsTextView != null) { + editsTextView.setText(R.string.data_is_not_available); + } + disableProgress(); + } + }; enableProgress(); GetJsonAsyncTask totalChangesByMontAsyncTask = new GetJsonAsyncTask<>(Protocol.TotalChangesByMonthResponse.class); totalChangesByMontAsyncTask.setOnResponseListener(onResponseListener); + totalChangesByMontAsyncTask.setOnErrorListener(onErrorListener); String finalUrl = String.format(TOTAL_CHANGES_BY_MONTH_URL_PATTERN, monthUrlString, regionUrlString); totalChangesByMontAsyncTask.execute(finalUrl); } @@ -262,6 +276,8 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti private final Class

protocolClass; private final Gson gson = new Gson(); private OnResponseListener

onResponseListener; + private OnErrorListener onErrorListener; + private volatile String error; public GetJsonAsyncTask(Class

protocolClass) { this.protocolClass = protocolClass; @@ -270,7 +286,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti @Override protected P doInBackground(String... params) { StringBuilder response = new StringBuilder(); - String error = NetworkUtils.sendGetRequest(params[0], null, response); + error = NetworkUtils.sendGetRequest(params[0], null, response); if (error == null) { return gson.fromJson(response.toString(), protocolClass); } @@ -280,8 +296,10 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti @Override protected void onPostExecute(P protocol) { - if (onResponseListener != null) { + if (protocol != null) { onResponseListener.onResponse(protocol); + } else { + onErrorListener.onError(error); } } @@ -289,9 +307,17 @@ public class ReportsFragment extends BaseOsmAndFragment implements SearchSelecti this.onResponseListener = onResponseListener; } + public void setOnErrorListener(OnErrorListener onErrorListener) { + this.onErrorListener = onErrorListener; + } + public interface OnResponseListener { void onResponse(Protocol response); } + + public interface OnErrorListener { + void onError(String error); + } } public static class CountrySearchSelectionFragment extends SearchSelectionFragment {