Fix screen rotating bug in DonateActivity

This commit is contained in:
Boris Timofeev 2017-01-19 10:45:34 +03:00
parent 46e84b607c
commit cecfb9460e
2 changed files with 22 additions and 16 deletions

View file

@ -45,15 +45,18 @@ public class DonateActivity extends AppCompatActivity {
}
getSupportActionBar().setTitle(R.string.donate_activity_title);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
DonationsFragment donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG,
false, null, null, null,
true, BuildConfig.PAYPAL_USER, BuildConfig.PAYPAL_CURRENCY_CODE, getString(R.string.donation),
false, null, null,
true, BuildConfig.BITCOIN_ADDRESS);
DonationsFragment fragment = (DonationsFragment) getSupportFragmentManager().findFragmentByTag("donationsFragment");
if (fragment == null) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
fragment = DonationsFragment.newInstance(BuildConfig.DEBUG,
false, null, null, null,
true, BuildConfig.PAYPAL_USER, BuildConfig.PAYPAL_CURRENCY_CODE, getString(R.string.donation),
false, null, null,
true, BuildConfig.BITCOIN_ADDRESS);
ft.replace(R.id.donate_fragment, donationsFragment, "fragment");
ft.commit();
ft.replace(R.id.donate_fragment, fragment, "donationsFragment");
ft.commit();
}
}
@Override

View file

@ -53,15 +53,18 @@ public class DonateActivity extends AppCompatActivity {
}
getSupportActionBar().setTitle(R.string.donate_activity_title);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
DonationsFragment donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG,
true, BuildConfig.GOOGLE_PLAY_PUBKEY, GOOGLE_PLAY_CATALOG, GOOGLE_PLAY_COST,
false, null, null, null,
false, null, null,
false, null);
DonationsFragment fragment = (DonationsFragment) getSupportFragmentManager().findFragmentByTag("donationsFragment");
if (fragment == null) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
fragment = DonationsFragment.newInstance(BuildConfig.DEBUG,
true, BuildConfig.GOOGLE_PLAY_PUBKEY, GOOGLE_PLAY_CATALOG, GOOGLE_PLAY_COST,
false, null, null, null,
false, null, null,
false, null);
ft.replace(R.id.donate_fragment, donationsFragment, "donationsFragment");
ft.commit();
ft.replace(R.id.donate_fragment, fragment, "donationsFragment");
ft.commit();
}
}
@Override