Fix choose plan ui issues

This commit is contained in:
crimean 2018-11-01 21:30:58 +03:00
parent 858a210b65
commit 360744b9cd
2 changed files with 17 additions and 8 deletions

View file

@ -63,6 +63,7 @@
android:id="@+id/card_buttons_container" android:id="@+id/card_buttons_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone" /> android:visibility="gone" />

View file

@ -14,7 +14,6 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes; import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -329,12 +328,6 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
double regularMonthlyPrice = monthlyLiveUpdates.getPriceValue(); double regularMonthlyPrice = monthlyLiveUpdates.getPriceValue();
for (final InAppSubscription s : purchaseHelper.getLiveUpdates().getVisibleSubscriptions()) { for (final InAppSubscription s : purchaseHelper.getLiveUpdates().getVisibleSubscriptions()) {
if (s.isPurchased()) { if (s.isPurchased()) {
if (lastBtn != null) {
View lastBtnDiv = lastBtn.findViewById(R.id.div);
if (lastBtnDiv != null) {
lastBtnDiv.setVisibility(View.GONE);
}
}
View buttonPurchased = inflate(R.layout.purchase_dialog_card_button_active_ex, osmLiveCardButtonsContainer); View buttonPurchased = inflate(R.layout.purchase_dialog_card_button_active_ex, osmLiveCardButtonsContainer);
View buttonContainer = buttonPurchased.findViewById(R.id.button_container); View buttonContainer = buttonPurchased.findViewById(R.id.button_container);
TextViewEx title = (TextViewEx) buttonPurchased.findViewById(R.id.title); TextViewEx title = (TextViewEx) buttonPurchased.findViewById(R.id.title);
@ -378,7 +371,6 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
divBottom = buttonCancel.findViewById(R.id.div_bottom); divBottom = buttonCancel.findViewById(R.id.div_bottom);
div = buttonCancel.findViewById(R.id.div); div = buttonCancel.findViewById(R.id.div);
buttonContainer.setBackgroundDrawable(null);
title.setText(getString(R.string.osm_live_payment_current_subscription)); title.setText(getString(R.string.osm_live_payment_current_subscription));
description.setText(s.getRenewDescription(ctx)); description.setText(s.getRenewDescription(ctx));
buttonView.setVisibility(View.GONE); buttonView.setVisibility(View.GONE);
@ -394,6 +386,18 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
divBottom.setVisibility(View.VISIBLE); divBottom.setVisibility(View.VISIBLE);
osmLiveCardButtonsContainer.addView(buttonCancel); osmLiveCardButtonsContainer.addView(buttonCancel);
if (lastBtn != null) {
View lastBtnDiv = lastBtn.findViewById(R.id.div);
if (lastBtnDiv != null) {
lastBtnDiv.setVisibility(View.GONE);
}
View lastBtnDivBottom = lastBtn.findViewById(R.id.div_bottom);
if (lastBtnDivBottom != null) {
lastBtnDivBottom.setVisibility(View.GONE);
}
}
lastBtn = buttonCancel;
} else { } else {
View button = inflate(R.layout.purchase_dialog_card_button_ex, osmLiveCardButtonsContainer); View button = inflate(R.layout.purchase_dialog_card_button_ex, osmLiveCardButtonsContainer);
TextViewEx title = (TextViewEx) button.findViewById(R.id.title); TextViewEx title = (TextViewEx) button.findViewById(R.id.title);
@ -441,6 +445,10 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
if (div != null) { if (div != null) {
div.setVisibility(View.GONE); div.setVisibility(View.GONE);
} }
View divBottom = lastBtn.findViewById(R.id.div_bottom);
if (divBottom != null) {
divBottom.setVisibility(View.GONE);
}
} }
if (osmLiveCardProgress != null) { if (osmLiveCardProgress != null) {
osmLiveCardProgress.setVisibility(View.GONE); osmLiveCardProgress.setVisibility(View.GONE);