purge unused code from OrbotMainActivity
mItemOnOff no longer exists, there is no more start/stop button on the menu and this code was trying to update menu.getItem(0), which is currently the settings button. onSharedPreferenceChanged() was entirely empty, and the prefs are all handled in their own Activity
This commit is contained in:
parent
bf3572eb82
commit
2f1d52f02d
|
@ -28,7 +28,6 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
@ -65,13 +64,13 @@ import com.google.zxing.integration.android.IntentIntegrator;
|
||||||
import com.google.zxing.integration.android.IntentResult;
|
import com.google.zxing.integration.android.IntentResult;
|
||||||
|
|
||||||
|
|
||||||
public class OrbotMainActivity extends Activity implements OrbotConstants, OnLongClickListener, OnTouchListener, OnSharedPreferenceChangeListener
|
public class OrbotMainActivity extends Activity
|
||||||
{
|
implements OrbotConstants, OnLongClickListener, OnTouchListener {
|
||||||
|
|
||||||
/* Useful UI bits */
|
/* Useful UI bits */
|
||||||
private TextView lblStatus = null; //the main text display widget
|
private TextView lblStatus = null; //the main text display widget
|
||||||
private ImageProgressView imgStatus = null; //the main touchable image for activating Orbot
|
private ImageProgressView imgStatus = null; //the main touchable image for activating Orbot
|
||||||
|
|
||||||
private MenuItem mItemOnOff = null;
|
|
||||||
private TextView downloadText = null;
|
private TextView downloadText = null;
|
||||||
private TextView uploadText = null;
|
private TextView uploadText = null;
|
||||||
private TextView mTxtOrbotLog = null;
|
private TextView mTxtOrbotLog = null;
|
||||||
|
@ -79,8 +78,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
private Button mBtnBrowser = null;
|
private Button mBtnBrowser = null;
|
||||||
private ToggleButton mBtnVPN = null;
|
private ToggleButton mBtnVPN = null;
|
||||||
private ToggleButton mBtnBridges = null;
|
private ToggleButton mBtnBridges = null;
|
||||||
|
|
||||||
|
|
||||||
private DrawerLayout mDrawer;
|
private DrawerLayout mDrawer;
|
||||||
private ActionBarDrawerToggle mDrawerToggle;
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
|
@ -100,7 +98,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
mPrefs.registerOnSharedPreferenceChangeListener(this);
|
|
||||||
|
|
||||||
doLayout();
|
doLayout();
|
||||||
|
|
||||||
|
@ -115,8 +112,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
lbm.registerReceiver(mLocalBroadcastReceiver,
|
lbm.registerReceiver(mLocalBroadcastReceiver,
|
||||||
new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
|
new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void sendIntentToService(String action) {
|
private void sendIntentToService(String action) {
|
||||||
Intent torService = new Intent(this, TorService.class);
|
Intent torService = new Intent(this, TorService.class);
|
||||||
|
@ -299,40 +294,10 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.orbot_main, menu);
|
inflater.inflate(R.menu.orbot_main, menu);
|
||||||
|
|
||||||
mItemOnOff = menu.getItem(0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
private void appConflictChecker ()
|
|
||||||
{
|
|
||||||
SharedPreferences sprefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
|
||||||
|
|
||||||
boolean showAppConflict = true;//sprefs.getBoolean("pref_show_conflict",true);
|
|
||||||
|
|
||||||
String[] badApps = {"com.sec.msc.nts.android.proxy:com.sec.msc.nts.android.proxy","com.sec.pcw:Samsung Link"};
|
|
||||||
|
|
||||||
for (String badApp : badApps)
|
|
||||||
{
|
|
||||||
String[] badAppParts = badApp.split(":");
|
|
||||||
|
|
||||||
if (appInstalledOrNot(badAppParts[0]))
|
|
||||||
{
|
|
||||||
String msg = getString(R.string.please_disable_this_app_in_android_settings_apps_if_you_are_having_problems_with_orbot_) + badAppParts[1];
|
|
||||||
|
|
||||||
if (showAppConflict)
|
|
||||||
showAlert(getString(R.string.app_conflict),msg,true);
|
|
||||||
|
|
||||||
// appendLogTextAndScroll(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sprefs.edit().putBoolean("pref_show_conflict", false).commit();
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private void showAbout ()
|
private void showAbout ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1094,8 +1059,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
|
|
||||||
mBtnBrowser.setEnabled(true);
|
mBtnBrowser.setEnabled(true);
|
||||||
|
|
||||||
if (mItemOnOff != null)
|
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
|
||||||
|
|
||||||
if (lblStatus != null && torServiceMsg != null)
|
if (lblStatus != null && torServiceMsg != null)
|
||||||
if (torServiceMsg.indexOf('%')!=-1)
|
if (torServiceMsg.indexOf('%')!=-1)
|
||||||
|
@ -1130,8 +1093,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
|
|
||||||
imgStatus.setImageResource(R.drawable.torstarting);
|
imgStatus.setImageResource(R.drawable.torstarting);
|
||||||
|
|
||||||
if (mItemOnOff != null)
|
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
|
||||||
|
|
||||||
if (lblStatus != null && torServiceMsg != null)
|
if (lblStatus != null && torServiceMsg != null)
|
||||||
if (torServiceMsg.indexOf('%')!=-1)
|
if (torServiceMsg.indexOf('%')!=-1)
|
||||||
|
@ -1146,8 +1107,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
lblStatus.setText(getString(R.string.press_to_start));
|
lblStatus.setText(getString(R.string.press_to_start));
|
||||||
mBtnBrowser.setEnabled(false);
|
mBtnBrowser.setEnabled(false);
|
||||||
|
|
||||||
if (mItemOnOff != null)
|
|
||||||
mItemOnOff.setTitle(R.string.menu_start);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,7 +1178,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
break;
|
break;
|
||||||
case TorServiceConstants.ENABLE_TOR_MSG:
|
case TorServiceConstants.ENABLE_TOR_MSG:
|
||||||
|
|
||||||
|
|
||||||
updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG));
|
updateStatus((String)msg.getData().getString(HANDLER_TOR_MSG));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1302,13 +1260,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
+ getString(R.string.mb);
|
+ getString(R.string.mb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
|
||||||
String key) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final float ROTATE_FROM = 0.0f;
|
private static final float ROTATE_FROM = 0.0f;
|
||||||
private static final float ROTATE_TO = 360.0f*4f;// 3.141592654f * 32.0f;
|
private static final float ROTATE_TO = 360.0f*4f;// 3.141592654f * 32.0f;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue