InApp small fix

This commit is contained in:
Alexey Kulish 2016-01-27 21:56:44 +03:00
parent 45590093e4
commit e404e492b7
2 changed files with 4 additions and 17 deletions

View file

@ -108,7 +108,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment {
//getSettings().LIVE_UPDATES_PURCHASED.set(true);
subscriptionHeader = inflater.inflate(R.layout.live_updates_header, listView, false);
updateHeader();
updateSubscriptionHeader();
listView.addHeaderView(subscriptionHeader);
@ -116,7 +116,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment {
return view;
}
public void updateHeader() {
public void updateSubscriptionHeader() {
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
if (getSettings().LIVE_UPDATES_PURCHASED.get()) {
@ -176,18 +176,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment {
}
}
public void updateSubscriptionBanner() {
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
if (InAppHelper.isSubscribedToLiveUpdates()) {
subscriptionBanner.setVisibility(View.GONE);
subscriptionInfo.setVisibility(View.VISIBLE);
} else {
subscriptionBanner.setVisibility(View.VISIBLE);
subscriptionInfo.setVisibility(View.GONE);
}
}
@Override
public void onDestroyView() {
super.onDestroyView();

View file

@ -4,7 +4,6 @@ import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@ -226,7 +225,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
Fragment parent = getParentFragment();
if (parent != null && parent instanceof LiveUpdatesFragment) {
((LiveUpdatesFragment) parent).updateHeader();
((LiveUpdatesFragment) parent).updateSubscriptionHeader();
}
dismiss();
@ -330,7 +329,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
if (InAppHelper.getSkuLiveUpdates().equals(sku)) {
Fragment parentFragment = getParentFragment();
if (parentFragment instanceof LiveUpdatesFragment) {
((LiveUpdatesFragment) parentFragment).updateSubscriptionBanner();
((LiveUpdatesFragment) parentFragment).updateSubscriptionHeader();
}
}