Fix crash
This commit is contained in:
parent
075fcf7806
commit
4aa118fe45
1 changed files with 39 additions and 37 deletions
|
@ -164,45 +164,47 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
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()) {
|
||||
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
|
||||
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
|
||||
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
|
||||
statusTextView.setText(getString(R.string.osm_live_active));
|
||||
statusIcon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_done));
|
||||
if (getActivity() instanceof OsmLiveActivity) {
|
||||
if (getSettings().LIVE_UPDATES_PURCHASED.get()) {
|
||||
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
|
||||
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
|
||||
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
|
||||
statusTextView.setText(getString(R.string.osm_live_active));
|
||||
statusIcon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_done));
|
||||
|
||||
String countryName = getSettings().BILLING_USER_COUNTRY.get();
|
||||
if (Algorithms.isEmpty(countryName)) {
|
||||
WorldRegion world = getMyApplication().getRegions().getWorldRegion();
|
||||
countryName = world.getLocaleName();
|
||||
String countryName = getSettings().BILLING_USER_COUNTRY.get();
|
||||
if (Algorithms.isEmpty(countryName)) {
|
||||
WorldRegion world = getMyApplication().getRegions().getWorldRegion();
|
||||
countryName = world.getLocaleName();
|
||||
}
|
||||
regionNameTextView.setText(countryName);
|
||||
|
||||
subscriptionBanner.setVisibility(View.GONE);
|
||||
subscriptionInfo.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Button readMoreBtn = (Button) subscriptionHeader.findViewById(R.id.read_more_button);
|
||||
readMoreBtn.setEnabled(!processing);
|
||||
readMoreBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Uri uri = Uri.parse("https://osmand.net/osm_live.php");
|
||||
Intent goToOsmLive = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(goToOsmLive);
|
||||
}
|
||||
});
|
||||
Button subscriptionButton = (Button) subscriptionHeader.findViewById(R.id.subscription_button);
|
||||
subscriptionButton.setEnabled(!processing);
|
||||
subscriptionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
|
||||
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
|
||||
}
|
||||
});
|
||||
|
||||
subscriptionBanner.setVisibility(View.VISIBLE);
|
||||
subscriptionInfo.setVisibility(View.GONE);
|
||||
}
|
||||
regionNameTextView.setText(countryName);
|
||||
|
||||
subscriptionBanner.setVisibility(View.GONE);
|
||||
subscriptionInfo.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Button readMoreBtn = (Button) subscriptionHeader.findViewById(R.id.read_more_button);
|
||||
readMoreBtn.setEnabled(!processing);
|
||||
readMoreBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Uri uri = Uri.parse("https://osmand.net/osm_live.php");
|
||||
Intent goToOsmLive = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(goToOsmLive);
|
||||
}
|
||||
});
|
||||
Button subscriptionButton = (Button) subscriptionHeader.findViewById(R.id.subscription_button);
|
||||
subscriptionButton.setEnabled(!processing);
|
||||
subscriptionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
|
||||
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
|
||||
}
|
||||
});
|
||||
|
||||
subscriptionBanner.setVisibility(View.VISIBLE);
|
||||
subscriptionInfo.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue