use of android.database.Cursor in project Talon-for-Twitter by klinker24.
the class ListDataSource method getLastIds.
public synchronized long[] getLastIds(long listId) {
long[] id = new long[] { 0, 0, 0, 0, 0 };
Cursor cursor;
try {
cursor = getCursor(listId);
} catch (Exception e) {
return id;
}
try {
if (cursor.moveToFirst()) {
int i = 0;
do {
id[i] = cursor.getLong(cursor.getColumnIndex(MentionsSQLiteHelper.COLUMN_TWEET_ID));
} while (cursor.moveToNext() && i < 5);
}
} catch (Exception e) {
}
cursor.close();
return id;
}
use of android.database.Cursor in project Talon-for-Twitter by klinker24.
the class MentionsDataSource method tweetExists.
public synchronized boolean tweetExists(long tweetId, int account) {
Cursor cursor;
try {
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, MentionsSQLiteHelper.COLUMN_ACCOUNT + " = " + account + " AND " + MentionsSQLiteHelper.COLUMN_TWEET_ID + " = " + tweetId, null, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
} catch (Exception e) {
open();
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, MentionsSQLiteHelper.COLUMN_ACCOUNT + " = " + account + " AND " + MentionsSQLiteHelper.COLUMN_TWEET_ID + " = " + tweetId, null, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
}
boolean exists = cursor.getCount() > 0;
cursor.close();
return exists;
}
use of android.database.Cursor in project Talon-for-Twitter by klinker24.
the class MentionsDataSource method getNewestNames.
public synchronized String getNewestNames(int account) {
Cursor cursor = getUnreadCursor(account);
String name = "";
try {
if (cursor.moveToFirst()) {
name = cursor.getString(cursor.getColumnIndex(MentionsSQLiteHelper.COLUMN_USERS));
}
} catch (Exception e) {
}
cursor.close();
return name;
}
use of android.database.Cursor in project Talon-for-Twitter by klinker24.
the class MentionsDataSource method getUnreadCursor.
public synchronized Cursor getUnreadCursor(int account) {
boolean mutedMentions = sharedPrefs.getBoolean("show_muted_mentions", false);
String users = sharedPrefs.getString("muted_users", "");
String hashtags = sharedPrefs.getString("muted_hashtags", "");
String expressions = sharedPrefs.getString("muted_regex", "");
expressions = expressions.replaceAll("'", "''");
String where = MentionsSQLiteHelper.COLUMN_ACCOUNT + " = ? AND " + MentionsSQLiteHelper.COLUMN_UNREAD + " = ?";
if (!users.equals("") && !mutedMentions) {
String[] split = users.split(" ");
for (String s : split) {
where += " AND " + MentionsSQLiteHelper.COLUMN_SCREEN_NAME + " NOT LIKE '" + s + "'";
}
}
if (!hashtags.equals("")) {
String[] split = hashtags.split(" ");
for (String s : split) {
where += " AND " + MentionsSQLiteHelper.COLUMN_HASHTAGS + " NOT LIKE " + "'%" + s + "%'";
}
}
if (!expressions.equals("")) {
String[] split = expressions.split(" ");
for (String s : split) {
where += " AND " + MentionsSQLiteHelper.COLUMN_TEXT + " NOT LIKE " + "'%" + s + "%'";
}
}
Cursor cursor;
try {
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, where, new String[] { account + "", "1" }, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
} catch (Exception e) {
open();
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, where, new String[] { account + "", "1" }, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
}
return cursor;
}
use of android.database.Cursor in project Talon-for-Twitter by klinker24.
the class MentionsDataSource method getTrimmingCursor.
public synchronized Cursor getTrimmingCursor(int account) {
String where = MentionsSQLiteHelper.COLUMN_ACCOUNT + " = " + account;
Cursor cursor;
try {
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, where, null, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
} catch (Exception e) {
open();
cursor = database.query(MentionsSQLiteHelper.TABLE_MENTIONS, allColumns, where, null, null, null, MentionsSQLiteHelper.COLUMN_TWEET_ID + " ASC");
}
return cursor;
}
Aggregations