Material theme: toolbar

Navigation tabs have all been replaced with spinners, because there are no nice
tab libraries for API 9+.
This commit is contained in:
str4d
2014-10-29 11:47:53 +00:00
parent 895a3a1dcc
commit 092591f4ec
11 changed files with 470 additions and 365 deletions

View File

@ -1,11 +1,14 @@
package net.i2p.android.i2ptunnel; package net.i2p.android.i2ptunnel;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import net.i2p.android.router.I2PActivityBase; import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
public class TunnelListActivity extends I2PActivityBase implements public class TunnelListActivity extends I2PActivityBase implements
TunnelListFragment.OnTunnelSelectedListener, TunnelListFragment.OnTunnelSelectedListener,
@ -16,7 +19,10 @@ public class TunnelListActivity extends I2PActivityBase implements
*/ */
private boolean mTwoPane; private boolean mTwoPane;
private static final String SELECTED_TAB = "selected_tab"; private static final String SELECTED_PAGE = "selected_page";
private static final int PAGE_CLIENT = 0;
private Spinner mSpinner;
@Override @Override
protected boolean canUseTwoPanes() { protected boolean canUseTwoPanes() {
@ -27,34 +33,22 @@ public class TunnelListActivity extends I2PActivityBase implements
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Set up action bar for tabs mSpinner = (Spinner) findViewById(R.id.main_spinner);
ActionBar actionBar = getSupportActionBar(); mSpinner.setVisibility(View.VISIBLE);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Client tunnels tab mSpinner.setAdapter(ArrayAdapter.createFromResource(this,
TunnelListFragment cf = new TunnelListFragment(); R.array.i2ptunnel_pages, android.R.layout.simple_spinner_dropdown_item));
Bundle args = new Bundle();
args.putBoolean(TunnelListFragment.SHOW_CLIENT_TUNNELS, true);
cf.setArguments(args);
Tab tab = actionBar.newTab()
.setText(R.string.label_i2ptunnel_client)
.setTabListener(new TabListener(cf));
actionBar.addTab(tab);
// Server tunnels tab mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
TunnelListFragment sf = new TunnelListFragment(); @Override
args = new Bundle(); public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
args.putBoolean(TunnelListFragment.SHOW_CLIENT_TUNNELS, false); selectPage(i);
sf.setArguments(args); }
tab = actionBar.newTab()
.setText(R.string.label_i2ptunnel_server)
.setTabListener(new TabListener(sf));
actionBar.addTab(tab);
if (savedInstanceState != null) { @Override
int selected = savedInstanceState.getInt(SELECTED_TAB); public void onNothingSelected(AdapterView<?> adapterView) {
actionBar.setSelectedNavigationItem(selected); }
} });
if (findViewById(R.id.detail_fragment) != null) { if (findViewById(R.id.detail_fragment) != null) {
// The detail container view will be present only in the // The detail container view will be present only in the
@ -62,19 +56,34 @@ public class TunnelListActivity extends I2PActivityBase implements
// res/values-sw600dp). If this view is present, then the // res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode. // activity should be in two-pane mode.
mTwoPane = true; mTwoPane = true;
// In two-pane mode, list items should be given the
// 'activated' state when touched.
cf.setActivateOnItemClick(true);
sf.setActivateOnItemClick(true);
} }
if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_PAGE);
mSpinner.setSelection(selected);
} else
selectPage(PAGE_CLIENT);
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(SELECTED_TAB, outState.putInt(SELECTED_PAGE, mSpinner.getSelectedItemPosition());
getSupportActionBar().getSelectedNavigationIndex()); }
private void selectPage(int page) {
TunnelListFragment f = new TunnelListFragment();
Bundle args = new Bundle();
args.putBoolean(TunnelListFragment.SHOW_CLIENT_TUNNELS, page == PAGE_CLIENT);
f.setArguments(args);
// In two-pane mode, list items should be given the
// 'activated' state when touched.
if (mTwoPane)
f.setActivateOnItemClick(true);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f).commit();
} }
// TunnelListFragment.OnTunnelSelectedListener // TunnelListFragment.OnTunnelSelectedListener
@ -86,7 +95,7 @@ public class TunnelListActivity extends I2PActivityBase implements
// fragment transaction. // fragment transaction.
TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance(tunnelId); TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance(tunnelId);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.detail_fragment, detailFrag).commit(); .replace(R.id.detail_fragment, detailFrag).commit();
} else { } else {
// In single-pane mode, simply start the detail activity // In single-pane mode, simply start the detail activity
// for the selected item ID. // for the selected item ID.
@ -105,11 +114,11 @@ public class TunnelListActivity extends I2PActivityBase implements
TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance( TunnelDetailFragment detailFrag = TunnelDetailFragment.newInstance(
(tunnelId > 0 ? tunnelId - 1 : 0)); (tunnelId > 0 ? tunnelId - 1 : 0));
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.detail_fragment, detailFrag).commit(); .replace(R.id.detail_fragment, detailFrag).commit();
} else { } else {
TunnelDetailFragment detailFrag = (TunnelDetailFragment) getSupportFragmentManager().findFragmentById(R.id.detail_fragment); TunnelDetailFragment detailFrag = (TunnelDetailFragment) getSupportFragmentManager().findFragmentById(R.id.detail_fragment);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.remove(detailFrag).commit(); .remove(detailFrag).commit();
} }
} }
} }

View File

@ -8,7 +8,6 @@ import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
@ -16,6 +15,8 @@ import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab; import android.support.v7.app.ActionBar.Tab;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -60,13 +61,16 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
private static final String SHARED_PREFS = "net.i2p.android.router"; private static final String SHARED_PREFS = "net.i2p.android.router";
protected static final String PREF_AUTO_START = "autoStart"; protected static final String PREF_AUTO_START = "autoStart";
/** true leads to a poor install experience, very slow to paint the screen */ /**
* true leads to a poor install experience, very slow to paint the screen
*/
protected static final boolean DEFAULT_AUTO_START = false; protected static final boolean DEFAULT_AUTO_START = false;
protected static final String PREF_NAV_DRAWER_OPENED = "navDrawerOpened"; protected static final String PREF_NAV_DRAWER_OPENED = "navDrawerOpened";
/** /**
* Override this in subclasses that need a ViewPager, such as a * Override this in subclasses that need a ViewPager, such as a
* category view. * category view.
*
* @return whether this Activity needs a ViewPager. * @return whether this Activity needs a ViewPager.
*/ */
protected boolean useViewPager() { protected boolean useViewPager() {
@ -76,16 +80,18 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
/** /**
* Override this in subclasses that can use two panes, such as a * Override this in subclasses that can use two panes, such as a
* list/detail class. * list/detail class.
*
* @return whether this Activity can use a two-pane layout. * @return whether this Activity can use a two-pane layout.
*/ */
protected boolean canUseTwoPanes() { protected boolean canUseTwoPanes() {
return false; return false;
} }
/** Called when the activity is first created. */ /**
* Called when the activity is first created.
*/
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState) {
{
Util.d(this + " onCreate called"); Util.d(this + " onCreate called");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0); _sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
@ -102,6 +108,10 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
else else
setContentView(R.layout.activity_navdrawer_onepane); setContentView(R.layout.activity_navdrawer_onepane);
// Set the action bar
Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
mTitle = mDrawerTitle = getTitle(); mTitle = mDrawerTitle = getTitle();
String[] activityTitles = getResources().getStringArray(R.array.navdrawer_activity_titles); String[] activityTitles = getResources().getStringArray(R.array.navdrawer_activity_titles);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("i2pandroid.main.showStats", false)) { if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("i2pandroid.main.showStats", false)) {
@ -123,12 +133,8 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
// Set the list's click listener // Set the list's click listener
mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// Enable ActionBar app icon to behave as action to toggle nav drawer
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_menu_white_24dp, R.string.drawer_open, R.string.drawer_close) { R.string.drawer_open, R.string.drawer_close) {
private boolean wasDragged = false; private boolean wasDragged = false;
/** Called when a drawer has settled in a completely closed state. */ /** Called when a drawer has settled in a completely closed state. */
@ -167,57 +173,55 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
private void selectItem(int pos) { private void selectItem(int pos) {
switch (pos) { switch (pos) {
case 1: case 1:
Intent news = new Intent(I2PActivityBase.this, NewsActivity.class); Intent news = new Intent(I2PActivityBase.this, NewsActivity.class);
startActivity(news); startActivity(news);
break; break;
case 2: case 2:
Intent ab = new Intent(I2PActivityBase.this, AddressbookActivity.class); Intent ab = new Intent(I2PActivityBase.this, AddressbookActivity.class);
startActivity(ab); startActivity(ab);
break; break;
case 3: case 3:
Intent itb = new Intent(I2PActivityBase.this, TunnelListActivity.class); Intent itb = new Intent(I2PActivityBase.this, TunnelListActivity.class);
startActivity(itb); startActivity(itb);
break; break;
case 4: case 4:
Intent log = new Intent(I2PActivityBase.this, LogActivity.class); Intent log = new Intent(I2PActivityBase.this, LogActivity.class);
startActivity(log); startActivity(log);
break; break;
case 5: case 5:
Intent wp = new Intent(I2PActivityBase.this, WebActivity.class); Intent wp = new Intent(I2PActivityBase.this, WebActivity.class);
wp.putExtra(WebFragment.HTML_RESOURCE_ID, R.raw.welcome_html); wp.putExtra(WebFragment.HTML_RESOURCE_ID, R.raw.welcome_html);
startActivity(wp); startActivity(wp);
break; break;
case 6: case 6:
Intent active = new Intent(I2PActivityBase.this, RateGraphActivity.class); Intent active = new Intent(I2PActivityBase.this, RateGraphActivity.class);
startActivity(active); startActivity(active);
break; break;
case 7: case 7:
Intent peers = new Intent(I2PActivityBase.this, PeersActivity.class); Intent peers = new Intent(I2PActivityBase.this, PeersActivity.class);
startActivity(peers); startActivity(peers);
break; break;
case 8: case 8:
Intent netdb = new Intent(I2PActivityBase.this, NetDbActivity.class); Intent netdb = new Intent(I2PActivityBase.this, NetDbActivity.class);
startActivity(netdb); startActivity(netdb);
break; break;
default: default:
Intent main = new Intent(I2PActivityBase.this, MainActivity.class); Intent main = new Intent(I2PActivityBase.this, MainActivity.class);
startActivity(main); startActivity(main);
break; break;
} }
mDrawerLayout.closeDrawer(mDrawerList); mDrawerLayout.closeDrawer(mDrawerList);
} }
@Override @Override
public void onRestart() public void onRestart() {
{
Util.d(this + " onRestart called"); Util.d(this + " onRestart called");
super.onRestart(); super.onRestart();
} }
@Override @Override
public void onStart() public void onStart() {
{
Util.d(this + " onStart called"); Util.d(this + " onStart called");
super.onStart(); super.onStart();
if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START)) if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START))
@ -226,24 +230,32 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
bindRouter(false); bindRouter(false);
} }
/** @param def default */ /**
* @param def default
*/
public boolean getPref(String pref, boolean def) { public boolean getPref(String pref, boolean def) {
return _sharedPrefs.getBoolean(pref, def); return _sharedPrefs.getBoolean(pref, def);
} }
/** @param def default */ /**
* @param def default
*/
public String getPref(String pref, String def) { public String getPref(String pref, String def) {
return _sharedPrefs.getString(pref, def); return _sharedPrefs.getString(pref, def);
} }
/** @return success */ /**
* @return success
*/
public boolean setPref(String pref, boolean val) { public boolean setPref(String pref, boolean val) {
SharedPreferences.Editor edit = _sharedPrefs.edit(); SharedPreferences.Editor edit = _sharedPrefs.edit();
edit.putBoolean(pref, val); edit.putBoolean(pref, val);
return edit.commit(); return edit.commit();
} }
/** @return success */ /**
* @return success
*/
public boolean setPref(String pref, String val) { public boolean setPref(String pref, String val) {
SharedPreferences.Editor edit = _sharedPrefs.edit(); SharedPreferences.Editor edit = _sharedPrefs.edit();
edit.putString(pref, val); edit.putString(pref, val);
@ -251,37 +263,32 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
} }
@Override @Override
public void onResume() public void onResume() {
{
Util.d(this + " onResume called"); Util.d(this + " onResume called");
super.onResume(); super.onResume();
} }
@Override @Override
public void onPause() public void onPause() {
{
Util.d(this + " onPause called"); Util.d(this + " onPause called");
super.onPause(); super.onPause();
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) public void onSaveInstanceState(Bundle outState) {
{
Util.d(this + " onSaveInstanceState called"); Util.d(this + " onSaveInstanceState called");
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@Override @Override
public void onStop() public void onStop() {
{
Util.d(this + " onStop called"); Util.d(this + " onStop called");
unbindRouter(); unbindRouter();
super.onStop(); super.onStop();
} }
@Override @Override
public void onDestroy() public void onDestroy() {
{
Util.d(this + " onDestroy called"); Util.d(this + " onDestroy called");
super.onDestroy(); super.onDestroy();
} }
@ -301,6 +308,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
/** /**
* Override in subclass with e.g. * Override in subclass with e.g.
* menu.findItem(R.id.action_add_to_addressbook).setVisible(!drawerOpen); * menu.findItem(R.id.action_add_to_addressbook).setVisible(!drawerOpen);
*
* @param drawerOpen true if the drawer is open * @param drawerOpen true if the drawer is open
*/ */
protected void onDrawerChange(boolean drawerOpen) { protected void onDrawerChange(boolean drawerOpen) {
@ -310,7 +318,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// The action bar home/up action should open or close the drawer. // The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this. // ActionBarDrawerToggle will take care of this.
if(mDrawerToggle.onOptionsItemSelected(item)) { if (mDrawerToggle.onOptionsItemSelected(item)) {
return true; return true;
} }
@ -361,7 +369,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
////// Service stuff ////// Service stuff
/** /**
* Start the service and bind to it * Start the service and bind to it
*/ */
protected boolean startRouter() { protected boolean startRouter() {
Intent intent = new Intent(); Intent intent = new Intent();
@ -378,7 +386,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
} }
/** /**
* Bind only * Bind only
*/ */
protected boolean bindRouter(boolean autoCreate) { protected boolean bindRouter(boolean autoCreate) {
Intent intent = new Intent(RouterBinder.class.getName()); Intent intent = new Intent(RouterBinder.class.getName());
@ -393,7 +401,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
protected void unbindRouter() { protected void unbindRouter() {
Util.d(this + " unbindRouter called with _isBound:" + _isBound + " _connection:" + _connection + " _triedBind:" + _triedBind); Util.d(this + " unbindRouter called with _isBound:" + _isBound + " _connection:" + _connection + " _triedBind:" + _triedBind);
if (_triedBind && _connection != null) if (_triedBind && _connection != null)
unbindService(_connection); unbindService(_connection);
_triedBind = false; _triedBind = false;
_connection = null; _connection = null;
@ -424,7 +432,9 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
} }
} }
/** callback from ServiceConnection, override as necessary */ /**
* callback from ServiceConnection, override as necessary
*/
protected void onRouterBind(RouterService svc) { protected void onRouterBind(RouterService svc) {
Fragment f = getSupportFragmentManager().findFragmentById(R.id.main_fragment); Fragment f = getSupportFragmentManager().findFragmentById(R.id.main_fragment);
if (f instanceof I2PFragmentBase) if (f instanceof I2PFragmentBase)
@ -441,8 +451,11 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
} }
} }
/** callback from ServiceConnection, override as necessary */ /**
protected void onRouterUnbind() {} * callback from ServiceConnection, override as necessary
*/
protected void onRouterUnbind() {
}
// I2PFragmentBase.RouterContextProvider // I2PFragmentBase.RouterContextProvider

View File

@ -1,9 +1,5 @@
package net.i2p.android.router.addressbook; package net.i2p.android.router.addressbook;
import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R;
import net.i2p.android.router.web.WebActivity;
import net.i2p.android.router.web.WebFragment;
import android.app.Activity; import android.app.Activity;
import android.app.SearchManager; import android.app.SearchManager;
import android.content.Context; import android.content.Context;
@ -12,11 +8,18 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R;
import net.i2p.android.router.web.WebActivity;
import net.i2p.android.router.web.WebFragment;
public class AddressbookActivity extends I2PActivityBase public class AddressbookActivity extends I2PActivityBase
implements AddressbookFragment.OnAddressSelectedListener, implements AddressbookFragment.OnAddressSelectedListener,
@ -27,7 +30,10 @@ public class AddressbookActivity extends I2PActivityBase
*/ */
private boolean mTwoPane; private boolean mTwoPane;
private static final String SELECTED_TAB = "selected_tab"; private static final String SELECTED_PAGE = "selected_page";
private static final int PAGE_ROUTER = 0;
private Spinner mSpinner;
@Override @Override
protected boolean canUseTwoPanes() { protected boolean canUseTwoPanes() {
@ -38,36 +44,22 @@ public class AddressbookActivity extends I2PActivityBase
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Set up action bar for tabs mSpinner = (Spinner) findViewById(R.id.main_spinner);
ActionBar actionBar = getSupportActionBar(); mSpinner.setVisibility(View.VISIBLE);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Router book tab mSpinner.setAdapter(ArrayAdapter.createFromResource(this,
AddressbookFragment rf = new AddressbookFragment(); R.array.addressbook_pages, android.R.layout.simple_spinner_dropdown_item));
Bundle args = new Bundle();
args.putString(AddressbookFragment.BOOK_NAME,
AddressbookFragment.ROUTER_BOOK);
rf.setArguments(args);
Tab tab = actionBar.newTab()
.setText("Router")
.setTabListener(new TabListener(rf));
actionBar.addTab(tab);
// Private book tab mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
AddressbookFragment pf = new AddressbookFragment(); @Override
args = new Bundle(); public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
args.putString(AddressbookFragment.BOOK_NAME, selectPage(i);
AddressbookFragment.PRIVATE_BOOK); }
pf.setArguments(args);
tab = actionBar.newTab()
.setText("Private")
.setTabListener(new TabListener(pf));
actionBar.addTab(tab);
if (savedInstanceState != null) { @Override
int selected = savedInstanceState.getInt(SELECTED_TAB); public void onNothingSelected(AdapterView<?> adapterView) {
actionBar.setSelectedNavigationItem(selected); }
} });
if (findViewById(R.id.detail_fragment) != null) { if (findViewById(R.id.detail_fragment) != null) {
// The detail container view will be present only in the // The detail container view will be present only in the
@ -76,13 +68,30 @@ public class AddressbookActivity extends I2PActivityBase
// activity should be in two-pane mode. // activity should be in two-pane mode.
mTwoPane = true; mTwoPane = true;
} }
if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_PAGE);
mSpinner.setSelection(selected);
} else
selectPage(PAGE_ROUTER);
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(SELECTED_TAB, outState.putInt(SELECTED_PAGE, mSpinner.getSelectedItemPosition());
getSupportActionBar().getSelectedNavigationIndex()); }
private void selectPage(int page) {
AddressbookFragment f = new AddressbookFragment();
Bundle args = new Bundle();
args.putString(AddressbookFragment.BOOK_NAME,
page == PAGE_ROUTER ?
AddressbookFragment.ROUTER_BOOK :
AddressbookFragment.PRIVATE_BOOK);
f.setArguments(args);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f).commit();
} }
@Override @Override

