commit 18d17afb701d1026553a45a086808b1634688ebd
parent 4a9e29af734c48da86403dabfecff3f8c31106aa
Author: Jan Dankert <devnull@localhost>
Date: Thu, 19 Jan 2012 21:13:52 +0100
Hintergrund im IBC-gelb, News-Detailseite mit komplettem Inhalt.
Diffstat:
10 files changed, 113 insertions(+), 31 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
@@ -15,6 +15,7 @@
<activity android:name="ForumActivity" android:label="@string/forum"></activity>
<activity android:name="NewsActivity" android:label="@string/news"></activity>
+ <activity android:name="NewsDetailActivity" android:label="@string/news"></activity>
<activity android:name="PhotoActivity" android:label="@string/photos"></activity>
<service android:name=".service.UploadIntentService"></service>
diff --git a/res/drawable/ibc_small.png b/res/drawable/ibc_small.png
Binary files differ.
diff --git a/res/layout/main.xml b/res/layout/main.xml
@@ -6,18 +6,23 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
+ <ImageView android:src="@drawable/ibc_logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content">
+ </ImageView>
<TextView android:layout_width="fill_parent" android:id="@+id/hello"
android:layout_height="wrap_content" />
<Button android:id="@+id/forum" android:text="@string/forum"
android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
-
+
<Button android:id="@+id/news" android:text="@string/news"
- android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
-
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ style="@style/button"></Button>
+
<Button android:id="@+id/photo" android:text="@string/photos"
- android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
-
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ style="@style/button"></Button>
+
</LinearLayout>
</ScrollView>
\ No newline at end of file
diff --git a/res/values/ibc.xml b/res/values/ibc.xml
@@ -2,18 +2,36 @@
<resources>
<style name="IBC" parent="android:Theme">
- <item name="android:textColor">#003399</item>
+ <!--
<item name="android:colorBackground">#FFCC66</item>
-
- <item name="android:button">@style/IBCButton</item>
+ -->
+ <item name="android:background">#FFCC66</item>
+
+ <item name="android:buttonStyle">@style/button</item>
+
+ <item name="android:windowBackground">@drawable/ibc_logo</item>
</style>
- <style name="IBCButton" parent="android:style/Widget.Button">
- <item name="android:textSize">19sp</item>
+ <style name="button" parent="@android:style/Widget.Button">
+ <!--
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ -->
+ <item name="android:textSize">20sp</item>
+ <item name="android:textColor">#003399</item>
<!--
<item name="android:layout_margin">0dip</item>
-->
<item name="android:background">#E3E3E3</item>
+ </style>
+
+
+ <style name="normalText">
+ <item name="android:textSize">13sp</item>
+ <item name="android:textColor">#000000</item>
+ </style>
+ <style name="titleText">
+ <item name="android:textSize">20sp</item>
<item name="android:textColor">#003399</item>
</style>
</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
@@ -79,6 +79,7 @@
<string name="saved">Gespeichert</string>
<string name="release">Freigeben</string>
<string name="noserver">Es ist noch kein Server konfiguriert. Über die Menütaste können Sie einen neuen Server anlegen.</string>
+ <string name="www">Zur Webseite</string>
<string name="forum">Forum</string>
<string name="news">News</string>
diff --git a/src/de/mtbnews/android/NewsActivity.java b/src/de/mtbnews/android/NewsActivity.java
@@ -1,17 +1,14 @@
package de.mtbnews.android;
import java.io.IOException;
-import java.util.Map;
import org.apache.http.client.ClientProtocolException;
import org.mcsoxford.rss.RSSFeed;
-import org.mcsoxford.rss.RSSItem;
import org.mcsoxford.rss.RSSReader;
import org.mcsoxford.rss.RSSReaderException;
import android.app.ListActivity;
import android.content.Intent;
-import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
@@ -19,17 +16,12 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import de.mtbnews.android.adapter.RSSContentAdapter;
+import de.mtbnews.android.util.AppData;
import de.mtbnews.android.util.IBC;
import de.mtbnews.android.util.ServerAsyncTask;
public class NewsActivity extends ListActivity
{
- public final static String ELEMENTID = "elementid";
- public final static String OBJECTID = "objectid";
- // public final static String TYPE = "type";
- public static final String CLIENT = "client";
- private Map<String, String> properties;
-
@Override
protected void onCreate(Bundle savedInstanceState)
{
@@ -37,6 +29,15 @@ public class NewsActivity extends ListActivity
super.onCreate(savedInstanceState);
+ reloadFeed();
+
+ }
+
+ /**
+ *
+ */
+ private void reloadFeed()
+ {
new ServerAsyncTask(this, R.string.waitingforcontent)
{
@@ -49,6 +50,7 @@ public class NewsActivity extends ListActivity
try
{
feed = reader.load(IBC.IBC_NEWS_RSS_URL);
+ AppData.newsFeed = feed;
}
catch (RSSReaderException e)
{
@@ -60,7 +62,7 @@ public class NewsActivity extends ListActivity
{
ListAdapter adapter = new RSSContentAdapter(NewsActivity.this,
feed);
- NewsActivity.this.setTitle( feed.getTitle() );
+ NewsActivity.this.setTitle(feed.getTitle());
setListAdapter(adapter);
}
}.execute();
@@ -74,13 +76,11 @@ public class NewsActivity extends ListActivity
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
- RSSItem item = (RSSItem) getListAdapter().getItem(position);
-
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(item.getLink());
- startActivity(i);
+ final Intent intent = new Intent(NewsActivity.this,
+ NewsDetailActivity.class);
+ intent.putExtra("itemid", position);
+ startActivity(intent);
}
});
-
}
}
diff --git a/src/de/mtbnews/android/NewsDetailActivity.java b/src/de/mtbnews/android/NewsDetailActivity.java
@@ -0,0 +1,56 @@
+package de.mtbnews.android;
+
+import org.mcsoxford.rss.RSSItem;
+
+import de.mtbnews.android.util.AppData;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Html;
+import android.text.format.DateFormat;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class NewsDetailActivity extends Activity
+{
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ setContentView(R.layout.newsdetail);
+
+ super.onCreate(savedInstanceState);
+
+ final RSSItem item = AppData.newsFeed.getItems().get(
+ getIntent().getIntExtra("itemid", 0));
+
+ TextView datum = (TextView) findViewById(R.id.item_date);
+ datum.setText(DateFormat.getTimeFormat(this).format(item.getPubDate()));
+
+ // TextView name = (TextView) findViewById(R.id.item_title);
+ // name.setText(item.getTitle());
+
+ TextView desc = (TextView) findViewById(R.id.item_description);
+
+ // if (e.getContent() != null)
+ desc.setText(Html.fromHtml(item.getContent()));
+ setTitle(item.getTitle());
+
+ Button button = (Button) findViewById(R.id.item_button);
+ button.setOnClickListener(new OnClickListener()
+ {
+
+ @Override
+ public void onClick(View v)
+
+ {
+ Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(item.getLink());
+ startActivity(i);
+ }
+ });
+
+ }
+}
diff --git a/src/de/mtbnews/android/adapter/RSSContentAdapter.java b/src/de/mtbnews/android/adapter/RSSContentAdapter.java
@@ -80,10 +80,10 @@ public class RSSContentAdapter extends BaseAdapter
TextView desc = (TextView) view.findViewById(R.id.item_description);
- if (e.getContent() != null)
- desc.setText(Html.fromHtml(e.getContent()));
- else if (e.getDescription() != null)
+ if (e.getDescription() != null)
desc.setText(e.getDescription() + " ...");
+ else
+ desc.setText("");
return view;
}
diff --git a/src/de/mtbnews/android/service/UploadIntentService.java b/src/de/mtbnews/android/service/UploadIntentService.java
@@ -53,7 +53,7 @@ public class UploadIntentService extends IntentService
final String tickerText = getResources()
.getString(R.string.upload_long);
final Notification notification = new Notification(
- R.drawable.ibc_small, tickerText, System.currentTimeMillis());
+ R.drawable.ibc_logo, tickerText, System.currentTimeMillis());
notification.setLatestEventInfo(getApplicationContext(), getResources()
.getString(R.string.upload), file.getName(), contentIntent);
notification.flags = Notification.FLAG_ONGOING_EVENT
diff --git a/src/org/mcsoxford/rss/RSSBase.java b/src/org/mcsoxford/rss/RSSBase.java
@@ -16,6 +16,7 @@
package org.mcsoxford.rss;
+import java.io.Serializable;
import java.util.ArrayList;
/**
@@ -23,7 +24,7 @@ import java.util.ArrayList;
*
* @author Mr Horn
*/
-abstract class RSSBase {
+abstract class RSSBase implements Serializable {
private String title;
private android.net.Uri link;