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


Java Delete类代码示例

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


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

示例1: onBackPressed

import com.activeandroid.query.Delete; //导入依赖的package包/类
@Override public void onBackPressed() {
    super.onBackPressed();
    //TODO 遍历数据,将isLike==true的数据存到数据库,优化线程
    if (mList == null || mList.isEmpty()) {
        return;
    }
    for (Gank gank : mList) {
        if (!new Select().from(Gank.class).where("_id=?", gank.get_id()).exists() &&
            gank.getIsLike()) {
            gank.save();
        }
        if (!gank.getIsLike() &&
            new Select().from(Gank.class)
                .where("_id=?", gank.get_id())
                .exists()) {//从数据库中将取消收藏的删除
            new Delete().from(Gank.class).where("_id=?", gank.get_id()).execute();
        }
        RxBus.getInstance().post(new StatusEvent(StatusEvent.TYPE_ON_LIKE_CHANGE));
    }
}
 
开发者ID:wavever,项目名称:GankLock,代码行数:21,代码来源:GankContentActivity.java

示例2: DeleteFileTask

import com.activeandroid.query.Delete; //导入依赖的package包/类
public DeleteFileTask(FileManagerFragment fileManagerFragment){
    this.fileManagerFragment = fileManagerFragment;

    Device device = Device.registeredDevice();

    // delete all local notes
    new Delete().from(Note.class).execute();

    // cozy register device url
    this.url = device.getUrl() + "/ds-api/data/";


    // concatenate username and password with colon for authentication
    final String credentials = device.getLogin() + ":" + device.getPassword();
    authHeader = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);

    dialog = new ProgressDialog(fileManagerFragment.getActivity());
    dialog.setCancelable(false);
    dialog.setProgress(0);
    dialog.setMax(100);
    dialog.setMessage("Please wait");
    dialog.setIndeterminate(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.show();

}
 
开发者ID:hamzux,项目名称:cosi,代码行数:27,代码来源:DeleteFileTask.java

示例3: GetPlacesTask

import com.activeandroid.query.Delete; //导入依赖的package包/类
public GetPlacesTask(PlacesFragment placesFragment){
    this.placesFragment = placesFragment;
    allPlaces = new ArrayList<>();

    Device device = Device.registeredDevice();

    // delete all local places
    new Delete().from(Place.class).execute();

    // cozy register device url
    this.url = device.getUrl() + "/ds-api/request/place/all/";


    // concatenate username and password with colon for authentication
    final String credentials = device.getLogin() + ":" + device.getPassword();
    authHeader = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);

    dialog = new ProgressDialog(placesFragment.getActivity());
    dialog.setCancelable(false);
    dialog.setMessage("Please wait");
    dialog.setIndeterminate(true);
    dialog.show();

}
 
开发者ID:hamzux,项目名称:cosi,代码行数:25,代码来源:GetPlacesTask.java

示例4: cleanQueue

