I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 8b79af43 authored by str4d's avatar str4d
Browse files

Use new callbacks for NetDB

parent 2c8e9d62
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,9 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
public class NetDbListFragment extends ListFragment
implements LoaderManager.LoaderCallbacks<List<NetDbEntry>> {
public class NetDbListFragment extends ListFragment implements
I2PFragmentBase.RouterContextUser,
LoaderManager.LoaderCallbacks<List<NetDbEntry>> {
public static final String SHOW_ROUTERS = "show_routers";
private static final int ROUTER_LOADER_ID = 1;
......@@ -33,6 +34,8 @@ public class NetDbListFragment extends ListFragment
*/
private static final String STATE_ACTIVATED_POSITION = "activated_position";
private boolean mOnActivityCreated;
private boolean mOnRouterBind;
RouterContextProvider mRouterContextProvider;
OnEntrySelectedListener mEntrySelectedCallback;
private NetDbEntryAdapter mAdapter;
......@@ -104,6 +107,12 @@ public class NetDbListFragment extends ListFragment
setListAdapter(mAdapter);
mOnActivityCreated = true;
if (mOnRouterBind)
onRouterConnectionReady();
}
public void onRouterConnectionReady() {
LoaderManager lm = getLoaderManager();
// If the Router is running, or there is an existing Loader
if (getRouterContext() != null || lm.getLoader(mRouters ?
......@@ -180,6 +189,14 @@ public class NetDbListFragment extends ListFragment
return mRouterContextProvider.getRouterContext();
}
// I2PFragmentBase.RouterContextUser
public void onRouterBind() {
mOnRouterBind = true;
if (mOnActivityCreated)
onRouterConnectionReady();
}
// LoaderManager.LoaderCallbacks<List<NetDbEntry>>
public Loader<List<NetDbEntry>> onCreateLoader(int id, Bundle args) {
......
......@@ -57,9 +57,7 @@ public class NetDbSummaryPagerFragment extends I2PFragmentBase implements
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
public void onRouterConnectionReady() {
LoaderManager lm = getLoaderManager();
// If the Router is running, or there is an existing Loader
if (getRouterContext() != null || lm.getLoader(0) != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment