下面列出了怎么用android.util.Config的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Checks whether this looks like a legitimate selection parameter
*/
public static void validateSelection(String selection,
Set<String> allowedColumns) {
try {
if (selection == null || selection.length() == 0) {
return;
}
Lexer lexer = new Lexer(selection, allowedColumns);
parseExpression(lexer);
if (lexer.currentToken() != Lexer.TOKEN_END) {
throw new IllegalArgumentException("syntax error");
}
} catch (RuntimeException ex) {
if (Constants.LOGV) {
Log.d(Constants.TAG, "invalid selection [" + selection
+ "] triggered " + ex);
} else if (Config.LOGD) {
Log.d(Constants.TAG, "invalid selection triggered " + ex);
}
throw ex;
}
}
@Override
public final void onClick(View v) {
final long lastClickTime = mLastClickTime;
final long now = SystemClock.uptimeMillis(); //guaranteed 100% monotonic
if (now - lastClickTime < MIN_DELAY_MS && !override) {
// Too fast: ignore
if (Config.LOGD) {
Log.d(TAG, "onClick Clicked too quickly: ignored");
}
} else {
override = false;
// Update mLastClickTime and register the click
mLastClickTime = now;
onSingleClick(v);
}
}
private DBHelper(Context context) {
DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, DB_NAME, null);
db = helper.getWritableDatabase();
// 注意:该数据库连接属于 DaoMaster,所以多个 Session 指的是相同的数据库连接。
DaoMaster daoMaster = new DaoMaster(db);
daoSession = daoMaster.newSession();
if(Config.DEBUG) {
QueryBuilder.LOG_SQL = true;
QueryBuilder.LOG_VALUES = true;
}
}