Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorАлександр Зацепин <az@mapswithme.com>2017-10-12 23:13:49 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2017-10-13 09:49:18 +0300
commitdad560a2cbeb80cc3b52cf60d413efbf3039a48e (patch)
treea62ff9c6ce17c4c16d9a23ad51fdb500c69079fa /android
parentf76d371c3caabd2e34f6b526e04ef2958656a288 (diff)
[android] Fixed rule to show leave/add review button in PP
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCController.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/android/src/com/mapswithme/maps/ugc/UGCController.java b/android/src/com/mapswithme/maps/ugc/UGCController.java
index 729cf26028..dc7a2d77a6 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCController.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCController.java
@@ -173,8 +173,6 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
mMapObject = mapObject;
if (mapObject.shouldShowUGC())
UGC.requestUGC(mMapObject.getFeatureId());
- else
- UiUtils.hide(mUgcRootView, mLeaveReviewButton);
}
public boolean isLeaveReviewButtonTouched(@NonNull MotionEvent event)
@@ -186,10 +184,8 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
public void onUGCReceived(@Nullable UGC ugc, @Nullable UGCUpdate ugcUpdate, @UGC.Impress int impress,
@NonNull String rating)
{
- UiUtils.show(mPreviewUgcInfoView);
- RatingView ratingView = (RatingView) mPreviewUgcInfoView.findViewById(R.id.rating_view);
- ratingView.setRating(Impress.values()[impress], rating);
- UiUtils.showIf(ugcUpdate == null, mLeaveReviewButton);
+ UiUtils.showIf(ugc != null, mPreviewUgcInfoView, mUgcRootView);
+ UiUtils.showIf(canUserLeaveReview(ugc, ugcUpdate), mLeaveReviewButton, mUgcAddRatingView);
mUgc = ugc;
if (mUgc == null)
{
@@ -197,6 +193,8 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
return;
}
+ RatingView ratingView = (RatingView) mPreviewUgcInfoView.findViewById(R.id.rating_view);
+ ratingView.setRating(Impress.values()[impress], rating);
seUserReviewAndRatingsView(ugcUpdate);
List<UGC.Review> reviews = ugc.getReviews();
if (reviews != null)
@@ -207,8 +205,11 @@ public class UGCController implements View.OnClickListener, UGC.UGCListener
mReviewCount.setText(context.getString(R.string.placepage_summary_rating_description,
String.valueOf(mUgc.getBasedOnCount())));
UiUtils.showIf(reviews != null && reviews.size() > UGCReviewAdapter.MAX_COUNT, mUgcMoreReviews);
- UiUtils.showIf(mMapObject != null && mMapObject.canBeRated(), mUgcAddRatingView);
- UiUtils.show(mUgcRootView);
+ }
+
+ private boolean canUserLeaveReview(@Nullable UGC ugc, @Nullable UGCUpdate ugcUpdate)
+ {
+ return mMapObject != null && mMapObject.canBeRated() && ugc != null && ugcUpdate == null;
}
private void onAggRatingTapped(@UGC.Impress int rating)