use of com.activeandroid.query.Delete in project AnimeTaste by daimajia.
the class DownloadRecord method deleteAll.
public static void deleteAll() {
List<DownloadRecord> records = new Select().from(DownloadRecord.class).execute();
for (int i = 0; i < records.size(); i++) {
DownloadRecord r = records.get(i);
String p = r.SaveDir + r.SaveFileName;
File f = new File(p);
if (f.exists() && f.isFile()) {
f.delete();
}
}
new Delete().from(DownloadRecord.class).execute();
}
use of com.activeandroid.query.Delete in project xDrip-plus by jamorham.
the class UploaderQueue method cleanQueue.
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();
}
use of com.activeandroid.query.Delete in project AnimeTaste by daimajia.
the class DownloadActivity method onItemLongClick.
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Object obj = mDownloadList.getAdapter().getItem(position);
if (obj instanceof Mission) {
final Mission m = (Mission) obj;
show(R.string.tip, getString(R.string.stop_mission, m.getSaveName()), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mBinder.stopMission(m.getMissionID());
}
});
} else if (obj instanceof DownloadRecord) {
final DownloadRecord r = (DownloadRecord) obj;
String msg = getString(R.string.surely_delete, r.Name);
show(R.string.tip, msg, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path = r.SaveDir + r.SaveFileName;
File f = new File(path);
if (f.exists() && f.isFile()) {
f.delete();
}
new Delete().from(DownloadRecord.class).where("AnimationId = ?", r.AnimationId).executeSingle();
DownloadAdapter adapter = (DownloadAdapter) mDownloadList.getAdapter();
adapter.reloadData();
}
});
}
return true;
}
use of com.activeandroid.query.Delete in project xDrip by NightscoutFoundation.
the class UploaderQueue method cleanQueue.
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();
}
use of com.activeandroid.query.Delete in project ActiveAndroid by pardom.
the class Model method delete.
// Convenience methods
public static void delete(Class<? extends Model> type, long id) {
TableInfo tableInfo = Cache.getTableInfo(type);
new Delete().from(type).where(tableInfo.getIdName() + "=?", id).execute();
}
Aggregations