From 49f0c1c1e7e12be1a71419721b1ed554e069d514 Mon Sep 17 00:00:00 2001 From: lado Date: Tue, 19 Mar 2013 16:35:26 +0100 Subject: Feature #1297 --- .../src/de/bjusystems/vdrmanager/data/CACHE.java | 62 ---------------------- .../de/bjusystems/vdrmanager/data/EpgCache.java | 18 +++++++ .../vdrmanager/gui/BaseTimerEditActivity.java | 4 +- .../vdrmanager/gui/EventEpgListActivity.java | 18 +++---- .../vdrmanager/gui/TimerDetailsActivity.java | 5 +- 5 files changed, 33 insertions(+), 74 deletions(-) delete mode 100644 vdrmanager/src/de/bjusystems/vdrmanager/data/CACHE.java create mode 100644 vdrmanager/src/de/bjusystems/vdrmanager/data/EpgCache.java diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/CACHE.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/CACHE.java deleted file mode 100644 index bd4facd..0000000 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/CACHE.java +++ /dev/null @@ -1,62 +0,0 @@ -package de.bjusystems.vdrmanager.data; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.WeakHashMap; - -public class CACHE { - - public static WeakHashMap> CACHE = new WeakHashMap>(); - - public static WeakHashMap NEXT_REFRESH = new WeakHashMap(); - - - private static final ArrayList channelGroups = new ArrayList(); - - private static final ArrayList channelSources = new ArrayList(); - - private static LinkedHashMap> groupChannels = new LinkedHashMap>(); - - private static TreeMap> providerChannels = new TreeMap>(); - - private static TreeMap> sourceChannels = new TreeMap>(); - - private static ArrayList channels = new ArrayList(); - - private static Map idChannels = new HashMap(); - - public static Map getIdChannels() { - return idChannels; - } - - private static boolean channels_inited = false; - - public static ArrayList getChannelGroups() { - return channelGroups; - } - - public static ArrayList getChannelSources() { - return channelSources; - } - - - public static HashMap> getGroupChannels() { - return groupChannels; - } - - public static TreeMap> getProviderChannels() { - return providerChannels; - } - - public static TreeMap> getSourceChannels() { - return sourceChannels; - } - - public static ArrayList getChannels() { - return channels; - } -} diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/EpgCache.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/EpgCache.java new file mode 100644 index 0000000..c63b731 --- /dev/null +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/EpgCache.java @@ -0,0 +1,18 @@ +package de.bjusystems.vdrmanager.data; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.WeakHashMap; + +public class EpgCache { + + public static WeakHashMap> CACHE = new WeakHashMap>(); + + public static WeakHashMap NEXT_REFRESH = new WeakHashMap(); + + +} diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java index 2a3b03d..03866fe 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java @@ -10,7 +10,7 @@ import android.view.View.OnClickListener; import android.widget.AdapterView; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.Intents; -import de.bjusystems.vdrmanager.data.CACHE; +import de.bjusystems.vdrmanager.data.EpgCache; import de.bjusystems.vdrmanager.data.Event; import de.bjusystems.vdrmanager.data.EventListItem; import de.bjusystems.vdrmanager.data.Timer; @@ -191,7 +191,7 @@ public abstract class BaseTimerEditActivity extends protected void timerModified(final Timer timer) { backupViewSelection(); if(timer != null && timer.getChannelId()!=null){ - CACHE.CACHE.remove(timer.getChannelId()); + EpgCache.CACHE.remove(timer.getChannelId()); } // say(R.string.update_will_start_in); // Runnable task = new Runnable() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java index c67e4dc..689fb34 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java @@ -23,7 +23,7 @@ import android.widget.TextView; import android.widget.Toast; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.VdrManagerApp; -import de.bjusystems.vdrmanager.data.CACHE; +import de.bjusystems.vdrmanager.data.EpgCache; import de.bjusystems.vdrmanager.data.Channel; import de.bjusystems.vdrmanager.data.Epg; import de.bjusystems.vdrmanager.data.Event; @@ -198,8 +198,8 @@ public class EventEpgListActivity extends BaseTimerEditActivity implements public void clearCache() { getCache().clear(); - CACHE.CACHE.remove(currentChannel.getId()); - CACHE.NEXT_REFRESH.remove(currentChannel.getId()); + EpgCache.CACHE.remove(currentChannel.getId()); + EpgCache.NEXT_REFRESH.remove(currentChannel.getId()); } private boolean useCache() { @@ -208,13 +208,13 @@ public class EventEpgListActivity extends BaseTimerEditActivity implements return false; } - ArrayList cachedChannel = CACHE.CACHE.get(currentChannel.getId()); + ArrayList cachedChannel = EpgCache.CACHE.get(currentChannel.getId()); if (cachedChannel == null) { return false; } - Date nextForceCache = CACHE.NEXT_REFRESH.get(currentChannel.getId()); + Date nextForceCache = EpgCache.NEXT_REFRESH.get(currentChannel.getId()); if (nextForceCache == null) { return false; @@ -274,7 +274,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity implements private static final ArrayList EMPTY = new ArrayList(0); private ArrayList getCache() { - ArrayList arrayList = CACHE.CACHE.get(currentChannel.getId()); + ArrayList arrayList = EpgCache.CACHE.get(currentChannel.getId()); if (arrayList == null) { return EMPTY; } @@ -330,7 +330,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity implements Date now = new Date(); - CACHE.NEXT_REFRESH.put(currentChannel.getId(), FUTURE); + EpgCache.NEXT_REFRESH.put(currentChannel.getId(), FUTURE); Date nextForceCache = FUTURE; @@ -353,8 +353,8 @@ public class EventEpgListActivity extends BaseTimerEditActivity implements } } - CACHE.NEXT_REFRESH.put(currentChannel.getId(), nextForceCache); - CACHE.CACHE.put(currentChannel.getId(), cache); + EpgCache.NEXT_REFRESH.put(currentChannel.getId(), nextForceCache); + EpgCache.CACHE.put(currentChannel.getId(), cache); fillAdapter(); listView.setSelectionAfterHeaderView(); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java index 75ac581..45594e9 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java @@ -27,6 +27,7 @@ import android.widget.Toast; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.Intents; import de.bjusystems.vdrmanager.app.VdrManagerApp; +import de.bjusystems.vdrmanager.data.EpgCache; import de.bjusystems.vdrmanager.data.EventFormatter; import de.bjusystems.vdrmanager.data.Timer; import de.bjusystems.vdrmanager.tasks.CreateTimerTask; @@ -134,7 +135,6 @@ public class TimerDetailsActivity extends Activity implements OnClickListener, tView.saveButton.setText(R.string.timer_details_save_title); break; } - } private void updateDisplay() { @@ -152,6 +152,9 @@ public class TimerDetailsActivity extends Activity implements OnClickListener, tView.priority.setText(String.valueOf(timer.getPriority())); tView.lifecycle.setText(String.valueOf(timer.getLifetime())); tView.repeat.setText(getSelectedItems().toString(this, true)); + EpgCache.CACHE.remove(timer.getChannelId()); + EpgCache.NEXT_REFRESH.remove(timer.getChannelId()); + } protected VdrManagerApp getApp() { -- cgit v1.2.3