Review
This commit is contained in:
parent
8de07a2c59
commit
7487cda2c3
8 changed files with 81 additions and 210 deletions
|
@ -12,13 +12,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/profile_preference_toolbar_with_icon" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_width="@dimen/map_widget_height"
|
||||
android:layout_height="@dimen/context_menu_controller_height"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/favorites_my_places_icon_size"
|
||||
android:layout_marginBottom="@dimen/favorites_my_places_icon_size"
|
||||
|
@ -27,7 +25,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_header_height"
|
||||
android:layout_marginLeft="@dimen/list_header_height"
|
||||
android:layout_marginEnd="@dimen/list_header_height"
|
||||
|
@ -36,7 +34,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title3"
|
||||
android:id="@+id/any_purchases_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
@ -212,6 +210,8 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/report_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -60,7 +60,7 @@
|
|||
android:id="@+id/live_updates_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -101,7 +101,7 @@
|
|||
android:id="@+id/manage_subscription_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -133,17 +133,18 @@
|
|||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/troubleshooting_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
|
@ -162,7 +163,7 @@
|
|||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
app:srcCompat="@drawable/ic_action_help"
|
||||
app:tint="?attr/active_color_basic_green" />
|
||||
app:tint="?attr/profile_icon_color_green" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/troubleshooting_title"
|
||||
|
@ -194,7 +195,7 @@
|
|||
android:id="@+id/restore_purchases"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -232,7 +233,7 @@
|
|||
android:id="@+id/new_device_account_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -270,7 +271,7 @@
|
|||
android:id="@+id/support_link_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
|
@ -307,7 +308,7 @@
|
|||
android:id="@+id/contact_support_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:drawable/list_selector_background"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/action_bar_image_side_margin"
|
||||
android:paddingLeft="@dimen/action_bar_image_side_margin"
|
||||
android:paddingTop="@dimen/card_padding"
|
||||
|
@ -330,6 +331,8 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
<attr name="divider_color_basic" format="reference" />
|
||||
<attr name="main_font_color_basic" format="reference" />
|
||||
<attr name="active_color_basic" format="reference" />
|
||||
<attr name="active_color_basic_green" format="reference" />
|
||||
<attr name="profile_icon_color_green" format="reference" />
|
||||
<attr name="card_and_list_background_basic" format="reference" />
|
||||
<attr name="activity_background_basic" format="reference" />
|
||||
<attr name="pages_bg" format="reference"/>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
<string name="troubleshooting_description">Please follow this link if you any issues with purchases.</string>
|
||||
<string name="troubleshooting">Troubleshooting</string>
|
||||
<string name="contact_support_mail">support@osmand.net</string>
|
||||
<string name="contact_support">Contact support</string>
|
||||
<string name="empty_purchases_description">If your purchases don\'t show up here, tap on “Restore purchases”, or contact our support team.</string>
|
||||
<string name="contact_support_description">If you have any questions, please contact us at %1$s.</string>
|
||||
|
|
|
@ -218,7 +218,7 @@
|
|||
<item name="divider_color_basic">@color/divider_color_light</item>
|
||||
<item name="main_font_color_basic">@color/text_color_primary_light</item>
|
||||
<item name="active_color_basic">@color/active_color_primary_light</item>
|
||||
<item name="active_color_basic_green">@color/profile_icon_color_green_light</item>
|
||||
<item name="profile_icon_color_green">@color/profile_icon_color_green_light</item>
|
||||
<item name="card_and_list_background_basic">@color/card_and_list_background_light</item>
|
||||
<item name="activity_background_basic">@color/activity_background_light</item>
|
||||
<item name="pages_bg">@drawable/pages_bg_light</item>
|
||||
|
@ -520,7 +520,7 @@
|
|||
<item name="divider_color_basic">@color/divider_color_dark</item>
|
||||
<item name="main_font_color_basic">@color/text_color_primary_dark</item>
|
||||
<item name="active_color_basic">@color/active_color_primary_dark</item>
|
||||
<item name="active_color_basic_green">@color/profile_icon_color_green_dark</item>
|
||||
<item name="profile_icon_color_green">@color/profile_icon_color_green_dark</item>
|
||||
<item name="card_and_list_background_basic">@color/card_and_list_background_dark</item>
|
||||
<item name="activity_background_basic">@color/activity_background_dark</item>
|
||||
<item name="pages_bg">@drawable/pages_bg_dark</item>
|
||||
|
|
|
@ -1030,22 +1030,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
*/
|
||||
|
||||
if (Version.isGooglePlayEnabled() || Version.isHuawei() || Version.isDeveloperVersion(app)) {
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.purchases, mapActivity)
|
||||
.setId(DRAWER_OSMAND_LIVE_ID)
|
||||
.setIcon(R.drawable.ic_action_purchases)
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||
app.logEvent("drawer_osm_live_open");
|
||||
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
mapActivity.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}).createItem());
|
||||
}
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity)
|
||||
.setId(DRAWER_HELP_ID)
|
||||
.setIcon(R.drawable.ic_action_help)
|
||||
|
|
|
@ -32,9 +32,11 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew;
|
||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||
|
@ -43,6 +45,7 @@ import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
|||
public class PurchasesFragment extends BaseOsmAndFragment {
|
||||
|
||||
public static final String TAG = PurchasesFragment.class.getName();
|
||||
public static final String KEY_IS_SUBSCRIBER = "action_is_new";
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_URL = "https://play.google.com/store/account/subscriptions";
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?sku=%s&package=%s";
|
||||
private InAppPurchaseHelper purchaseHelper;
|
||||
|
@ -50,6 +53,7 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
private Context context;
|
||||
private OsmandApplication app;
|
||||
private String url;
|
||||
private Boolean isSubscriber;
|
||||
|
||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||
try {
|
||||
|
@ -74,12 +78,26 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
app = getMyApplication();
|
||||
context = requireContext();
|
||||
purchaseHelper = getInAppPurchaseHelper();
|
||||
|
||||
|
||||
isSubscriber = Version.isPaidVersion(app);
|
||||
final MapActivity mapActivity = (MapActivity) getActivity();
|
||||
final boolean nightMode = !getMyApplication().getSettings().isLightContent();
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(context, nightMode);
|
||||
|
||||
if (!isSubscriber) {
|
||||
mainView = themedInflater.inflate(R.layout.purchases_layout, container, false);
|
||||
setSubscriptionClick(mapActivity);
|
||||
} else {
|
||||
mainView = themedInflater.inflate(R.layout.empty_purchases_layout, container, false);
|
||||
LinearLayout osmandLive = mainView.findViewById(R.id.osmand_live);
|
||||
osmandLive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getMyApplication() != null && getMyActivity() != null) {
|
||||
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), getMyActivity().getSupportFragmentManager(), ChoosePlanDialogFragment.ChoosePlanDialogType.OSM_LIVE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
AndroidUtils.addStatusBarPadding21v(getActivity(), mainView);
|
||||
createToolbar(mainView, nightMode);
|
||||
mainView.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
@ -87,7 +105,6 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayout purchasesRestore = mainView.findViewById(R.id.restore_purchases);
|
||||
purchasesRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -97,6 +114,33 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
LinearLayout newDeviceAccountContainer = mainView.findViewById(R.id.new_device_account_container);
|
||||
newDeviceAccountContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
WikipediaDialogFragment.showFullArticle(context, Uri.parse("https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account"), nightMode);
|
||||
}
|
||||
});
|
||||
|
||||
setFormatLink();
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(KEY_IS_SUBSCRIBER, isSubscriber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
|
||||
super.onViewStateRestored(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
savedInstanceState.getBoolean(KEY_IS_SUBSCRIBER);
|
||||
}
|
||||
}
|
||||
|
||||
private void setSubscriptionClick(final MapActivity mapActivity) {
|
||||
LinearLayout reportContainer = mainView.findViewById(R.id.report_container);
|
||||
reportContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -118,16 +162,18 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
LinearLayout newDeviceAccountContainer = mainView.findViewById(R.id.new_device_account_container);
|
||||
newDeviceAccountContainer.setOnClickListener(new View.OnClickListener() {
|
||||
getSkuAppId();
|
||||
LinearLayout manageSubscriptionContainer = mainView.findViewById(R.id.manage_subscription_container);
|
||||
manageSubscriptionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
WikipediaDialogFragment.showFullArticle(context, Uri.parse("https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account"), nightMode);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
if (AndroidUtils.isIntentSafe(context, intent)) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setFormatLink();
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -163,18 +209,7 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
getSkuAppId();
|
||||
LinearLayout manageSubscriptionContainer = mainView.findViewById(R.id.manage_subscription_container);
|
||||
manageSubscriptionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
if (AndroidUtils.isIntentSafe(context, intent)) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||
toolbarTitle.setText(getString(R.string.purchases));
|
||||
appbar.addView(toolbar);
|
||||
|
@ -188,7 +223,7 @@ public class PurchasesFragment extends BaseOsmAndFragment {
|
|||
String urlSupport = "mailto:support@osmand.net";
|
||||
spannableStringSupport.setSpan(new URLSpan(urlSupport), 0, spannableStringSupport.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
String emailString = getString(R.string.contact_support_mail);
|
||||
String emailString = "support@osmand.net";
|
||||
String supportDescriptionString = getString(R.string.contact_support_description, emailString);
|
||||
SpannableString spannableStringMail = new SpannableString(supportDescriptionString);
|
||||
int startIndex = supportDescriptionString.indexOf(emailString);
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
package net.osmand.plus.settings.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
|
||||
public class PurchasesFragmentEmpty extends BaseOsmAndFragment {
|
||||
public static final String TAG = PurchasesFragmentEmpty.class.getName();
|
||||
private InAppPurchaseHelper purchaseHelper;
|
||||
private View mainView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
Context context = requireContext();
|
||||
purchaseHelper = getInAppPurchaseHelper();
|
||||
boolean nightMode = !getMyApplication().getSettings().isLightContent();
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(context, nightMode);
|
||||
mainView = themedInflater.inflate(R.layout.empty_purchases_layout, container, false);
|
||||
createToolbar(mainView, nightMode);
|
||||
LinearLayout purchasesRestore = mainView.findViewById(R.id.restore_purchases);
|
||||
purchasesRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (purchaseHelper != null && !purchaseHelper.hasInventory()) {
|
||||
purchaseHelper.requestInventory();
|
||||
}
|
||||
}
|
||||
});
|
||||
LinearLayout osmandLive = mainView.findViewById(R.id.osmand_live);
|
||||
osmandLive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getMyApplication() != null && getMyActivity() != null) {
|
||||
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), getMyActivity().getSupportFragmentManager(), ChoosePlanDialogFragment.ChoosePlanDialogType.OSM_LIVE);
|
||||
}
|
||||
}
|
||||
});
|
||||
setFormatLink();
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public InAppPurchaseHelper getInAppPurchaseHelper() {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof OsmandInAppPurchaseActivity) {
|
||||
return ((OsmandInAppPurchaseActivity) activity).getPurchaseHelper();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createToolbar(View mainView, boolean nightMode) {
|
||||
AppBarLayout appbar = mainView.findViewById(R.id.appbar);
|
||||
View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.profile_preference_toolbar_with_icon, appbar, false);
|
||||
|
||||
View iconToolbarContainer = toolbar.findViewById(R.id.icon_toolbar);
|
||||
ImageView icon = iconToolbarContainer.findViewById(R.id.profile_icon);
|
||||
icon.setImageResource(R.drawable.ic_action_help_online);
|
||||
icon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Uri uri = Uri.parse("https://docs.osmand.net/en/main@latest/osmand/purchases");
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
ImageButton backButton = toolbar.findViewById(R.id.close_button);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentActivity fragmentActivity = getActivity();
|
||||
if (fragmentActivity != null) {
|
||||
fragmentActivity.onBackPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||
toolbarTitle.setText(getString(R.string.purchases));
|
||||
appbar.addView(toolbar);
|
||||
}
|
||||
|
||||
public void setFormatLink() {
|
||||
TextView newDeviceAccountLink = mainView.findViewById(R.id.new_device_account_title);
|
||||
TextView contactSupportLink = mainView.findViewById(R.id.contact_support_title);
|
||||
TextView supportDescription = mainView.findViewById(R.id.support_link_title);
|
||||
|
||||
SpannableString spannableStringSupport = new SpannableString(getString(R.string.contact_support));
|
||||
String urlSupport = "mailto:support@osmand.net";
|
||||
spannableStringSupport.setSpan(new URLSpan(urlSupport), 0, spannableStringSupport.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
SpannableString spannableStringNewDeviceAccount = new SpannableString(getString(R.string.new_device_account));
|
||||
String urlNewDeviceAccount = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account";
|
||||
spannableStringNewDeviceAccount.setSpan(new URLSpan(urlNewDeviceAccount), 0, spannableStringNewDeviceAccount.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
String emailString = getString(R.string.contact_support_mail);
|
||||
String supportDescriptionString = getString(R.string.contact_support_description, emailString);
|
||||
SpannableString spannableStringMail = new SpannableString(supportDescriptionString);
|
||||
int startIndex = supportDescriptionString.indexOf(emailString);
|
||||
int endIndex = startIndex + emailString.length();
|
||||
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableStringMail.setSpan(boldSpan, startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
contactSupportLink.setText(spannableStringSupport);
|
||||
newDeviceAccountLink.setText(spannableStringNewDeviceAccount);
|
||||
supportDescription.setText(spannableStringMail);
|
||||
|
||||
AndroidUtils.removeLinkUnderline(contactSupportLink);
|
||||
AndroidUtils.removeLinkUnderline(newDeviceAccountLink);
|
||||
|
||||
contactSupportLink.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
newDeviceAccountLink.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue