android-ibc-forum

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6eb39d63634c0c4cdfa088b7cef1dd74ff00b57a
parent 58cce1eae0484e46c80ae09aa62aac7b9bc8f91f
Author: Jan Dankert <devnull@localhost>
Date:   Fri, 27 Jan 2012 22:59:17 +0100

Benutzernamen in Beiträgen anzeigen.

Diffstat:
AndroidManifest.xml | 2+-
res/layout/exp_listing.xml | 7-------
res/layout/listing.xml | 11+++++++++++
res/layout/rss_item.xml | 15++++++++++-----
res/values/strings.xml | 12+++++++++++-
res/xml/preferences.xml | 9++++++++-
src/de/mtbnews/android/ForumActivity.java | 2++
src/de/mtbnews/android/ForumOverviewActivity.java | 16++++++++++------
src/de/mtbnews/android/IBCActivity.java | 19+++++++++----------
src/de/mtbnews/android/IBCApplication.java | 7+++++++
src/de/mtbnews/android/MailboxActivity.java | 13++++++++-----
src/de/mtbnews/android/SearchActivity.java | 3+++
src/de/mtbnews/android/TopicActivity.java | 6++++--
src/de/mtbnews/android/adapter/ListEntryContentAdapter.java | 12++++++++++--
src/de/mtbnews/android/tapatalk/TapatalkClient.java | 12++++++------
src/de/mtbnews/android/tapatalk/wrapper/Forum.java | 11+++++++++++
src/de/mtbnews/android/tapatalk/wrapper/ListEntry.java | 2++
src/de/mtbnews/android/tapatalk/wrapper/Post.java | 16+++++++++++++++-
src/de/mtbnews/android/tapatalk/wrapper/Topic.java | 13++++++++++++-
src/org/mcsoxford/rss/RSSBase.java | 248+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
20 files changed, 283 insertions(+), 153 deletions(-)

