Search in sources :

Example 66 with WorkerThread

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

the class WriteOrEmulateCardDataFragment 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)

Example 67 with WorkerThread

use of android.support.annotation.WorkerThread in project AndroidLife by CaMnter.

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 68 with WorkerThread

use of android.support.annotation.WorkerThread in project AndroidLife by CaMnter.

the class ScreenshotsListener method handleMediaContentChange.

@WorkerThread
private void handleMediaContentChange(@NonNull final Uri contentUri) {
    Cursor cursor = null;
    try {
        // 数据改变时查询数据库中最后加入的一条数据
        cursor = this.context.getContentResolver().query(contentUri, Build.VERSION.SDK_INT < 16 ? MEDIA_PROJECTIONS : MEDIA_PROJECTIONS_API_16, null, null, MediaStore.Images.ImageColumns.DATE_ADDED + " desc limit 1");
        if (cursor == null) {
            Log.d(TAG, "[handleMediaContentChange]   [cursor] = null");
            return;
        }
        if (!cursor.moveToFirst()) {
            Log.d(TAG, "[handleMediaContentChange]   Cursor no data");
            return;
        }
        // 获取各列的索引
        int dataIndex = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
        int dateTakenIndex = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATE_TAKEN);
        // 获取行数据
        String data = cursor.getString(dataIndex);
        long dateTaken = cursor.getLong(dateTakenIndex);
        // 处理获取到的第一行数据
        this.handleMediaRowData(data, dateTaken, cursor);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
    }
}
Also used : Cursor(android.database.Cursor) Point(android.graphics.Point) WorkerThread(android.support.annotation.WorkerThread)

Example 69 with WorkerThread

use of android.support.annotation.WorkerThread in project AppCenter-SDK-Android by Microsoft.

the class Analytics method queuePage.

/**
 * Enqueue page log now.
 */
@WorkerThread
private void queuePage(String name, Map<String, String> properties) {
    PageLog pageLog = new PageLog();
    pageLog.setName(name);
    pageLog.setProperties(properties);
    mChannel.enqueue(pageLog, ANALYTICS_GROUP);
}
Also used : PageLog(com.microsoft.appcenter.analytics.ingestion.models.PageLog) WorkerThread(android.support.annotation.WorkerThread)

Example 70 with WorkerThread

use of android.support.annotation.WorkerThread in project AppCenter-SDK-Android by Microsoft.

the class AppCenter method queueCustomProperties.

/**
 * Send custom properties.
 * Unit test requires top level methods when PowerMock.whenNew.
 *
 * @param properties properties to send.
 */
@WorkerThread
private void queueCustomProperties(@NonNull Map<String, Object> properties) {
    CustomPropertiesLog customPropertiesLog = new CustomPropertiesLog();
    customPropertiesLog.setProperties(properties);
    mChannel.enqueue(customPropertiesLog, CORE_GROUP);
}
Also used : CustomPropertiesLog(com.microsoft.appcenter.ingestion.models.CustomPropertiesLog) 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