|
2 | 2 |
|
3 | 3 | import android.app.Activity;
|
4 | 4 | import android.app.ProgressDialog;
|
5 |
| -import android.content.ClipData; |
6 |
| -import android.content.ClipboardManager; |
7 | 5 | import android.content.ComponentName;
|
8 | 6 | import android.content.Intent;
|
9 | 7 | import android.content.pm.PackageManager;
|
|
13 | 11 | import android.preference.PreferenceFragment;
|
14 | 12 | import android.preference.PreferenceScreen;
|
15 | 13 | import android.preference.SwitchPreference;
|
16 |
| -import android.support.v7.app.AlertDialog; |
17 | 14 | import android.widget.Toast;
|
18 | 15 |
|
19 | 16 | import com.android.launcher3.LauncherFiles;
|
|
27 | 24 | import io.virtualapp.R;
|
28 | 25 | import io.virtualapp.gms.FakeGms;
|
29 | 26 | import io.virtualapp.home.ListAppActivity;
|
30 |
| -import moe.feng.alipay.zerosdk.AlipayZeroSdk; |
| 27 | +import io.virtualapp.utils.Misc; |
31 | 28 |
|
32 | 29 | /**
|
33 | 30 | * Settings activity for Launcher. Currently implements the following setting: Allow rotation
|
@@ -150,63 +147,7 @@ public void onCreate(Bundle savedInstanceState) {
|
150 | 147 | });
|
151 | 148 |
|
152 | 149 | donate.setOnPreferenceClickListener(preference -> {
|
153 |
| - AlertDialog alertDialog = new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_DayNight_Dialog_Alert) |
154 |
| - .setTitle(R.string.donate_dialog_title) |
155 |
| - .setMessage(R.string.donate_dialog_content) |
156 |
| - .setPositiveButton(R.string.donate_dialog_yes, (dialog, which) -> { |
157 |
| - // show chooser dialog |
158 |
| - |
159 |
| - final String alipay = getResources().getString(R.string.donate_alipay); |
160 |
| - final String[] items = {alipay, "Paypal", "Bitcoin"}; |
161 |
| - |
162 |
| - AlertDialog chooseDialog = new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_DayNight_Dialog_Alert) |
163 |
| - .setTitle(R.string.donate_choose_title) |
164 |
| - .setItems(items, (dialog1, which1) -> { |
165 |
| - dialog1.dismiss(); |
166 |
| - if (which1 == 0) { |
167 |
| - if (!AlipayZeroSdk.hasInstalledAlipayClient(getActivity())) { |
168 |
| - Toast.makeText(getActivity(), R.string.prompt_alipay_not_found, Toast.LENGTH_SHORT).show(); |
169 |
| - return; |
170 |
| - } |
171 |
| - AlipayZeroSdk.startAlipayClient(getActivity(), "FKX016770URBZGZSR37U37"); |
172 |
| - } else if (which1 == 1) { |
173 |
| - try { |
174 |
| - Intent t = new Intent(Intent.ACTION_VIEW); |
175 |
| - t.setData(Uri.parse("https://paypal.me/virtualxposed")); |
176 |
| - startActivity(t); |
177 |
| - } catch (Throwable ignored) { |
178 |
| - ignored.printStackTrace(); |
179 |
| - } |
180 |
| - } else if (which1 == 2) { |
181 |
| - final String address = "39Wst8oL74pRP2vKPkPihH6RFQF4hWoBqU"; |
182 |
| - |
183 |
| - try { |
184 |
| - ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE); |
185 |
| - if (clipboardManager != null) { |
186 |
| - clipboardManager.setPrimaryClip(ClipData.newPlainText(null, address)); |
187 |
| - } |
188 |
| - Toast.makeText(getActivity(), getResources().getString(R.string.donate_bitconins_tips), Toast.LENGTH_SHORT).show(); |
189 |
| - } catch (Throwable ignored) { |
190 |
| - ignored.printStackTrace(); |
191 |
| - } |
192 |
| - } |
193 |
| - }) |
194 |
| - .create(); |
195 |
| - chooseDialog.show(); |
196 |
| - }) |
197 |
| - .setNegativeButton(R.string.donate_dialog_no, ((dialog, which) -> { |
198 |
| - Intent intent = new Intent(); |
199 |
| - intent.setAction(Intent.ACTION_VIEW); |
200 |
| - intent.addCategory(Intent.CATEGORY_BROWSABLE); |
201 |
| - intent.setData(Uri.parse("https://github.com/android-hacker/VirtualXposed")); |
202 |
| - startActivity(intent); |
203 |
| - })) |
204 |
| - .create(); |
205 |
| - try { |
206 |
| - alertDialog.show(); |
207 |
| - } catch (Throwable ignored) { |
208 |
| - // BadTokenException. |
209 |
| - } |
| 150 | + Misc.showDonate(getActivity()); |
210 | 151 | return false;
|
211 | 152 | });
|
212 | 153 | about.setOnPreferenceClickListener(preference -> {
|
|
0 commit comments