public void setSetings(String key, String value) { ContentResolver cr = ctx.getContentResolver(); String currentValue = DBUtils.getSettValue(cr, key); if (currentValue == null) { DBUtils.createSetValue(cr, key, value); } else { DBUtils.updateSetValue(cr, key, value); } }
public void invalidateDateFormat() { String value = DBUtils.getSettValue(ctx.getContentResolver(), SET_DATE_FORMAT); if (value == null) { value = "0"; } DATATE_FORMAT = dataFormatArray[Integer.valueOf(value)]; }
public void reload(long carId, boolean onlyLabels) { if (carId != -1) { Cursor c = ctx.getContentResolver() .query( ProviderDescriptor.Car.CONTENT_URI, null, BaseActivity.SELECTION_ID_FILTER, new String[] {String.valueOf(carId)}, null); if (c == null) { return; } boolean hasItem = c.moveToFirst(); if (hasItem) { fuelValue = c.getInt(c.getColumnIndex(ProviderDescriptor.Car.Cols.UNIT_FUEL)); distanceValue = c.getInt(c.getColumnIndex(ProviderDescriptor.Car.Cols.UNIT_DISTANCE)); consumptionValue = c.getInt(c.getColumnIndex(ProviderDescriptor.Car.Cols.UNIT_CONSUMPTION)); currency = c.getString(c.getColumnIndex(ProviderDescriptor.Car.Cols.UNIT_CURRENCY)); loadConsumptionArrayType(); } } else { loadDefault(ctx); } if (onlyLabels) { return; } carId = DBUtils.getActiveCarId(ctx.getContentResolver()); carName = DBUtils.getActiveCarName(ctx.getContentResolver(), carId); if (carName == null || carName.length() == 0) { carName = ctx.getString(R.string.no_car); } invalidateAll(); }
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Long carId = DBUtils.getActiveCarId(getActivity().getContentResolver()); CursorLoader cursorLoader = new CursorLoader( getActivity(), ProviderDescriptor.FuelRateView.CONTENT_URI, null, DBUtils.CAR_SELECTION_RATE, new String[] {String.valueOf(carId)}, null); return cursorLoader; }
public String getLogDefault(int type) { ContentResolver cr = ctx.getContentResolver(); String value = DBUtils.getSettValue(cr, LOG_DEF + type); return value == null ? "" : value; }
public String getSetting(String key, String defaultValue) { ContentResolver cr = ctx.getContentResolver(); String value = DBUtils.getSettValue(cr, key); return value == null ? defaultValue : value; }
public String getSetting(String key) { ContentResolver cr = ctx.getContentResolver(); return DBUtils.getSettValue(cr, key); }