mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-06 17:38:48 +00:00
DonateFragment: handle ActivityNotFoundException when clicking on bitcoin URI
This commit is contained in:
parent
ac639a635e
commit
25f378d0be
1 changed files with 13 additions and 0 deletions
|
@ -17,15 +17,28 @@
|
|||
|
||||
package de.schildbach.oeffi.preference;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import androidx.annotation.Nullable;
|
||||
import de.schildbach.oeffi.R;
|
||||
|
||||
public class DonateFragment extends PreferenceFragment {
|
||||
private static final String KEY_ABOUT_DONATE_BITCOIN = "about_donate_bitcoin";
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preference_donate);
|
||||
final Preference donateBitcoinPreference = findPreference(KEY_ABOUT_DONATE_BITCOIN);
|
||||
donateBitcoinPreference.setOnPreferenceClickListener(preference -> {
|
||||
try {
|
||||
startActivity(donateBitcoinPreference.getIntent());
|
||||
} catch (final ActivityNotFoundException x) {
|
||||
donateBitcoinPreference.setEnabled(false);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue