Fixed topic and thread retrieval
Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<manifest package="org.RickBarrette.osj.forum"
|
||||
android:versionCode="305"
|
||||
android:versionCode="310"
|
||||
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
|
||||
<uses-sdk
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ThreadContent {
|
||||
ITEM_MAP.clear();
|
||||
|
||||
final ForumDatabase db = new ForumDatabase(context);
|
||||
final List<String> list = db.getThreads();
|
||||
final List<String> list = db.getThreads(topicId);
|
||||
|
||||
int index = 0;
|
||||
for (final String item : list)
|
||||
|
||||
@@ -88,7 +88,7 @@ public class TopicContent {
|
||||
ITEM_MAP.clear();
|
||||
|
||||
final ForumDatabase db = new ForumDatabase(context);
|
||||
final List<String> list = db.getTopics();
|
||||
final List<String> list = db.getTopics(forumId);
|
||||
|
||||
int index = 0;
|
||||
for (final String item : list)
|
||||
|
||||
@@ -421,12 +421,13 @@ public class ForumDatabase {
|
||||
/**
|
||||
* Retrieves a list of thread ids
|
||||
*
|
||||
* @param id of topic
|
||||
* @return
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public List<String> getThreads() {
|
||||
public List<String> getThreads(String id) {
|
||||
final ArrayList<String> list = new ArrayList<String>();
|
||||
final Cursor c = mDb.query(TABLE_THREADS, new String[] { KEY_ID }, null, null, null, null, null);
|
||||
final Cursor c = mDb.query(TABLE_THREADS, new String[] { KEY_ID }, KEY_TOPIC_ID +" = "+ DatabaseUtils.sqlEscapeString(id), null, null, null, null);
|
||||
if (c.moveToFirst())
|
||||
do
|
||||
list.add(c.getString(0));
|
||||
@@ -449,12 +450,13 @@ public class ForumDatabase {
|
||||
/**
|
||||
* Retrieves a list of topic ids
|
||||
*
|
||||
* @param id of forum
|
||||
* @return
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public List<String> getTopics() {
|
||||
public List<String> getTopics(String id) {
|
||||
final ArrayList<String> list = new ArrayList<String>();
|
||||
final Cursor c = mDb.query(TABLE_TOPICS, new String[] { KEY_ID }, null, null, null, null, null);
|
||||
final Cursor c = mDb.query(TABLE_TOPICS, new String[] { KEY_ID }, KEY_FORUM_ID +" = "+ DatabaseUtils.sqlEscapeString(id) , null, null, null, null);
|
||||
if (c.moveToFirst())
|
||||
do
|
||||
list.add(c.getString(0));
|
||||
|
||||
Reference in New Issue
Block a user