Search in sources :

Example 1 with DonationsFragment

use of org.sufficientlysecure.donations.DonationsFragment in project Mindustry by Anuken.

the class DonationsActivity method onActivityResult.

/**
 * Needed for Google Play In-app Billing. It uses startIntentSenderForResult(). The result is not propagated to
 * the Fragment like in startActivityForResult(). Thus we need to propagate manually to our Fragment.
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Button b = ((Button) findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button));
    b.setEnabled(true);
    FragmentManager fragmentManager = getSupportFragmentManager();
    Fragment fragment = fragmentManager.findFragmentByTag("donationsFragment");
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    // TODO donation event, set settings?
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Button(android.widget.Button) Fragment(android.support.v4.app.Fragment) DonationsFragment(org.sufficientlysecure.donations.DonationsFragment)

Example 2 with DonationsFragment

use of org.sufficientlysecure.donations.DonationsFragment in project J2ME-Loader by nikita36078.

the class DonationsActivity method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    FragmentManager fragmentManager = getSupportFragmentManager();
    Fragment fragment = fragmentManager.findFragmentByTag("donationsFragment");
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) Fragment(androidx.fragment.app.Fragment) DonationsFragment(org.sufficientlysecure.donations.DonationsFragment)

Example 3 with DonationsFragment

use of org.sufficientlysecure.donations.DonationsFragment in project J2ME-Loader by nikita36078.

the class DonationsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_donations);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.donate);
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    DonationsFragment donationsFragment;
    if (BuildConfig.DONATIONS_GOOGLE) {
        donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, true, GOOGLE_PUBKEY, GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), false, null, null, null, false, null, null, false, null);
    } else {
        donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, false, null, null, null, true, PAYPAL_USER, PAYPAL_CURRENCY_CODE, getString(R.string.donation_paypal_item), false, null, null, false, null);
    }
    ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment");
    ft.commit();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) ActionBar(androidx.appcompat.app.ActionBar) DonationsFragment(org.sufficientlysecure.donations.DonationsFragment)

Aggregations

DonationsFragment (org.sufficientlysecure.donations.DonationsFragment)3 Fragment (android.support.v4.app.Fragment)1 FragmentManager (android.support.v4.app.FragmentManager)1 Button (android.widget.Button)1 ActionBar (androidx.appcompat.app.ActionBar)1 Fragment (androidx.fragment.app.Fragment)1 FragmentManager (androidx.fragment.app.FragmentManager)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1