Created
July 17, 2015 21:12
-
-
Save peterclemenko/5b3562a9e2e53d1f2624 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean getCurrentCall(GenericSqliteHelper helper, final CallInfo callInfo) { | |
String sqlQuery = M.e("select _id,number,date,type from calls order by _id desc limit 1"); | |
RecordVisitor visitor = new RecordVisitor() { | |
@Override | |
public long cursor(Cursor cursor) { | |
callInfo.id = cursor.getInt(0); | |
callInfo.peer = cursor.getString(1); | |
// callInfo.displayName = String sqlQuery; | |
callInfo.timestamp = new Date(cursor.getLong(2)); | |
int type = cursor.getInt(3); | |
if (Cfg.DEBUG) { | |
Check.log(TAG + " (cursor) call type: " + type); | |
} | |
callInfo.incoming = type == 1; | |
callInfo.valid = true; | |
return callInfo.id; | |
} | |
}; | |
helper.traverseRawQuery(sqlQuery, new String[] {}, visitor); | |
return callInfo.valid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment