Started to update adapters to use new layouts

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-08-31 12:37:42 -04:00
parent e977c64abd
commit 997af18b5c
4 changed files with 27 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
<manifest package="com.RickBarrette.osj.forum"
android:versionCode="49"
android:versionCode="60"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
<uses-sdk

View File

@@ -37,6 +37,7 @@ public class ForumAdapter extends BaseAdapter {
class ViewHolder {
TextView title;
TextView description;
}
private LayoutInflater mInflater;
@@ -99,6 +100,7 @@ public class ForumAdapter extends BaseAdapter {
// we want to bind data to.
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.textView1);
holder.description = (TextView) convertView.findViewById(R.id.textView2);
convertView.setTag(holder);
} else
@@ -113,6 +115,7 @@ public class ForumAdapter extends BaseAdapter {
* This will prevent the list from changing the values on you.
*/
holder.title.setText(new String((byte[]) getItem(position).content.get("forum_name")));
holder.description.setText(new String((byte[]) getItem(position).content.get("description")));
return convertView;
}

View File

@@ -28,6 +28,7 @@ import org.xmlrpc.android.XMLRPCClient;
import org.xmlrpc.android.XMLRPCException;
import android.content.Context;
import android.util.Log;
import com.RickBarrette.osj.forum.R;
@@ -43,6 +44,7 @@ public class ForumContent {
*/
public static class ForumItem {
private static final String TAG = "ForumItem";
public String id;
public HashMap<?, ?> content;
@@ -55,6 +57,9 @@ public class ForumContent {
public ForumItem(final String id, final HashMap<?, ?> content) {
this.id = id;
this.content = content;
for(Object key: content.keySet())
Log.d(TAG, key.toString());
}
/**
@@ -105,7 +110,7 @@ public class ForumContent {
}
/**
* Downloads the forum from the internet
* Downloads the forum from the Internet
* @param context
* @author ricky barrette
*/

View File

@@ -22,10 +22,12 @@ package com.RickBarrette.osj.forum.content;
import java.util.HashMap;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import com.RickBarrette.osj.forum.R;
@@ -38,8 +40,13 @@ public class TopicAdapter extends BaseAdapter {
class ViewHolder {
TextView title;
TextView lastestPost;
TextView user;
QuickContactBadge badage;
}
private static final String TAG = "TopicAdapter";
private LayoutInflater mInflater;
private Object[] mTopics;
@@ -98,14 +105,17 @@ public class TopicAdapter extends BaseAdapter {
// supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(R.layout.forum_item, null);
convertView = mInflater.inflate(R.layout.topic_item, null);
// Creates a ViewHolder and store references to the two children
// views
// we want to bind data to.
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.textView1);
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView2);
holder.user = (TextView) convertView.findViewById(R.id.textView3);
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
convertView.setTag(holder);
} else
// Get the ViewHolder back to get fast access to the TextView
@@ -119,6 +129,11 @@ public class TopicAdapter extends BaseAdapter {
* This will prevent the list from changing the values on you.
*/
holder.title.setText(new String((byte[]) getItem(position).get("topic_title")));
holder.user.setText(new String((byte[]) getItem(position).get("topic_author_name")));
holder.lastestPost.setText(new String((byte[]) getItem(position).get("short_content")));
for(Object key: getItem(position).keySet())
Log.d(TAG, key.toString());
return convertView;
}