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

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

Added PeersActivity; moved peers link to nav drawer for now

parent 7768c624
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,10 @@
android:label="I2P License Information"
android:parentActivityName=".activity.HelpActivity" >
</activity>
<activity android:name=".activity.PeersActivity"
android:label="Peers Information"
android:parentActivityName=".activity.MainActivity" >
</activity>
<activity android:name=".activity.WebActivity"
android:label="I2P Web Browser"
android:configChanges="orientation|keyboardHidden" >
......
......@@ -59,20 +59,6 @@
android:drawableLeft="@drawable/stop_router_icon" />
-->
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_tools"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/peers_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_peers_status"
android:drawableLeft="@drawable/peers_icon" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
......
......@@ -6,6 +6,7 @@
<item>@string/label_i2ptunnel</item>
<item>@string/label_logs</item>
<item>@string/label_error_logs</item>
<item>@string/label_peers_status</item>
</string-array>
<string-array name="setting0to3">
<item>0</item>
......
......@@ -73,6 +73,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
{
Util.i(this + " onCreate called");
super.onCreate(savedInstanceState);
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
_myDir = getFilesDir().getAbsolutePath();
// If the Activity can make use of two panes (if available),
......@@ -146,6 +147,10 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
err.putExtra(LogActivity.ERRORS_ONLY, true);
startActivity(err);
break;
case 5:
Intent peers = new Intent(I2PActivityBase.this, PeersActivity.class);
startActivity(peers);
break;
default:
Intent main = new Intent(I2PActivityBase.this, MainActivity.class);
startActivity(main);
......@@ -166,7 +171,6 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
{
Util.i(this + " onStart called");
super.onStart();
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START))
startRouter();
else
......
package net.i2p.android.router.activity;
import net.i2p.android.router.R;
import net.i2p.android.router.fragment.PeersFragment;
import net.i2p.android.router.service.RouterService;
import android.os.Bundle;
public class PeersActivity extends I2PActivityBase {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDrawerToggle.setDrawerIndicatorEnabled(false);
// Start with the base view
if (savedInstanceState == null) {
PeersFragment f = new PeersFragment();
f.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction()
.add(R.id.main_fragment, f).commit();
}
}
/**
* Not bound by the time onResume() is called, so we have to do it here.
* If it is bound we update twice.
*/
@Override
protected void onRouterBind(RouterService svc) {
PeersFragment f = (PeersFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);
f.update();
}
}
......@@ -140,18 +140,6 @@ public class MainFragment extends I2PFragmentBase {
}
});
b = (Button) v.findViewById(R.id.peers_button);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.main_fragment, new PeersFragment())
.addToBackStack(null)
.commit();
}
});
/*
* hidden, unused b = (Button) v.findViewById(R.id.router_stop_button);
* b.setOnClickListener(new View.OnClickListener() { public void
......
......@@ -9,7 +9,6 @@ import android.webkit.WebView;
import java.io.IOException;
import java.io.StringWriter;
import net.i2p.android.router.R;
import net.i2p.android.router.service.RouterService;
import net.i2p.router.CommSystemFacade;
public class PeersFragment extends I2PFragmentBase {
......@@ -41,16 +40,7 @@ public class PeersFragment extends I2PFragmentBase {
update();
}
/**
* Not bound by the time onResume() is called, so we have to do it here.
* If it is bound we update twice.
*/
@Override
protected void onRouterBind(RouterService svc) {
update();
}
private void update() {
public void update() {
WebView wv = (WebView) getActivity().findViewById(R.id.peers_webview);
wv.clearHistory(); // fixes having to hit back.
CommSystemFacade comm = getCommSystem();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment