add toolbar and drawer handlers back in
This commit is contained in:
parent
4c49822861
commit
5131c62c3e
|
@ -186,6 +186,31 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
{
|
{
|
||||||
setContentView(R.layout.layout_main);
|
setContentView(R.layout.layout_main);
|
||||||
|
|
||||||
|
mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
mToolbar.inflateMenu(R.menu.orbot_main);
|
||||||
|
mToolbar.setTitle(R.string.app_name);
|
||||||
|
|
||||||
|
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
mDrawerToggle = new ActionBarDrawerToggle(
|
||||||
|
this, mDrawer, mToolbar,
|
||||||
|
android.R.string.ok, android.R.string.cancel
|
||||||
|
);
|
||||||
|
|
||||||
|
mDrawer.setDrawerListener(mDrawerToggle);
|
||||||
|
mDrawerToggle.setDrawerIndicatorEnabled(true);
|
||||||
|
mDrawerToggle.syncState();
|
||||||
|
mDrawerToggle.setToolbarNavigationClickListener(new OnClickListener ()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
setupMenu();
|
||||||
|
|
||||||
lblStatus = (TextView)findViewById(R.id.lblStatus);
|
lblStatus = (TextView)findViewById(R.id.lblStatus);
|
||||||
lblStatus.setOnLongClickListener(this);
|
lblStatus.setOnLongClickListener(this);
|
||||||
imgStatus = (ImageProgressView)findViewById(R.id.imgStatus);
|
imgStatus = (ImageProgressView)findViewById(R.id.imgStatus);
|
||||||
|
@ -311,10 +336,14 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void setupMenu ()
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
{
|
||||||
|
|
||||||
super.onOptionsItemSelected(item);
|
mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener ()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
||||||
if (item.getItemId() == R.id.menu_start)
|
if (item.getItemId() == R.id.menu_start)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +380,7 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
}
|
}
|
||||||
else if (item.getItemId() == R.id.menu_wizard)
|
else if (item.getItemId() == R.id.menu_wizard)
|
||||||
{
|
{
|
||||||
startActivity(new Intent(this, ChooseLocaleWizardActivity.class));
|
startActivity(new Intent(OrbotMainActivity.this, ChooseLocaleWizardActivity.class));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (item.getItemId() == R.id.menu_exit)
|
else if (item.getItemId() == R.id.menu_exit)
|
||||||
|
@ -369,6 +398,12 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -758,15 +793,15 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||||
public void startVpnService ()
|
public void startVpnService ()
|
||||||
{
|
{
|
||||||
Intent intent = VpnService.prepare(this);
|
Intent intent = VpnService.prepare(this);
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
startActivityForResult(intent,REQUEST_VPN);
|
startActivityForResult(intent,REQUEST_VPN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_VPN);
|
startService(TorServiceConstants.CMD_VPN);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean flushTransProxy ()
|
private boolean flushTransProxy ()
|
||||||
|
@ -850,9 +885,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
|
|
||||||
imgStatus.setImageResource(R.drawable.toron);
|
imgStatus.setImageResource(R.drawable.toron);
|
||||||
|
|
||||||
mBtnBrowser.setEnabled(true);
|
|
||||||
mBtnVPN.setEnabled(true);
|
|
||||||
|
|
||||||
|
|
||||||
if (mItemOnOff != null)
|
if (mItemOnOff != null)
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
mItemOnOff.setTitle(R.string.menu_stop);
|
||||||
|
@ -911,9 +943,6 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
|
||||||
if (mItemOnOff != null)
|
if (mItemOnOff != null)
|
||||||
mItemOnOff.setTitle(R.string.menu_start);
|
mItemOnOff.setTitle(R.string.menu_start);
|
||||||
|
|
||||||
mBtnBrowser.setEnabled(false);
|
|
||||||
mBtnVPN.setEnabled(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue