diff --git a/android/res/drawable/ic_matrix.xml b/android/res/drawable/ic_matrix.xml new file mode 100644 index 0000000000..8ae88ce1cd --- /dev/null +++ b/android/res/drawable/ic_matrix.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/android/res/drawable/ic_openstreetmap.xml b/android/res/drawable/ic_openstreetmap.xml new file mode 100644 index 0000000000..bbb123017e --- /dev/null +++ b/android/res/drawable/ic_openstreetmap.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/src/com/mapswithme/maps/help/HelpFragment.java b/android/src/com/mapswithme/maps/help/HelpFragment.java index 62bb709384..c97e57dc5b 100644 --- a/android/src/com/mapswithme/maps/help/HelpFragment.java +++ b/android/src/com/mapswithme/maps/help/HelpFragment.java @@ -1,7 +1,5 @@ package com.mapswithme.maps.help; -import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -58,14 +56,16 @@ public class HelpFragment extends BaseMwmFragment implements View.OnClickListene .setText(getString(R.string.data_version, localDate(Framework.nativeGetDataVersion()))); setupItem(R.id.web, true, root); + setupItem(R.id.email, true, root); setupItem(R.id.github, false, root); setupItem(R.id.telegram, false, root); setupItem(R.id.instagram, false, root); setupItem(R.id.facebook, false, root); setupItem(R.id.twitter, false, root); + setupItem(R.id.matrix, true, root); + setupItem(R.id.openstreetmap, true, root); setupItem(R.id.faq, true, root); setupItem(R.id.report, true, root); - //noinspection ConstantConditions if ("google".equalsIgnoreCase(BuildConfig.FLAVOR)) { TextView view = root.findViewById(R.id.support_us); @@ -103,51 +103,34 @@ public class HelpFragment extends BaseMwmFragment implements View.OnClickListene @Override public void onClick(View v) { - switch (v.getId()) - { - case R.id.web: - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.WEB_SITE))); - break; - - case R.id.github: - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.GITHUB))); - break; - - case R.id.telegram: - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.TELEGRAM))); - break; - - case R.id.instagram: - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.INSTAGRAM))); - break; - - case R.id.facebook: + final int id = v.getId(); + if (id == R.id.web) + openLink(Constants.Url.WEB_SITE); + else if (id == R.id.email) + Utils.sendTo(getContext(), BuildConfig.SUPPORT_MAIL, "Organic Maps"); + else if (id == R.id.github) + openLink(Constants.Url.GITHUB); + else if (id == R.id.telegram) + openLink(Constants.Url.TELEGRAM); + else if (id == R.id.instagram) + openLink(Constants.Url.INSTAGRAM); + else if (id == R.id.facebook) Utils.showFacebookPage(getActivity()); - break; - - case R.id.twitter: - Utils.showTwitterPage(getActivity()); - break; - - case R.id.faq: + else if (id == R.id.twitter) + openLink(Constants.Url.TWITTER); + else if (id == R.id.matrix) + openLink(Constants.Url.MATRIX); + else if (id == R.id.openstreetmap) + openLink(Constants.Url.OSM_ABOUT); + else if (id == R.id.faq) ((HelpActivity) getActivity()).stackFragment(FaqFragment.class, getString(R.string.faq), null); - break; - - case R.id.report: + else if (id == R.id.report) Utils.sendFeedback(getActivity()); - break; - - case R.id.support_us: - Utils.showSupportUsPage(getActivity()); - break; - - case R.id.rate: + else if (id == R.id.support_us) + openLink(Constants.Url.SUPPORT_US); + else if (id == R.id.rate) Utils.openAppInMarket(getActivity(), BuildConfig.REVIEW_URL); - break; - - case R.id.copyright: + else if (id == R.id.copyright) ((HelpActivity) getActivity()).stackFragment(CopyrightFragment.class, getString(R.string.copyright), null); - break; - } } } diff --git a/android/src/com/mapswithme/util/Constants.java b/android/src/com/mapswithme/util/Constants.java index b04c265cea..1c1d193a85 100644 --- a/android/src/com/mapswithme/util/Constants.java +++ b/android/src/com/mapswithme/util/Constants.java @@ -25,6 +25,7 @@ public final class Constants public static final String TWITTER = "https://twitter.com/OrganicMapsApp"; public static final String TELEGRAM = "https://t.me/OrganicMaps"; public static final String INSTAGRAM = "https://www.instagram.com/organicmaps.app"; + public static final String MATRIX = "https://matrix.to/#/%23organicmaps:matrix.org"; public static final String SUPPORT_US = "https://organicmaps.app/support-us"; diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index 237679cee4..94bdac6263 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -264,16 +264,6 @@ public class Utils } } - public static void showTwitterPage(Activity activity) - { - activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.TWITTER))); - } - - public static void showSupportUsPage(Activity activity) - { - activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.SUPPORT_US))); - } - public static void openUrl(@NonNull Context context, @Nullable String url) { if (TextUtils.isEmpty(url)) @@ -435,9 +425,19 @@ public class Utils } public static void sendTo(@NonNull Context context, @NonNull String email) + { + sendTo(context, email, "", ""); + } + + public static void sendTo(@NonNull Context context, @NonNull String email, @NonNull String subject) + { + sendTo(context, email, subject, ""); + } + + public static void sendTo(@NonNull Context context, @NonNull String email, @NonNull String subject, @NonNull String body) { Intent intent = new Intent(Intent.ACTION_SENDTO); - intent.setData(Utils.buildMailUri(email, "", "")); + intent.setData(Utils.buildMailUri(email, subject, body)); context.startActivity(intent); }