View File

@ -1,17 +1,19 @@
package net.i2p.android.router.log; package net.i2p.android.router.log;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import net.i2p.android.router.I2PActivityBase; import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import net.i2p.android.router.SettingsActivity; import net.i2p.android.router.SettingsActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.SpinnerAdapter;
public class LogActivity extends I2PActivityBase implements public class LogActivity extends I2PActivityBase implements
LogFragment.OnEntrySelectedListener { LogFragment.OnEntrySelectedListener {
@ -23,6 +25,9 @@ public class LogActivity extends I2PActivityBase implements
private static final String SELECTED_LEVEL = "selected_level"; private static final String SELECTED_LEVEL = "selected_level";
private String[] mLevels;
private Spinner mSpinner;
@Override @Override
protected boolean canUseTwoPanes() { protected boolean canUseTwoPanes() {
return true; return true;
@ -32,9 +37,10 @@ public class LogActivity extends I2PActivityBase implements
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Set up action bar for drop-down list mLevels = getResources().getStringArray(R.array.log_level_list);
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); mSpinner = (Spinner) findViewById(R.id.main_spinner);
mSpinner.setVisibility(View.VISIBLE);
mDrawerToggle.setDrawerIndicatorEnabled(false); mDrawerToggle.setDrawerIndicatorEnabled(false);
@ -46,31 +52,36 @@ public class LogActivity extends I2PActivityBase implements
mTwoPane = true; mTwoPane = true;
} }
SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, mSpinner.setAdapter(ArrayAdapter.createFromResource(this,
R.array.log_level_list, android.R.layout.simple_spinner_dropdown_item); R.array.log_level_list, android.R.layout.simple_spinner_dropdown_item));
ActionBar.OnNavigationListener mNavigationListener = new ActionBar.OnNavigationListener() { mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
String[] levels = getResources().getStringArray(R.array.log_level_list); @Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
public boolean onNavigationItemSelected(int position, long itemId) { selectLevel(i);
String level = levels[position];
LogFragment f = LogFragment.newInstance(level);
// In two-pane mode, list items should be given the
// 'activated' state when touched.
if (mTwoPane)
f.setActivateOnItemClick(true);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f, levels[position]).commit();
return true;
} }
};
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationListener); @Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
if (savedInstanceState != null) { if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_LEVEL); int selected = savedInstanceState.getInt(SELECTED_LEVEL);
actionBar.setSelectedNavigationItem(selected); mSpinner.setSelection(selected);
} } else
selectLevel(0);
}
private void selectLevel(int i) {
String level = mLevels[i];
LogFragment f = LogFragment.newInstance(level);
// In two-pane mode, list items should be given the
// 'activated' state when touched.
if (mTwoPane)
f.setActivateOnItemClick(true);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f, level).commit();
} }
@Override @Override
@ -106,8 +117,7 @@ public class LogActivity extends I2PActivityBase implements
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(SELECTED_LEVEL, outState.putInt(SELECTED_LEVEL, mSpinner.getSelectedItemPosition());
getSupportActionBar().getSelectedNavigationIndex());
} }
// LogFragment.OnEntrySelectedListener // LogFragment.OnEntrySelectedListener

View File

@ -1,14 +1,16 @@
package net.i2p.android.router.netdb; package net.i2p.android.router.netdb;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import net.i2p.android.router.I2PActivityBase; import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R; import net.i2p.android.router.R;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
public class NetDbActivity extends I2PActivityBase implements public class NetDbActivity extends I2PActivityBase implements
NetDbListFragment.OnEntrySelectedListener { NetDbListFragment.OnEntrySelectedListener {
@ -18,7 +20,11 @@ public class NetDbActivity extends I2PActivityBase implements
*/ */
private boolean mTwoPane; private boolean mTwoPane;
private static final String SELECTED_TAB = "selected_tab"; private static final String SELECTED_PAGE = "selected_page";
private static final int PAGE_STATS = 0;
private static final int PAGE_ROUTERS = 1;
private Spinner mSpinner;
@Override @Override
protected boolean canUseTwoPanes() { protected boolean canUseTwoPanes() {
@ -29,41 +35,22 @@ public class NetDbActivity extends I2PActivityBase implements
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Set up action bar for tabs mSpinner = (Spinner) findViewById(R.id.main_spinner);
ActionBar actionBar = getSupportActionBar(); mSpinner.setVisibility(View.VISIBLE);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Statistics tab mSpinner.setAdapter(ArrayAdapter.createFromResource(this,
NetDbSummaryPagerFragment sf = new NetDbSummaryPagerFragment(); R.array.netdb_pages, android.R.layout.simple_spinner_dropdown_item));
actionBar.addTab(
actionBar.newTab()
.setText("Statistics")
.setTabListener(new NetDbSummaryPagerTabListener(sf)));
// Routers tab mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
NetDbListFragment rf = new NetDbListFragment(); @Override
Bundle args = new Bundle(); public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
args.putBoolean(NetDbListFragment.SHOW_ROUTERS, true); selectPage(i);
rf.setArguments(args); }
actionBar.addTab(
actionBar.newTab()
.setText("Routers")
.setTabListener(new TabListener(rf)));
// LeaseSets tab @Override
NetDbListFragment lf = new NetDbListFragment(); public void onNothingSelected(AdapterView<?> adapterView) {
args = new Bundle(); }
args.putBoolean(NetDbListFragment.SHOW_ROUTERS, false); });
lf.setArguments(args);
actionBar.addTab(
actionBar.newTab()
.setText("LeaseSets")
.setTabListener(new TabListener(lf)));
if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_TAB);
actionBar.setSelectedNavigationItem(selected);
}
if (findViewById(R.id.detail_fragment) != null) { if (findViewById(R.id.detail_fragment) != null) {
// The detail container view will be present only in the // The detail container view will be present only in the
@ -71,38 +58,37 @@ public class NetDbActivity extends I2PActivityBase implements
// res/values-sw600dp). If this view is present, then the // res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode. // activity should be in two-pane mode.
mTwoPane = true; mTwoPane = true;
// In two-pane mode, list items should be given the
// 'activated' state when touched.
rf.setActivateOnItemClick(true);
lf.setActivateOnItemClick(true);
} }
if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_PAGE);
mSpinner.setSelection(selected);
} else
selectPage(PAGE_STATS);
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(SELECTED_TAB, outState.putInt(SELECTED_PAGE, mSpinner.getSelectedItemPosition());
getSupportActionBar().getSelectedNavigationIndex());
} }
public static class NetDbSummaryPagerTabListener extends TabListener { private void selectPage(int page) {
public NetDbSummaryPagerTabListener(Fragment fragment) { Fragment f;
super(fragment); if (page == PAGE_STATS)
} f = new NetDbSummaryPagerFragment();
else {
@Override f = new NetDbListFragment();
public void onTabSelected(Tab tab, FragmentTransaction ft) { Bundle args = new Bundle();
/** args.putBoolean(NetDbListFragment.SHOW_ROUTERS, page == PAGE_ROUTERS);
* This is a work-around for Issue 42601 f.setArguments(args);
* https://code.google.com/p/android/issues/detail?id=42601 // In two-pane mode, list items should be given the
* // 'activated' state when touched.
* The method getChildFragmentManager() does not clear up if (mTwoPane)
* when the Fragment is detached. ((NetDbListFragment) f).setActivateOnItemClick(true);
*/
mFragment = new NetDbSummaryPagerFragment();
super.onTabSelected(tab, ft);
} }
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f).commit();
} }
// NetDbListFragment.OnEntrySelectedListener // NetDbListFragment.OnEntrySelectedListener
@ -115,12 +101,12 @@ public class NetDbActivity extends I2PActivityBase implements
NetDbDetailFragment detailFrag = NetDbDetailFragment.newInstance( NetDbDetailFragment detailFrag = NetDbDetailFragment.newInstance(
isRouterInfo, entryHash); isRouterInfo, entryHash);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.detail_fragment, detailFrag).commit(); .replace(R.id.detail_fragment, detailFrag).commit();
// If we are coming from a LS to a RI, change the tab // If we are coming from a LS to a RI, change the tab
int currentTab = getSupportActionBar().getSelectedNavigationIndex(); int currentTab = mSpinner.getSelectedItemPosition();
if (isRouterInfo && currentTab !=1) if (isRouterInfo && currentTab != PAGE_ROUTERS)
getSupportActionBar().setSelectedNavigationItem(1); selectPage(PAGE_ROUTERS);
} else { } else {
// In single-pane mode, simply start the detail activity // In single-pane mode, simply start the detail activity
// for the selected item ID. // for the selected item ID.

View File

@ -1,15 +1,5 @@
package net.i2p.android.router.stats; package net.i2p.android.router.stats;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R;
import net.i2p.android.router.SettingsActivity;
import net.i2p.android.router.service.StatSummarizer;
import net.i2p.android.router.service.SummaryListener;
import net.i2p.stat.Rate;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -17,13 +7,28 @@ import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.ActionBar; import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.SpinnerAdapter; import android.widget.Spinner;
import net.i2p.android.router.I2PActivityBase;
import net.i2p.android.router.R;
import net.i2p.android.router.SettingsActivity;
import net.i2p.android.router.service.StatSummarizer;
import net.i2p.android.router.service.SummaryListener;
import net.i2p.stat.Rate;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
public class RateGraphActivity extends I2PActivityBase { public class RateGraphActivity extends I2PActivityBase {
private static final String SELECTED_RATE = "selected_rate"; private static final String SELECTED_RATE = "selected_rate";
private String[] mRates;
private long[] mPeriods;
private Spinner mSpinner;
private boolean mFinishOnResume; private boolean mFinishOnResume;
@Override @Override
@ -40,8 +45,8 @@ public class RateGraphActivity extends I2PActivityBase {
if (ordered.size() > 0) { if (ordered.size() > 0) {
// Extract the rates and periods // Extract the rates and periods
final String[] mRates = new String[ordered.size()]; mRates = new String[ordered.size()];
final long[] mPeriods = new long[ordered.size()]; mPeriods = new long[ordered.size()];
int i = 0; int i = 0;
for (SummaryListener listener : ordered) { for (SummaryListener listener : ordered) {
Rate r = listener.getRate(); Rate r = listener.getRate();
@ -50,33 +55,28 @@ public class RateGraphActivity extends I2PActivityBase {
i++; i++;
} }
// Set up action bar for drop-down list mSpinner = (Spinner) findViewById(R.id.main_spinner);
ActionBar actionBar = getSupportActionBar(); mSpinner.setVisibility(View.VISIBLE);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
SpinnerAdapter mSpinnerAdapter = new ArrayAdapter<String>(this, mSpinner.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_dropdown_item, mRates); android.R.layout.simple_spinner_dropdown_item, mRates));
ActionBar.OnNavigationListener mNavigationListener = new ActionBar.OnNavigationListener() { mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
String[] rates = mRates; @Override
long[] periods = mPeriods; public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
selectRate(i);
public boolean onNavigationItemSelected(int position, long itemId) {
String rateName = rates[position];
long period = periods[position];
RateGraphFragment f = RateGraphFragment.newInstance(rateName, period);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f, rates[position]).commit();
return true;
} }
};
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationListener); @Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
if (savedInstanceState != null) { if (savedInstanceState != null) {
int selected = savedInstanceState.getInt(SELECTED_RATE); int selected = savedInstanceState.getInt(SELECTED_RATE);
actionBar.setSelectedNavigationItem(selected); mSpinner.setSelection(selected);
} } else
selectRate(0);
} else { } else {
DialogFragment df = new DialogFragment() { DialogFragment df = new DialogFragment() {
@Override @Override
@ -130,6 +130,14 @@ public class RateGraphActivity extends I2PActivityBase {
} }
} }
private void selectRate(int position) {
String rateName = mRates[position];
long period = mPeriods[position];
RateGraphFragment f = RateGraphFragment.newInstance(rateName, period);
getSupportFragmentManager().beginTransaction()
.replace(R.id.main_fragment, f, rateName).commit();
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -142,8 +150,8 @@ public class RateGraphActivity extends I2PActivityBase {
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(SELECTED_RATE, if (mSpinner != null)
getSupportActionBar().getSelectedNavigationIndex()); outState.putInt(SELECTED_RATE, mSpinner.getSelectedItemPosition());
} }
private static class AlphaComparator implements Comparator<SummaryListener> { private static class AlphaComparator implements Comparator<SummaryListener> {

View File

@ -1,27 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" > android:orientation="vertical">
<!-- The main content view --> <android.support.v7.widget.Toolbar
<FrameLayout android:id="@+id/main_toolbar"
android:id="@+id/main_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
<!-- The navigation drawer --> <Spinner
<ListView android:id="@+id/main_spinner"
android:id="@+id/drawer" android:layout_width="wrap_content"
android:layout_width="240dp" android:layout_height="wrap_content"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" tools:context=".MainActivity">
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout> <!-- The main content view -->
<FrameLayout
android:id="@+id/main_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>

View File

@ -1,51 +1,72 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" > android:orientation="vertical">
<LinearLayout <android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
<Spinner
android:id="@+id/main_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:baselineAligned="false" tools:context=".MainActivity">
android:orientation="horizontal" >
<!-- <LinearLayout
This layout is a two-pane layout for the master/detail android:layout_width="match_parent"
flow within a DrawerLayout. See res/values-large/refs.xml
and res/values-sw600dp/refs.xml for layout aliases
that replace the single-pane version of the layout with
this two-pane version.
-->
<!-- The main fragment view -->
<FrameLayout
android:id="@+id/main_fragment"
android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" /> android:baselineAligned="false"
android:orientation="horizontal">
<!-- The detail fragment view --> <!--
<FrameLayout This layout is a two-pane layout for the master/detail
android:id="@+id/detail_fragment" flow within a DrawerLayout. See res/values-large/refs.xml
android:layout_width="0dp" and res/values-sw600dp/refs.xml for layout aliases
that replace the single-pane version of the layout with
this two-pane version.
-->
<!-- The main fragment view -->
<FrameLayout
android:id="@+id/main_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<!-- The detail fragment view -->
<FrameLayout
android:id="@+id/detail_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" /> android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</LinearLayout> </android.support.v4.widget.DrawerLayout>
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

View File

@ -1,33 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" > android:orientation="vertical">
<!-- The main content view --> <android.support.v7.widget.Toolbar
<android.support.v4.view.ViewPager android:id="@+id/main_toolbar"
android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="?attr/actionBarSize"
<android.support.v4.view.PagerTitleStrip android:background="?attr/colorPrimary"
android:id="@+id/pager_title_strip" android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent" app:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
android:layout_height="wrap_content"
android:layout_gravity="top" />
</android.support.v4.view.ViewPager>
<!-- The navigation drawer --> <android.support.v4.widget.DrawerLayout
<ListView android:id="@+id/drawer_layout"
android:id="@+id/drawer" android:layout_width="match_parent"
android:layout_width="240dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" tools:context=".MainActivity">
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout> <!-- The main content view -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />
</android.support.v4.view.ViewPager>
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>

View File

@ -13,6 +13,14 @@
<item>@string/label_peers_status</item> <item>@string/label_peers_status</item>
<item>NetDB</item> <item>NetDB</item>
</string-array> </string-array>
<string-array name="addressbook_pages">
<item>Router</item>
<item>Private</item>
</string-array>
<string-array name="i2ptunnel_pages">
<item>@string/label_i2ptunnel_client</item>
<item>@string/label_i2ptunnel_server</item>
</string-array>
<string-array name="log_level_list"> <string-array name="log_level_list">
<item>ERROR</item> <item>ERROR</item>
<item>All</item> <item>All</item>
@ -24,6 +32,11 @@
<item>INFO</item> <item>INFO</item>
<item>DEBUG</item> <item>DEBUG</item>
</string-array> </string-array>
<string-array name="netdb_pages">
<item>Statistics</item>
<item>Routers</item>
<item>LeaseSets</item>
</string-array>
<string-array name="setting0to3"> <string-array name="setting0to3">
<item>0</item> <item>0</item>
<item>1</item> <item>1</item>

View File

@ -1,5 +1,5 @@
<resources> <resources>
<style name="Theme.I2P" parent="Theme.AppCompat"> <style name="Theme.I2P" parent="Theme.AppCompat.NoActionBar">
<!-- Here we setting appcompats actionBarStyle --> <!-- Here we setting appcompats actionBarStyle -->
<!--<item name="actionBarStyle">@style/MyActionBarStyle</item>--> <!--<item name="actionBarStyle">@style/MyActionBarStyle</item>-->