Hide support region setting

This commit is contained in:
cepprice 2021-04-19 13:08:06 +05:00
parent 2d2a951dde
commit cf26ccc7ab
2 changed files with 83 additions and 83 deletions

View file

@ -21,69 +21,69 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<LinearLayout <!-- <LinearLayout-->
android:id="@+id/support_region_container" <!-- android:id="@+id/support_region_container"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:orientation="horizontal" <!-- android:orientation="horizontal"-->
android:background="?android:attr/selectableItemBackground" <!-- android:background="?android:attr/selectableItemBackground"-->
android:paddingStart="@dimen/content_padding" <!-- android:paddingStart="@dimen/content_padding"-->
android:paddingLeft="@dimen/content_padding" <!-- android:paddingLeft="@dimen/content_padding"-->
android:paddingRight="@dimen/content_padding" <!-- android:paddingRight="@dimen/content_padding"-->
android:paddingEnd="@dimen/content_padding"> <!-- android:paddingEnd="@dimen/content_padding">-->
<androidx.appcompat.widget.AppCompatImageView <!-- <androidx.appcompat.widget.AppCompatImageView-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:minHeight="@dimen/setting_list_item_group_height" <!-- android:minHeight="@dimen/setting_list_item_group_height"-->
android:layout_gravity="center_vertical" <!-- android:layout_gravity="center_vertical"-->
android:layout_marginEnd="@dimen/map_widget_height" <!-- android:layout_marginEnd="@dimen/map_widget_height"-->
android:layout_marginRight="@dimen/map_widget_height" <!-- android:layout_marginRight="@dimen/map_widget_height"-->
app:srcCompat="@drawable/ic_world_globe_dark" <!-- app:srcCompat="@drawable/ic_world_globe_dark"-->
app:tint="?attr/default_icon_color" /> <!-- app:tint="?attr/default_icon_color" />-->
<LinearLayout <!-- <LinearLayout-->
android:layout_width="0dp" <!-- android:layout_width="0dp"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:layout_weight="1" <!-- android:layout_weight="1"-->
android:layout_marginTop="@dimen/content_padding_small" <!-- android:layout_marginTop="@dimen/content_padding_small"-->
android:layout_marginBottom="@dimen/content_padding_small" <!-- android:layout_marginBottom="@dimen/content_padding_small"-->
android:layout_gravity="center_vertical" <!-- android:layout_gravity="center_vertical"-->
android:orientation="vertical"> <!-- android:orientation="vertical">-->
<net.osmand.plus.widgets.TextViewEx <!-- <net.osmand.plus.widgets.TextViewEx-->
android:id="@+id/support_region_header" <!-- android:id="@+id/support_region_header"-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:textColor="?android:attr/textColorPrimary" <!-- android:textColor="?android:attr/textColorPrimary"-->
android:textSize="@dimen/default_list_text_size" <!-- android:textSize="@dimen/default_list_text_size"-->
osmand:typeface="@string/font_roboto_regular" <!-- osmand:typeface="@string/font_roboto_regular"-->
tools:text="@string/osm_live_support_region"/> <!-- tools:text="@string/osm_live_support_region"/>-->
<net.osmand.plus.widgets.TextViewEx <!-- <net.osmand.plus.widgets.TextViewEx-->
android:id="@+id/support_region" <!-- android:id="@+id/support_region"-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:layout_marginEnd="@dimen/content_padding" <!-- android:layout_marginEnd="@dimen/content_padding"-->
android:layout_marginRight="@dimen/content_padding" <!-- android:layout_marginRight="@dimen/content_padding"-->
android:text="@string/osm_live_support_region" <!-- android:text="@string/osm_live_support_region"-->
android:textColor="?android:attr/textColorSecondary" <!-- android:textColor="?android:attr/textColorSecondary"-->
android:textSize="@dimen/default_desc_text_size" <!-- android:textSize="@dimen/default_desc_text_size"-->
osmand:typeface="@string/font_roboto_regular" <!-- osmand:typeface="@string/font_roboto_regular"-->
tools:text="@string/clear_updates_proposition_message"/> <!-- tools:text="@string/clear_updates_proposition_message"/>-->
</LinearLayout> <!-- </LinearLayout>-->
<androidx.appcompat.widget.AppCompatImageView <!-- <androidx.appcompat.widget.AppCompatImageView-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:layout_gravity="center_vertical" <!-- android:layout_gravity="center_vertical"-->
app:srcCompat="@drawable/ic_action_settings" <!-- app:srcCompat="@drawable/ic_action_settings"-->
app:tint="?attr/default_icon_color" /> <!-- app:tint="?attr/default_icon_color" />-->
</LinearLayout> <!-- </LinearLayout>-->
<include layout="@layout/simple_divider_item" /> <!-- <include layout="@layout/simple_divider_item" />-->
<LinearLayout <LinearLayout
android:id="@+id/report_container" android:id="@+id/report_container"

