Merge pull request #11465 from osmandapp/purchases_screen_review
Purchases screen review
This commit is contained in:
commit
cd970e85ff
10 changed files with 26 additions and 132 deletions
|
@ -64,7 +64,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingStart="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding_small"
|
||||
android:paddingTop="@dimen/content_padding_small_half"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
|
@ -13,78 +11,13 @@
|
|||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider" />
|
||||
<include layout="@layout/divider" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/subscriptions_list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_region_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/setting_list_item_group_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_world_globe_dark"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/osm_live_support_region"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:text="@string/osm_live_support_region"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/clear_updates_proposition_message"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_action_settings"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/simple_divider_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/report_container"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -206,8 +139,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activity_background_color">
|
||||
|
||||
<include
|
||||
layout="@layout/card_bottom_divider" />
|
||||
<include layout="@layout/card_bottom_divider" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
android:id="@+id/troubleshooting_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
|
|
|
@ -442,15 +442,14 @@ public class UiUtilities {
|
|||
} catch (Throwable e) { }
|
||||
}
|
||||
|
||||
public static void rotateImageByLayoutDirection(ImageView image, int layoutDirection) {
|
||||
public static void rotateImageByLayoutDirection(ImageView image) {
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
int rotation = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
|
||||
int rotation = AndroidUtils.getLayoutDirection(image.getContext()) == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
|
||||
image.setRotationY(rotation);
|
||||
}
|
||||
|
||||
|
||||
public static void updateCustomRadioButtons(Context app, View buttonsView, boolean nightMode,
|
||||
CustomRadioButtonType buttonType) {
|
||||
int activeColor = ContextCompat.getColor(app, nightMode
|
||||
|
|
|
@ -109,7 +109,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat
|
|||
}
|
||||
}
|
||||
});
|
||||
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
|
||||
UiUtilities.rotateImageByLayoutDirection(closeButton);
|
||||
|
||||
Drawable pluginImage = plugin.getAssetResourceImage();
|
||||
if (pluginImage != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi
|
|||
}
|
||||
}
|
||||
});
|
||||
UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app));
|
||||
UiUtilities.rotateImageByLayoutDirection(closeButton);
|
||||
|
||||
adapter = new PluginsListAdapter(requireContext());
|
||||
|
||||
|
|
|
@ -492,8 +492,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
});
|
||||
if (closeButton instanceof ImageView) {
|
||||
UiUtilities.rotateImageByLayoutDirection(
|
||||
(ImageView) closeButton, AndroidUtils.getLayoutDirection(app));
|
||||
UiUtilities.rotateImageByLayoutDirection((ImageView) closeButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ import android.widget.ImageButton;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -30,11 +35,6 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurchaseListener, OnFragmentInteractionListener {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(PurchasesFragment.class);
|
||||
|
@ -152,6 +152,7 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
}
|
||||
});
|
||||
ImageButton backButton = toolbar.findViewById(R.id.close_button);
|
||||
UiUtilities.rotateImageByLayoutDirection(backButton);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -197,9 +198,7 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
|
||||
@Override
|
||||
public void onSearchResult(CountrySelectionFragment.CountryItem name) {
|
||||
if (subscriptionsCard != null) {
|
||||
subscriptionsCard.onSupportRegionSelected(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,30 +5,26 @@ import android.net.Uri;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesFragment;
|
||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class SubscriptionsCard extends BaseCard {
|
||||
|
||||
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 Fragment target;
|
||||
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||
private SubscriptionsListCard subscriptionsListCard;
|
||||
|
||||
private InAppPurchaseHelper purchaseHelper;
|
||||
|
@ -54,7 +50,6 @@ public class SubscriptionsCard extends BaseCard {
|
|||
}
|
||||
|
||||
updateSubscriptionsListCard();
|
||||
setupSupportRegion();
|
||||
|
||||
LinearLayout reportContainer = view.findViewById(R.id.report_container);
|
||||
reportContainer.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -99,26 +94,6 @@ public class SubscriptionsCard extends BaseCard {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupSupportRegion() {
|
||||
String region = LiveUpdatesFragment.getSupportRegionName(app, purchaseHelper);
|
||||
String header = LiveUpdatesFragment.getSupportRegionHeader(app, region);
|
||||
TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = view.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(header);
|
||||
supportRegion.setText(region);
|
||||
|
||||
View supportRegionContainer = view.findViewById(R.id.support_region_container);
|
||||
supportRegionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CountrySelectionFragment countryCountrySelectionFragment = countrySelectionFragment;
|
||||
countryCountrySelectionFragment.show(target.getChildFragmentManager(), CountrySelectionFragment.TAG);
|
||||
}
|
||||
});
|
||||
|
||||
countrySelectionFragment.initCountries(app);
|
||||
}
|
||||
|
||||
private String getSubscriptionUrl() {
|
||||
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
|
||||
if (purchaseHelper != null && purchaseHelper.getFullVersion() != null) {
|
||||
|
@ -129,17 +104,4 @@ public class SubscriptionsCard extends BaseCard {
|
|||
return PLAY_STORE_SUBSCRIPTION_URL;
|
||||
}
|
||||
}
|
||||
|
||||
public void onSupportRegionSelected(CountrySelectionFragment.CountryItem selectedCountryItem) {
|
||||
String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
|
||||
String countryDownloadName = selectedCountryItem != null ?
|
||||
selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER;
|
||||
|
||||
TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = view.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(LiveUpdatesFragment.getSupportRegionHeader(app, countryName));
|
||||
supportRegion.setText(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY.set(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(countryDownloadName);
|
||||
}
|
||||
}
|
|
@ -7,20 +7,22 @@ import android.text.Spannable;
|
|||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
public class TroubleshootingOrPurchasingCard extends BaseCard {
|
||||
|
||||
private static final String OSMAND_NEW_DEVICE_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account";
|
||||
|
@ -74,6 +76,9 @@ public class TroubleshootingOrPurchasingCard extends BaseCard {
|
|||
} else {
|
||||
AndroidUtils.setBackground(mapActivity, getItButton, nightMode, R.drawable.btn_unstroked_light, R.drawable.btn_unstroked_dark);
|
||||
}
|
||||
|
||||
ImageView getItArrow = view.findViewById(R.id.additional_button_icon);
|
||||
UiUtilities.rotateImageByLayoutDirection(getItArrow);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue