use of android.content.ContentValues in project android-job by evernote.
the class DatabaseUpgradeTest method createJobs.
private void createJobs(UpgradeAbleJobOpenHelper openHelper) {
SQLiteDatabase database = openHelper.getWritableDatabase();
ContentValues contentValues = openHelper.createBaseContentValues(1);
contentValues.put(JobStorage.COLUMN_START_MS, 60_000L);
contentValues.put(JobStorage.COLUMN_END_MS, 120_000L);
database.insert(JobStorage.JOB_TABLE_NAME, null, contentValues);
contentValues = openHelper.createBaseContentValues(2);
contentValues.put(JobStorage.COLUMN_INTERVAL_MS, 60_000L);
database.insert(JobStorage.JOB_TABLE_NAME, null, contentValues);
contentValues = openHelper.createBaseContentValues(3);
contentValues.put(JobStorage.COLUMN_INTERVAL_MS, TimeUnit.MINUTES.toMillis(20));
database.insert(JobStorage.JOB_TABLE_NAME, null, contentValues);
}
use of android.content.ContentValues in project cw-omnibus by commonsguy.
the class ConstantsFragment method onClick.
public void onClick(DialogInterface di, int whichButton) {
ContentValues values = new ContentValues(2);
AlertDialog dlg = (AlertDialog) di;
EditText title = (EditText) dlg.findViewById(R.id.title);
EditText value = (EditText) dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task = new InsertTask().execute(values);
}
use of android.content.ContentValues in project cw-omnibus by commonsguy.
the class ConstantsBrowser method processAdd.
private void processAdd(DialogWrapper wrapper) {
ContentValues values = new ContentValues(2);
values.put(Provider.Constants.TITLE, wrapper.getTitle());
values.put(Provider.Constants.VALUE, wrapper.getValue());
getContentResolver().insert(Provider.Constants.CONTENT_URI, values);
}
use of android.content.ContentValues in project cw-omnibus by commonsguy.
the class DatabaseHelper method onCreate.
@Override
public void onCreate(SQLiteDatabase db) {
Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table' AND name='constants'", null);
try {
if (c.getCount() == 0) {
db.execSQL("CREATE TABLE constants (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, value REAL);");
ContentValues cv = new ContentValues();
cv.put(Provider.Constants.TITLE, "Gravity, Death Star I");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_DEATH_STAR_I);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Earth");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_EARTH);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Jupiter");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_JUPITER);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Mars");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_MARS);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Mercury");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_MERCURY);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Moon");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_MOON);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Neptune");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_NEPTUNE);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Pluto");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_PLUTO);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Saturn");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_SATURN);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Sun");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_SUN);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, The Island");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_THE_ISLAND);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Uranus");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_URANUS);
db.insert("constants", Provider.Constants.TITLE, cv);
cv.put(Provider.Constants.TITLE, "Gravity, Venus");
cv.put(Provider.Constants.VALUE, SensorManager.GRAVITY_VENUS);
db.insert("constants", Provider.Constants.TITLE, cv);
}
} finally {
c.close();
}
}
use of android.content.ContentValues in project cw-omnibus by commonsguy.
the class ConstantsBrowser method processAdd.
private void processAdd(DialogWrapper wrapper) {
ContentValues values = new ContentValues(2);
values.put(Provider.Constants.TITLE, wrapper.getTitle());
values.put(Provider.Constants.VALUE, wrapper.getValue());
getContentResolver().insert(Provider.Constants.CONTENT_URI, values);
}
Aggregations