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-06-21 16:02:20 +0300
committerYuri Gorshenin <mipt.vi002@gmail.com>2017-07-05 16:41:38 +0300
commitffbeb2b683d48dc6068585086b1cd19546240fc6 (patch)
tree854df9415a959147a51ed110e429aec3e42b4ac0
parent2ed20867e578148a7a0dd93656265da87b8ed3fd (diff)
[android] Added showing ratings on UGC editor
-rw-r--r--android/res/layout/fragment_ugc_editor.xml96
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGC.java4
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java8
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java4
-rw-r--r--android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java7
5 files changed, 65 insertions, 54 deletions
diff --git a/android/res/layout/fragment_ugc_editor.xml b/android/res/layout/fragment_ugc_editor.xml
index 5df3894ce8..bc861eccf8 100644
--- a/android/res/layout/fragment_ugc_editor.xml
+++ b/android/res/layout/fragment_ugc_editor.xml
@@ -1,54 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:orientation="vertical"
- android:background="?cardBackground"
android:layout_width="match_parent"
- android:layout_height="match_parent">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/rv__ratings"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- tools:listitem="@layout/item_ugc_rating"/>
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_marginLeft="@dimen/margin_base"
- android:layout_marginRight="@dimen/margin_base"
- android:background="?dividerHorizontal"/>
+ android:layout_height="wrap_content">
<LinearLayout
- android:padding="@dimen/margin_base"
+ android:orientation="vertical"
+ android:background="?cardBackground"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <TextView
- android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+ <android.support.v7.widget.RecyclerView
+ android:id="@+id/rv__ratings"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ tools:listitem="@layout/item_ugc_rating"/>
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_marginLeft="@dimen/margin_base"
+ android:layout_marginRight="@dimen/margin_base"
+ android:background="?dividerHorizontal"/>
+ <LinearLayout
+ android:padding="@dimen/margin_base"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/MwmTextAppearance.Body1.Secondary"
+ android:text="What is the best food in Sorochani?"
+ />
+ </LinearLayout>
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="?dividerHorizontal"/>
+ <EditText
+ android:id="@+id/et_review"
+ android:layout_width="match_parent"
+ android:layout_height="152dp"
+ android:gravity="top"
+ android:inputType="textMultiLine"
+ android:maxLength="400"
+ android:paddingLeft="@dimen/margin_base"
+ android:paddingStart="@dimen/margin_base"
+ android:paddingEnd="@dimen/margin_base"
+ android:paddingRight="@dimen/margin_base"
+ android:hint="Write a review, if possible in English"/>
+ <Button
+ android:id="@+id/submit"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="@style/MwmTextAppearance.Body1.Secondary"
- android:text="What is the best food in Sorochani?"
- />
+ style="@style/MwmWidget.Button.Start"
+ android:text="Submit"
+ android:textAllCaps="true"/>
</LinearLayout>
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="?dividerHorizontal"/>
- <EditText
- android:id="@+id/et_review"
- android:layout_width="match_parent"
- android:layout_height="152dp"
- android:gravity="top"
- android:inputType="textMultiLine"
- android:maxLength="400"
- android:paddingLeft="@dimen/margin_base"
- android:paddingStart="@dimen/margin_base"
- android:paddingEnd="@dimen/margin_base"
- android:paddingRight="@dimen/margin_base"
- android:hint="Write a review, if possible in English"/>
- <Button
- android:id="@+id/submit"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/MwmWidget.Button.Start"
- android:text="Submit"
- android:textAllCaps="true"/>
-</LinearLayout>
+</ScrollView>
diff --git a/android/src/com/mapswithme/maps/ugc/UGC.java b/android/src/com/mapswithme/maps/ugc/UGC.java
index 53026bb895..037ed94bd6 100644
--- a/android/src/com/mapswithme/maps/ugc/UGC.java
+++ b/android/src/com/mapswithme/maps/ugc/UGC.java
@@ -69,7 +69,7 @@ public class UGC implements Serializable
mListener.onUGCReceived(ugc);
}
- public static class Rating
+ public static class Rating implements Serializable
{
@NonNull
private final String mName;
@@ -93,7 +93,7 @@ public class UGC implements Serializable
}
}
- public static class Review
+ public static class Review implements Serializable
{
@NonNull
private final String mText;
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
index 8cf8e1ed26..42386c15ef 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
@@ -14,15 +14,15 @@ import com.mapswithme.util.ThemeUtils;
public class UGCEditorActivity extends BaseToolbarActivity
{
private static final String EXTRA_FEATURE_INDEX = "extra_feature_index";
- private static final String EXTRA_RATING = "extra_rating";
- private static final String EXTRA_TITLE = "extra_title";
+ static final String EXTRA_UGC = "extra_ugc";
+ static final String EXTRA_TITLE = "extra_title";
public static void start(@NonNull Activity activity, @NonNull String title,
- int featureIndex, @UGC.UGCRating int rating)
+ int featureIndex, @NonNull UGC ugc)
{
final Intent i = new Intent(activity, UGCEditorActivity.class);
i.putExtra(EXTRA_FEATURE_INDEX, featureIndex);
- i.putExtra(EXTRA_RATING, rating);
+ i.putExtra(EXTRA_UGC, ugc);
i.putExtra(EXTRA_TITLE, title);
activity.startActivity(i);
}
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
index c58bf39146..70a7f0c4e8 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
@@ -29,6 +29,10 @@ public class UGCEditorFragment extends BaseMwmFragment
rvRatingView.setNestedScrollingEnabled(false);
rvRatingView.setHasFixedSize(false);
rvRatingView.setAdapter(mUGCRatingAdapter);
+
+ //TODO: use parcelable instead of seriliazable
+ UGC ugc = (UGC) getActivity().getIntent().getSerializableExtra(UGCEditorActivity.EXTRA_UGC);
+ mUGCRatingAdapter.setItems(ugc.getRatings());
return root;
}
}
diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java
index 85a3509d60..ebaa137252 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java
@@ -215,6 +215,8 @@ public class PlacePageView extends RelativeLayout
@Nullable
private Sponsored mSponsored;
private String mSponsoredPrice;
+ @Nullable
+ private UGC mUgc;
private boolean mIsLatLonDms;
@NonNull
private final FacilitiesAdapter mFacilitiesAdapter = new FacilitiesAdapter();
@@ -271,16 +273,17 @@ public class PlacePageView extends RelativeLayout
@Override
public void onRatingChanged(@UGC.UGCRating int rating)
{
- if (mMapObject == null)
+ if (mMapObject == null || mUgc == null)
return;
UGCEditorActivity.start(getActivity(), mMapObject.getTitle(), mMapObject.getFeatureIndex(),
- rating);
+ mUgc);
}
@Override
public void onUGCReceived(@NonNull UGC ugc)
{
+ mUgc = ugc;
if (ugc.getReviews() != null)
mUGCReviewAdapter.setItems(ugc.getReviews());
UiUtils.show(mUgcView);