clean up wizard context use
This commit is contained in:
parent
0178d3e4de
commit
d5293340d5
|
@ -4,6 +4,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
import org.torproject.android.R;
|
import org.torproject.android.R;
|
||||||
import org.torproject.android.TorConstants;
|
import org.torproject.android.TorConstants;
|
||||||
|
import org.torproject.android.service.TorServiceUtils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -22,14 +23,12 @@ import android.widget.ListView;
|
||||||
|
|
||||||
public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
|
public class ChooseLocaleWizardActivity extends Activity implements TorConstants {
|
||||||
|
|
||||||
private Context context;
|
|
||||||
private int flag = 0;
|
private int flag = 0;
|
||||||
private ListView listLocales;
|
private ListView listLocales;
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
context = this;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,21 +46,11 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
setupUI();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setupUI ()
|
|
||||||
{
|
|
||||||
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void stepSix(){
|
private void stepSix(){
|
||||||
|
|
||||||
listLocales = (ListView)findViewById(R.id.wizard_locale_list);
|
listLocales = (ListView)findViewById(R.id.wizard_locale_list);
|
||||||
|
@ -84,7 +73,7 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
|
||||||
int arg2, long arg3) {
|
int arg2, long arg3) {
|
||||||
|
|
||||||
setLocalePref(arg2);
|
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) {
|
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)
|
private void setLocalePref(int selId)
|
||||||
{
|
{
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
Configuration config = getResources().getConfiguration();
|
Configuration config = getResources().getConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.torproject.android.R.drawable;
|
||||||
import org.torproject.android.R.id;
|
import org.torproject.android.R.id;
|
||||||
import org.torproject.android.R.layout;
|
import org.torproject.android.R.layout;
|
||||||
import org.torproject.android.R.string;
|
import org.torproject.android.R.string;
|
||||||
|
import org.torproject.android.service.TorServiceUtils;
|
||||||
import org.torproject.android.settings.AppManager;
|
import org.torproject.android.settings.AppManager;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -76,7 +77,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
|
||||||
|
|
||||||
private void setupUI ()
|
private void setupUI ()
|
||||||
{
|
{
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false);
|
boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false);
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
|
||||||
|
|
||||||
public void onClick(View v) {
|
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) {
|
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 rb1 = (RadioButton)findViewById(R.id.radio1);
|
||||||
RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
|
RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
Editor pEdit = prefs.edit();
|
Editor pEdit = prefs.edit();
|
||||||
pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());
|
pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.torproject.android.R.drawable;
|
||||||
import org.torproject.android.R.id;
|
import org.torproject.android.R.id;
|
||||||
import org.torproject.android.R.layout;
|
import org.torproject.android.R.layout;
|
||||||
import org.torproject.android.R.string;
|
import org.torproject.android.R.string;
|
||||||
|
import org.torproject.android.service.TorServiceUtils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -40,7 +41,7 @@ public class LotsaText extends Activity implements TorConstants{
|
||||||
super.onStart();
|
super.onStart();
|
||||||
setContentView(R.layout.scrollingtext_buttons_view);
|
setContentView(R.layout.scrollingtext_buttons_view);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",true);
|
boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",true);
|
||||||
if(wizardScreen1)
|
if(wizardScreen1)
|
||||||
|
@ -72,7 +73,7 @@ public class LotsaText extends Activity implements TorConstants{
|
||||||
|
|
||||||
private void stepOne() {
|
private void stepOne() {
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
Editor pEdit = prefs.edit();
|
Editor pEdit = prefs.edit();
|
||||||
pEdit.putBoolean("wizardscreen1",true);
|
pEdit.putBoolean("wizardscreen1",true);
|
||||||
|
@ -102,7 +103,7 @@ public class LotsaText extends Activity implements TorConstants{
|
||||||
|
|
||||||
private void stepTwo() {
|
private void stepTwo() {
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
Editor pEdit = prefs.edit();
|
Editor pEdit = prefs.edit();
|
||||||
pEdit.putBoolean("wizardscreen1",false);
|
pEdit.putBoolean("wizardscreen1",false);
|
||||||
|
@ -134,7 +135,7 @@ public class LotsaText extends Activity implements TorConstants{
|
||||||
btn2.setOnClickListener(new View.OnClickListener() {
|
btn2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
|
startActivityForResult(new Intent(LotsaText.this, Permissions.class), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.sufficientlysecure.rootcommands.RootCommands;
|
||||||
import org.torproject.android.R;
|
import org.torproject.android.R;
|
||||||
import org.torproject.android.TorConstants;
|
import org.torproject.android.TorConstants;
|
||||||
import org.torproject.android.service.TorService;
|
import org.torproject.android.service.TorService;
|
||||||
|
import org.torproject.android.service.TorServiceUtils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -92,7 +93,7 @@ public class Permissions extends Activity implements TorConstants {
|
||||||
|
|
||||||
//this is saying do not use root
|
//this is saying do not use root
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
Editor pEdit = prefs.edit();
|
Editor pEdit = prefs.edit();
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ public class Permissions extends Activity implements TorConstants {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//Check and Install iptables - TorTransProxy.testOwnerModule(this)
|
//Check and Install iptables - TorTransProxy.testOwnerModule(this)
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
|
|
||||||
boolean hasRoot = RootCommands.rootAccessGiven();
|
boolean hasRoot = RootCommands.rootAccessGiven();
|
||||||
Editor pEdit = prefs.edit();
|
Editor pEdit = prefs.edit();
|
||||||
|
@ -137,7 +138,7 @@ public class Permissions extends Activity implements TorConstants {
|
||||||
}
|
}
|
||||||
else
|
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) {
|
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) {
|
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) {
|
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() {
|
btn2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivityForResult(new Intent(getBaseContext(), TipsAndTricks.class), 1);
|
startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
|
||||||
|
|
||||||
public void onClick(View v) {
|
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() {
|
btn1.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
public void onClick(View v) {
|
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() {
|
btn2.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivityForResult(new Intent(getBaseContext(), Orbot.class), 1);
|
startActivityForResult(new Intent(TipsAndTricks.this, Orbot.class), 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue