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 17:06:01 +0300
committerYuri Gorshenin <mipt.vi002@gmail.com>2017-07-05 16:41:38 +0300
commit7a57513d08adc9f91c221ca10df243e58377c0fb (patch)
treed5e447a33e531fea84d8594ce9078ff78d65df4c
parent00d2363b63f96993ed8165c15f8c2e0ab1093def (diff)
[android] Implemented passing ratings to editor
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGC.java7
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java4
-rw-r--r--android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java19
-rw-r--r--android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java2
4 files changed, 28 insertions, 4 deletions
diff --git a/android/src/com/mapswithme/maps/ugc/UGC.java b/android/src/com/mapswithme/maps/ugc/UGC.java
index eadcb64f95..6eb90dc4ec 100644
--- a/android/src/com/mapswithme/maps/ugc/UGC.java
+++ b/android/src/com/mapswithme/maps/ugc/UGC.java
@@ -76,7 +76,7 @@ public class UGC implements Serializable
{
@NonNull
private final String mName;
- private final float mValue;
+ private float mValue;
private Rating(@NonNull String name, float value)
{
@@ -94,6 +94,11 @@ public class UGC implements Serializable
{
return mName;
}
+
+ public void setValue(float value)
+ {
+ mValue = value;
+ }
}
public static class Review implements Serializable
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
index 42386c15ef..024df8134c 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorActivity.java
@@ -16,14 +16,16 @@ public class UGCEditorActivity extends BaseToolbarActivity
private static final String EXTRA_FEATURE_INDEX = "extra_feature_index";
static final String EXTRA_UGC = "extra_ugc";
static final String EXTRA_TITLE = "extra_title";
+ static final String EXTRA_AVG_RATING = "extra_avg_rating";
public static void start(@NonNull Activity activity, @NonNull String title,
- int featureIndex, @NonNull UGC ugc)
+ int featureIndex, @NonNull UGC ugc, @UGC.UGCRating int rating)
{
final Intent i = new Intent(activity, UGCEditorActivity.class);
i.putExtra(EXTRA_FEATURE_INDEX, featureIndex);
i.putExtra(EXTRA_UGC, ugc);
i.putExtra(EXTRA_TITLE, title);
+ i.putExtra(EXTRA_AVG_RATING, rating);
activity.startActivity(i);
}
diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
index 70a7f0c4e8..2ba0e07791 100644
--- a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
+++ b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java
@@ -12,6 +12,8 @@ import android.view.ViewGroup;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmFragment;
+import java.util.ArrayList;
+import java.util.List;
public class UGCEditorFragment extends BaseMwmFragment
{
@@ -32,7 +34,22 @@ public class UGCEditorFragment extends BaseMwmFragment
//TODO: use parcelable instead of seriliazable
UGC ugc = (UGC) getActivity().getIntent().getSerializableExtra(UGCEditorActivity.EXTRA_UGC);
- mUGCRatingAdapter.setItems(ugc.getRatings());
+ List<UGC.Rating> avgRatings = new ArrayList<>(ugc.getRatings());
+ for (UGC.Rating rating: avgRatings)
+ rating.setValue(getActivity().getIntent().getIntExtra(UGCEditorActivity.EXTRA_AVG_RATING, 3));
+ mUGCRatingAdapter.setItems(avgRatings);
+
+ View submit = root.findViewById(R.id.submit);
+ submit.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ getActivity().finish();
+ }
+ });
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 5396d26dd8..129a9fe72f 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java
@@ -278,7 +278,7 @@ public class PlacePageView extends RelativeLayout
return;
UGCEditorActivity.start(getActivity(), mMapObject.getTitle(), mMapObject.getFeatureIndex(),
- mUgc);
+ mUgc, rating);
}
@Override