summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-02 03:10:46 +0100
committerlado <herrlado@gmail.com>2011-11-02 03:10:46 +0100
commit2e920182ba9b29288610c365289210ceb67608a0 (patch)
treee20314a25bc34edd9cd3d4cbddbedd1fb1876791
parentd46362a5998d3062ec8c4b86d7f473499a92fbdc (diff)
downloadvdr-manager-2e920182ba9b29288610c365289210ceb67608a0.tar.gz
vdr-manager-2e920182ba9b29288610c365289210ceb67608a0.tar.bz2
refactoring
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java3
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java54
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java32
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java22
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java37
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java77
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java17
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java15
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java11
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java12
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java1
12 files changed, 160 insertions, 126 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index f4633b5..b1569f4 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -35,7 +35,8 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
private Button retry;
protected SvdrpProgressDialog progress;
-
+
+ abstract protected int getWindowTitle();
abstract protected int getMainLayout();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
index f802b81..c6d3e77 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
@@ -35,8 +35,9 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
* @author lado
*
*/
-public abstract class BaseEventListActivity<T extends Event> extends BaseActivity<T, ListView> implements OnItemClickListener,
- SimpleGestureListener {
+public abstract class BaseEventListActivity<T extends Event> extends
+ BaseActivity<T, ListView> implements OnItemClickListener,
+ SimpleGestureListener {
public static final String TAG = BaseEventListActivity.class.getName();
@@ -53,14 +54,11 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
protected String highlight = null;
protected static final Date FUTURE = new Date(Long.MAX_VALUE);
-
// private static final Date BEGIN = new Date(0);
protected Channel currentChannel = null;
- abstract protected int getWindowTitle();
-
protected List<Event> results = new ArrayList<Event>();
@Override
@@ -71,14 +69,14 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
setTitle(getWindowTitle());
initFlipper();
detector = new SimpleGestureFilter(this, this);
-
+
initChannel();
}
private void initChannel() {
currentChannel = getApp().getCurrentChannel();
- //currentChannel = getIntent()
- // .getParcelableExtra(Intents.CURRENT_CHANNEL);
+ // currentChannel = getIntent()
+ // .getParcelableExtra(Intents.CURRENT_CHANNEL);
}
private boolean refreshViewOnResume = false;
@@ -151,19 +149,17 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
*/
public boolean onOptionsItemSelected(final MenuItem item) {
- Intent intent;
-
- switch (item.getItemId()) {
-// case R.id.epg_menu_search:
- // startSearchManager();
- // super.onSearchRequested();
- // break;
- case R.id.epg_menu_times:
- intent = new Intent();
- intent.setClass(this, EpgSearchTimesListActivity.class);
- startActivity(intent);
- break;
- }
+ // switch (item.getItemId()) {
+ // case R.id.epg_menu_search:
+ // startSearchManager();
+ // super.onSearchRequested();
+ // break;
+ // case R.id.epg_menu_times:
+ // intent = new Intent();
+ // /intent.setClass(this, EpgSearchTimesListActivity.class);
+ // startActivity(intent);
+ // break;
+ // }
return super.onOptionsItemSelected(item);
}
@@ -216,7 +212,8 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
if (highlight != null) {
intent.putExtra(Intents.HIGHLIGHT, highlight);
}
- startActivity(intent);
+ startActivityForResult(intent,
+ TimerDetailsActivity.REQUEST_CODE_TIMER_MODIFIED);
}
@Override
@@ -232,19 +229,18 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
// }
}
-
protected void resultReceived(Event result) {
results.add(result);
}
@Override
protected void connected() {
- if(flipper != null){
+ if (flipper != null) {
flipper.setDisplayedChild(0);
}
results.clear();
}
-
+
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
@@ -270,7 +266,6 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
dialog.dismiss();
}
-
public boolean onSearchRequested() {
InputMethodManager inputMgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
@@ -327,4 +322,11 @@ public abstract class BaseEventListActivity<T extends Event> extends BaseActivit
alert(getString(R.string.vdr_error_text, exception.getMessage()));
}
+ abstract protected boolean finishedSuccessImpl();
+
+ protected final boolean finishedSuccess() {
+ setTitle(getString(R.string.epg_window_title_count, getString(getWindowTitle()), results.size()));
+ return finishedSuccessImpl();
+ }
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
index c9aec1d..4c379c3 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
@@ -1,6 +1,5 @@
package de.bjusystems.vdrmanager.gui;
-import android.app.Activity;
import android.content.Intent;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -43,8 +42,7 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
final Intent intent = new Intent();
intent.setClass(this, TimerDetailsActivity.class);
intent.putExtra(Intents.TIMER_OP, Intents.ADD_TIMER);
- startActivityForResult(intent,
- TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT);
+ startActivityForResult(intent, TimerDetailsActivity.REQUEST_CODE_TIMER_ADD);
}
break;
case R.id.epg_item_menu_timer_modify: {
@@ -54,8 +52,7 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
final Intent intent = new Intent();
intent.setClass(this, TimerDetailsActivity.class);
intent.putExtra(Intents.TIMER_OP, Intents.EDIT_TIMER);
- startActivityForResult(intent,
- TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT);
+ startActivityForResult(intent, TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT);
break;
}
case R.id.epg_item_menu_timer_delete: {
@@ -115,7 +112,7 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
}
protected Timer getTimer(EventListItem item) {
- return item.getEpg().getTimer();
+ return item.getTimer();
}
protected void toggleTimer(Timer timer) {
@@ -130,7 +127,7 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
}
protected void deleteTimer(final Timer timer) {
- //backupViewSelection();
+ // backupViewSelection();
final DeleteTimerTask task = new DeleteTimerTask(this, timer) {
@Override
public void finished(SvdrpEvent event) {
@@ -140,24 +137,33 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
};
task.start();
}
-
- protected void timerModified(){
+
+ protected void timerModified() {
backupViewSelection();
refresh();
}
-
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != Activity.RESULT_OK) {
+ if (resultCode != RESULT_OK) {
+ return;
+ }
+ if (requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT) {
+ timerModified();
+ return;
+ }
+ if (requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_MODIFIED) {
+ timerModified();
return;
}
- if(requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT){
+
+ if (requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_ADD) {
timerModified();
+ return;
}
-// refresh();
+
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index 510e1de..b320ace 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -31,9 +31,9 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
*
* @author bju
*/
-public class ChannelListActivity extends BaseActivity<Channel, ExpandableListView>
- implements OnChildClickListener, OnGroupClickListener
-{
+public class ChannelListActivity extends
+ BaseActivity<Channel, ExpandableListView> implements
+ OnChildClickListener, OnGroupClickListener {
private static final String TAG = ChannelListActivity.class.getName();
@@ -62,7 +62,7 @@ public class ChannelListActivity extends BaseActivity<Channel, ExpandableListVie
// Attach view
setContentView(getMainLayout());
- setTitle(R.string.action_menu_channels);
+ setTitle(getWindowTitle());
initFlipper();
adapter = new ChannelAdapter(this);
@@ -156,7 +156,6 @@ public class ChannelListActivity extends BaseActivity<Channel, ExpandableListVie
}
}
-
public boolean onPrepareOptionsMenu(Menu menu) {
return super.onPrepareOptionsMenu(menu);
@@ -281,7 +280,6 @@ public class ChannelListActivity extends BaseActivity<Channel, ExpandableListVie
}
-
@Override
public boolean onSearchRequested() {
InputMethodManager inputMgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -303,7 +301,7 @@ public class ChannelListActivity extends BaseActivity<Channel, ExpandableListVie
// show details
final Intent intent = new Intent();
getApp().setCurrentChannel(channel);
- //intent.putExtra(Intents.CURRENT_CHANNEL, channel);
+ // intent.putExtra(Intents.CURRENT_CHANNEL, channel);
intent.setClass(this, EventEpgListActivity.class);
startActivity(intent);
}
@@ -336,17 +334,23 @@ public class ChannelListActivity extends BaseActivity<Channel, ExpandableListVie
protected boolean finishedSuccess() {
fillAdapter();
restoreViewSelection();
+ setTitle(getString(R.string.channels_window_title_count,getString(getWindowTitle()), ChannelClient.getChannelGroups().size(), ChannelClient.getChannels().size()));
+
return ChannelClient.getChannels().isEmpty() == false;
}
@Override
protected void resultReceived(Channel result) {
-
}
-
+
protected void cacheHit() {
fillAdapter();
restoreViewSelection();
}
+ @Override
+ protected int getWindowTitle() {
+ return R.string.action_menu_channels;
+ }
+
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
index 2e3dd4e..4886f9e 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
@@ -59,7 +59,9 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
Event cEvent;
ImageView state;
-
+
+ boolean modifed = false;
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -130,7 +132,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
String cn = event.getChannelName();
- setTitle(getString(R.string.epg_of_a_channel, cn));
+ setTitle(getString(R.string.epg_of_a_channel, cn, counter + 1, epgs.size()));
final EventFormatter formatter = new EventFormatter(event);
@@ -149,7 +151,6 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
.getChannelName());
// ((TextView) findViewById(R.id.epg_detail_date)).setText(formatter
// .getLongDate());
-
switch (event.getTimerState()) {
case Active:
@@ -496,7 +497,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
final ModifyTimerTask task = new ModifyTimerTask(this, timer) {
@Override
public void finished(SvdrpEvent event) {
-
+ modifed = true;
}
};
task.start();
@@ -509,6 +510,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
if (event == SvdrpEvent.FINISHED_SUCCESS) {
setState((ImageView) findViewById(R.id.epg_timer_state),
R.drawable.timer_none);
+ modifed = true;
}
}
};
@@ -517,14 +519,31 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if(resultCode != RESULT_OK){
+ if (resultCode != RESULT_OK) {
return;
}
- if(requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_ADD){
- setState(state, Utils.isLive(getApp().getCurrentEvent()) ? R.drawable.timer_recording : R.drawable.timer_active);
- } else if( requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT){
- //??
+ if (requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_ADD) {
+ modifed = true;
+ setState(
+ state,
+ Utils.isLive(getApp().getCurrentEvent()) ? R.drawable.timer_recording
+ : R.drawable.timer_active);
+ } else if (requestCode == TimerDetailsActivity.REQUEST_CODE_TIMER_EDIT) {
+ modifed = true;
+ // ??
}
}
+
+ @Override
+ public void onBackPressed() {
+ if (modifed) {
+ setResult(RESULT_OK);
+ finish();
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
index b79e084..0410007 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -92,7 +92,6 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
sp.setTitle(highlight);
setTitle(getString(R.string.epg_by_search_param, highlight));
epgClient = new EpgClient(sp);
- epgClient.setResultInfoEnabled(true);
// remove old listeners
// epgClient.clearSvdrpListener();
@@ -119,7 +118,7 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
* @see de.bjusystems.vdrmanager.gui.BaseEpgListActivity#finishedSuccess()
*/
@Override
- protected boolean finishedSuccess() {
+ protected boolean finishedSuccessImpl() {
adapter.clear();
adapter.highlight = this.highlight;
@@ -144,7 +143,7 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
protected void prepareTimer(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
- app.setCurrentEvent(item.getEpg());
+ app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(results);
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index 7841f20..cb936bd 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -2,10 +2,7 @@ package de.bjusystems.vdrmanager.gui;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.Date;
-import java.util.List;
import android.content.Intent;
import android.os.Bundle;
@@ -64,6 +61,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
channelSpinner = (Spinner) findViewById(R.id.epg_list_channel_spinner);
channelSpinner.setAdapter(channelSpinnerAdapter);
+ channelSpinner.setOnItemSelectedListener(this);
switcher = findViewById(R.id.switch_epg_view);
switcher.setOnClickListener(this);
@@ -90,6 +88,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
// register EPG item click
listView.setOnItemClickListener(this);
+ startEpgQuery();
}
// private void ensureChannelList() {
@@ -102,9 +101,9 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
@Override
protected void onResume() {
super.onResume();
- backupViewSelection();
- startEpgQuery();
- channelSpinner.setOnItemSelectedListener(this);
+ //backupViewSelection();
+ //startEpgQuery();
+ //
}
public void onItemSelected(final AdapterView<?> parent, final View view,
@@ -113,7 +112,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
// get spinner value
final Channel channel = (Channel) channelSpinner.getSelectedItem();
currentChannel = channel;
- getApp().setCurrentChannel(currentChannel);
+ setCurrent(channel);
// setAsCurrent(channel);
// update search
startEpgQuery();
@@ -152,11 +151,11 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
cachedChannel = null;
}
- private boolean useCache(Channel channel) {
- if (cachedChannel == null) {
+ private boolean useCache() {
+ if (cachedChannel == null || currentChannel == null) {
return false;
}
- if (channel.getNumber() != cachedChannel.getNumber()) {
+ if (currentChannel.getNumber() != cachedChannel.getNumber()) {
return false;
}
if (nextForceCache == null) {
@@ -171,11 +170,11 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
//
- private void startEpgQuery(boolean force) {
- startEpgQuery(currentChannel, force);
- }
+ //private void startEpgQuery(boolean force) {
+ //startEpgQuery(force);
+ //}
- private void startEpgQuery() {
+ synchronized private void startEpgQuery() {
startEpgQuery(false);
}
@@ -192,7 +191,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
- private void startEpgQuery(Channel channel, boolean force) {
+ private void startEpgQuery(boolean force) {
try {
ChannelClient client = new ChannelClient();
client.addSvdrpListener(new SvdrpListener<Channel>() {
@@ -211,13 +210,23 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
client.run();
} catch (SvdrpException ex) {
svdrpException(ex);
+ return;
}
- startEpgQueryImpl(channel, force);
+ if(currentChannel == null && ChannelClient.getChannels().isEmpty() == false){
+ currentChannel = ChannelClient.getChannels().get(0);
+ setCurrent(currentChannel);
+ }
+
+ if(currentChannel != null){
+ startEpgQueryImpl(force);
+ }
+
+
}
- private void startEpgQueryImpl(Channel channel, boolean force) {
+ synchronized private void startEpgQueryImpl(boolean force) {
- if (useCache(channel) && !force) {
+ if (useCache() && !force) {
Calendar cal = Calendar.getInstance();
int day = -1;
for (Event i : CACHE) {
@@ -241,8 +250,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
clearCache();
- epgClient = new EpgClient(channel);
- epgClient.setResultInfoEnabled(true);
+ epgClient = new EpgClient(currentChannel);
// remove old listeners
// epgClient.clearSvdrpListener();
@@ -268,7 +276,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
* @see de.bjusystems.vdrmanager.gui.BaseEpgListActivity#finishedSuccess()
*/
@Override
- protected boolean finishedSuccess() {
+ synchronized protected boolean finishedSuccessImpl() {
adapter.clear();
CACHE.clear();
Date now = new Date();
@@ -291,14 +299,12 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
cachedChannel = currentChannel;
- // listView.setSelectionAfterHeaderView();
- dismiss(progress);
- return CACHE.isEmpty() == false;
+ return results.isEmpty() == false;
}
protected void prepareTimer(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
- app.setCurrentEvent(item.getEpg());
+ app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(CACHE);
}
@@ -309,7 +315,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
@Override
protected void refresh() {
- startEpgQuery(currentChannel, true);
+ startEpgQuery(true);
}
@Override
@@ -353,20 +359,9 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
- protected void sortItemsByChannel(List<Event> result) {
- final Comparator<Event> comparator = new Comparator<Event>() {
-
- public int compare(final Event item1, final Event item2) {
- return Integer.valueOf(item1.getChannelNumber()).compareTo(
- Integer.valueOf(item2.getChannelNumber()));
- }
- };
- Collections.sort(result, comparator);
- }
-
- @Override
- protected void timerModified() {
- cachedChannel = null;
- }
+// @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 c38a20d..06272fd 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
@@ -12,6 +12,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.EventFormatter;
import de.bjusystems.vdrmanager.data.EventListItem;
import de.bjusystems.vdrmanager.data.Recording;
@@ -50,7 +51,8 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
listView.setOnItemClickListener(this);
// context menu wanted
registerForContextMenu(listView);
-
+ listView.setFastScrollEnabled(true);
+ listView.setTextFilterEnabled(true);
// start query
startRecordingQuery();
}
@@ -62,7 +64,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
@Override
protected void prepareTimer(EventListItem event) {
- getApp().setCurrentEvent(event);
+ getApp().setCurrentEvent(event.getEvent());
getApp().setCurrentEpgList(results);
}
@@ -90,13 +92,14 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item
.getMenuInfo();
final EventListItem event = adapter.getItem(info.position);
- Recording rec = event.getRecording();
+ Recording rec = (Recording) event.getEvent();
switch (item.getItemId()) {
case R.id.recording_item_menu_delete: {
DeleteRecordingTask drt = new DeleteRecordingTask(this, rec) {
@Override
public void finished(SvdrpEvent event) {
dismiss(progress);
+ backupViewSelection();
refresh();
}
};
@@ -161,12 +164,12 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
}
@Override
- protected boolean finishedSuccess() {
+ protected boolean finishedSuccessImpl() {
adapter.clear();
Calendar cal = Calendar.getInstance();
int day = -1;
- for (final Recording rec : recordingClient.getResults()) {
- results.add(rec);
+ sortItemsByTime(results);
+ for (final Event rec : results) {
cal.setTime(rec.getStart());
int eday = cal.get(Calendar.DAY_OF_YEAR);
if (eday != day) {
@@ -174,7 +177,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
adapter.add(new EventListItem(new DateFormatter(cal)
.getDailyHeader()));
}
- adapter.add(new EventListItem(rec));
+ adapter.add(new EventListItem((Recording)rec));
}
// adapter.sortItems();
return results.isEmpty() == false;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
index 6a12b0d..2d32dc5 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
@@ -230,7 +230,6 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
clearCache();
epgClient = new EpgClient(time);
- epgClient.setResultInfoEnabled(true);
// remove old listeners
// epgClient.clearSvdrpListener();
@@ -250,7 +249,7 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
@Override
- protected boolean finishedSuccess() {
+ protected boolean finishedSuccessImpl() {
// get spinner value
final EpgSearchTimeValue selection = (EpgSearchTimeValue) timeSpinner
.getSelectedItem();
@@ -260,10 +259,13 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
cachedTime = selection.getValue();
Date now = new Date();
sortItemsByChannel(results);
- if (results.isEmpty() == false) {
- adapter.add(new EventListItem(new DateFormatter(results.get(0)
- .getStart()).getDailyHeader()));
+ if (results.isEmpty()) {
+ return false;
}
+
+ adapter.add(new EventListItem(new DateFormatter(results.get(0)
+ .getStart()).getDailyHeader()));
+
for (Event e : results) {
CACHE.add(e);
adapter.add(new EventListItem((Epg) e));
@@ -272,7 +274,6 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
listView.setSelectionAfterHeaderView();
- dismiss(progress);
return CACHE.isEmpty() == false;
}
@@ -281,7 +282,7 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
final VdrManagerApp app = (VdrManagerApp) getApplication();
// remember event for details view and timer things
- app.setCurrentEvent(item.getEpg());
+ app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(CACHE);
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
index 696da9e..448c490 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
@@ -30,10 +30,13 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
public class TimerDetailsActivity extends Activity implements OnClickListener,
OnDateSetListener, OnTimeSetListener {
- public static final int REQUEST_CODE_TIMER_EDIT = 84;
-
- public static final int REQUEST_CODE_TIMER_ADD = 85;
+ public static final int REQUEST_CODE_TIMER_MODIFIED = 34;
+
+ public static final int REQUEST_CODE_TIMER_EDIT = 35;
+
+ public static final int REQUEST_CODE_TIMER_ADD = 36;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -167,7 +170,7 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
break;
}
case R.id.timer_details_cancel: {
- finishActivity(REQUEST_CODE_TIMER_EDIT);
+// finishActivity(REQUEST_CODE_TIMER_EDIT);
finish();
break;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
index 8d8d3a3..04732c4 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
@@ -7,6 +7,7 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.VdrManagerApp;
+import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.EventListItem;
import de.bjusystems.vdrmanager.data.Timer;
import de.bjusystems.vdrmanager.utils.date.DateFormatter;
@@ -86,19 +87,20 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
@Override
protected Timer getTimer(EventListItem item) {
- return item.getTimer();
+ return (Timer)item.getEvent();
}
protected void prepareTimer(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
// remember event for details view and timer things
- app.setCurrentEvent(item.getTimer());
+ app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(results);
}
- protected boolean finishedSuccess() {
+ protected boolean finishedSuccessImpl() {
adapter.clear();
- for(Timer e : timerClient.getResults()){
- results.add(e);
+ sortItemsByTime(results);
+ for(Event e : results) {
+ //results.add(e);
Calendar cal = Calendar.getInstance();
int day = -1;
cal.setTime(e.getStart());
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java
index 3d1e73f..90e5358 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java
@@ -1,6 +1,5 @@
package de.bjusystems.vdrmanager.utils.svdrp;
-import android.text.TextUtils;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Epg;