diff options
author | lado <herrlado@gmail.com> | 2013-03-19 16:35:26 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2013-03-19 16:35:26 +0100 |
commit | 49f0c1c1e7e12be1a71419721b1ed554e069d514 (patch) | |
tree | 7c3aaff17f290dadc4b56fddd40156fa4dc748e4 | |
parent | 8a10bc5c03dca9d7034f7463fd9e972018fd067b (diff) | |
download | vdr-manager-49f0c1c1e7e12be1a71419721b1ed554e069d514.tar.gz vdr-manager-49f0c1c1e7e12be1a71419721b1ed554e069d514.tar.bz2 |
Feature #1297
5 files changed, 33 insertions, 74 deletions
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<String, ArrayList<Epg>> CACHE = new WeakHashMap<String, ArrayList<Epg>>(); - - public static WeakHashMap<String, Date> NEXT_REFRESH = new WeakHashMap<String, Date>(); - - - private static final ArrayList<String> channelGroups = new ArrayList<String>(); - - private static final ArrayList<String> channelSources = new ArrayList<String>(); - - private static LinkedHashMap<String, ArrayList<Channel>> groupChannels = new LinkedHashMap<String, ArrayList<Channel>>(); - - private static TreeMap<String, ArrayList<Channel>> providerChannels = new TreeMap<String, ArrayList<Channel>>(); - - private static TreeMap<String, ArrayList<Channel>> sourceChannels = new TreeMap<String, ArrayList<Channel>>(); - - private static ArrayList<Channel> channels = new ArrayList<Channel>(); - - private static Map<String, Channel> idChannels = new HashMap<String, Channel>(); - - public static Map<String, Channel> getIdChannels() { - return idChannels; - } - - private static boolean channels_inited = false; - - public static ArrayList<String> getChannelGroups() { - return channelGroups; - } - - public static ArrayList<String> getChannelSources() { - return channelSources; - } - - - public static HashMap<String, ArrayList<Channel>> getGroupChannels() { - return groupChannels; - } - - public static TreeMap<String, ArrayList<Channel>> getProviderChannels() { - return providerChannels; - } - - public static TreeMap<String, ArrayList<Channel>> getSourceChannels() { - return sourceChannels; - } - - public static ArrayList<Channel> 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<String, ArrayList<Epg>> CACHE = new WeakHashMap<String, ArrayList<Epg>>(); + + public static WeakHashMap<String, Date> NEXT_REFRESH = new WeakHashMap<String, Date>(); + + +} 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<T extends Event> 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<Epg> 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<Epg> implements return false; } - ArrayList<Epg> cachedChannel = CACHE.CACHE.get(currentChannel.getId()); + ArrayList<Epg> 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<Epg> implements private static final ArrayList<Epg> EMPTY = new ArrayList<Epg>(0); private ArrayList<Epg> getCache() { - ArrayList<Epg> arrayList = CACHE.CACHE.get(currentChannel.getId()); + ArrayList<Epg> arrayList = EpgCache.CACHE.get(currentChannel.getId()); if (arrayList == null) { return EMPTY; } @@ -330,7 +330,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> 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<Epg> 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() { |