Cleaned up posts list items
I also created header.xml, a reusable resource for displaying an avatar, title, user name, and time stamp. I also renamed some view id's to be more developer friendly Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<manifest package="org.RickBarrette.osj.forum"
|
<manifest package="org.RickBarrette.osj.forum"
|
||||||
android:versionCode="1349"
|
android:versionCode="1362"
|
||||||
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
|
|||||||
62
OSJ Forum/res/layout/header.xml
Normal file
62
OSJ Forum/res/layout/header.xml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<QuickContactBadge
|
||||||
|
android:id="@+id/quickContactBadge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="right" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_user"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/user"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/date"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_toRightOf="@+id/quickContactBadge"
|
||||||
|
android:paddingLeft="5dip"
|
||||||
|
android:text="@string/title"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/firstDivider"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:background="#0099CC"
|
||||||
|
android:padding="10dip" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,46 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:padding="5dip"
|
android:orientation="vertical"
|
||||||
>
|
android:padding="5dip" >
|
||||||
|
|
||||||
|
<include layout="@layout/header" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/textView_post"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_toRightOf="@+id/quickContactBadge1"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="@string/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<QuickContactBadge
|
|
||||||
android:id="@+id/quickContactBadge1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@+id/quickContactBadge1"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:text="@string/post" />
|
android:text="@string/post" />
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/textView2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_above="@+id/textView3"
|
|
||||||
android:layout_alignLeft="@+id/textView1"
|
|
||||||
android:text="@string/user"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
@@ -5,73 +5,25 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="5dip" >
|
android:padding="5dip" >
|
||||||
|
|
||||||
<RelativeLayout
|
<include layout="@layout/header" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="5dip" >
|
|
||||||
|
|
||||||
<QuickContactBadge
|
|
||||||
android:id="@+id/quickContactBadge1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView1"
|
|
||||||
android:paddingLeft="5dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_toRightOf="@+id/quickContactBadge1"
|
|
||||||
android:text="@string/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView5"
|
|
||||||
android:layout_below="@id/textView1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:text="@string/date"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@+id/textView5"
|
|
||||||
android:text="@string/user"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/firstDivider"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:background="#0099CC"
|
|
||||||
android:padding="10dip" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" >
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView2"
|
android:id="@+id/textView_latestPost"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/firstDivider"
|
|
||||||
android:text="@string/latest_post"
|
android:text="@string/latest_post"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/textView_newPosts"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_below="@+id/textView2"
|
android:layout_below="@+id/textView_latestPost"
|
||||||
android:text="@string/new_posts"
|
android:text="@string/new_posts"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public class ForumDetailFragment extends PullToRefreshListFragment implements Da
|
|||||||
public void run() {
|
public void run() {
|
||||||
TopicContent.getTopics((String) mItem.content.get("forum_id"), mDb);
|
TopicContent.getTopics((String) mItem.content.get("forum_id"), mDb);
|
||||||
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
||||||
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge1 }));
|
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||||
getPullToRefreshListView().onRefreshComplete();
|
getPullToRefreshListView().onRefreshComplete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public class TopicDetailFragment extends PullToRefreshListFragment implements Da
|
|||||||
public void run() {
|
public void run() {
|
||||||
ThreadContent.getThread((String) mItem.content.get("topic_id"), mDb);
|
ThreadContent.getThread((String) mItem.content.get("topic_id"), mDb);
|
||||||
setListAdapter(new ThumbnailAdapter(getActivity(), new ThreadAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
setListAdapter(new ThumbnailAdapter(getActivity(), new ThreadAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
||||||
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge1 }));
|
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||||
getPullToRefreshListView().onRefreshComplete();
|
getPullToRefreshListView().onRefreshComplete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class TopicListFragment extends ListFragment {
|
|||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null, 101,
|
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null, 101,
|
||||||
new ThumbnailBus()), new int[] { R.id.quickContactBadge1 }));
|
new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class ThreadAdapter extends BaseAdapter {
|
|||||||
TextView user;
|
TextView user;
|
||||||
TextView post;
|
TextView post;
|
||||||
QuickContactBadge badage;
|
QuickContactBadge badage;
|
||||||
|
TextView date;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
@@ -110,10 +111,11 @@ public class ThreadAdapter extends BaseAdapter {
|
|||||||
// views
|
// views
|
||||||
// we want to bind data to.
|
// we want to bind data to.
|
||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
holder.title = (TextView) convertView.findViewById(R.id.textView_title);
|
||||||
holder.user = (TextView) convertView.findViewById(R.id.textView2);
|
holder.user = (TextView) convertView.findViewById(R.id.textView_user);
|
||||||
holder.post = (TextView) convertView.findViewById(R.id.textView3);
|
holder.post = (TextView) convertView.findViewById(R.id.textView_post);
|
||||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
holder.date = (TextView) convertView.findViewById(R.id.textView_date);
|
||||||
|
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge);
|
||||||
|
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else
|
} else
|
||||||
@@ -129,6 +131,7 @@ public class ThreadAdapter extends BaseAdapter {
|
|||||||
holder.title.setText((String) getItem(position).get("post_title"));
|
holder.title.setText((String) getItem(position).get("post_title"));
|
||||||
holder.user.setText((String) getItem(position).get("post_author_name"));
|
holder.user.setText((String) getItem(position).get("post_author_name"));
|
||||||
holder.post.setText((String) getItem(position).get("post_content"));
|
holder.post.setText((String) getItem(position).get("post_content"));
|
||||||
|
holder.date.setText((String) getItem(position).get("post_time"));
|
||||||
holder.badage.setImageResource(R.drawable.ic_launcher);
|
holder.badage.setImageResource(R.drawable.ic_launcher);
|
||||||
holder.badage.setTag("http://www.gravatar.com/avatar/9b4f3d34ca3ce31198efac149c3a1ca2?s=300&d=identicon&r=PG");
|
holder.badage.setTag("http://www.gravatar.com/avatar/9b4f3d34ca3ce31198efac149c3a1ca2?s=300&d=identicon&r=PG");
|
||||||
|
|
||||||
|
|||||||
@@ -111,12 +111,12 @@ public class TopicAdapter extends BaseAdapter {
|
|||||||
// views
|
// views
|
||||||
// we want to bind data to.
|
// we want to bind data to.
|
||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
holder.title = (TextView) convertView.findViewById(R.id.textView_title);
|
||||||
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView2);
|
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView_latestPost);
|
||||||
holder.user = (TextView) convertView.findViewById(R.id.textView3);
|
holder.user = (TextView) convertView.findViewById(R.id.textView_user);
|
||||||
holder.newPosts = (TextView) convertView.findViewById(R.id.textView4);
|
holder.newPosts = (TextView) convertView.findViewById(R.id.textView_newPosts);
|
||||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge);
|
||||||
holder.date = (TextView) convertView.findViewById(R.id.textView5);
|
holder.date = (TextView) convertView.findViewById(R.id.textView_date);
|
||||||
|
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user