Search in sources :

Example 61 with WorkerThread

use of android.support.annotation.WorkerThread in project quran_android by quran.

the class QuranUtils method getDebugInfo.

@WorkerThread
public static String getDebugInfo(Context context, QuranScreenInfo quranScreenInfo) {
    StringBuilder builder = new StringBuilder();
    builder.append("Android SDK Version: ").append(Build.VERSION.SDK_INT);
    String location = QuranSettings.getInstance(context).getAppCustomLocation();
    builder.append("\nApp Location:").append(location);
    try {
        File file = new File(location);
        builder.append("\n App Location Directory ").append(file.exists() ? "exists" : "doesn't exist").append("\n   Image zip files:");
        String[] list = file.list();
        for (String fileName : list) {
            if (fileName.contains("images_")) {
                File f = new File(fileName);
                builder.append("\n   file: ").append(fileName).append("\tlength: ").append(f.length());
            }
        }
    } catch (Exception e) {
        builder.append("Exception trying to list files").append(e);
    }
    if (quranScreenInfo != null) {
        builder.append("\nDisplay: ").append(quranScreenInfo.getWidthParam());
        if (quranScreenInfo.isDualPageMode()) {
            builder.append(", tablet width: ").append(quranScreenInfo.getWidthParam());
        }
        builder.append("\n");
    }
    int memClass = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
    builder.append("memory class: ").append(memClass).append("\n\n");
    return builder.toString();
}
Also used : ActivityManager(android.app.ActivityManager) File(java.io.File) WorkerThread(android.support.annotation.WorkerThread)

Example 62 with WorkerThread

use of android.support.annotation.WorkerThread in project vlc-android by GeoffreyMetais.

the class ThumbnailsProvider method getComposedImage.

@WorkerThread
public static Bitmap getComposedImage(MediaGroup group) {
    final BitmapCache bmc = BitmapCache.getInstance();
    final String key = "group:" + group.getTitle();
    Bitmap composedImage = bmc.getBitmapFromMemCache(key);
    if (composedImage == null) {
        composedImage = composeImage(group);
        if (composedImage != null)
            bmc.addBitmapToMemCache(key, composedImage);
    }
    return composedImage;
}
Also used : AudioUtil.readCoverBitmap(org.videolan.vlc.gui.helpers.AudioUtil.readCoverBitmap) Bitmap(android.graphics.Bitmap) BitmapCache(org.videolan.vlc.gui.helpers.BitmapCache) WorkerThread(android.support.annotation.WorkerThread)

Example 63 with WorkerThread

use of android.support.annotation.WorkerThread in project vlc-android by GeoffreyMetais.

the class AudioUtil method prepareCacheFolder.

@SuppressLint("NewApi")
@WorkerThread
public static void prepareCacheFolder(final Context context) {
    try {
        if (AndroidDevices.hasExternalStorage() && context.getExternalCacheDir() != null)
            CACHE_DIR = context.getExternalCacheDir().getPath();
        else
            CACHE_DIR = AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Android/data/" + BuildConfig.APPLICATION_ID + "/cache";
    } catch (Exception | ExceptionInInitializerError e) {
        // catch NPE thrown by getExternalCacheDir()
        CACHE_DIR = AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Android/data/" + BuildConfig.APPLICATION_ID + "/cache";
    }
    ART_DIR.set(CACHE_DIR + "/art/");
    COVER_DIR.set(CACHE_DIR + "/covers/");
    for (String path : Arrays.asList(ART_DIR.get(), COVER_DIR.get())) {
        File file = new File(path);
        if (!file.exists())
            file.mkdirs();
    }
}
Also used : File(java.io.File) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WorkerThread(android.support.annotation.WorkerThread) SuppressLint(android.annotation.SuppressLint)

Example 64 with WorkerThread

use of android.support.annotation.WorkerThread in project VirtualAPK by didi.

the class LoadedPlugin method createResources.

@WorkerThread
private static Resources createResources(Context context, File apk) {
    if (Constants.COMBINE_RESOURCES) {
        Resources resources = ResourcesManager.createResources(context, apk.getAbsolutePath());
        ResourcesManager.hookResources(context, resources);
        return resources;
    } else {
        Resources hostResources = context.getResources();
        AssetManager assetManager = createAssetManager(context, apk);
        return new Resources(assetManager, hostResources.getDisplayMetrics(), hostResources.getConfiguration());
    }
}
Also used : AssetManager(android.content.res.AssetManager) Resources(android.content.res.Resources) WorkerThread(android.support.annotation.WorkerThread)

Example 65 with WorkerThread

use of android.support.annotation.WorkerThread in project Walrus by megabug.

the class ReadCardDataFragment method onFinish.

@Override
@WorkerThread
public void onFinish() {
    FragmentManager fragmentManager = getFragmentManager();
    Fragment dialogFragment = fragmentManager.findFragmentByTag(SINGLE_CARD_DATA_IO_DIALOG_FRAGMENT_TAG);
    if (dialogFragment != null)
        fragmentManager.beginTransaction().remove(dialogFragment).commit();
}
Also used : FragmentManager(android.app.FragmentManager) Fragment(android.app.Fragment) WorkerThread(android.support.annotation.WorkerThread)

Aggregations

WorkerThread (android.support.annotation.WorkerThread)152 Cursor (android.database.Cursor)37 ArrayList (java.util.ArrayList)36 NonNull (android.support.annotation.NonNull)34 File (java.io.File)20 HashMap (java.util.HashMap)17 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)15 StorIOException (com.pushtorefresh.storio.StorIOException)15 IOException (java.io.IOException)13 ContentValues (android.content.ContentValues)11 Resources (android.content.res.Resources)10 Bitmap (android.graphics.Bitmap)10 Context (android.content.Context)8 Intent (android.content.Intent)7 SharedPreferences (android.content.SharedPreferences)7 Uri (android.net.Uri)7 Nullable (android.support.annotation.Nullable)7 VisibleForTesting (android.support.annotation.VisibleForTesting)7 Media (com.doctoror.fuckoffmusicplayer.domain.queue.Media)7 DashboardCategory (com.android.settingslib.drawer.DashboardCategory)6