@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); orbot = OrbotInitializer.get(getActivity()); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.actions, menu); orbotItem = menu.findItem(R.id.orbot); orbotItem.setVisible(!orbot.isInstalled()); }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.orbot) { OrbotInitializer.get(getActivity()).installOrbot(getActivity()); return (true); } return (super.onOptionsItemSelected(item)); }
private void checkTor() { if (orbot.isInstalled()) { try { strategy = buildStatusStrategy(); strategy.checkStatus(this); } catch (Exception e) { Toast.makeText(getActivity(), "Exception trying to build strategy", Toast.LENGTH_LONG) .show(); e.printStackTrace(); } } }