com.activeandroid.query.Update Java Examples
The following examples show how to use
com.activeandroid.query.Update.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SentenceCollectionsService.java From 10000sentences with Apache License 2.0 | 6 votes |
/** * Update counters after calling this. */ public void updateStatusByComplexity(String collectionId, int limit, SentenceStatus fromStatus, SentenceStatus toStatus, String complecityOrder) { List<Sentence> sentences = new Select() .from(Sentence.class) .where("collection_id=? and status=?", collectionId, fromStatus.getStatus()) .orderBy("complexity " + complecityOrder) .limit(limit) .execute(); if (sentences == null || sentences.size() == 0) { return; } String[] sentenceIds = new String[sentences.size()]; for (int i = 0; i < sentences.size(); i++) { sentenceIds[i] = sentences.get(i).sentenceId; } new Update(Sentence.class) .set("status=?", toStatus.getStatus()) .where("sentence_id in (" + StringUtils.repeat(",?", sentences.size()).substring(1) + ")", sentenceIds) .execute(); }
Example #2
Source File: Animation.java From AnimeTaste with MIT License | 6 votes |
public void addToFavorite(final UpdateFinishCallback callback) { IsFav = true; new Thread() { @Override public void run() { super.run(); boolean exist = new Select().from(Animation.class).where("AnimationId='" + AnimationId + "'").executeSingle() != null; if (!exist) save(); else new com.activeandroid.query.Update(Animation.class).set("IsFavorite='1'").where("AnimationId='" + AnimationId + "'").execute(); Message msg = Message.obtain(); Looper.prepare(); msg.setTarget(new FavoriteHandler(callback, Method.ADD_FAVORITE)); msg.sendToTarget(); Looper.loop(); } }.start(); }
Example #3
Source File: FriendInfoActivity.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private void updateUserInfo() { final Dialog dialog = DialogCreator.createLoadingDialog(FriendInfoActivity.this, FriendInfoActivity.this.getString(R.string.jmui_loading)); dialog.show(); if (TextUtils.isEmpty(mTargetId) && !TextUtils.isEmpty(mUserID)) { mTargetId = mUserID; } JMessageClient.getUserInfo(mTargetId, mTargetAppKey, new GetUserInfoCallback() { @Override public void gotResult(int responseCode, String responseMessage, UserInfo info) { dialog.dismiss(); if (responseCode == 0) { //拉取好友信息时候要更新数据库中的nickName.因为如果对方修改了nickName我们是无法感知的.如果不在拉取信息 //时候更新数据库的话会影响到搜索好友的nickName, 注意要在没有备注名并且有昵称时候去更新.因为备注名优先级更高 new Update(FriendEntry.class).set("DisplayName=?", info.getDisplayName()).where("Username=?", mTargetId).execute(); new Update(FriendEntry.class).set("NickName=?", info.getNickname()).where("Username=?", mTargetId).execute(); new Update(FriendEntry.class).set("NoteName=?", info.getNotename()).where("Username=?", mTargetId).execute(); if (info.getAvatarFile() != null) { new Update(FriendEntry.class).set("Avatar=?", info.getAvatarFile().getAbsolutePath()).where("Username=?", mTargetId).execute(); } mUserInfo = info; mFriendInfoController.setFriendInfo(info); mTitle = info.getNotename(); if (TextUtils.isEmpty(mTitle)) { mTitle = info.getNickname(); } mFriendInfoView.initInfo(info); } else { HandleResponseCode.onHandle(FriendInfoActivity.this, responseCode, false); } } }); }
Example #4
Source File: Animation.java From AnimeTaste with MIT License | 5 votes |
public void removeFromFavorite(final UpdateFinishCallback callback) { IsFav = false; new Thread() { @Override public void run() { super.run(); new Update(Animation.class).set("IsFavorite='0'").where("AnimationId='" + AnimationId + "'").execute(); Message msg = Message.obtain(); Looper.prepare(); msg.setTarget(new FavoriteHandler(callback, Method.REMOVE_FAVORITE)); msg.sendToTarget(); Looper.loop(); } }.start(); }
Example #5
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
public void updateData(View view){ Update update = new Update(UserEntity.class); update.set("nickname=?","haha").where("nickname=?","realmo").execute(); }
Example #6
Source File: UpdateTest.java From clear-todolist with GNU General Public License v3.0 | 4 votes |
private Update update() { return new Update(MockModel.class); }
Example #7
Source File: DownloadRecord.java From AnimeTaste with MIT License | 4 votes |
public static void save(Animation animation,M3U8Mission mission){ DownloadRecord record = new Select() .from(DownloadRecord.class) .where("AnimationId = ?" , animation.AnimationId) .executeSingle(); if(record == null){ new DownloadRecord(animation,mission).save(); }else{ int status; if(mission.isDone()){ status = mission.isSuccess() ? STATUS.SUCCESS : STATUS.ERROR; status = mission.isCanceled() ? STATUS.CANCELED : status; }else{ status = STATUS.DOWNLOADING; } new Update(DownloadRecord.class) .set("Size = ?," + "DownloadedSize = ?," + "Duration = ?," + "DownloadedDuration = ?," + "Segments = ?," + "DownloadedSegments = ?," + "DownloadedPercentage = ?," + "RangeStart = ?,"+ "Status = ?," + "Extra = ?," + "SaveDir = ?," + "SaveFileName = ? ," + "UsingDownloadUrl = ? ", mission.getFilesize(), mission.getDownloaded(), mission.getVideoDuration(), mission.getDownloadedDuration(), mission.getSegmentsCount(), mission.getDownloadedSegmentCount(), mission.getPercentage(), mission.getCurrentSegmentDownloaded(), status, "", mission.getSaveDir(), mission.getSaveName(), mission.getUri()) .where("AnimationId = ?",animation.AnimationId) .execute(); } }