diff --git a/OsmAnd/res/layout/fragment_explore_tab.xml b/OsmAnd/res/layout/fragment_explore_tab.xml
index 34316e6ef0..8a663f6d42 100644
--- a/OsmAnd/res/layout/fragment_explore_tab.xml
+++ b/OsmAnd/res/layout/fragment_explore_tab.xml
@@ -6,20 +6,11 @@
android:gravity="center"
android:orientation="vertical">
-
-
-
-
-
-
-
+ android:layout_height="match_parent"
+ android:clipToPadding="false"
+ android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"/>
diff --git a/OsmAnd/res/layout/wikivoyage_open_beta_card.xml b/OsmAnd/res/layout/wikivoyage_open_beta_card.xml
index 19812ccf03..93b709dd03 100644
--- a/OsmAnd/res/layout/wikivoyage_open_beta_card.xml
+++ b/OsmAnd/res/layout/wikivoyage_open_beta_card.xml
@@ -7,7 +7,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/list_content_padding"
android:layout_marginTop="@dimen/list_content_padding"
- android:background="@drawable/wikivoyage_card_bg">
+ android:background="@drawable/travel_card_bg">
-
+
diff --git a/OsmAnd/res/layout/wikivoyage_start_editing_card.xml b/OsmAnd/res/layout/wikivoyage_start_editing_card.xml
index b770ca7272..c2b9a4b6c0 100644
--- a/OsmAnd/res/layout/wikivoyage_start_editing_card.xml
+++ b/OsmAnd/res/layout/wikivoyage_start_editing_card.xml
@@ -1,12 +1,13 @@
+ android:background="@drawable/travel_card_bg">
+ android:layout_height="wrap_content"
+ android:background="@color/wikivoyage_start_editing_background">
@@ -58,7 +60,17 @@
android:layout_height="1dp"
android:background="?attr/wikivoyage_card_divider_color" />
-
+
diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml
index eaa0b79144..f5b86303db 100644
--- a/OsmAnd/res/values/colors.xml
+++ b/OsmAnd/res/values/colors.xml
@@ -428,5 +428,6 @@
#212121
#cccccc
#727272
+ #339966
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
index 62eafee287..7bf579e6fc 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
@@ -3,6 +3,8 @@ package net.osmand.plus.wikivoyage.explore;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -27,18 +29,16 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
final View mainView = inflater.inflate(R.layout.fragment_explore_tab, container, false);
- LinearLayout linearLayout = (LinearLayout) mainView.findViewById(R.id.cards_list);
+
ArrayList items = new ArrayList<>();
- BaseTravelCard openBetaTravelCard = new OpenBetaTravelCard(app, getFragmentManager(), nightMode);
+ BaseTravelCard openBetaTravelCard = new OpenBetaTravelCard(app, nightMode, getFragmentManager());
BaseTravelCard startEditingTravelCard = new StartEditingTravelCard(app, nightMode);
items.add(openBetaTravelCard);
items.add(startEditingTravelCard);
- for (BaseTravelCard item : items) {
- item.inflate(app, linearLayout, nightMode);
- }
-
+ final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
+ rv.setLayoutManager(new LinearLayoutManager(getContext()));
return mainView;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java
index 40d0001abf..5acc09860d 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/BaseTravelCard.java
@@ -4,44 +4,45 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
+import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
-import android.view.ViewGroup;
+import android.support.v7.widget.RecyclerView;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
public abstract class BaseTravelCard {
- protected static final int INVALID_POSITION = -1;
-
protected OsmandApplication app;
-
- protected int position = INVALID_POSITION;
protected boolean nightMode;
- public abstract void inflate(OsmandApplication app, ViewGroup container, boolean nightMode);
+ public BaseTravelCard(OsmandApplication app, boolean nightMode) {
+ this.app = app;
+ this.nightMode = nightMode;
+ }
+
+ public abstract void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder);
+
+ public abstract int getCardType();
@ColorInt
protected int getResolvedColor(@ColorRes int colorId) {
return ContextCompat.getColor(app, colorId);
}
- protected Drawable getIcon(@DrawableRes int drawableRes, @ColorRes int color) {
- return app.getIconsCache().getIcon(drawableRes, color);
+ protected Drawable getContentIcon(@DrawableRes int icon) {
+ return getColoredIcon(icon, R.color.icon_color);
}
- protected Drawable getIcon(@DrawableRes int drawableRes) {
- return app.getIconsCache().getIcon(drawableRes);
+ protected Drawable getActiveIcon(@DrawableRes int icon) {
+ return getColoredIcon(icon, R.color.wikivoyage_active_light, R.color.wikivoyage_active_dark);
}
- protected Drawable getIcon(int iconId, int colorLightId, int colorDarkId) {
- return app.getIconsCache().getIcon(iconId, nightMode ? colorLightId : colorDarkId);
+ protected Drawable getColoredIcon(@DrawableRes int icon, @ColorRes int colorLight, @ColorRes int colorDark) {
+ return getColoredIcon(icon, nightMode ? colorDark : colorLight);
}
- protected void onLeftButtonClickAction() {
-
+ protected Drawable getColoredIcon(@DrawableRes int icon, @ColorRes int color) {
+ return app.getIconsCache().getIcon(icon, color);
}
-
- protected void onRightButtonClickAction() {
-
- }
-}
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/OpenBetaTravelCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/OpenBetaTravelCard.java
index 2dce41f604..86aa1a1247 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/OpenBetaTravelCard.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/OpenBetaTravelCard.java
@@ -1,10 +1,11 @@
package net.osmand.plus.wikivoyage.explore.travelcards;
+import android.support.annotation.NonNull;
import android.support.v4.app.FragmentManager;
+import android.support.v7.widget.RecyclerView;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@@ -14,47 +15,34 @@ import net.osmand.plus.dialogs.ChoosePlanDialogFragment;
public class OpenBetaTravelCard extends BaseTravelCard {
- private FragmentManager fm;
+ private FragmentManager fragmentManager;
- public OpenBetaTravelCard(OsmandApplication app, FragmentManager fm, boolean nightMode) {
- this.app = app;
- this.fm = fm;
- this.nightMode = nightMode;
+ public OpenBetaTravelCard(OsmandApplication app, boolean nightMode, FragmentManager fragmentManager) {
+ super(app, nightMode);
+ this.fragmentManager = fragmentManager;
}
- public OpenBetaTravelCard(OsmandApplication app, FragmentManager fm, int position, boolean nightMode) {
- this.app = app;
- this.fm = fm;
- this.position = position;
- this.nightMode = nightMode;
- }
@Override
- public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
+ public void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View view = LayoutInflater.from(new ContextThemeWrapper(app, themeRes))
- .inflate(R.layout.wikivoyage_open_beta_card, container, false);
+ .inflate(R.layout.wikivoyage_open_beta_card, null, false);
ImageView imageView = (ImageView) view.findViewById(R.id.background_image);
- imageView.setImageDrawable(getIcon(R.drawable.img_help_wikivoyage_articles));
+ imageView.setImageResource(R.drawable.img_help_wikivoyage_articles);
((TextView) view.findViewById(R.id.title)).setText(R.string.welcome_to_open_beta);
((TextView) view.findViewById(R.id.description)).setText(R.string.welcome_to_open_beta_description);
((TextView) view.findViewById(R.id.left_bottom_button_text)).setText(R.string.get_unlimited_access);
view.findViewById(R.id.left_bottom_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- onLeftButtonClickAction();
+ ChoosePlanDialogFragment.showFreeVersionInstance(fragmentManager);
}
});
-
- if (position != INVALID_POSITION) {
- container.addView(view, position);
- } else {
- container.addView(view);
- }
}
@Override
- protected void onLeftButtonClickAction() {
- ChoosePlanDialogFragment.showFreeVersionInstance(fm);
+ public int getCardType() {
+ return 0;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/StartEditingTravelCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/StartEditingTravelCard.java
index 5263a1ebde..44082c160b 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/StartEditingTravelCard.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/StartEditingTravelCard.java
@@ -1,12 +1,13 @@
package net.osmand.plus.wikivoyage.explore.travelcards;
import android.net.Uri;
+import android.support.annotation.NonNull;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.content.ContextCompat;
+import android.support.v7.widget.RecyclerView;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@@ -16,46 +17,33 @@ import net.osmand.plus.R;
public class StartEditingTravelCard extends BaseTravelCard {
public StartEditingTravelCard(OsmandApplication app, boolean nightMode) {
- this.app = app;
- this.nightMode = nightMode;
- }
-
- public StartEditingTravelCard(OsmandApplication app, int position, boolean nightMode) {
- this.app = app;
- this.position = position;
- this.nightMode = nightMode;
+ super(app, nightMode);
}
@Override
- public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
+ public void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View view = LayoutInflater.from(new ContextThemeWrapper(app, themeRes))
- .inflate(R.layout.wikivoyage_start_editing_card, container, false);
+ .inflate(R.layout.wikivoyage_open_beta_card, null, false);
ImageView imageView = (ImageView) view.findViewById(R.id.background_image);
- imageView.setImageDrawable(getIcon(R.drawable.img_help_wikivoyage_contribute));
- ((TextView) view.findViewById(R.id.title)).setText(R.string.start_editing_card_image_text);
- ((TextView) view.findViewById(R.id.description)).setText(R.string.start_editing_card_description);
- ((TextView) view.findViewById(R.id.left_bottom_button_text)).setText(R.string.start_editing);
+ imageView.setImageResource(R.drawable.img_help_wikivoyage_articles);
+ ((TextView) view.findViewById(R.id.title)).setText(R.string.welcome_to_open_beta);
+ ((TextView) view.findViewById(R.id.description)).setText(R.string.welcome_to_open_beta_description);
+ ((TextView) view.findViewById(R.id.left_bottom_button_text)).setText(R.string.get_unlimited_access);
view.findViewById(R.id.left_bottom_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- onLeftButtonClickAction();
+ CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
+ .setToolbarColor(ContextCompat.getColor(app, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
+ .build();
+ String text = "https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org";
+ customTabsIntent.launchUrl(app, Uri.parse(text));
}
});
-
- if (position != INVALID_POSITION) {
- container.addView(view, position);
- } else {
- container.addView(view);
- }
}
@Override
- protected void onLeftButtonClickAction() {
- CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
- .setToolbarColor(ContextCompat.getColor(app, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
- .build();
- String text = "https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org";
- customTabsIntent.launchUrl(app, Uri.parse(text));
+ public int getCardType() {
+ return 1;
}
}