Search in sources :

Example 16 with CustomEvent

use of com.crashlytics.android.answers.CustomEvent in project quran_android by quran.

the class QuranDataActivity method checkPermissions.

private void checkPermissions() {
    final String path = quranSettings.getAppCustomLocation();
    final File fallbackFile = getExternalFilesDir(null);
    boolean usesExternalFileDir = path != null && path.contains("com.quran");
    if (path == null || (usesExternalFileDir && fallbackFile == null)) {
        // suggests that we're on m+ and getExternalFilesDir returned null at some point
        runListView();
        return;
    }
    boolean needsPermission = !usesExternalFileDir || !path.equals(fallbackFile.getAbsolutePath());
    if (needsPermission && !PermissionUtil.haveWriteExternalStoragePermission(this)) {
        // request permission
        if (PermissionUtil.canRequestWriteExternalStoragePermission(this)) {
            Answers.getInstance().logCustom(new CustomEvent("storagePermissionRationaleShown"));
            // show permission rationale dialog
            permissionsDialog = new AlertDialog.Builder(this).setMessage(R.string.storage_permission_rationale).setCancelable(false).setPositiveButton(android.R.string.ok, (dialog, which) -> {
                dialog.dismiss();
                permissionsDialog = null;
                Answers.getInstance().logCustom(new CustomEvent("storagePermissionRationaleAccepted"));
                // request permissions
                requestExternalSdcardPermission();
            }).setNegativeButton(android.R.string.cancel, (dialog, which) -> {
                // dismiss the dialog
                dialog.dismiss();
                permissionsDialog = null;
                Answers.getInstance().logCustom(new CustomEvent("storagePermissionRationaleDenied"));
                // fall back if we can
                if (fallbackFile != null) {
                    quranSettings.setAppCustomLocation(fallbackFile.getAbsolutePath());
                    checkPages();
                } else {
                    // set to null so we can try again next launch
                    quranSettings.setAppCustomLocation(null);
                    runListView();
                }
            }).create();
            permissionsDialog.show();
        } else {
            // fall back if we can
            if (fallbackFile != null) {
                quranSettings.setAppCustomLocation(fallbackFile.getAbsolutePath());
                checkPages();
            } else {
                // set to null so we can try again next launch
                quranSettings.setAppCustomLocation(null);
                runListView();
            }
        }
    } else {
        checkPages();
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) Context(android.content.Context) QuranActivity(com.quran.labs.androidquran.ui.QuranActivity) Bundle(android.os.Bundle) PackageManager(android.content.pm.PackageManager) QuranDownloadService(com.quran.labs.androidquran.service.QuranDownloadService) ServiceIntentHelper(com.quran.labs.androidquran.service.util.ServiceIntentHelper) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) LocalBroadcastManager(android.support.v4.content.LocalBroadcastManager) Inject(javax.inject.Inject) Manifest(android.Manifest) Toast(android.widget.Toast) QuranFileUtils(com.quran.labs.androidquran.util.QuranFileUtils) QuranSettings(com.quran.labs.androidquran.util.QuranSettings) PageProvider(com.quran.data.source.PageProvider) AsyncTask(android.os.AsyncTask) IntentFilter(android.content.IntentFilter) QuranDownloadNotifier(com.quran.labs.androidquran.service.util.QuranDownloadNotifier) TextUtils(android.text.TextUtils) PermissionUtil(com.quran.labs.androidquran.service.util.PermissionUtil) ActivityCompat(android.support.v4.app.ActivityCompat) QuranScreenInfo(com.quran.labs.androidquran.util.QuranScreenInfo) File(java.io.File) Timber(timber.log.Timber) CustomEvent(com.crashlytics.android.answers.CustomEvent) AlertDialog(android.support.v7.app.AlertDialog) QuranInfo(com.quran.labs.androidquran.data.QuranInfo) DefaultDownloadReceiver(com.quran.labs.androidquran.service.util.DefaultDownloadReceiver) Answers(com.crashlytics.android.answers.Answers) Activity(android.app.Activity) File(java.io.File)

Example 17 with CustomEvent

use of com.crashlytics.android.answers.CustomEvent in project quran_android by quran.

the class QuranImportActivity method showImportComplete.

public void showImportComplete() {
    Answers.getInstance().logCustom(new CustomEvent("importDataSuccessful"));
    Toast.makeText(QuranImportActivity.this, R.string.import_successful, Toast.LENGTH_LONG).show();
    finish();
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent)

Example 18 with CustomEvent

use of com.crashlytics.android.answers.CustomEvent in project VirtualXposed by android-hacker.

the class FlurryROMCollector method reportCameraNativeSetup.

private static void reportCameraNativeSetup() {
    for (Method method : Camera.class.getDeclaredMethods()) {
        if ("native_setup".equals(method.getName())) {
            CustomEvent cameraSetup = new CustomEvent("camera::native_setup");
            Map<String, String> methodDetails = createLogContent("method_details", Reflect.getMethodDetails(method));
            for (String key : methodDetails.keySet()) {
                cameraSetup.putCustomAttribute(key, methodDetails.get(key));
            }
            Answers.getInstance().logCustom(cameraSetup);
            break;
        }
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) Method(java.lang.reflect.Method)

Example 19 with CustomEvent

use of com.crashlytics.android.answers.CustomEvent in project DisasterApp by cutmail.

the class MainActivity method openInquiry.

private void openInquiry() {
    Answers.getInstance().logCustom(new CustomEvent("Open Inquiry"));
    try {
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:cutmailapp@gmail.com"));
        intent.putExtra(Intent.EXTRA_SUBJECT, "[地震・災害情報] お問い合わせ");
        intent.putExtra(Intent.EXTRA_TEXT, "こちらにお問い合わせ内容をご記入ください。");
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Timber.e(e, e.getMessage());
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent)

Example 20 with CustomEvent

use of com.crashlytics.android.answers.CustomEvent in project DisasterApp by cutmail.

the class MainActivity method openAbout.

private void openAbout() {
    Answers.getInstance().logCustom(new CustomEvent("Open About"));
    startActivity(new Intent(this, AboutActivity.class));
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) Intent(android.content.Intent)

Aggregations

CustomEvent (com.crashlytics.android.answers.CustomEvent)28 Intent (android.content.Intent)6 Bundle (android.os.Bundle)3 HashMap (java.util.HashMap)3 Activity (android.app.Activity)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 Context (android.content.Context)2 Uri (android.net.Uri)2 AsyncTask (android.os.AsyncTask)2 AlertDialog (android.support.v7.app.AlertDialog)2 TextUtils (android.text.TextUtils)2 Toast (android.widget.Toast)2 Answers (com.crashlytics.android.answers.Answers)2 Sensor (com.eveningoutpost.dexdrip.Models.Sensor)2 StatsResult (com.eveningoutpost.dexdrip.stats.StatsResult)2 PermissionUtil (com.quran.labs.androidquran.service.util.PermissionUtil)2 QuranFileUtils (com.quran.labs.androidquran.util.QuranFileUtils)2 QuranScreenInfo (com.quran.labs.androidquran.util.QuranScreenInfo)2 QuranSettings (com.quran.labs.androidquran.util.QuranSettings)2 File (java.io.File)2