summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--AndroidManifest.xml7
-rw-r--r--project.properties1
-rw-r--r--res/values/ids.xml6
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/de/podfetcher/FeedlistActivity.java18
-rw-r--r--src/de/podfetcher/PodcastApp.java12
-rw-r--r--src/de/podfetcher/PodfetcherActivity.java59
8 files changed, 82 insertions, 29 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..4f78d9bdd
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "libs/GreenDroid"]
+ path = libs/GreenDroid
+ url = https://github.com/cyrilmottier/GreenDroid.git
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 429d80499..1e8141d31 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -12,16 +12,19 @@
<application
android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
+ android:label="@string/app_name"
+ android:theme="@style/Theme.GreenDroid"
+ android:name=".PodcastApp">
<activity
android:label="@string/app_name"
android:name=".PodfetcherActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
-
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity
+ android:name=".FeedlistActivity"/>
<service android:enabled="true" android:name=".DownloadService" />
<service android:enabled="true" android:name=".FeedSyncService" >
<intent-filter>
diff --git a/project.properties b/project.properties
index f049142c1..7d7aaf426 100644
--- a/project.properties
+++ b/project.properties
@@ -9,3 +9,4 @@
# Project target.
target=android-10
+android.library.reference.1=libs/GreenDroid/GreenDroid
diff --git a/res/values/ids.xml b/res/values/ids.xml
new file mode 100644
index 000000000..c0e789528
--- /dev/null
+++ b/res/values/ids.xml
@@ -0,0 +1,6 @@
+<resources>
+
+ <item type="id" name="action_bar_refresh" />
+ <item type="id" name="action_bar_add" />
+
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fcd5d2837..9f8b127f3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">Hello World, PodfetcherActivity!</string>
<string name="app_name">Podfetcher</string>
+ <string name="feeds_label">Feeds</string>
+ <string name="settings_label">Settings</string>
-</resources> \ No newline at end of file
+</resources>
diff --git a/src/de/podfetcher/FeedlistActivity.java b/src/de/podfetcher/FeedlistActivity.java
new file mode 100644
index 000000000..2b906a7ca
--- /dev/null
+++ b/src/de/podfetcher/FeedlistActivity.java
@@ -0,0 +1,18 @@
+package de.podfetcher;
+
+import greendroid.app.GDListActivity;
+import android.os.Bundle;
+import android.view.View;
+import greendroid.widget.ActionBarItem.Type;
+
+public class FeedlistActivity extends GDListActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addActionBarItem(Type.Add, R.id.action_bar_add);
+ addActionBarItem(Type.Refresh, R.id.action_bar_refresh);
+
+ }
+}
diff --git a/src/de/podfetcher/PodcastApp.java b/src/de/podfetcher/PodcastApp.java
index 59c68f6b8..94227b522 100644
--- a/src/de/podfetcher/PodcastApp.java
+++ b/src/de/podfetcher/PodcastApp.java
@@ -1,9 +1,11 @@
package de.podfetcher;
import de.podfetcher.feed.FeedManager;
+import de.podfetcher.FeedlistActivity;
import android.app.Application;
+import greendroid.app.GDApplication;
-public class PodcastApp extends Application {
+public class PodcastApp extends GDApplication {
private static PodcastApp singleton;
@@ -11,13 +13,17 @@ public class PodcastApp extends Application {
return singleton;
}
+ public Class<?> getHomeActivityClass() {
+ return PodfetcherActivity.class;
+ }
+
@Override
public void onCreate() {
super.onCreate();
singleton = this;
- FeedManager manager = FeedManager.getInstance();
- manager.loadDBData(getApplicationContext());
+ //FeedManager manager = FeedManager.getInstance();
+ //manager.loadDBData(getApplicationContext());
}
diff --git a/src/de/podfetcher/PodfetcherActivity.java b/src/de/podfetcher/PodfetcherActivity.java
index 9cb4f9cfc..199091c0c 100644
--- a/src/de/podfetcher/PodfetcherActivity.java
+++ b/src/de/podfetcher/PodfetcherActivity.java
@@ -6,36 +6,51 @@ import org.xml.sax.SAXException;
import de.podfetcher.feed.*;
import de.podfetcher.storage.DownloadRequester;
-import android.app.Activity;
+import greendroid.app.GDListActivity;
+import greendroid.widget.ItemAdapter;
+import greendroid.widget.item.TextItem;
+import greendroid.widget.item.Item;
+import greendroid.widget.ActionBar;
+import greendroid.widget.ActionBar.Type;
+import greendroid.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.ListView;
import android.os.Bundle;
+import android.content.Intent;
-public class PodfetcherActivity extends Activity {
- /** Called when the activity is first created. */
+public class PodfetcherActivity extends GDListActivity {
+
+ public PodfetcherActivity() {
+ super(ActionBar.Type.Normal);
+ }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- final DownloadRequester requester = DownloadRequester.getInstance();
- final FeedHandler handler = new FeedHandler();
- final FeedManager manager = FeedManager.getInstance();
-
- final Button button = (Button)findViewById(R.id.testbutton);
- final EditText edittext = (EditText)findViewById(R.id.textedit);
-
-
+
+
+ // Add navigation menu
+ ItemAdapter adapter = new ItemAdapter(this);
+ adapter.add(createListItem(R.string.feeds_label, FeedlistActivity.class));
+ adapter.add(new TextItem("Settings"));
+
+ setListAdapter(adapter);
+
- button.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- final String s = edittext.getText().toString();
- manager.addFeed(v.getContext(), s);
- edittext.setText("Receiving...");
-
- }
- });
-
}
+
+ private TextItem createListItem(int id, Class<?> _class) {
+ final TextItem item = new TextItem(getString(id));
+ item.setTag(_class);
+ return item;
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ final TextItem item = (TextItem) l.getAdapter().getItem(position);
+ Intent intent = new Intent(PodfetcherActivity.this, (Class<?>) item.getTag());
+ intent.putExtra(ActionBarActivity.GD_ACTION_BAR_TITLE, item.text);
+ startActivity(intent);
+ }
}