diff --git a/OsmAnd/res/layout/subscription_layout.xml b/OsmAnd/res/layout/subscription_layout.xml index 411e49db31..044ab6ba03 100644 --- a/OsmAnd/res/layout/subscription_layout.xml +++ b/OsmAnd/res/layout/subscription_layout.xml @@ -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" diff --git a/OsmAnd/res/layout/subscriptions_card.xml b/OsmAnd/res/layout/subscriptions_card.xml index 4635957ad7..7d2058a487 100644 --- a/OsmAnd/res/layout/subscriptions_card.xml +++ b/OsmAnd/res/layout/subscriptions_card.xml @@ -1,8 +1,6 @@ - + - - - - - - - - - - - - - - - - - - - + diff --git a/OsmAnd/res/layout/troubleshooting_card.xml b/OsmAnd/res/layout/troubleshooting_card.xml index e7de139dc1..3ce447d5d0 100644 --- a/OsmAnd/res/layout/troubleshooting_card.xml +++ b/OsmAnd/res/layout/troubleshooting_card.xml @@ -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" diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index a7c0223c22..cba86b7f8b 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -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 diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java index ced666e32b..5d32ee228d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java @@ -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) { diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java index 04666e9607..54439daefa 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginsFragment.java @@ -101,7 +101,7 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi } } }); - UiUtilities.rotateImageByLayoutDirection(closeButton, AndroidUtils.getLayoutDirection(app)); + UiUtilities.rotateImageByLayoutDirection(closeButton); adapter = new PluginsListAdapter(requireContext()); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index 05c4c7e323..73c62eacfe 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -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); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/PurchasesFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/PurchasesFragment.java index 461f51e14d..9c60348d65 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/PurchasesFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/PurchasesFragment.java @@ -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 diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java b/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java index 6b7ba26980..0957969ccd 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java @@ -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); - } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/TroubleshootingOrPurchasingCard.java b/OsmAnd/src/net/osmand/plus/settings/fragments/TroubleshootingOrPurchasingCard.java index f0ed9d8968..6758292334 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/TroubleshootingOrPurchasingCard.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/TroubleshootingOrPurchasingCard.java @@ -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); } }