diff --git a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java index beea75f57cd9..b55c3c45d799 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java @@ -7,7 +7,6 @@ import android.content.Context; import android.database.Cursor; import android.os.Bundle; -import android.support.v4.app.FragmentManager; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.support.v7.widget.LinearLayoutManager; @@ -17,15 +16,11 @@ import android.widget.FrameLayout; import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.R; -import org.mozilla.gecko.animation.PropertyAnimator; -import org.mozilla.gecko.home.HomeBanner; -import org.mozilla.gecko.home.HomeFragment; -import org.mozilla.gecko.home.HomeScreen; import org.mozilla.gecko.home.SimpleCursorLoader; import org.mozilla.gecko.home.activitystream.topsites.TopSitesPagerAdapter; public class ActivityStream extends FrameLayout { - private StreamRecyclerAdapter adapter; + private final StreamRecyclerAdapter adapter; private static final int LOADER_ID_HIGHLIGHTS = 0; private static final int LOADER_ID_TOPSITES = 1; @@ -34,20 +29,19 @@ public class ActivityStream extends FrameLayout { super(context, attrs); inflate(context, R.layout.as_content, this); - } - public void load(LoaderManager lm) { - // Signal to load data from storage as needed, compare with HomePager + adapter = new StreamRecyclerAdapter(); + RecyclerView rv = (RecyclerView) findViewById(R.id.activity_stream_main_recyclerview); - // TODO: we need to retrieve BrowserApp and pass it in as onUrlOpenListener. That will - // be simpler once we're a HomeFragment, but isn't so simple while we're still a View. - adapter = new StreamRecyclerAdapter(lm, null); rv.setAdapter(adapter); rv.setLayoutManager(new LinearLayoutManager(getContext())); rv.setHasFixedSize(true); + } + public void load(LoaderManager lm) { CursorLoaderCallbacks callbacks = new CursorLoaderCallbacks(); + lm.initLoader(LOADER_ID_HIGHLIGHTS, null, callbacks); lm.initLoader(LOADER_ID_TOPSITES, null, callbacks); } @@ -55,7 +49,6 @@ public class ActivityStream extends FrameLayout { public void unload() { adapter.swapHighlightsCursor(null); adapter.swapTopSitesCursor(null); - // Signal to clear data that has been loaded, compare with HomePager } /** diff --git a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java index 896497a44d6d..8003b08efaf2 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java @@ -22,11 +22,9 @@ public class StreamRecyclerAdapter extends RecyclerView.Adapter { private Cursor highlightsCursor; private Cursor topSitesCursor; - private final WeakReference loaderManagerWeakReference; private final HomePager.OnUrlOpenListener onUrlOpenListener; - StreamRecyclerAdapter(LoaderManager lm, HomePager.OnUrlOpenListener onUrlOpenListener) { - loaderManagerWeakReference = new WeakReference<>(lm); + StreamRecyclerAdapter(HomePager.OnUrlOpenListener onUrlOpenListener) { this.onUrlOpenListener = onUrlOpenListener; } diff --git a/mobile/android/base/resources/layout/activity_stream.xml b/mobile/android/base/resources/layout/activity_stream.xml index 76c34e2a59fb..b40c01cdeefa 100644 --- a/mobile/android/base/resources/layout/activity_stream.xml +++ b/mobile/android/base/resources/layout/activity_stream.xml @@ -3,10 +3,4 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#FAFAFA"> - - - + android:background="#FAFAFA"/> diff --git a/mobile/android/base/resources/layout/as_content.xml b/mobile/android/base/resources/layout/as_content.xml index 64b19deb0f97..e3d716d130b4 100644 --- a/mobile/android/base/resources/layout/as_content.xml +++ b/mobile/android/base/resources/layout/as_content.xml @@ -2,4 +2,8 @@ + \ No newline at end of file