|
|
@ -38,6 +38,7 @@ public class SettingsActivity extends Activity { |
|
|
|
static SharedPreferences.Editor mEditPrefs; |
|
|
|
static SharedPreferences.Editor mEditPrefs; |
|
|
|
static int agentChoice; |
|
|
|
static int agentChoice; |
|
|
|
static String homepage; |
|
|
|
static String homepage; |
|
|
|
|
|
|
|
static String searchurl; |
|
|
|
static TextView agentText; |
|
|
|
static TextView agentText; |
|
|
|
static String agent; |
|
|
|
static String agent; |
|
|
|
static TextView download; |
|
|
|
static TextView download; |
|
|
@ -74,6 +75,9 @@ public class SettingsActivity extends Activity { |
|
|
|
searchText = (TextView) findViewById(R.id.searchText); |
|
|
|
searchText = (TextView) findViewById(R.id.searchText); |
|
|
|
|
|
|
|
|
|
|
|
switch (settings.getInt("search", 1)) { |
|
|
|
switch (settings.getInt("search", 1)) { |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
searchText.setText("Custom URL"); |
|
|
|
|
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
searchText.setText("Google"); |
|
|
|
searchText.setText("Google"); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -226,20 +230,24 @@ public class SettingsActivity extends Activity { |
|
|
|
SettingsActivity.this); |
|
|
|
SettingsActivity.this); |
|
|
|
picker.setTitle(getResources().getString( |
|
|
|
picker.setTitle(getResources().getString( |
|
|
|
R.string.title_search_engine)); |
|
|
|
R.string.title_search_engine)); |
|
|
|
CharSequence[] chars = { "Google", "Bing", "Yahoo", |
|
|
|
CharSequence[] chars = { getResources().getString(R.string.custom_url), |
|
|
|
|
|
|
|
"Google", "Bing", "Yahoo", |
|
|
|
"StartPage", "DuckDuckGo (Privacy)" , "Baidu (Chinese)", "Yandex (Russian)", "DuckDuckGo Lite (Privacy)"}; |
|
|
|
"StartPage", "DuckDuckGo (Privacy)" , "Baidu (Chinese)", "Yandex (Russian)", "DuckDuckGo Lite (Privacy)"}; |
|
|
|
|
|
|
|
|
|
|
|
int n = settings.getInt("search", 1); |
|
|
|
int n = settings.getInt("search", 1); |
|
|
|
|
|
|
|
|
|
|
|
picker.setSingleChoiceItems(chars, n - 1, |
|
|
|
picker.setSingleChoiceItems(chars, n, |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
int which) { |
|
|
|
int which) { |
|
|
|
mEditPrefs.putInt("search", which + 1); |
|
|
|
mEditPrefs.putInt("search", which); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
switch (which + 1) { |
|
|
|
switch (which) { |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
searchUrlPicker(); |
|
|
|
|
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
searchText.setText("Google"); |
|
|
|
searchText.setText("Google"); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -282,6 +290,33 @@ public class SettingsActivity extends Activity { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void searchUrlPicker() { |
|
|
|
|
|
|
|
final AlertDialog.Builder urlPicker = new AlertDialog.Builder( |
|
|
|
|
|
|
|
SettingsActivity.this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urlPicker.setTitle(getResources().getString( |
|
|
|
|
|
|
|
R.string.custom_url)); |
|
|
|
|
|
|
|
final EditText getSearchUrl = new EditText(SettingsActivity.this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
searchurl = settings.getString("searchurl", FinalVariables.GOOGLE_SEARCH); |
|
|
|
|
|
|
|
getSearchUrl.setText(searchurl); |
|
|
|
|
|
|
|
urlPicker.setView(getSearchUrl); |
|
|
|
|
|
|
|
urlPicker.setPositiveButton( |
|
|
|
|
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
String text = getSearchUrl.getText().toString(); |
|
|
|
|
|
|
|
mEditPrefs.putString("searchurl", text); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
searchText.setText( getResources().getString(R.string.custom_url) + ": " + text); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
urlPicker.show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void clickListenerForCheckBoxes(RelativeLayout one, |
|
|
|
public void clickListenerForCheckBoxes(RelativeLayout one, |
|
|
|
RelativeLayout two, RelativeLayout three, final CheckBox loc, |
|
|
|
RelativeLayout two, RelativeLayout three, final CheckBox loc, |
|
|
|
final CheckBox full, final CheckBox flash) { |
|
|
|
final CheckBox full, final CheckBox flash) { |
|
|
|