summaryrefslogtreecommitdiff
path: root/vdrmanager
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2013-02-25 01:12:30 +0100
committerlado <herrlado@gmail.com>2013-02-25 01:12:30 +0100
commit6ad4d12110219b25d9c7517631174e5551c053c3 (patch)
treea416362cdd3213ae42ee4f34b2775aae6115e58d /vdrmanager
parent7f29b3a3644019c68c953d205f1a5802510db6ec (diff)
downloadvdr-manager-6ad4d12110219b25d9c7517631174e5551c053c3.tar.gz
vdr-manager-6ad4d12110219b25d9c7517631174e5551c053c3.tar.bz2
Feature #1273
Diffstat (limited to 'vdrmanager')
-rw-r--r--vdrmanager/res/menu/epg_list_menu.xml13
-rw-r--r--vdrmanager/res/menu/timer_list_menu.xml7
-rw-r--r--vdrmanager/res/values/strings.xml9
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java98
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java3
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java10
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java6
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java1
12 files changed, 149 insertions, 18 deletions
diff --git a/vdrmanager/res/menu/epg_list_menu.xml b/vdrmanager/res/menu/epg_list_menu.xml
index ea31378..8d1b0ba 100644
--- a/vdrmanager/res/menu/epg_list_menu.xml
+++ b/vdrmanager/res/menu/epg_list_menu.xml
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
+<!--
<item
android:id="@+id/epg_menu_search"
android:icon="@android:drawable/ic_menu_search"
android:title="@string/epg_menu_search"/>
-->
-<!--
+<!--
<item
android:id="@+id/epg_menu_times"
android:icon="@android:drawable/ic_menu_search"
android:title="@string/epg_menu_times"/>
-->
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@drawable/ic_menu_moreoverflow"
- android:showAsAction="ifRoom"
- android:title="@string/action_menu_channels"/>
-
+
<item
android:showAsAction="ifRoom"
android:id="@+id/epg_list_sort_menu"
android:icon="@android:drawable/ic_menu_sort_alphabetically"
android:title="@string/sort"/>
-
+
</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/timer_list_menu.xml b/vdrmanager/res/menu/timer_list_menu.xml
index fa00a26..3003bea 100644
--- a/vdrmanager/res/menu/timer_list_menu.xml
+++ b/vdrmanager/res/menu/timer_list_menu.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
+<!--
<item
android:id="@+id/epg_menu_search"
android:icon="@android:drawable/ic_menu_search"
@@ -13,9 +13,4 @@
android:alphabeticShortcut="a"
android:title="@string/epg_item_menu_timer_add"/>
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@drawable/ic_menu_moreoverflow"
- android:showAsAction="ifRoom"
- android:title="@string/action_menu_channels"/>
</menu> \ No newline at end of file
diff --git a/vdrmanager/res/values/strings.xml b/vdrmanager/res/values/strings.xml
index efbc841..adaaef2 100644
--- a/vdrmanager/res/values/strings.xml
+++ b/vdrmanager/res/values/strings.xml
@@ -373,4 +373,13 @@
<item>Name</item>
</string-array>
+ <string-array name="navigation_array">
+ <item>Channels</item>
+ <item>EPG by Time</item>
+ <item>EPG by Channel</item>
+ <item>Recordings</item>
+ <item>Timers</item>
+ </string-array>
+
+
</resources> \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index 5e43e92..d4f6f32 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -1,5 +1,7 @@
package de.bjusystems.vdrmanager.gui;
+import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
+
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
@@ -7,8 +9,10 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
+import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
+import android.widget.SpinnerAdapter;
import android.widget.ViewFlipper;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.VdrManagerApp;
@@ -129,6 +133,81 @@ public abstract class BaseActivity<Result, T extends ListView> extends
// setTitle(title);
// }
+ abstract protected int getListNavigationIndex();
+
+ public static final int LIST_NAVIGATION_CHANNELS = 0;
+ public static final int LIST_NAVIGATION_EPG_BY_TIME = 1;
+ public static final int LIST_NAVIGATION_EPG_BY_CHANNEL = 2;
+ public static final int LIST_NAVIGATION_RECORDINGS = 3;
+ public static final int LIST_NAVIGATION_TIMERS = 4;
+
+ protected boolean hasListNavigation(){
+ return true;
+ }
+
+ protected void initListNavigation(){
+
+ if(hasListNavigation() == false){
+ return;
+ }
+
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+
+ getSupportActionBar().setNavigationMode(
+ getSupportActionBar().NAVIGATION_MODE_LIST);
+
+ ArrayAdapter<CharSequence> mSpinnerAdapter = ArrayAdapter
+ .createFromResource(this, R.array.navigation_array,
+ android.R.layout.simple_spinner_dropdown_item);
+
+ getSupportActionBar().setListNavigationCallbacks(mSpinnerAdapter,
+ new OnNavigationListener() {
+
+ private boolean firstHit = true;
+
+ @Override
+ public boolean onNavigationItemSelected(int itemPosition,
+ long itemId) {
+
+ if (firstHit == true) {
+ firstHit = false;
+ return false;
+ }
+ switch (itemPosition) {
+
+ case LIST_NAVIGATION_CHANNELS: {
+ startActivity(ChannelListActivity.class);
+ return true;
+ }
+ case LIST_NAVIGATION_EPG_BY_TIME: {
+ startActivity(TimeEpgListActivity.class);
+ return true;
+ }
+
+ case LIST_NAVIGATION_EPG_BY_CHANNEL: {
+ startActivity(EventEpgListActivity.class);
+ return true;
+ }
+
+ case LIST_NAVIGATION_RECORDINGS: {
+ startActivity(RecordingListActivity.class);
+ return true;
+ }
+
+ case LIST_NAVIGATION_TIMERS: {
+ startActivity(TimerListActivity.class);
+ return true;
+ }
+
+ }
+ return false;
+ }
+ });
+ getSupportActionBar().setSelectedNavigationItem(
+ getListNavigationIndex());
+
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -138,6 +217,18 @@ public abstract class BaseActivity<Result, T extends ListView> extends
initActionBar();
+ initListNavigation();
+
+ // new OnNavigationListener() {
+ // @Override
+ // public boolean onNavigationItemSelected(int itemPosition, long
+ // itemId) {
+ // System.err.println("itemPosition: "+ itemPosition +", itemId:" +
+ // itemId);
+ // rturn false;
+ // }
+ // });
+
// your logic for click listner
// setListenerForActionBarCustomView(actionBarView);
@@ -149,6 +240,13 @@ public abstract class BaseActivity<Result, T extends ListView> extends
}
+ public void startActivity(Class<?> clazz) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setClass(this, clazz);
+ startActivity(intent);
+ finish();
+ }
+
@Override
public boolean onCreateOptionsMenu(
final com.actionbarsherlock.view.Menu menu) {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
index dbc7826..a744e28 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
@@ -193,9 +193,6 @@ public abstract class BaseEventListActivity<T extends Event> extends
final com.actionbarsherlock.view.MenuItem item) {
switch (item.getItemId()) {
- case R.id.epg_list_menu_channels:
- startActivity(new Intent(this, ChannelListActivity.class));
- return true;
case R.id.epg_list_sort_menu: {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index f126baf..60134fb 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -604,4 +604,9 @@ public class ChannelListActivity extends
return channelClient;
}
+ @Override
+ protected int getListNavigationIndex() {
+ return LIST_NAVIGATION_CHANNELS;
+ }
+
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
index b9c426b..7a52e63 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -175,4 +175,14 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
return true;
}
+ @Override
+ protected int getListNavigationIndex() {
+ return -1;
+ }
+
+ @Override
+ protected boolean hasListNavigation() {
+ return false;
+ }
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index 91ef2d4..6bf93da 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -414,6 +414,11 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
+ @Override
+ protected int getListNavigationIndex() {
+ return LIST_NAVIGATION_EPG_BY_CHANNEL;
+ }
+
// @Override
// protected void timerModified() {
// cachedChannel = null;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
index 573f45f..56f91bd 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
@@ -280,4 +280,9 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
return false;
}
+ @Override
+ protected int getListNavigationIndex() {
+ return LIST_NAVIGATION_RECORDINGS;
+ }
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
index 92ab1eb..2893583 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
@@ -389,4 +389,10 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
+
+ @Override
+ protected int getListNavigationIndex() {
+ return LIST_NAVIGATION_EPG_BY_TIME;
+ }
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
index edb5325..3ba957a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
@@ -228,4 +228,9 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
return super.onCreateOptionsMenu(menu);
}
+ @Override
+ protected int getListNavigationIndex() {
+ return LIST_NAVIGATION_TIMERS;
+ }
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index fb4ea49..20730da 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -417,4 +417,5 @@ public class Utils {
DateUtils.FORMAT_SHOW_TIME).toString();
}
+
}