Display error if online reviews can't be loaded
This commit is contained in:
parent
c9f5f58245
commit
3f41da709d
|
@ -93,6 +93,11 @@ public class ReviewsActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void handleReviews(List<CommunityReview> reviews) {
|
||||
if (reviews == null) {
|
||||
setText(getString(R.string.reviews_loading_error));
|
||||
return;
|
||||
}
|
||||
|
||||
listViewAdapter.setItems(reviews);
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
displaySummary(reviews);
|
||||
|
|
|
@ -38,14 +38,14 @@ public class CommunityReviewsLoader {
|
|||
|
||||
WebService.WSResponse response = webService.callForJson(webService.getGetReviewsUrlPart(), params);
|
||||
|
||||
List<CommunityReview> reviews = new ArrayList<>();
|
||||
|
||||
if (response == null || !response.getSuccessful()) {
|
||||
LOG.warn("loadReviews() response is not successful");
|
||||
return reviews;
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
List<CommunityReview> reviews = new ArrayList<>();
|
||||
|
||||
// response.getJsonObject():
|
||||
// "success": boolean
|
||||
// "nn": String number starting with "+"
|
||||
|
@ -68,10 +68,12 @@ public class CommunityReviewsLoader {
|
|||
}
|
||||
|
||||
LOG.trace("loadReviews() loaded {} reviews", reviews.size());
|
||||
|
||||
return reviews;
|
||||
} catch (JSONException e) {
|
||||
LOG.error("loadReviews()", e);
|
||||
}
|
||||
return reviews;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<string name="incoming_call_notifications_summary">Отображает уведомление с краткой информацией о номере (рейтинги, кол-во отзывов, категория) при входящих вызовах</string>
|
||||
<string name="title_activity_reviews">Отзывы</string>
|
||||
<string name="reviews_loading">Загружаем отзывы…</string>
|
||||
<string name="reviews_loading_error">Ошибка загрузки отзывов</string>
|
||||
<string name="sia_category_fax">Факс</string>
|
||||
<string name="sia_category_nuisance">Злонамеренный</string>
|
||||
<string name="sia_category_unsolicited">Нежелательный</string>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
<string name="title_activity_reviews">Reviews</string>
|
||||
<string name="reviews_loading">Loading reviews…</string>
|
||||
<string name="reviews_loading_error">Reviews loading error</string>
|
||||
|
||||
<string name="denied_permissions_message">Due to denied permissions following features may not work:</string>
|
||||
<string name="feature_info">notifications</string>
|
||||
|
|
Loading…
Reference in New Issue