当前位置: 首页>>代码示例>>Java>>正文


Java WorkerThread类代码示例

本文整理汇总了Java中android.support.annotation.WorkerThread的典型用法代码示例。如果您正苦于以下问题:Java WorkerThread类的具体用法?Java WorkerThread怎么用?Java WorkerThread使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WorkerThread类属于android.support.annotation包,在下文中一共展示了WorkerThread类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runProgram

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
private void runProgram(Context context, JavaProjectFolder projectFile, int action, Intent intent) throws Exception {
    InputStream in = mConsoleEditText.getInputStream();

    File tempDir = getDir("dex", MODE_PRIVATE);
    switch (action) {
        case CompileHelper.Action.RUN: {
            CompileHelper.compileAndRun(context, in, tempDir, projectFile);
            break;
        }
        case CompileHelper.Action.RUN_DEX: {
            File dex = (File) intent.getSerializableExtra(CompileManager.DEX_FILE);
            if (dex != null) {
                String mainClass = projectFile.getMainClass().getName();
                CompileHelper.executeDex(context, in, dex, tempDir, mainClass);
            }
            break;
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:ExecuteActivity.java

示例2: delete

import android.support.annotation.WorkerThread; //导入依赖的package包/类
/**
 * Delete rows from the specified {@code table} and notify any subscribed queries. This method
 * will not trigger a notification if no rows were deleted.
 *
 * @see SQLiteDatabase#delete(String, String, String[])
 */
@WorkerThread
public int delete(@NonNull String table, @Nullable String whereClause,
    @Nullable String... whereArgs) {
  SQLiteDatabase db = getWritableDatabase();

  if (logging) {
    log("DELETE\n  table: %s\n  whereClause: %s\n  whereArgs: %s", table, whereClause,
        Arrays.toString(whereArgs));
  }
  int rows = db.delete(table, whereClause, whereArgs);

  if (logging) log("DELETE affected %s %s", rows, rows != 1 ? "rows" : "row");

  if (rows > 0) {
    // Only send a table trigger if rows were affected.
    sendTableTrigger(Collections.singleton(table));
  }
  return rows;
}
 
开发者ID:jiechic,项目名称:sqlbrite-sqlcipher,代码行数:26,代码来源:BriteDatabase.java

示例3: surfaceChanged

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@UiThread
public void surfaceChanged(final SurfaceHolder holder, int format, int width, int height) {
    runOnNativeThread(new Runnable() {
        @WorkerThread
        @Override
        public void run() {
            m_surfaceHolder = holder;
            if (m_surfaceHolder != null) {
                Surface surface = m_surfaceHolder.getSurface();
                if (surface.isValid()) {
                    nativeSetSurface(m_jniApiRunnerPtr, surface);
                }
            }
        }
    });
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:17,代码来源:EegeoNativeMapView.java

示例4: onPointerUp

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@UiThread
public void onPointerUp(final int primaryActionIndex, final int primaryActionIdentifier, final int pointerCount, final float[] x, final float y[], final int[] pointerIdentity, final int[] pointerIndex) {
    runOnNativeThread(new Runnable() {
        @WorkerThread
        @Override
        public void run() {
            nativeProcessPointerUp(m_jniApiRunnerPtr, primaryActionIndex, primaryActionIdentifier, pointerCount, x, y, pointerIdentity, pointerIndex);
        }
    });
    if (m_eeGeoMap == null) {
        Log.d("eegeo-android-sdk", "skipping input event -- map not ready");
        return;
    }
    if (x.length > 0) { // TODO: remove this and promote to native ITouchController
        Point mouseUpPoint = new Point((int) x[0], (int) y[0]);
        double distSquared = Math.pow(mouseUpPoint.x - m_mouseDownPoint.x, 2) + Math.pow(mouseUpPoint.y - m_mouseDownPoint.y, 2);
        if (distSquared < 25) {
            m_eeGeoMap.onTapped(mouseUpPoint);
        }
    }
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:22,代码来源:EegeoNativeMapView.java

示例5: writeToFile

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
private void writeToFile() {
    if (mFiles.canWrite(mLogFile)) {
        List<LogMessage> list;

        synchronized (mLock) {
            list = new LinkedList<>(mCacheQueue);
            mCacheQueue.clear();
        }

        mFiles.writeToFile(list, mLogFile);
        if (mSetting.debuggable()) {
            mWriteCount ++;
        }
    }
}
 
开发者ID:kaedea,项目名称:b-log,代码行数:17,代码来源:LogFileImpl.java

示例6: jniOnIndoorEntered

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
private void jniOnIndoorEntered() {
    final IndoorMap indoorMap = IndoorsApiJniCalls.getIndoorMapData(m_eegeoMapApiPtr);
    final int currentIndoorFloor = IndoorsApiJniCalls.getCurrentFloorIndex(m_eegeoMapApiPtr);
    m_uiRunner.runOnUiThread(new Runnable() {
        @UiThread
        @Override
        public void run() {
            m_indoorMap = indoorMap;
            m_currentIndoorFloor = currentIndoorFloor;
            for (OnIndoorEnteredListener listener : m_onIndoorEnteredListeners) {
                listener.onIndoorEntered();
            }
        }
    });
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:17,代码来源:EegeoMap.java

示例7: notifyTagsLoaded

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
public void notifyTagsLoaded()
{
    m_uiRunner.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            m_hasLoadedTags = true;
            m_loadInProgress = false;
            if(m_listener != null)
            {
                m_listener.onTagsLoadCompleted();
            }
            m_listener = null;
        }
    });
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:17,代码来源:TagApi.java

示例8: create

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
public int create(PolygonOptions polygonOptions, Polygon.AllowHandleAccess allowHandleAccess) throws InvalidParameterException {
    if (allowHandleAccess == null)
        throw new NullPointerException("Null access token. Method is intended for internal use by Polygon");

    if (polygonOptions.getPoints().size() < 2)
        throw new InvalidParameterException("PolygonOptions points must contain at least two elements");

    List<LatLng> exteriorPoints = polygonOptions.getPoints();
    List<List<LatLng>> holes = polygonOptions.getHoles();

    final int[] ringVertexCounts = buildRingVertexCounts(exteriorPoints, holes);
    final double[] allPointsDoubleArray = buildPointsArray(exteriorPoints, holes, ringVertexCounts);

    return nativeCreatePolygon(
            m_jniEegeoMapApiPtr,
            polygonOptions.getIndoorMapId(),
            polygonOptions.getIndoorFloorId(),
            polygonOptions.getElevation(),
            polygonOptions.getElevationMode().ordinal(),
            allPointsDoubleArray,
            ringVertexCounts,
            polygonOptions.getFillColor()
    );
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:26,代码来源:PolygonApi.java

示例9: setProgramViewCount

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
static void setProgramViewCount(Context context, long programId, int numberOfViews) {
    Uri programUri = TvContractCompat.buildPreviewProgramUri(programId);
    try (Cursor cursor = context.getContentResolver().query(programUri, null, null, null,
            null)) {
        if (!cursor.moveToFirst()) {
            return;
        }
        PreviewProgram existingProgram = PreviewProgram.fromCursor(cursor);
        PreviewProgram.Builder builder = new PreviewProgram.Builder(existingProgram)
                .setInteractionCount(numberOfViews)
                .setInteractionType(TvContractCompat.PreviewProgramColumns
                        .INTERACTION_TYPE_VIEWS);
        int rowsUpdated = context.getContentResolver().update(
                TvContractCompat.buildPreviewProgramUri(programId),
                builder.build().toContentValues(), null, null);
        if (rowsUpdated != 1) {
            Log.e(TAG, "Update program failed");
        }
    }
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:22,代码来源:SampleTvProvider.java

示例10: getAllMedia

import android.support.annotation.WorkerThread; //导入依赖的package包/类
/**
 * Get all the multimedia files, including videos and pictures.
 */
@WorkerThread
public ArrayList<AlbumFolder> getAllMedia() {
    Map<String, AlbumFolder> albumFolderMap = new HashMap<>();
    AlbumFolder allFileFolder = new AlbumFolder();
    allFileFolder.setChecked(true);
    allFileFolder.setName(mContext.getString(R.string.album_all_images_videos));

    scanImageFile(albumFolderMap, allFileFolder);
    scanVideoFile(albumFolderMap, allFileFolder);

    ArrayList<AlbumFolder> albumFolders = new ArrayList<>();
    Collections.sort(allFileFolder.getAlbumFiles());
    albumFolders.add(allFileFolder);

    for (Map.Entry<String, AlbumFolder> folderEntry : albumFolderMap.entrySet()) {
        AlbumFolder albumFolder = folderEntry.getValue();
        Collections.sort(albumFolder.getAlbumFiles());
        albumFolders.add(albumFolder);
    }
    return albumFolders;
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:25,代码来源:MediaReader.java

示例11: getVariable

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
T getVariable(String variableName)
        throws ParticleCloudException, IOException, VariableDoesNotExistException {

    if (!device.deviceState.variables.containsKey(variableName)) {
        throw new VariableDoesNotExistException(variableName);
    }

    R reply;
    try {
        reply = callApi(variableName);
    } catch (RetrofitError e) {
        throw new ParticleCloudException(e);
    }

    if (!reply.coreInfo.connected) {
        // FIXME: we should be doing this "connected" check on _any_ reply that comes back
        // with a "coreInfo" block.
        device.cloud.onDeviceNotConnected(device.deviceState);
        throw new IOException("Device is not connected.");
    } else {
        return reply.result;
    }
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:25,代码来源:ParticleDevice.java

示例12: fetchBuildingInformation

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
private void fetchBuildingInformation(int nativeHandle)
{
    final BuildingHighlight buildingHighlight = m_nativeHandleToBuildingHighlight.get(nativeHandle);

    if (buildingHighlight == null)
        throw new NullPointerException("BuildingHighlight object not found for nativeHandle");

    final BuildingInformation buildingInformation = nativeGetBuildingInformation(m_jniEegeoMapApiPtr, nativeHandle);
    if (buildingInformation != null) {
        m_uiRunner.runOnUiThread(new Runnable() {
            @UiThread
            @Override
            public void run() {
                buildingHighlight.setBuildingInformation(buildingInformation);
            }
        });
    }
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:20,代码来源:BuildingsApi.java

示例13: extractAttachmentInfoForView

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
public List<AttachmentViewInfo> extractAttachmentInfoForView(List<Part> attachmentParts)
        throws MessagingException {

    List<AttachmentViewInfo> attachments = new ArrayList<>();
    for (Part part : attachmentParts) {
        AttachmentViewInfo attachmentViewInfo = extractAttachmentInfo(part);
        attachments.add(attachmentViewInfo);
    }

    return attachments;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:13,代码来源:AttachmentInfoExtractor.java

示例14: updateElevation

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@UiThread
private void updateElevation() {
    final double elevation = m_elevation;

    submit(new Runnable() {
        @WorkerThread
        public void run() {
            m_bluesphereApi.setElevation(BlueSphere.m_allowHandleAccess, elevation);
        }
    });
}
 
开发者ID:wrld3d,项目名称:android-api,代码行数:12,代码来源:BlueSphere.java

示例15: extractMessageForView

import android.support.annotation.WorkerThread; //导入依赖的package包/类
@WorkerThread
public MessageViewInfo extractMessageForView(Message message, @Nullable MessageCryptoAnnotations cryptoAnnotations)
        throws MessagingException {

    ArrayList<Part> extraParts = new ArrayList<>();
    Part cryptoContentPart = MessageCryptoStructureDetector.findPrimaryEncryptedOrSignedPart(message, extraParts);

    if (cryptoContentPart == null) {
        if (cryptoAnnotations != null && !cryptoAnnotations.isEmpty()) {
            Timber.e("Got crypto message cryptoContentAnnotations but no crypto root part!");
        }
        return extractSimpleMessageForView(message, message);
    }

    boolean isOpenPgpEncrypted = (MessageCryptoStructureDetector.isPartMultipartEncrypted(cryptoContentPart) &&
                    MessageCryptoStructureDetector.isMultipartEncryptedOpenPgpProtocol(cryptoContentPart)) ||
                    MessageCryptoStructureDetector.isPartPgpInlineEncrypted(cryptoContentPart);
    boolean isSMimeEncrypted = (MessageCryptoStructureDetector.isPartMultipartEncrypted(cryptoContentPart) &&
            MessageCryptoStructureDetector.isMultipartEncryptedSMimeProtocol(cryptoContentPart));
    if ((!QMail.isOpenPgpProviderConfigured() && isOpenPgpEncrypted) || (!QMail.isSMimeProviderConfigured() && isSMimeEncrypted)) {
        CryptoResultAnnotation noProviderAnnotation = CryptoResultAnnotation.createErrorAnnotation(
                CryptoError.SMIME_ENCRYPTED_NO_PROVIDER, null);
        return MessageViewInfo.createWithErrorState(message, false)
                .withCryptoData(noProviderAnnotation, null, null, null);
    }

    CryptoResultAnnotation cryptoContentPartAnnotation =
            cryptoAnnotations != null ? cryptoAnnotations.get(cryptoContentPart) : null;
    if (cryptoContentPartAnnotation != null) {
        return extractCryptoMessageForView(message, extraParts, cryptoContentPart, cryptoContentPartAnnotation);
    }

    return extractSimpleMessageForView(message, message);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:35,代码来源:MessageViewInfoExtractor.java


注:本文中的android.support.annotation.WorkerThread类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。