diff --git a/AndroidManifest.xml b/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="de.mtbnews.android"> - <application android:icon="@drawable/ibc_icon" + <application android:icon="@drawable/ibc_icon" android:name=".IBCApplication" android:label="@string/app_name" android:theme="@style/IBC"> <activity android:name=".IBCActivity" android:label="@string/app_name"> <intent-filter> diff --git a/res/layout/exp_listing.xml b/res/layout/exp_listing.xml @@ -3,13 +3,6 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> - <ImageView android:id="@+id/listimage" android:layout_width="wrap_content" - android:layout_height="wrap_content" android:visibility="invisible" /> - - <TextView android:id="@+id/listtitle" android:textSize="14sp" - android:layout_width="wrap_content" android:layout_height="wrap_content" - android:visibility="invisible" /> - <ExpandableListView android:id="@id/android:list" android:textSize="25sp" android:layout_width="fill_parent" android:layout_height="wrap_content"> </ExpandableListView> diff --git a/res/layout/listing.xml b/res/layout/listing.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="vertical"> + + <ListView android:id="@id/android:list" android:textSize="25sp" + android:layout_width="fill_parent" android:layout_height="wrap_content"> + </ListView> + + +</LinearLayout> diff --git a/res/layout/rss_item.xml b/res/layout/rss_item.xml @@ -5,16 +5,21 @@ android:layout_height="wrap_content" android:layout_margin="8sp" android:padding="5sp" style="@style/textbox"> - - <TextView android:layout_width="wrap_content" - android:layout_height="wrap_content" android:id="@+id/item_date" - style="@style/normalText"></TextView> + <LinearLayout android:orientation="horizontal" style="@style/textbox" + android:layout_width="fill_parent" android:layout_height="wrap_content"> + <TextView android:layout_width="wrap_content" + android:layout_height="wrap_content" android:id="@+id/item_date" + style="@style/normalText"></TextView> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:id="@+id/item_name" + style="@style/normalText" android:gravity="right"></TextView> + </LinearLayout> <TextView android:text="@+id/TextView03" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/item_title" style="@style/titleText"></TextView> - <TextView android:text="@+id/TextView01" android:layout_width="wrap_content" + <TextView android:text="@+id/TextView01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/item_description" style="@style/normalText"></TextView> </LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml @@ -95,11 +95,13 @@ Menütaste können Sie einen neuen Server anlegen.</string> <string name="nousername">Es ist noch kein Benutzername konfiguriert</string> <string name="www">Zur Webseite</string> - <string name="scroll_down">Immer an das Ende scrollen</string> + <string name="scroll_down">Zum Ende springen</string> <string name="use_ibc_theme">Das IBC-Theme benutzen</string> <string name="auto_login">Automatisch anmelden</string> <string name="num_load">Anzahl Posts laden</string> <string name="login">Anmelden</string> + <string name="login_success">Benutzeranmeldung erfolgreich</string> + <string name="login_failed">Benutzeranmeldung nicht erfolgreich</string> <string name="logout">Abmelden</string> <string-array name="num_load_list"> <item>5</item> @@ -120,4 +122,12 @@ <string name="video">Videos</string> <string name="blog">Blog</string> <string name="links">Links</string> + <string name="load_images">Bilder anzeigen</string> + <string name="goto_first_post">Zum ersten Beitrag</string> + <string name="goto_last_post">Zum letzten Beitrag</string> + <string name="goto_top">Nach oben</string> + <string name="goto_buttom">Nach unten</string> + <string name="reply">Antworten</string> + <string name="new_topic">Neues Thema</string> + <string name="parse_bbcode">BB-Code auswerten</string> </resources> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml @@ -20,6 +20,10 @@ android:title="@string/username"></EditTextPreference> <EditTextPreference android:key="password" android:password="true" android:title="@string/password"></EditTextPreference> + + <CheckBoxPreference android:defaultValue="true" + android:key="auto_login" android:title="@string/auto_login" android:dependency="username" /> + </PreferenceCategory> <PreferenceCategory android:title="@string/forum"> @@ -32,6 +36,9 @@ android:key="scroll_down" android:title="@string/scroll_down" /> <CheckBoxPreference android:defaultValue="true" - android:key="auto_login" android:title="@string/auto_login" /> + android:key="parse_bbcode" android:title="@string/parse_bbcode" /> + + <CheckBoxPreference android:defaultValue="true" + android:key="load_images" android:title="@string/load_images" android:dependency="parse_bbcode" /> </PreferenceCategory> </PreferenceScreen> diff --git a/src/de/mtbnews/android/ForumActivity.java b/src/de/mtbnews/android/ForumActivity.java @@ -49,6 +49,8 @@ public class ForumActivity extends ListActivity @Override protected void onCreate(Bundle savedInstanceState) { + if ( ((IBCApplication)getApplication()).ibcTheme ) + setTheme(R.style.IBC); super.onCreate(savedInstanceState); diff --git a/src/de/mtbnews/android/ForumOverviewActivity.java b/src/de/mtbnews/android/ForumOverviewActivity.java @@ -26,7 +26,6 @@ import de.mtbnews.android.adapter.ExpandableForumContentAdapter; import de.mtbnews.android.tapatalk.TapatalkClient; import de.mtbnews.android.tapatalk.TapatalkException; import de.mtbnews.android.tapatalk.wrapper.Forum; -import de.mtbnews.android.util.IBC; import de.mtbnews.android.util.ServerAsyncTask; /** @@ -41,13 +40,16 @@ public class ForumOverviewActivity extends ExpandableListActivity @Override protected void onCreate(Bundle savedInstanceState) { + if (((IBCApplication) getApplication()).ibcTheme) + setTheme(R.style.IBC); + super.onCreate(savedInstanceState); setContentView(R.layout.exp_listing); prefs = PreferenceManager.getDefaultSharedPreferences(this); - if (!((IBCApplication)getApplication()).getTapatalkClient().loggedIn + if (!((IBCApplication) getApplication()).getTapatalkClient().loggedIn && prefs.getBoolean("auto_login", false)) login(); @@ -56,7 +58,7 @@ public class ForumOverviewActivity extends ExpandableListActivity private void login() { - final TapatalkClient client = ((IBCApplication)getApplication()).client; + final TapatalkClient client = ((IBCApplication) getApplication()).client; new ServerAsyncTask(this, R.string.waitingfor_login) { @@ -121,7 +123,8 @@ public class ForumOverviewActivity extends ExpandableListActivity private void loadForum() { - final TapatalkClient client = ((IBCApplication)getApplication()).getTapatalkClient(); + final TapatalkClient client = ((IBCApplication) getApplication()) + .getTapatalkClient(); new ServerAsyncTask(this, R.string.waitingfor_forum) { @@ -210,7 +213,8 @@ public class ForumOverviewActivity extends ExpandableListActivity super.onCreateOptionsMenu(menu); MenuInflater mi = new MenuInflater(getApplication()); - TapatalkClient client = ((IBCApplication)getApplication()).getTapatalkClient(); + TapatalkClient client = ((IBCApplication) getApplication()) + .getTapatalkClient(); if (client.loggedIn) mi.inflate(R.menu.forum, menu); @@ -291,7 +295,7 @@ public class ForumOverviewActivity extends ExpandableListActivity private void logout() { - final TapatalkClient client = ((IBCApplication)getApplication()).client; + final TapatalkClient client = ((IBCApplication) getApplication()).client; new ServerAsyncTask(this, R.string.waitingfor_logout) { diff --git a/src/de/mtbnews/android/IBCActivity.java b/src/de/mtbnews/android/IBCActivity.java @@ -27,10 +27,8 @@ import org.mcsoxford.rss.RSSReaderException; import android.app.ListActivity; import android.content.Intent; -import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; -import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -41,7 +39,7 @@ import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; -import de.mtbnews.android.adapter.RSSContentAdapter; +import de.mtbnews.android.adapter.ListEntryContentAdapter; import de.mtbnews.android.util.IBC; import de.mtbnews.android.util.ServerAsyncTask; @@ -54,12 +52,12 @@ public class IBCActivity extends ListActivity @Override public void onCreate(Bundle savedInstanceState) { + if ( ((IBCApplication)getApplication()).ibcTheme ) + setTheme(R.style.IBC); + super.onCreate(savedInstanceState); setContentView(R.layout.start); - SharedPreferences globalPrefs = PreferenceManager - .getDefaultSharedPreferences(this); - // Gast-Zugang ist ok, daher keine Meldung anzeigen... // if (globalPrefs.getString("username", "").equals("") ) // { @@ -101,7 +99,7 @@ public class IBCActivity extends ListActivity */ private void reloadFeed() { - if (((IBCApplication)getApplication()).newsFeed != null) + if (((IBCApplication) getApplication()).newsFeed != null) { // Nicht nochmal laden. // TODO: Reload-Funktion. @@ -120,7 +118,7 @@ public class IBCActivity extends ListActivity try { feed = reader.load(IBC.IBC_NEWS_RSS_URL); - ((IBCApplication)getApplication()).newsFeed = feed; + ((IBCApplication) getApplication()).newsFeed = feed; } catch (RSSReaderException e) { @@ -130,9 +128,10 @@ public class IBCActivity extends ListActivity protected void doOnSuccess() { - ListAdapter adapter = new RSSContentAdapter(IBCActivity.this, - feed); IBCActivity.this.setTitle(feed.getTitle()); + + ListAdapter adapter = new ListEntryContentAdapter( + IBCActivity.this, this.feed.getItems()); setListAdapter(adapter); } }.execute(); diff --git a/src/de/mtbnews/android/IBCApplication.java b/src/de/mtbnews/android/IBCApplication.java @@ -6,6 +6,8 @@ package de.mtbnews.android; import org.mcsoxford.rss.RSSFeed; import android.app.Application; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; import de.mtbnews.android.tapatalk.TapatalkClient; import de.mtbnews.android.util.IBC; @@ -24,6 +26,9 @@ public class IBCApplication extends Application public TapatalkClient client; + public SharedPreferences prefs; + public boolean ibcTheme; + public TapatalkClient getTapatalkClient() { return client; @@ -38,6 +43,8 @@ public class IBCApplication extends Application public void onCreate() { client = new TapatalkClient(IBC.IBC_FORUM_CONNECTOR_URL); + prefs = PreferenceManager.getDefaultSharedPreferences(this); + ibcTheme = prefs.getBoolean("ibc_theme",false); super.onCreate(); } diff --git a/src/de/mtbnews/android/MailboxActivity.java b/src/de/mtbnews/android/MailboxActivity.java @@ -24,6 +24,9 @@ public class MailboxActivity extends ListActivity @Override protected void onCreate(Bundle savedInstanceState) { + if (((IBCApplication) getApplication()).ibcTheme) + setTheme(R.style.IBC); + setContentView(R.layout.listing); super.onCreate(savedInstanceState); @@ -41,7 +44,8 @@ public class MailboxActivity extends ListActivity try { - Object l = ((IBCApplication)getApplication()).client.getXMLRPCClient().call("get_box_info"); + Object l = ((IBCApplication) getApplication()).client + .getXMLRPCClient().call("get_box_info"); this.forumList = (Object[]) ((Map) l).get("list"); @@ -59,8 +63,8 @@ public class MailboxActivity extends ListActivity { list1.add((Map) o); } - ListAdapter adapter = new MapContentAdapter(MailboxActivity.this, - list1, null, "box_name", null); + ListAdapter adapter = new MapContentAdapter( + MailboxActivity.this, list1, null, "box_name", null); // IBCActivity.this.setTitle(feed.getTitle()); setListAdapter(adapter); @@ -76,7 +80,6 @@ public class MailboxActivity extends ListActivity public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - // final Intent intent = new Intent(ForumActivity.this, // NewsDetailActivity.class); @@ -95,7 +98,7 @@ public class MailboxActivity extends ListActivity int position, long id) { RSSItem item = (RSSItem) getListAdapter().getItem(position); - + Intent i = new Intent(Intent.ACTION_VIEW); i.setData(item.getLink()); startActivity(i); diff --git a/src/de/mtbnews/android/SearchActivity.java b/src/de/mtbnews/android/SearchActivity.java @@ -53,6 +53,9 @@ public class SearchActivity extends ListActivity @Override protected void onCreate(Bundle savedInstanceState) { + if ( ((IBCApplication)getApplication()).ibcTheme ) + setTheme(R.style.IBC); + final SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(this); diff --git a/src/de/mtbnews/android/TopicActivity.java b/src/de/mtbnews/android/TopicActivity.java @@ -33,6 +33,9 @@ public class TopicActivity extends EndlessListActivity<Post> @Override protected void onCreate(Bundle savedInstanceState) { + if (((IBCApplication) getApplication()).ibcTheme) + setTheme(R.style.IBC); + super.onCreate(savedInstanceState); setContentView(R.layout.listing); @@ -63,7 +66,6 @@ public class TopicActivity extends EndlessListActivity<Post> }); } - @Override protected int getTotalSize() { @@ -85,7 +87,7 @@ public class TopicActivity extends EndlessListActivity<Post> @Override protected void callServer() throws IOException { - TapatalkClient client = ((IBCApplication)getApplication()).client; + TapatalkClient client = ((IBCApplication) getApplication()).client; try { diff --git a/src/de/mtbnews/android/adapter/ListEntryContentAdapter.java b/src/de/mtbnews/android/adapter/ListEntryContentAdapter.java @@ -90,6 +90,8 @@ public class ListEntryContentAdapter extends BaseAdapter viewHolder.datum = (TextView) convertView .findViewById(R.id.item_date); viewHolder.name = (TextView) convertView + .findViewById(R.id.item_name); + viewHolder.title = (TextView) convertView .findViewById(R.id.item_title); viewHolder.desc = (TextView) convertView .findViewById(R.id.item_description); @@ -110,13 +112,18 @@ public class ListEntryContentAdapter extends BaseAdapter viewHolder.datum.setEnabled(false); if (e.getTitle() != null) - viewHolder.name.setText(e.getTitle()); + viewHolder.title.setText(e.getTitle()); + else + viewHolder.title.setEnabled(false); + + if (e.getName() != null) + viewHolder.name.setText(e.getName()); else viewHolder.name.setEnabled(false); if (e.getContent() != null) { - //if ( prefs parse_bbcode ) {} + // if ( prefs parse_bbcode ) {} // TextProcessor create = BBProcessorFactory.getInstance().create(); // CharSequence html = create.process("[b]..."); // Html.fromHtml(html); @@ -131,6 +138,7 @@ public class ListEntryContentAdapter extends BaseAdapter static class ViewHolder { TextView datum; + TextView title; TextView name; TextView desc; } diff --git a/src/de/mtbnews/android/tapatalk/TapatalkClient.java b/src/de/mtbnews/android/tapatalk/TapatalkClient.java @@ -99,14 +99,14 @@ public class TapatalkClient int postCount = toInt(map.get("total_post_num")); List<Post> posts = new ArrayList<Post>(); - Topic topic = new Topic(id, posts, title, null, null, postCount); + Topic topic = new Topic(id, posts, title, null, null,null, postCount); for (Object o1 : (Object[]) map.get("posts")) { Map postMap = (Map) o1; Post post = new Post((Date) postMap.get("post_time"), new String((byte[]) postMap.get("post_title")), - new String((byte[]) postMap.get("post_content"))); + new String((byte[]) postMap.get("post_content")),new String((byte[]) postMap.get("post_author_name"))); posts.add(post); } @@ -170,7 +170,7 @@ public class TapatalkClient byteArrayToString(topicMap.get("topic_title")),// (Date) topicMap.get("last_reply_time"), // new String((byte[]) topicMap.get("short_content")),// - 0); + new String((byte[]) topicMap.get("topic_author_name")), 0); topics.add(topic); } @@ -211,7 +211,7 @@ public class TapatalkClient byteArrayToString(topicMap.get("topic_title")),// (Date) topicMap.get("post_time"), // new String((byte[]) topicMap.get("short_content")),// - 0); + new String((byte[]) topicMap.get("post_author_name")), 0); topics.add(topic); } @@ -247,7 +247,7 @@ public class TapatalkClient byteArrayToString(topicMap.get("topic_title")),// (Date) topicMap.get("post_time"), // new String((byte[]) topicMap.get("short_content")),// - 0); + "", 0); topics.add(topic); } @@ -288,7 +288,7 @@ public class TapatalkClient byteArrayToString(topicMap.get("topic_title")),// (Date) topicMap.get("post_time"), // new String((byte[]) topicMap.get("short_content")),// - 0); + "", 0); topics.add(topic); } diff --git a/src/de/mtbnews/android/tapatalk/wrapper/Forum.java b/src/de/mtbnews/android/tapatalk/wrapper/Forum.java @@ -78,4 +78,15 @@ public class Forum implements ListEntry return topics; } + + /** + * Forum hat keinen Namen + * @see de.mtbnews.android.tapatalk.wrapper.ListEntry#getName() + */ + @Override + public String getName() + { + return null; + } + } diff --git a/src/de/mtbnews/android/tapatalk/wrapper/ListEntry.java b/src/de/mtbnews/android/tapatalk/wrapper/ListEntry.java @@ -10,4 +10,6 @@ public interface ListEntry String getContent(); Date getDate(); + + String getName(); } diff --git a/src/de/mtbnews/android/tapatalk/wrapper/Post.java b/src/de/mtbnews/android/tapatalk/wrapper/Post.java @@ -8,17 +8,22 @@ public class Post implements ListEntry private Date time; private String title; private String content; + private String name; + /** + * @param time * @param title * @param content + * @param name */ - public Post(Date time, String title, String content) + public Post(Date time, String title, String content, String name) { super(); this.time = time; this.title = title; this.content = content; + this.name = name; } /** @@ -43,4 +48,13 @@ public class Post implements ListEntry return time; } + /** + * @return the name + */ + public String getName() + { + return name; + } + + } diff --git a/src/de/mtbnews/android/tapatalk/wrapper/Topic.java b/src/de/mtbnews/android/tapatalk/wrapper/Topic.java @@ -13,6 +13,7 @@ public class Topic implements ListEntry private String title; private Date date; private String content; + private String name; private int postCount; /** @@ -21,10 +22,11 @@ public class Topic implements ListEntry * @param title * @param date * @param content + * @param name * @param postCount */ public Topic(String id, List<Post> posts, String title, Date date, - String content, int postCount) + String content, String name, int postCount) { super(); this.id = id; @@ -32,6 +34,7 @@ public class Topic implements ListEntry this.title = title; this.date = date; this.content = content; + this.name = name; this.postCount = postCount; } @@ -83,4 +86,12 @@ public class Topic implements ListEntry return posts; } + /** + * @return the name + */ + public String getName() + { + return name; + } + } diff --git a/src/org/mcsoxford/rss/RSSBase.java b/src/org/mcsoxford/rss/RSSBase.java @@ -19,114 +19,152 @@ package org.mcsoxford.rss; import java.io.Serializable; import java.util.ArrayList; +import de.mtbnews.android.tapatalk.wrapper.ListEntry; + /** * Common data about RSS feeds and items. * * @author Mr Horn */ -abstract class RSSBase implements Serializable { - - private String title; - private android.net.Uri link; - private String description; - private java.util.List<String> categories; - private java.util.Date pubdate; - - /** - * Specify initial capacity for the List which contains the category names. - */ - RSSBase(byte categoryCapacity) { - categories = categoryCapacity == 0 ? null : new ArrayList<String>( - categoryCapacity); - } - - public String getTitle() { - return title; - } - - public String getDescription() { - return description; - } - - public android.net.Uri getLink() { - return link; - } - - public java.util.List<String> getCategories() { - if (categories == null) { - return java.util.Collections.emptyList(); - } - - return java.util.Collections.unmodifiableList(categories); - } - - public java.util.Date getPubDate() { - return pubdate; - } - - void setTitle(String title) { - this.title = title; - } - - void setLink(android.net.Uri link) { - this.link = link; - } - - void setDescription(String description) { - this.description = description; - } - - void addCategory(String category) { - if (categories == null) { - categories = new ArrayList<String>(3); - } - - this.categories.add(category); - } - - void setPubDate(java.util.Date pubdate) { - this.pubdate = pubdate; - } - - /** - * Returns the title. - */ - public String toString() { - return title; - } - - /** - * Returns the hash code of the link. - */ - @Override - public int hashCode() { - if (link == null) { - return 0; - } - - return link.hashCode(); - } - - /** - * Compares the links for equality. - */ - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } else if (object instanceof RSSBase) { - /* other is never null */ - final RSSBase other = (RSSBase) (object); - - if (link == null) { - return other.link == null; - } - - return link.equals(other.link); - } else { - return false; - } - } - +abstract class RSSBase implements Serializable, ListEntry +{ + + private String title; + private android.net.Uri link; + private String description; + private java.util.List<String> categories; + private java.util.Date pubdate; + + /** + * Specify initial capacity for the List which contains the category names. + */ + RSSBase(byte categoryCapacity) + { + categories = categoryCapacity == 0 ? null : new ArrayList<String>( + categoryCapacity); + } + + public String getTitle() + { + return title; + } + + public String getDescription() + { + return description; + } + + public android.net.Uri getLink() + { + return link; + } + + public java.util.List<String> getCategories() + { + if (categories == null) + { + return java.util.Collections.emptyList(); + } + + return java.util.Collections.unmodifiableList(categories); + } + + public java.util.Date getPubDate() + { + return pubdate; + } + + public java.util.Date getDate() + { + return this.getPubDate(); + } + + void setTitle(String title) + { + this.title = title; + } + + void setLink(android.net.Uri link) + { + this.link = link; + } + + void setDescription(String description) + { + this.description = description; + } + + void addCategory(String category) + { + if (categories == null) + { + categories = new ArrayList<String>(3); + } + + this.categories.add(category); + } + + void setPubDate(java.util.Date pubdate) + { + this.pubdate = pubdate; + } + + /** + * Returns the title. + */ + public String toString() + { + return title; + } + + /** + * Returns the hash code of the link. + */ + @Override + public int hashCode() + { + if (link == null) + { + return 0; + } + + return link.hashCode(); + } + + /** + * Compares the links for equality. + */ + @Override + public boolean equals(Object object) + { + if (this == object) + { + return true; + } + else if (object instanceof RSSBase) + { + /* other is never null */ + final RSSBase other = (RSSBase) (object); + + if (link == null) + { + return other.link == null; + } + + return link.equals(other.link); + } + else + { + return false; + } + } + + + public String getName() { + return null; + } + + public String getContent() { + return getDescription(); + } } -