aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java')
-rw-r--r--main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
new file mode 100644
index 0000000..333ef11
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
@@ -0,0 +1,32 @@
+package cgeo.geocaching.ui;
+
+import cgeo.geocaching.activity.AbstractViewPagerActivity.PageViewCreator;
+
+import android.view.View;
+
+/**
+ * View creator which destroys the created view on every {@link #notifyDataSetChanged()}.
+ *
+ * @param <ViewClass>
+ */
+public abstract class AbstractCachingPageViewCreator<ViewClass extends View> implements PageViewCreator {
+
+ public ViewClass view;
+
+ @Override
+ public final void notifyDataSetChanged() {
+ view = null;
+ }
+
+ @Override
+ public final View getView() {
+ if (view == null) {
+ view = getDispatchedView();
+ }
+
+ return view;
+ }
+
+ @Override
+ public abstract ViewClass getDispatchedView();
+}