项目:javaide
文件:ExecuteActivity.java
@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,dex,mainClass);
}
break;
}
}
}
/**
* 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,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;
}
项目:android-api
文件:EegeoNativeMapView.java
@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);
}
}
}
});
}
项目:android-api
文件:EegeoNativeMapView.java
@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);
}
}
}
项目:b-log
文件:LogFileImpl.java
项目:android-api
文件:EegeoMap.java
@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();
}
}
});
}
项目:android-api
文件:TagApi.java
@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;
}
});
}
@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()
);
}
项目:leanback-homescreen-channels
文件:SampleTvProvider.java
@WorkerThread
static void setProgramViewCount(Context context,long programId,int numberOfViews) {
Uri programUri = TvContractCompat.buildPreviewProgramUri(programId);
try (Cursor cursor = context.getContentResolver().query(programUri,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);
if (rowsUpdated != 1) {
Log.e(TAG,"Update program Failed");
}
}
}
项目:Recognize-it
文件:MediaReader.java
/**
* 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;
}
项目:xlight_android_native
文件:ParticleDevice.java
@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;
}
}
项目:android-api
文件:BuildingsApi.java
@WorkerThread
private void fetchBuilding@R_947_4045@ion(int nativeHandle)
{
final BuildingHighlight buildingHighlight = m_nativeHandletoBuildingHighlight.get(nativeHandle);
if (buildingHighlight == null)
throw new NullPointerException("BuildingHighlight object not found for nativeHandle");
final Building@R_947_4045@ion building@R_947_4045@ion = nativeGetBuilding@R_947_4045@ion(m_jniEegeoMapApiPtr,nativeHandle);
if (building@R_947_4045@ion != null) {
m_uiRunner.runOnUiThread(new Runnable() {
@UiThread
@Override
public void run() {
buildingHighlight.setBuilding@R_947_4045@ion(building@R_947_4045@ion);
}
});
}
}
项目:q-mail
文件:AttachmentInfoExtractor.java
@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;
}
项目:android-api
文件:BlueSphere.java
@UiThread
private void updateElevation() {
final double elevation = m_elevation;
submit(new Runnable() {
@WorkerThread
public void run() {
m_bluesphereApi.setElevation(BlueSphere.m_allowHandleAccess,elevation);
}
});
}
项目:q-mail
文件:MessageViewInfoExtractor.java
@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);
}
CryptoResultAnnotation cryptoContentPartAnnotation =
cryptoAnnotations != null ? cryptoAnnotations.get(cryptoContentPart) : null;
if (cryptoContentPartAnnotation != null) {
return extractCryptoMessageForView(message,extraParts,cryptoContentPart,cryptoContentPartAnnotation);
}
return extractSimpleMessageForView(message,message);
}
项目:q-mail
文件:LocalMessageExtractorLoader.java
@Override
@WorkerThread
public MessageViewInfo loadInBackground() {
try {
return messageViewInfoExtractor.extractMessageForView(message,annotations);
} catch (Exception e) {
Timber.e(e,"Error while decoding message");
return null;
}
}
项目:android-api
文件:MapsceneApi.java
@UiThread
public MapsceneRequest requestMapscene(final MapsceneRequestOptions options) {
MapsceneRequest request = new MapsceneRequest(
this,options.getApplyOnLoad(),options.getonMapsceneRequestCompletedListener(),new Callable<Integer>() {
@WorkerThread
@Override
public Integer call() throws Exception {
return beginMapsceneRequest(options);
}
});
return request;
}
项目:q-mail
文件:AttachmentTempFileProvider.java
@WorkerThread
public static Uri createTempuriForContentUri(Context context,Uri uri) throws IOException {
Context applicationContext = context.getApplicationContext();
File tempFile = getTempFileForUri(uri,applicationContext);
writeUriContentToTempFileIfNotExists(context,uri,tempFile);
Uri tempFileUri = FileProvider.getUriForFile(context,AUTHORITY,tempFile);
registerFileCleanupReceiver(applicationContext);
return tempFileUri;
}
项目:android-api
文件:EegeoNativeMapView.java
@WorkerThread
public long create(EegeoMap eegeoMap,EegeoMapOptions eegeoMapOptions) {
String apiKey = EegeoApi.getInstance().getApiKey();
String coverageTreeManifest = eegeoMapOptions.getCoverageTreeManifest();
if (coverageTreeManifest == null) {
coverageTreeManifest = "";
}
String environmentThemesManifest = eegeoMapOptions.getEnvironmentThemesManifest();
if (environmentThemesManifest == null) {
environmentThemesManifest = "";
}
long jniEegeoMapApiPtr = nativeCreateEegeoMapApi(m_jniApiRunnerPtr,eegeoMap,apiKey,coverageTreeManifest,environmentThemesManifest);
return jniEegeoMapApiPtr;
}
项目:xlight_android_native
文件:ParticleCloud.java
/**
* Get a short-lived claiming token for transmitting to soon-to-be-claimed device in
* soft AP setup process
*
* @return a claim code string set on success (48 random bytes,base64 encoded
* to 64 ASCII characters)
*/
@WorkerThread
public Responses.ClaimCodeResponse generateClaimCode() throws ParticleCloudException {
try {
// Offer empty string to appease newer OkHttp versions which require a POST body,// even if it's empty or (as far as the endpoint cares) nonsense
return mainApi.generateClaimCode("okhttp_appeasement");
} catch (RetrofitError error) {
throw new ParticleCloudException(error);
}
}
/**
* See {@link #executeUpdateDelete(String,sqliteStatement)} for usage. This overload allows for triggering multiple tables.
*
* @see BriteDatabase#executeUpdateDelete(String,sqliteStatement)
*/
@WorkerThread
@RequiresApi(Build.VERSION_CODES.HONEYCOMB)
public int executeUpdateDelete(Set<String> tables,sqliteStatement statement) {
if (logging) log("EXECUTE\n %s",statement);
int rows = statement.executeUpdateDelete();
if (rows > 0) {
// Only send a table trigger if rows were affected.
sendTableTrigger(tables);
}
return rows;
}
项目:FirefoxData-android
文件:FirefoxSyncBookmarks.java
/**
* Gets the bookmarks associated with the given account.
*
* Both the request and the callback occur on the calling thread (this is unintuitive: issue #3).
*
* @param itemLimit The number of items to fetch. If < 0,fetches all items.
*/
@WorkerThread // network request.
static void getBlocking(final FirefoxSyncConfig syncConfig,final int itemLimit,final OnSyncComplete<BookmarkFolder> onComplete) {
final SyncclientBookmarksResourceDelegate resourceDelegate = new SyncclientBookmarksResourceDelegate(syncConfig,onComplete);
try {
FirefoxSyncUtils.makeGetRequestForCollection(syncConfig,BOOKMARKS_COLLECTION,getArgs(itemLimit),resourceDelegate);
} catch (final FirefoxDataException e) {
onComplete.onException(e);
}
}
项目:android-api
文件:EegeoNativeMapView.java
@UiThread
public void onDestroy() {
Log.d("eegeo-android-sdk","onDestroy");
runOnNativeThread(new Runnable() {
@WorkerThread
@Override
public void run() {
Log.d("eegeo-android-sdk","Native Thread: onDestroy");
m_nativeThread.stopUpdating();
nativeDestroyApiRunner(m_jniApiRunnerPtr);
m_jniApiRunnerPtr = 0;
synchronized (m_nativeThread) {
m_nativeThread.notifyAll();
}
}
});
Log.d("eegeo-android-sdk","begin wait nativeDestroyApiRunner");
synchronized (m_nativeThread) {
try {
m_nativeThread.wait();
} catch (InterruptedException e) {
e.printstacktrace();
}
}
Log.d("eegeo-android-sdk","end wait nativeDestroyApiRunner");
m_nativeThread.quit();
}
项目:android-api
文件:EegeoNativeMapView.java
@UiThread
public void onPause() {
Log.d("eegeo-android-sdk","onPause");
runOnNativeThread(new Runnable() {
@WorkerThread
@Override
public void run() {
m_nativeThread.stopUpdating();
nativePauseApiRunner(m_jniApiRunnerPtr);
}
});
}
@WorkerThread
public int create(polylineoptions polylineoptions,polyline.AllowHandleAccess allowHandleAccess) throws InvalidParameterException {
if (allowHandleAccess == null)
throw new NullPointerException("Null access token. Method is intended for internal use by polyline");
if (polylineoptions.getPoints().size() < 2)
throw new InvalidParameterException("polylineoptions points must contain at least two elements");
double[] latLongs = pointsToArray(polylineoptions.getPoints());
List<Double> perPointElevationsList = polylineoptions.getPerPointElevations();
double[] perPointElevations = new double[perPointElevationsList.size()];
for (int i = 0; i < perPointElevationsList.size(); ++i) {
perPointElevations[i] = perPointElevationsList.get(i);
}
return nativeCreatepolyline(
m_jniEegeoMapApiPtr,polylineoptions.getIndoorMapId(),polylineoptions.getIndoorFloorId(),polylineoptions.getElevation(),polylineoptions.getElevationMode().ordinal(),latLongs,perPointElevations,polylineoptions.getWidth(),polylineoptions.getColor(),polylineoptions.getMiterLimit()
);
}
项目:xlight_android_native
文件:ParticleDevice.java
/**
* Call a function on the device
*
* @param functionName Function name
* @param args Array of arguments to pass to the function on the device.
* Arguments must not be more than MAX_PARTICLE_FUNCTION_ARG_LENGTH chars
* in length. If any arguments are longer,a runtime exception will be thrown.
* @return result code: a value of 1 indicates success
*/
@WorkerThread
public int callFunction(String functionName,@Nullable List<String> args)
throws ParticleCloudException,FunctionDoesNotExistException {
// Todo: check response of calling a non-existent function
if (!deviceState.functions.contains(functionName)) {
throw new FunctionDoesNotExistException(functionName);
}
// null is accepted here,but it won't be in the Retrofit API call later
if (args == null) {
args = list();
}
String argsstring = ParticleInternalStringUtils.join(args,',');
Preconditions.checkArgument(argsstring.length() < MAX_PARTICLE_FUNCTION_ARG_LENGTH,String.format("Arguments '%s' exceed max args length of %d",argsstring,MAX_PARTICLE_FUNCTION_ARG_LENGTH));
Responses.CallFunctionResponse response;
try {
response = mainApi.callFunction(deviceState.deviceid,functionName,new FunctionArgs(argsstring));
} catch (RetrofitError e) {
throw new ParticleCloudException(e);
}
if (!response.connected) {
cloud.onDeviceNotConnected(deviceState);
throw new IOException("Device is not connected.");
} else {
return response.returnValue;
}
}
项目:android-api
文件:BlueSphere.java
@UiThread
private void updateEnabled() {
final boolean enabled = m_enabled;
submit(new Runnable() {
@WorkerThread
public void run() {
m_bluesphereApi.setEnabled(BlueSphere.m_allowHandleAccess,enabled);
}
});
}
项目:android-api
文件:EegeoNativeMapView.java
@UiThread
public void onResume() {
runOnNativeThread(new Runnable() {
@WorkerThread
@Override
public void run() {
if (m_surfaceHolder != null && m_surfaceHolder.getSurface() != null) {
nativeSetSurface(m_jniApiRunnerPtr,m_surfaceHolder.getSurface());
nativeResumeApiRunner(m_jniApiRunnerPtr);
}
m_nativeThread.startUpdating();
}
});
}
项目:b-log
文件:BLog.java
/**
* Sync log message to file.
*/
@WorkerThread
public static void syncLog(int priority,String message) {
if (checkInit()) {
sLogEngine.syncLog(priority,message);
}
}
项目:goblin-lib
文件:BaseSyncableDao.java
@WorkerThread
public boolean updateAfterSync(HashSet<T> tHashSet) {
LinkedHashSet<ParamUpdate> paramUpdates = new LinkedHashSet<>();
for(T t : tHashSet){
paramUpdates.add(new ParamUpdate(getTableName(),getIdFieldName() + " = ?",new String[]{t.id},getSyncContentValuesAfterSync(t)));
}
return BaseDao.bulkupdate(paramUpdates) >= tHashSet.size();
}
项目:Xndroid
文件:HistoryDatabase.java
项目:android-api
文件:EegeoMap.java
@WorkerThread
private void jniOnCameraMove() {
m_uiRunner.runOnUiThread(new Runnable() {
@UiThread
@Override
public void run() {
for (OnCameraMoveListener listener : m_onCameraMoveListeners) {
listener.onCameraMove();
}
}
});
}
项目:goblin-lib
文件:BaseDao.java
@WorkerThread
private Cursor query(Param param){
sqliteQueryBuilder sqliteQueryBuilder = getQueryBuilder();
Cursor c;
if(sqliteQueryBuilder != null){
c = sqliteQueryBuilder.query(
Database.getDatabase(),param.projection,param.selection,param.selectionArgs,param.sortOrder
);
}
else {
c = Database.getDatabase().query(
getTableName(),param.sortOrder
);
}
return c;
}
项目:b-log
文件:BLog.java
/**
* Zipping log files and return the zip file.
*/
@WorkerThread
public static File zippingLogFiles(int mode,List<File> attaches) {
if (checkInit()) {
return sLogEngine.zippingFiles(mode,attaches);
}
return null;
}
项目:android-api
文件:NativeApiObject.java
@WorkerThread
protected int getNativeHandle() {
if (m_nativeHandle == null)
throw new RuntimeException("nativeHandle not yet available,ensure all calls to getNativeHandle are wrapped by submit()");
return m_nativeHandle.intValue();
}
项目:Xndroid
文件:HistoryDatabase.java
@WorkerThread
@Nullable
synchronized String getHistoryItem(@NonNull String url) {
Cursor cursor = lazyDatabase().query(TABLE_HISTORY,new String[]{KEY_ID,KEY_URL,KEY_TITLE},KEY_URL + " = ?",new String[]{url},"1");
String m = null;
if (cursor != null) {
cursor.movetoFirst();
m = cursor.getString(0);
cursor.close();
}
return m;
}
项目:android-api
文件:PoiSearch.java
@UiThread
PoiSearch(final PoiApi poiApi,OnPoiSearchCompletedListener callback,Callable<Integer> beginSearchCallable) {
super(poiApi.getNativeRunner(),poiApi.getUiRunner(),beginSearchCallable);
m_poiApi = poiApi;
m_callback = callback;
submit(new Runnable() {
@WorkerThread
@Override
public void run() {
m_poiApi.register(PoiSearch.this,getNativeHandle());
}
});
}
项目:android-api
文件:EegeoMap.java
@WorkerThread
private void jniOnIndoorEnterFailed() {
m_uiRunner.runOnUiThread(new Runnable() {
public void run() {
m_indoorMap = null;
m_currentIndoorFloor = -1;
}
});
}
项目:android-api
文件:BlueSphereApi.java
@WorkerThread
public void setElevation(BlueSphere.AllowHandleAccess allowHandleAccess,double elevation) {
if (allowHandleAccess == null)
throw new NullPointerException("Null access token. Method is intended for internal use by BlueSphere");
nativeSetElevation(
m_jniEegeoMapApiPtr,elevation);
}
项目:xlight_android_native
文件:ParticleCloud.java
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。