View file

@ -28,7 +28,7 @@ public class SubscriptionsCard extends BaseCard {
private static final String PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?sku=%s&package=%s"; private static final String PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?sku=%s&package=%s";
private Fragment target; private Fragment target;
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment(); // private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
private SubscriptionsListCard subscriptionsListCard; private SubscriptionsListCard subscriptionsListCard;
private InAppPurchaseHelper purchaseHelper; private InAppPurchaseHelper purchaseHelper;
@ -100,23 +100,23 @@ public class SubscriptionsCard extends BaseCard {
} }
private void setupSupportRegion() { private void setupSupportRegion() {
String region = LiveUpdatesFragment.getSupportRegionName(app, purchaseHelper); // String region = LiveUpdatesFragment.getSupportRegionName(app, purchaseHelper);
String header = LiveUpdatesFragment.getSupportRegionHeader(app, region); // String header = LiveUpdatesFragment.getSupportRegionHeader(app, region);
TextView supportRegionHeader = view.findViewById(R.id.support_region_header); // TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
TextView supportRegion = view.findViewById(R.id.support_region); // TextView supportRegion = view.findViewById(R.id.support_region);
supportRegionHeader.setText(header); // supportRegionHeader.setText(header);
supportRegion.setText(region); // supportRegion.setText(region);
//
View supportRegionContainer = view.findViewById(R.id.support_region_container); // View supportRegionContainer = view.findViewById(R.id.support_region_container);
supportRegionContainer.setOnClickListener(new View.OnClickListener() { // supportRegionContainer.setOnClickListener(new View.OnClickListener() {
@Override // @Override
public void onClick(View v) { // public void onClick(View v) {
CountrySelectionFragment countryCountrySelectionFragment = countrySelectionFragment; // CountrySelectionFragment countryCountrySelectionFragment = countrySelectionFragment;
countryCountrySelectionFragment.show(target.getChildFragmentManager(), CountrySelectionFragment.TAG); // countryCountrySelectionFragment.show(target.getChildFragmentManager(), CountrySelectionFragment.TAG);
} // }
}); // });
//
countrySelectionFragment.initCountries(app); // countrySelectionFragment.initCountries(app);
} }
private String getSubscriptionUrl() { private String getSubscriptionUrl() {
@ -131,15 +131,15 @@ public class SubscriptionsCard extends BaseCard {
} }
public void onSupportRegionSelected(CountrySelectionFragment.CountryItem selectedCountryItem) { public void onSupportRegionSelected(CountrySelectionFragment.CountryItem selectedCountryItem) {
String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : ""; // String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
String countryDownloadName = selectedCountryItem != null ? // String countryDownloadName = selectedCountryItem != null ?
selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER; // selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER;
//
TextView supportRegionHeader = view.findViewById(R.id.support_region_header); // TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
TextView supportRegion = view.findViewById(R.id.support_region); // TextView supportRegion = view.findViewById(R.id.support_region);
supportRegionHeader.setText(LiveUpdatesFragment.getSupportRegionHeader(app, countryName)); // supportRegionHeader.setText(LiveUpdatesFragment.getSupportRegionHeader(app, countryName));
supportRegion.setText(countryName); // supportRegion.setText(countryName);
app.getSettings().BILLING_USER_COUNTRY.set(countryName); // app.getSettings().BILLING_USER_COUNTRY.set(countryName);
app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(countryDownloadName); // app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(countryDownloadName);
} }
} }