clean up wizard context use

This commit is contained in:
Nathan Freitas 2014-04-25 12:42:31 -04:00
parent 0178d3e4de
commit d5293340d5
5 changed files with 25 additions and 33 deletions

View File

@ -4,6 +4,7 @@ import java.util.Locale;
import org.torproject.android.R;
import org.torproject.android.TorConstants;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
import android.content.Context;
@ -22,14 +23,12 @@ import android.widget.ListView;
public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
private Context context;
private int flag = 0;
private ListView listLocales;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
context = this;
}
@ -47,16 +46,6 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
protected void onResume() {
super.onResume();
setupUI();
}
private void setupUI ()
{
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
}
@ -84,7 +73,7 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
int arg2, long arg3) {
setLocalePref(arg2);
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
}
});
@ -94,7 +83,7 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
}
});
@ -106,7 +95,7 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
private void setLocalePref(int selId)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Configuration config = getResources().getConfiguration();

View File

@ -7,6 +7,7 @@ import org.torproject.android.R.drawable;
import org.torproject.android.R.id;
import org.torproject.android.R.layout;
import org.torproject.android.R.string;
import org.torproject.android.service.TorServiceUtils;
import org.torproject.android.settings.AppManager;
import android.app.Activity;
@ -76,7 +77,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
private void setupUI ()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false);
@ -119,7 +120,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
startActivityForResult(new Intent(ConfigureTransProxy.this, Permissions.class), 1);
}
});
@ -127,7 +128,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
startActivityForResult(new Intent(ConfigureTransProxy.this, TipsAndTricks.class), 1);
}
});
@ -162,7 +163,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = prefs.edit();
pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());

View File

@ -6,6 +6,7 @@ import org.torproject.android.R.drawable;
import org.torproject.android.R.id;
import org.torproject.android.R.layout;
import org.torproject.android.R.string;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
import android.content.Context;
@ -40,7 +41,7 @@ public class LotsaText extends Activity implements TorConstants{
super.onStart();
setContentView(R.layout.scrollingtext_buttons_view);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",true);
if(wizardScreen1)
@ -72,7 +73,7 @@ public class LotsaText extends Activity implements TorConstants{
private void stepOne() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = prefs.edit();
pEdit.putBoolean("wizardscreen1",true);
@ -102,7 +103,7 @@ public class LotsaText extends Activity implements TorConstants{
private void stepTwo() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = prefs.edit();
pEdit.putBoolean("wizardscreen1",false);
@ -134,7 +135,7 @@ public class LotsaText extends Activity implements TorConstants{
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
startActivityForResult(new Intent(LotsaText.this, Permissions.class), 1);
}
});

View File

@ -4,6 +4,7 @@ import org.sufficientlysecure.rootcommands.RootCommands;
import org.torproject.android.R;
import org.torproject.android.TorConstants;
import org.torproject.android.service.TorService;
import org.torproject.android.service.TorServiceUtils;
import android.app.Activity;
import android.content.Context;
@ -92,7 +93,7 @@ public class Permissions extends Activity implements TorConstants {
//this is saying do not use root
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
Editor pEdit = prefs.edit();
@ -122,7 +123,7 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) {
//Check and Install iptables - TorTransProxy.testOwnerModule(this)
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
boolean hasRoot = RootCommands.rootAccessGiven();
Editor pEdit = prefs.edit();
@ -137,7 +138,7 @@ public class Permissions extends Activity implements TorConstants {
}
else
{
startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
startActivityForResult(new Intent(Permissions.this, ConfigureTransProxy.class), 1);
}
@ -150,7 +151,7 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
}
});
@ -159,7 +160,7 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
}
});
@ -193,14 +194,14 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
}
});
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
}
});
}

View File

@ -149,7 +149,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
}
});
@ -183,7 +183,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
}
});
@ -191,7 +191,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivityForResult(new Intent(getBaseContext(), Orbot.class), 1);
startActivityForResult(new Intent(TipsAndTricks.this, Orbot.class), 1);
}
});