That fuck shit the fascists are using
at master 67 lines 2.2 kB view raw
1/** 2 * Copyright (C) 2014 Open Whisper Systems 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18package org.tm.archive; 19 20import android.app.Activity; 21import android.app.Dialog; 22import android.content.DialogInterface; 23import android.os.Bundle; 24 25import androidx.annotation.NonNull; 26import androidx.annotation.Nullable; 27import androidx.appcompat.app.AlertDialog; 28import androidx.fragment.app.DialogFragment; 29 30import com.google.android.gms.common.GoogleApiAvailability; 31import com.google.android.material.dialog.MaterialAlertDialogBuilder; 32 33public class PlayServicesProblemFragment extends DialogFragment { 34 35 @Override 36 public @NonNull Dialog onCreateDialog(@Nullable Bundle bundle) { 37 int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getActivity()); 38 Dialog dialog = GoogleApiAvailability.getInstance().getErrorDialog(getActivity(), code, 9111); 39 40 if (dialog == null) { 41 return new MaterialAlertDialogBuilder(requireActivity()) 42 .setNegativeButton(android.R.string.ok, null) 43 .setMessage(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning) 44 .create(); 45 } else { 46 return dialog; 47 } 48 } 49 50 @Override 51 public void onCancel(DialogInterface dialog) { 52 super.onCancel(dialog); 53 finish(); 54 } 55 56 @Override 57 public void onDismiss(DialogInterface dialog) { 58 super.onDismiss(dialog); 59 finish(); 60 } 61 62 private void finish() { 63 Activity activity = getActivity(); 64 if (activity != null) activity.finish(); 65 } 66 67}