import com.activeandroid.query.Delete; //导入依赖的package包/类
public static void cleanQueue() {
    // delete all completed records > 24 hours old
    fixUpTable();
    try {
        new Delete()
                .from(UploaderQueue.class)
                .where("timestamp < ?", JoH.tsl() - 86400000L)
                .where("bitfield_wanted == bitfield_complete")
                .execute();

        // delete everything > 7 days old
        new Delete()
                .from(UploaderQueue.class)
                .where("timestamp < ?", JoH.tsl() - 86400000L * 7L)
                .execute();
    } catch (Exception e) {
        UserError.Log.d(TAG, "Exception cleaning uploader queue: " + e);
    }
    last_cleanup = JoH.tsl();
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:21,代码来源:UploaderQueue.java

示例5: cachePost

import com.activeandroid.query.Delete; //导入依赖的package包/类
private void cachePost(Post post, boolean isNewPost) {
    if (isNewPost) {
        this.post = post;
        Post oldPost = new Select().from(Post.class).where("id = ?", post.id).executeSingle();
        if (oldPost != null)
            oldPost.delete();
        else
            while (new Select().from(Post.class).count() >= POST_MAX_CACHE_NUM)
                new Delete().from(Post.class).executeSingle();
        post.text = "";
    }
    for (Object line : post.content) {
        if (line.getClass().equals(String.class))
            this.post.text += line + "\n";
        else
            this.post.text += gson.toJson(line) + "\n";
    }
    this.post.save();
}
 
开发者ID:c910335,项目名称:PTR,代码行数:20,代码来源:GrapttClient.java

示例6: removeFeedRelativeItems

import com.activeandroid.query.Delete; //导入依赖的package包/类
private void removeFeedRelativeItems() throws ClassNotFoundException {
    // 获取所有缓存的Feed
    List<FeedItem> cacheFeedItems = new Select().from(FeedItem.class)
            .where("category='NORMAL'").execute();

    Class<? extends Model> feedLikeClass = refectModelClz("com.umeng.comm.core.beans.relation.FeedLike");
    Class<? extends Model> feedCommentClass = refectModelClz("com.umeng.comm.core.beans.relation.FeedComment");
    Class<? extends Model> feedTopicClass = refectModelClz("com.umeng.comm.core.beans.relation.FeedTopic");
    Class<? extends Model> feedCreatorClass = refectModelClz("com.umeng.comm.core.beans.relation.FeedCreator");
    Class<? extends Model> feedFriendClass = refectModelClz("com.umeng.comm.core.beans.relation.FeedFriends");

    for (FeedItem feedItem : cacheFeedItems) {
        // 移除like相关
        removeRelativeLike(feedItem.id, feedLikeClass);
        // 移除Feed相关的Comment
        removeRelativeComment(feedItem.id, feedCommentClass);
        new Delete().from(feedTopicClass).where("feed_id=?", feedItem.id)
                .execute();
        new Delete().from(feedCreatorClass).where("feed_id=?", feedItem.id)
                .execute();
        new Delete().from(feedFriendClass).where("feed_id=?", feedItem.id)
                .execute();
    }
}
 
开发者ID:umeng,项目名称:umeng_community_android,代码行数:25,代码来源:FeedDBAPIImpl.java

示例7: deleteLikesFromDB

import com.activeandroid.query.Delete; //导入依赖的package包/类
@Override
public void deleteLikesFromDB(final String feedId, final String likeId) {
    if (TextUtils.isEmpty(feedId) || TextUtils.isEmpty(likeId)) {
        return;
    }

    submit(new DbCommand() {

        @Override
        protected void execute() {
            new Delete().from(Like.class).where("_id=?", likeId).execute();
            DBRelationOP<?> relation = EntityRelationFactory.createFeedLike(feedId);
            relation.deleteById(likeId);
        }
    });
}
 
开发者ID:umeng,项目名称:umeng_community_android,代码行数:17,代码来源:LikeDBAPIImpl.java

示例8: testAddressItems

import com.activeandroid.query.Delete; //导入依赖的package包/类
public static void testAddressItems(Context context) {
    new Delete().from(SimpleAddressItem.class).execute();

    final Collection<SimpleAddressItem> activeAndroidModels =
            Generator.getAddresses(SimpleAddressItem.class, MainActivity.LOOP_COUNT);

    long startTime = System.currentTimeMillis();
    // Reuse method so we don't have to write
    TransactionManager.transact(ActiveAndroid.getDatabase(), new Runnable() {
        @Override
        public void run() {
            Saver.saveAll(activeAndroidModels);
        }
    });
    EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.SAVE_TIME));

    startTime = System.currentTimeMillis();
    Collection<SimpleAddressItem> activeAndroidModelLoad =
            new Select().from(SimpleAddressItem.class).execute();
    EventBus.getDefault().post(new LogTestDataEvent(startTime, FRAMEWORK_NAME, MainActivity.LOAD_TIME));

    new Delete().from(SimpleAddressItem.class).execute();
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:24,代码来源:AATester.java

示例9: deleteWaypointAt

import com.activeandroid.query.Delete; //导入依赖的package包/类
public void deleteWaypointAt(int order) {
    if (order == WaypointModel.START_WAYPOINT_ORDER || order == WaypointModel.END_WAYPOINT_ORDER) {
        // Do not allow deleting the start or end point
        throw new IllegalArgumentException("Not allowed to delete the start or end point");
    }

    new Delete().from(WaypointModel.class)
                .where(WaypointContract.Columns.ROUTE + " = ?", getId())
                .and(WaypointContract.Columns.ORDER + " = ?", order)
                .execute();

    new Update(WaypointModel.class)
            .set(WaypointContract.Columns.ORDER + " = " + WaypointContract.Columns.ORDER + " - 1")
            .where(String.format("%s = ? AND %s > ? AND %s <> ?",
                            WaypointContract.Columns.ROUTE, WaypointContract.Columns.ORDER, WaypointContract.Columns.ORDER),
                    getId(), order, WaypointModel.END_WAYPOINT_ORDER)
            .execute();
}
 
开发者ID:SenAndAaron,项目名称:voyager2-android,代码行数:19,代码来源:RouteModel.java

示例10: deleteScreen

