diff --git a/android/res/drawable/ic_contribute.xml b/android/res/drawable/ic_contribute.xml index 4ba64b5beb..de15bb484c 100644 --- a/android/res/drawable/ic_contribute.xml +++ b/android/res/drawable/ic_contribute.xml @@ -1,15 +1,9 @@ + android:viewportHeight="24" + android:viewportWidth="24"> - - + android:fillColor="@android:color/white" + android:pathData="M9.6,15.6 L11,14.175 8.825,12 11,9.825 9.6,8.4 6,12ZM14.4,15.6 L18,12 14.4,8.4 13,9.825 15.175,12 13,14.175ZM5,21Q4.175,21 3.587,20.413Q3,19.825 3,19V5Q3,4.175 3.587,3.587Q4.175,3 5,3H19Q19.825,3 20.413,3.587Q21,4.175 21,5V19Q21,19.825 20.413,20.413Q19.825,21 19,21ZM5,19H19Q19,19 19,19Q19,19 19,19V5Q19,5 19,5Q19,5 19,5H5Q5,5 5,5Q5,5 5,5V19Q5,19 5,19Q5,19 5,19ZM5,5Q5,5 5,5Q5,5 5,5V19Q5,19 5,19Q5,19 5,19Q5,19 5,19Q5,19 5,19V5Q5,5 5,5Q5,5 5,5Z" /> diff --git a/android/res/drawable/ic_donate.xml b/android/res/drawable/ic_donate.xml new file mode 100644 index 0000000000..4ba64b5beb --- /dev/null +++ b/android/res/drawable/ic_donate.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/android/res/layout/about.xml b/android/res/layout/about.xml index 361669d6df..1e9b51586d 100644 --- a/android/res/layout/about.xml +++ b/android/res/layout/about.xml @@ -77,6 +77,12 @@ android:text="@string/report_a_bug" app:drawableStartCompat="@drawable/ic_report_a_bug"/> + + Help Frequently Asked Questions + + Donate How to support us? diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index c102286ce4..885309f19b 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -86,6 +86,7 @@ import com.mapswithme.maps.widget.placepage.PlacePageController; import com.mapswithme.maps.widget.placepage.PlacePageData; import com.mapswithme.maps.widget.placepage.PlacePageFactory; import com.mapswithme.maps.widget.placepage.RoutingModeListener; +import com.mapswithme.util.Config; import com.mapswithme.util.Counters; import com.mapswithme.util.InputUtils; import com.mapswithme.util.PermissionsUtils; @@ -201,6 +202,8 @@ public class MwmActivity extends BaseMwmFragmentActivity @NonNull private PlacePageController mPlacePageController; + private String mDonatesUrl; + public interface LeftAnimationTrackListener { void onTrackStarted(boolean collapsed); @@ -447,6 +450,9 @@ public class MwmActivity extends BaseMwmFragmentActivity getDownloadMapsCounter(), this::onDownloadMapsOptionSelected )); + mDonatesUrl = Config.getDonateUrl(); + if (!TextUtils.isEmpty(mDonatesUrl)) + items.add(new MenuBottomSheetItem(R.string.donate, R.drawable.ic_donate, this::onDonateOptionSelected)); items.add(new MenuBottomSheetItem(R.string.settings, R.drawable.ic_settings, this::onSettingsOptionSelected)); items.add(new MenuBottomSheetItem(R.string.share_my_location, R.drawable.ic_share, this::onShareLocationOptionSelected)); return items; @@ -2004,6 +2010,11 @@ public class MwmActivity extends BaseMwmFragmentActivity showDownloader(false); } + public void onDonateOptionSelected() + { + Utils.openUrl(this, mDonatesUrl); + } + public void onSettingsOptionSelected() { Intent intent = new Intent(getActivity(), SettingsActivity.class); diff --git a/android/src/com/mapswithme/maps/help/HelpFragment.java b/android/src/com/mapswithme/maps/help/HelpFragment.java index c0aee14927..b4cab21495 100644 --- a/android/src/com/mapswithme/maps/help/HelpFragment.java +++ b/android/src/com/mapswithme/maps/help/HelpFragment.java @@ -1,6 +1,7 @@ package com.mapswithme.maps.help; import android.os.Bundle; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -14,6 +15,7 @@ import com.mapswithme.maps.BuildConfig; import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseMwmFragment; +import com.mapswithme.util.Config; import com.mapswithme.util.Constants; import com.mapswithme.util.Graphics; import com.mapswithme.util.Utils; @@ -22,6 +24,8 @@ import java.text.SimpleDateFormat; public class HelpFragment extends BaseMwmFragment implements View.OnClickListener { + private String mDonateUrl; + private void setupItem(@IdRes int id, boolean tint, @NonNull View frame) { TextView view = frame.findViewById(id); @@ -47,6 +51,7 @@ public class HelpFragment extends BaseMwmFragment implements View.OnClickListene @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mDonateUrl = Config.getDonateUrl(); View root = inflater.inflate(R.layout.about, container, false); ((TextView) root.findViewById(R.id.version)) @@ -67,13 +72,16 @@ public class HelpFragment extends BaseMwmFragment implements View.OnClickListene setupItem(R.id.openstreetmap, true, root); setupItem(R.id.faq, true, root); setupItem(R.id.report, true, root); - if ("google".equalsIgnoreCase(BuildConfig.FLAVOR)) + if (TextUtils.isEmpty(mDonateUrl)) { - TextView view = root.findViewById(R.id.support_us); - view.setVisibility(View.GONE); + TextView donateView = root.findViewById(R.id.donate); + donateView.setVisibility(View.GONE); + TextView supportUsView = root.findViewById(R.id.support_us); + supportUsView.setVisibility(View.GONE); } else { + setupItem(R.id.donate, true, root); setupItem(R.id.support_us, true, root); } setupItem(R.id.rate, true, root); @@ -131,6 +139,8 @@ public class HelpFragment extends BaseMwmFragment implements View.OnClickListene Utils.sendBugReport(getActivity(), ""); else if (id == R.id.support_us) openLink(Constants.Url.SUPPORT_US); + else if (id == R.id.donate) + openLink(mDonateUrl); else if (id == R.id.rate) Utils.openAppInMarket(getActivity(), BuildConfig.REVIEW_URL); else if (id == R.id.copyright) diff --git a/android/src/com/mapswithme/util/Config.java b/android/src/com/mapswithme/util/Config.java index 024e5e276d..e30c31b14e 100644 --- a/android/src/com/mapswithme/util/Config.java +++ b/android/src/com/mapswithme/util/Config.java @@ -41,6 +41,7 @@ public final class Config private static final String KEY_MISC_ENABLE_SCREEN_SLEEP = "EnableScreenSleep"; private static final String KEY_MISC_SHOW_ON_LOCK_SCREEN = "ShowOnLockScreen"; private static final String KEY_MISC_AGPS_TIMESTAMP = "AGPSTimestamp"; + private static final String KEY_DONATE_URL = "DonateUrl"; private Config() {} @@ -64,11 +65,13 @@ public final class Config return nativeGetLong(key, def); } + @NonNull private static String getString(String key) { return getString(key, ""); } + @NonNull private static String getString(String key, String def) { return nativeGetString(key, def); @@ -335,6 +338,11 @@ public final class Config nativeSetTransliteration(value); } + @NonNull + public static String getDonateUrl() + { + return getString(KEY_DONATE_URL); + } private static native boolean nativeGetBoolean(String name, boolean defaultValue); private static native void nativeSetBoolean(String name, boolean value); diff --git a/data/strings/strings.txt b/data/strings/strings.txt index 64b333e146..32e30d5f8b 100644 --- a/data/strings/strings.txt +++ b/data/strings/strings.txt @@ -5138,6 +5138,45 @@ zh-Hans = 问题和解答 zh-Hant = 問題和解答 + [donate] + comment = Button in the main menu + tags = android + en = Donate + ar = ﻉﺮﺒﺘﻳ + be = Ахвяраваць + bg = Дарете + cs = Darovat + da = Doner + de = Spenden + el = Προσφέρω + es = Donar + eu = Dohaintza eman + fa = ﺪﯿﻨﮐ ﺍﺪﻫﺍ + fi = Lahjoittaa + fr = Faire un don + he = םוֹרתְלִ + hu = Adományoz + id = Menyumbangkan + it = Donare + ja = 寄付 + ko = 기부 + nb = Donere + nl = Doneren + pl = Podarować + pt = Doar + pt-BR = Doar + ro = Donează + ru = Поддержать рублём + sk = Darovať + sv = Donera + sw = Changia + th = บริจาค + tr = Bağış yapmak + uk = Пожертвувати + vi = Quyên tặng + zh-Hans = 捐 + zh-Hant = 捐 + [how_to_support_us] comment = Button in the main Help dialog tags = android,ios