import com.activeandroid.query.Delete; //导入依赖的package包/类
public void deleteScreen(final Screen screen, Observer<Object> observer) {
    Observable.create(new Observable.OnSubscribe<Object>() {
        @Override
        public void call(Subscriber<? super Object> subscriber) {
            new Delete().from(ScreenRelation.class)
                    .where("parent = ? OR child = ?", screen.getId())
                    .execute();
            new Delete().from(Screen.class)
                    .where(Screen._ID + " = ?", screen.getId())
                    .execute();
            subscriber.onNext(null);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer);
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:18,代码来源:ScreenListController.java

示例11: removeRelation

import com.activeandroid.query.Delete; //导入依赖的package包/类
public void removeRelation(final Screen parentScreen, final Screen childScreen, Observer<Integer> observer) {
    Observable.create(new Observable.OnSubscribe<Integer>() {
        @Override
        public void call(Subscriber<? super Integer> subscriber) {
            int count = new Select().from(ScreenRelation.class)
                    .where("parent = ? and child = ?", parentScreen.getId(), childScreen.getId())
                    .count();
            if(count > 0) {
                new Delete().from(ScreenRelation.class)
                        .where("parent = ? and child = ?", parentScreen.getId(), childScreen.getId())
                        .execute();
            }
            subscriber.onNext(count);
            subscriber.onCompleted();
        }
    }).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(observer);
}
 
开发者ID:rockycamacho,项目名称:usbong-builder,代码行数:20,代码来源:ScreenDetailController.java

示例12: logout

import com.activeandroid.query.Delete; //导入依赖的package包/类
public void logout() {
    AddJam.log(Log.INFO, TAG, "Logging out");

    // Remove account
    AccountManager accountManager = AccountManager.get(getApplicationContext());
    Account[] accounts = accountManager.getAccountsByType(CyclingAuthenticator.ACCOUNT_TYPE);
    if (accounts.length > 0) {
        Account account = accounts[0];
        accountManager.removeAccount(account, null, null);
    }

    // Delete stored details
    new Delete().from(User.class).execute();
    new Delete().from(Month.class).execute();

    // Start sign in activity
    Intent startSignIn = new Intent(this, SignInActivity.class);
    startSignIn.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    startActivity(startSignIn);
}
 
开发者ID:openglasgow,项目名称:glasgow-cycling-android,代码行数:21,代码来源:CyclingApplication.java

示例13: getRecentlyPlayed

import com.activeandroid.query.Delete; //导入依赖的package包/类
public List<Release> getRecentlyPlayed() {
    ArrayList<Release> releases = new ArrayList<Release>();
    //get the user preference on recently played size
    int size = 50;
    try {
        String items = PreferenceManager.getDefaultSharedPreferences(mContext).getString("recently_played_size", "50");
        size = Integer.parseInt(items);
    } catch(NumberFormatException ex) {}
    List<RecentlyPlayed> recent = new Select().from(RecentlyPlayed.class).limit(size).orderBy("timestamp DESC").execute();
    //create release list and store the oldest timestamp
    long minTimestamp = 0;
    for(RecentlyPlayed r : recent) {
        releases.add(r.getRelease());
        minTimestamp=r.timestamp;
    }
    //do some cleanup while we're at it: remove all recently played items with timestamp < oldest timestamp of valid results
    new Delete().from(RecentlyPlayed.class).where("timestamp < ?", minTimestamp).execute();
    return releases;
}
 
开发者ID:jvanhie,项目名称:discogsscrobbler,代码行数:20,代码来源:Discogs.java

示例14: refresh

import com.activeandroid.query.Delete; //导入依赖的package包/类
/**
 * Obter a Lista de todas as palestras disponíveis.
 * 
 * @return Lista de Palestras.
 */
public static List<Keynote> refresh() {
	KeynoteService service = ServiceFactory.getKeynoteService();
	List<Keynote> keynotes = service.list(1L);

	ActiveAndroid.beginTransaction();
	new Delete().from(Keynote.class).execute();

	try {
		for (Keynote keynote : keynotes) {
			keynote.save();
		}
		ActiveAndroid.setTransactionSuccessful();
	} finally {
		ActiveAndroid.endTransaction();
	}

	return keynotes;
}
 
开发者ID:exmo,项目名称:GameLivreNFC,代码行数:24,代码来源:Keynote.java

示例15: saveTokenAndUser

import com.activeandroid.query.Delete; //导入依赖的package包/类
@AfterPut
@ServerModel
void saveTokenAndUser() {

    if (success == 1) {

        loggedUser.setCurrent(true);
        loggedUser.save();

        new Delete().from(Token_.class).execute();
        token.save();
    }

}
 
开发者ID:smaugho,项目名称:declex-example-expenses,代码行数:15,代码来源:Auth.java


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