|
|
@ -141,27 +141,20 @@ public class SettingsActivity extends Activity { |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
boolean locationBool = mPreferences.getBoolean( |
|
|
|
boolean locationBool = mPreferences.getBoolean(PreferenceConstants.LOCATION, false); |
|
|
|
PreferenceConstants.LOCATION, false); |
|
|
|
int flashNum = mPreferences.getInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
int flashNum = mPreferences.getInt( |
|
|
|
boolean fullScreenBool = mPreferences.getBoolean(PreferenceConstants.FULL_SCREEN, false); |
|
|
|
PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
|
|
|
|
boolean fullScreenBool = mPreferences.getBoolean( |
|
|
|
|
|
|
|
PreferenceConstants.FULL_SCREEN, false); |
|
|
|
|
|
|
|
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1); |
|
|
|
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1); |
|
|
|
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, |
|
|
|
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
|
|
|
Constants.HOMEPAGE); |
|
|
|
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
mDownloadLocation = mPreferences.getString( |
|
|
|
|
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
|
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
|
|
|
|
|
|
|
|
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' |
|
|
|
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + mDownloadLocation); |
|
|
|
+ mDownloadLocation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String code = "HOLO"; |
|
|
|
String code = "HOLO"; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
PackageInfo p = getPackageManager().getPackageInfo( |
|
|
|
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0); |
|
|
|
getPackageName(), 0); |
|
|
|
|
|
|
|
code = p.versionName; |
|
|
|
code = p.versionName; |
|
|
|
} catch (NameNotFoundException e) { |
|
|
|
} catch (NameNotFoundException e) { |
|
|
|
// TODO add logging
|
|
|
|
// TODO add logging
|
|
|
@ -172,34 +165,27 @@ public class SettingsActivity extends Activity { |
|
|
|
version.setText(code + ""); |
|
|
|
version.setText(code + ""); |
|
|
|
|
|
|
|
|
|
|
|
if (mHomepage.contains("about:home")) { |
|
|
|
if (mHomepage.contains("about:home")) { |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
mHomepageText.setText(getResources().getString(R.string.action_homepage)); |
|
|
|
R.string.action_homepage)); |
|
|
|
|
|
|
|
} else if (mHomepage.contains("about:blank")) { |
|
|
|
} else if (mHomepage.contains("about:blank")) { |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
mHomepageText.setText(getResources().getString(R.string.action_blank)); |
|
|
|
R.string.action_blank)); |
|
|
|
|
|
|
|
} else if (mHomepage.contains("about:bookmarks")) { |
|
|
|
} else if (mHomepage.contains("about:bookmarks")) { |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
mHomepageText.setText(getResources().getString(R.string.action_bookmarks)); |
|
|
|
R.string.action_bookmarks)); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mHomepageText.setText(mHomepage); |
|
|
|
mHomepageText.setText(mHomepage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (mAgentChoice) { |
|
|
|
switch (mAgentChoice) { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
mAgentTextView.setText(getResources().getString(R.string.agent_default)); |
|
|
|
R.string.agent_default)); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
mAgentTextView.setText(getResources().getString(R.string.agent_desktop)); |
|
|
|
R.string.agent_desktop)); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
mAgentTextView.setText(getResources().getString(R.string.agent_mobile)); |
|
|
|
R.string.agent_mobile)); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
mAgentTextView.setText(getResources().getString(R.string.agent_custom)); |
|
|
|
R.string.agent_custom)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
RelativeLayout r1, r2, r3, r4, r5, licenses; |
|
|
|
RelativeLayout r1, r2, r3, r4, r5, licenses; |
|
|
|
r1 = (RelativeLayout) findViewById(R.id.setR1); |
|
|
|
r1 = (RelativeLayout) findViewById(R.id.setR1); |
|
|
@ -239,15 +225,12 @@ public class SettingsActivity extends Activity { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
flash.setChecked(false); |
|
|
|
flash.setChecked(false); |
|
|
|
} |
|
|
|
} |
|
|
|
adblock.setChecked(mPreferences.getBoolean( |
|
|
|
adblock.setChecked(mPreferences.getBoolean(PreferenceConstants.BLOCK_ADS, false)); |
|
|
|
PreferenceConstants.BLOCK_ADS, false)); |
|
|
|
orbot.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_PROXY, false)); |
|
|
|
orbot.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_PROXY, |
|
|
|
|
|
|
|
false)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initSwitch(location, fullScreen, flash, adblock, orbot); |
|
|
|
initSwitch(location, fullScreen, flash, adblock, orbot); |
|
|
|
clickListenerForSwitches(layoutLocation, layoutFullScreen, layoutFlash, |
|
|
|
clickListenerForSwitches(layoutLocation, layoutFullScreen, layoutFlash, layoutBlockAds, |
|
|
|
layoutBlockAds, layoutOrbot, location, fullScreen, flash, |
|
|
|
layoutOrbot, location, fullScreen, flash, adblock, orbot); |
|
|
|
adblock, orbot); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent); |
|
|
|
RelativeLayout agent = (RelativeLayout) findViewById(R.id.layoutUserAgent); |
|
|
|
RelativeLayout download = (RelativeLayout) findViewById(R.id.layoutDownload); |
|
|
|
RelativeLayout download = (RelativeLayout) findViewById(R.id.layoutDownload); |
|
|
@ -271,69 +254,61 @@ public class SettingsActivity extends Activity { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
picker.setTitle(getResources().getString( |
|
|
|
picker.setTitle(getResources().getString(R.string.title_search_engine)); |
|
|
|
R.string.title_search_engine)); |
|
|
|
CharSequence[] chars = { getResources().getString(R.string.custom_url), "Google", |
|
|
|
CharSequence[] chars = { |
|
|
|
"Android Search", "Bing", "Yahoo", "StartPage", "StartPage (Mobile)", |
|
|
|
getResources().getString(R.string.custom_url), |
|
|
|
"DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", "Baidu (Chinese)", |
|
|
|
"Google", "Android Search", "Bing", "Yahoo", |
|
|
|
"Yandex (Russian)" }; |
|
|
|
"StartPage", "StartPage (Mobile)", |
|
|
|
|
|
|
|
"DuckDuckGo (Privacy)", "DuckDuckGo Lite (Privacy)", |
|
|
|
|
|
|
|
"Baidu (Chinese)", "Yandex (Russian)"}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int n = mPreferences.getInt(PreferenceConstants.SEARCH, 1); |
|
|
|
int n = mPreferences.getInt(PreferenceConstants.SEARCH, 1); |
|
|
|
|
|
|
|
|
|
|
|
picker.setSingleChoiceItems(chars, n, |
|
|
|
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(PreferenceConstants.SEARCH, which); |
|
|
|
mEditPrefs.putInt(PreferenceConstants.SEARCH, |
|
|
|
mEditPrefs.commit(); |
|
|
|
which); |
|
|
|
switch (which) { |
|
|
|
mEditPrefs.commit(); |
|
|
|
case 0: |
|
|
|
switch (which) { |
|
|
|
searchUrlPicker(); |
|
|
|
case 0: |
|
|
|
break; |
|
|
|
searchUrlPicker(); |
|
|
|
case 1: |
|
|
|
break; |
|
|
|
mSearchText.setText("Google"); |
|
|
|
case 1: |
|
|
|
break; |
|
|
|
mSearchText.setText("Google"); |
|
|
|
case 2: |
|
|
|
break; |
|
|
|
mSearchText.setText("Android Search"); |
|
|
|
case 2: |
|
|
|
break; |
|
|
|
mSearchText.setText("Android Search"); |
|
|
|
case 3: |
|
|
|
break; |
|
|
|
mSearchText.setText("Bing"); |
|
|
|
case 3: |
|
|
|
break; |
|
|
|
mSearchText.setText("Bing"); |
|
|
|
case 4: |
|
|
|
break; |
|
|
|
mSearchText.setText("Yahoo"); |
|
|
|
case 4: |
|
|
|
break; |
|
|
|
mSearchText.setText("Yahoo"); |
|
|
|
case 5: |
|
|
|
break; |
|
|
|
mSearchText.setText("StartPage"); |
|
|
|
case 5: |
|
|
|
break; |
|
|
|
mSearchText.setText("StartPage"); |
|
|
|
case 6: |
|
|
|
break; |
|
|
|
mSearchText.setText("StartPage (Mobile)"); |
|
|
|
case 6: |
|
|
|
break; |
|
|
|
mSearchText.setText("StartPage (Mobile)"); |
|
|
|
case 7: |
|
|
|
break; |
|
|
|
mSearchText.setText("DuckDuckGo"); |
|
|
|
case 7: |
|
|
|
break; |
|
|
|
mSearchText.setText("DuckDuckGo"); |
|
|
|
case 8: |
|
|
|
break; |
|
|
|
mSearchText.setText("DuckDuckGo Lite"); |
|
|
|
case 8: |
|
|
|
break; |
|
|
|
mSearchText.setText("DuckDuckGo Lite"); |
|
|
|
case 9: |
|
|
|
break; |
|
|
|
mSearchText.setText("Baidu"); |
|
|
|
case 9: |
|
|
|
break; |
|
|
|
mSearchText.setText("Baidu"); |
|
|
|
case 10: |
|
|
|
break; |
|
|
|
mSearchText.setText("Yandex"); |
|
|
|
case 10: |
|
|
|
} |
|
|
|
mSearchText.setText("Yandex"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
|
|
|
}); |
|
|
|
|
|
|
|
picker.setNeutralButton( |
|
|
|
|
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -353,29 +328,25 @@ public class SettingsActivity extends Activity { |
|
|
|
Constants.GOOGLE_SEARCH); |
|
|
|
Constants.GOOGLE_SEARCH); |
|
|
|
getSearchUrl.setText(mSearchUrl); |
|
|
|
getSearchUrl.setText(mSearchUrl); |
|
|
|
urlPicker.setView(getSearchUrl); |
|
|
|
urlPicker.setView(getSearchUrl); |
|
|
|
urlPicker.setPositiveButton(getResources() |
|
|
|
urlPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
|
|
|
.getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
String text = getSearchUrl.getText().toString(); |
|
|
|
String text = getSearchUrl.getText().toString(); |
|
|
|
mEditPrefs.putString(PreferenceConstants.SEARCH_URL, |
|
|
|
mEditPrefs.putString(PreferenceConstants.SEARCH_URL, text); |
|
|
|
text); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mSearchText.setText(getResources().getString( |
|
|
|
mSearchText.setText(getResources().getString(R.string.custom_url) + ": " |
|
|
|
R.string.custom_url) |
|
|
|
+ text); |
|
|
|
+ ": " + text); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
urlPicker.show(); |
|
|
|
urlPicker.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void clickListenerForSwitches(RelativeLayout one, |
|
|
|
public void clickListenerForSwitches(RelativeLayout one, RelativeLayout two, |
|
|
|
RelativeLayout two, RelativeLayout three, |
|
|
|
RelativeLayout three, RelativeLayout layoutBlockAds, RelativeLayout layoutOrbot, |
|
|
|
RelativeLayout layoutBlockAds, RelativeLayout layoutOrbot, |
|
|
|
final Switch loc, final Switch full, final Switch flash, final Switch adblock, |
|
|
|
final Switch loc, final Switch full, final Switch flash, |
|
|
|
final Switch orbot) { |
|
|
|
final Switch adblock, final Switch orbot) { |
|
|
|
|
|
|
|
layoutBlockAds.setOnClickListener(new OnClickListener() { |
|
|
|
layoutBlockAds.setOnClickListener(new OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -407,9 +378,9 @@ public class SettingsActivity extends Activity { |
|
|
|
if (API < 19) { |
|
|
|
if (API < 19) { |
|
|
|
flash.setChecked(!flash.isChecked()); |
|
|
|
flash.setChecked(!flash.isChecked()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Utils.createInformativeDialog(mContext, getResources() |
|
|
|
Utils.createInformativeDialog(mContext, |
|
|
|
.getString(R.string.title_warning), getResources() |
|
|
|
getResources().getString(R.string.title_warning), getResources() |
|
|
|
.getString(R.string.dialog_adobe_dead)); |
|
|
|
.getString(R.string.dialog_adobe_dead)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -421,8 +392,7 @@ public class SettingsActivity extends Activity { |
|
|
|
if (orbot.isEnabled()) { |
|
|
|
if (orbot.isEnabled()) { |
|
|
|
orbot.setChecked(!orbot.isChecked()); |
|
|
|
orbot.setChecked(!orbot.isChecked()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Utils.showToast(mContext, |
|
|
|
Utils.showToast(mContext, getResources().getString(R.string.install_orbot)); |
|
|
|
getResources().getString(R.string.install_orbot)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -438,10 +408,9 @@ public class SettingsActivity extends Activity { |
|
|
|
mEasterEggCounter++; |
|
|
|
mEasterEggCounter++; |
|
|
|
if (mEasterEggCounter == 10) { |
|
|
|
if (mEasterEggCounter == 10) { |
|
|
|
|
|
|
|
|
|
|
|
startActivity(new Intent( |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri |
|
|
|
Intent.ACTION_VIEW, |
|
|
|
.parse("http://imgs.xkcd.com/comics/compiling.png"), mContext, |
|
|
|
Uri.parse("http://imgs.xkcd.com/comics/compiling.png"), |
|
|
|
MainActivity.class)); |
|
|
|
mContext, MainActivity.class)); |
|
|
|
|
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
mEasterEggCounter = 0; |
|
|
|
mEasterEggCounter = 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -450,13 +419,12 @@ public class SettingsActivity extends Activity { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void initSwitch(Switch location, Switch fullscreen, Switch flash, |
|
|
|
public void initSwitch(Switch location, Switch fullscreen, Switch flash, Switch adblock, |
|
|
|
Switch adblock, Switch orbot) { |
|
|
|
Switch orbot) { |
|
|
|
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_ADS, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.BLOCK_ADS, isChecked); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
@ -465,8 +433,7 @@ public class SettingsActivity extends Activity { |
|
|
|
location.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
location.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
@ -477,21 +444,18 @@ public class SettingsActivity extends Activity { |
|
|
|
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
if (isChecked) { |
|
|
|
if (isChecked) { |
|
|
|
getFlashChoice(); |
|
|
|
getFlashChoice(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
0); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean flashInstalled = false; |
|
|
|
boolean flashInstalled = false; |
|
|
|
try { |
|
|
|
try { |
|
|
|
PackageManager pm = getPackageManager(); |
|
|
|
PackageManager pm = getPackageManager(); |
|
|
|
ApplicationInfo ai = pm.getApplicationInfo( |
|
|
|
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0); |
|
|
|
"com.adobe.flashplayer", 0); |
|
|
|
|
|
|
|
if (ai != null) { |
|
|
|
if (ai != null) { |
|
|
|
flashInstalled = true; |
|
|
|
flashInstalled = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -499,22 +463,17 @@ public class SettingsActivity extends Activity { |
|
|
|
flashInstalled = false; |
|
|
|
flashInstalled = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!flashInstalled && isChecked) { |
|
|
|
if (!flashInstalled && isChecked) { |
|
|
|
Utils.createInformativeDialog( |
|
|
|
Utils.createInformativeDialog(SettingsActivity.this, |
|
|
|
SettingsActivity.this, |
|
|
|
getResources().getString(R.string.title_warning), getResources() |
|
|
|
getResources().getString(R.string.title_warning), |
|
|
|
.getString(R.string.dialog_adobe_not_installed)); |
|
|
|
getResources().getString( |
|
|
|
|
|
|
|
R.string.dialog_adobe_not_installed)); |
|
|
|
|
|
|
|
buttonView.setChecked(false); |
|
|
|
buttonView.setChecked(false); |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
0); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
|
} else if ((API >= 17) && isChecked) { |
|
|
|
} else if ((API >= 17) && isChecked) { |
|
|
|
Utils.createInformativeDialog( |
|
|
|
Utils.createInformativeDialog(SettingsActivity.this, |
|
|
|
SettingsActivity.this, |
|
|
|
getResources().getString(R.string.title_warning), getResources() |
|
|
|
getResources().getString(R.string.title_warning), |
|
|
|
.getString(R.string.dialog_adobe_unsupported)); |
|
|
|
getResources().getString( |
|
|
|
|
|
|
|
R.string.dialog_adobe_unsupported)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -522,10 +481,8 @@ public class SettingsActivity extends Activity { |
|
|
|
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, |
|
|
|
|
|
|
|
isChecked); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -539,8 +496,7 @@ public class SettingsActivity extends Activity { |
|
|
|
orbot.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
orbot.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.USE_PROXY, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.USE_PROXY, isChecked); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
@ -551,54 +507,43 @@ public class SettingsActivity extends Activity { |
|
|
|
|
|
|
|
|
|
|
|
private void getFlashChoice() { |
|
|
|
private void getFlashChoice() { |
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); |
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); |
|
|
|
builder.setTitle(mContext.getResources() |
|
|
|
builder.setTitle(mContext.getResources().getString(R.string.title_flash)); |
|
|
|
.getString(R.string.title_flash)); |
|
|
|
|
|
|
|
builder.setMessage(getResources().getString(R.string.flash)) |
|
|
|
builder.setMessage(getResources().getString(R.string.flash)) |
|
|
|
.setCancelable(true) |
|
|
|
.setCancelable(true) |
|
|
|
.setPositiveButton( |
|
|
|
.setPositiveButton(getResources().getString(R.string.action_manual), |
|
|
|
getResources().getString(R.string.action_manual), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int id) { |
|
|
|
public void onClick(DialogInterface dialog, int id) { |
|
|
|
mEditPrefs |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 1); |
|
|
|
.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, |
|
|
|
|
|
|
|
1); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.setNegativeButton( |
|
|
|
.setNegativeButton(getResources().getString(R.string.action_auto), |
|
|
|
getResources().getString(R.string.action_auto), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 2); |
|
|
|
mEditPrefs |
|
|
|
|
|
|
|
.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, |
|
|
|
|
|
|
|
2); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
}).setOnCancelListener(new OnCancelListener() { |
|
|
|
}).setOnCancelListener(new OnCancelListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCancel(DialogInterface dialog) { |
|
|
|
public void onCancel(DialogInterface dialog) { |
|
|
|
mEditPrefs.putInt( |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
AlertDialog alert = builder.create(); |
|
|
|
AlertDialog alert = builder.create(); |
|
|
|
alert.show(); |
|
|
|
alert.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void initCheckBox(CheckBox location, CheckBox fullscreen, |
|
|
|
public void initCheckBox(CheckBox location, CheckBox fullscreen, CheckBox flash) { |
|
|
|
CheckBox flash) { |
|
|
|
|
|
|
|
location.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
location.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.LOCATION, isChecked); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
@ -608,8 +553,7 @@ public class SettingsActivity extends Activity { |
|
|
|
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
|
|
|
|
int n = 0; |
|
|
|
int n = 0; |
|
|
|
if (isChecked) { |
|
|
|
if (isChecked) { |
|
|
|
n = 1; |
|
|
|
n = 1; |
|
|
@ -619,8 +563,7 @@ public class SettingsActivity extends Activity { |
|
|
|
boolean flashInstalled = false; |
|
|
|
boolean flashInstalled = false; |
|
|
|
try { |
|
|
|
try { |
|
|
|
PackageManager pm = getPackageManager(); |
|
|
|
PackageManager pm = getPackageManager(); |
|
|
|
ApplicationInfo ai = pm.getApplicationInfo( |
|
|
|
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0); |
|
|
|
"com.adobe.flashplayer", 0); |
|
|
|
|
|
|
|
if (ai != null) { |
|
|
|
if (ai != null) { |
|
|
|
flashInstalled = true; |
|
|
|
flashInstalled = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -628,22 +571,17 @@ public class SettingsActivity extends Activity { |
|
|
|
flashInstalled = false; |
|
|
|
flashInstalled = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!flashInstalled && isChecked) { |
|
|
|
if (!flashInstalled && isChecked) { |
|
|
|
Utils.createInformativeDialog( |
|
|
|
Utils.createInformativeDialog(SettingsActivity.this, |
|
|
|
SettingsActivity.this, |
|
|
|
getResources().getString(R.string.title_warning), getResources() |
|
|
|
getResources().getString(R.string.title_warning), |
|
|
|
.getString(R.string.dialog_adobe_not_installed)); |
|
|
|
getResources().getString( |
|
|
|
|
|
|
|
R.string.dialog_adobe_not_installed)); |
|
|
|
|
|
|
|
buttonView.setChecked(false); |
|
|
|
buttonView.setChecked(false); |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, |
|
|
|
mEditPrefs.putInt(PreferenceConstants.ADOBE_FLASH_SUPPORT, 0); |
|
|
|
0); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
|
} else if ((API > 17) && isChecked) { |
|
|
|
} else if ((API > 17) && isChecked) { |
|
|
|
Utils.createInformativeDialog( |
|
|
|
Utils.createInformativeDialog(SettingsActivity.this, |
|
|
|
SettingsActivity.this, |
|
|
|
getResources().getString(R.string.title_warning), getResources() |
|
|
|
getResources().getString(R.string.title_warning), |
|
|
|
.getString(R.string.dialog_adobe_unsupported)); |
|
|
|
getResources().getString( |
|
|
|
|
|
|
|
R.string.dialog_adobe_unsupported)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -651,10 +589,8 @@ public class SettingsActivity extends Activity { |
|
|
|
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
fullscreen.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, |
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
|
|
boolean isChecked) { |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked); |
|
|
|
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, |
|
|
|
|
|
|
|
isChecked); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -667,65 +603,55 @@ public class SettingsActivity extends Activity { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
AlertDialog.Builder agentPicker = new AlertDialog.Builder( |
|
|
|
AlertDialog.Builder agentPicker = new AlertDialog.Builder(mActivity); |
|
|
|
mActivity); |
|
|
|
agentPicker.setTitle(getResources().getString(R.string.title_user_agent)); |
|
|
|
agentPicker.setTitle(getResources().getString( |
|
|
|
mAgentChoice = mPreferences.getInt(PreferenceConstants.USER_AGENT, 1); |
|
|
|
R.string.title_user_agent)); |
|
|
|
agentPicker.setSingleChoiceItems(R.array.user_agent, mAgentChoice - 1, |
|
|
|
mAgentChoice = mPreferences.getInt( |
|
|
|
|
|
|
|
PreferenceConstants.USER_AGENT, 1); |
|
|
|
|
|
|
|
agentPicker.setSingleChoiceItems(R.array.user_agent, |
|
|
|
|
|
|
|
mAgentChoice - 1, |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
mEditPrefs.putInt(PreferenceConstants.USER_AGENT, which + 1); |
|
|
|
mEditPrefs.putInt( |
|
|
|
|
|
|
|
PreferenceConstants.USER_AGENT, |
|
|
|
|
|
|
|
which + 1); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
switch (which + 1) { |
|
|
|
switch (which + 1) { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
mAgentTextView.setText(getResources() |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
.getString(R.string.agent_default)); |
|
|
|
R.string.agent_default)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
mAgentTextView.setText(getResources() |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
.getString(R.string.agent_desktop)); |
|
|
|
R.string.agent_desktop)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
mAgentTextView.setText(getResources() |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
.getString(R.string.agent_mobile)); |
|
|
|
R.string.agent_mobile)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
mAgentTextView.setText(getResources() |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
.getString(R.string.agent_custom)); |
|
|
|
R.string.agent_custom)); |
|
|
|
agentPicker(); |
|
|
|
agentPicker(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
agentPicker.setNeutralButton( |
|
|
|
agentPicker.setNeutralButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
agentPicker |
|
|
|
agentPicker.setOnCancelListener(new DialogInterface.OnCancelListener() { |
|
|
|
.setOnCancelListener(new DialogInterface.OnCancelListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCancel(DialogInterface dialog) { |
|
|
|
public void onCancel(DialogInterface dialog) { |
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
Log.i("Cancelled", ""); |
|
|
|
Log.i("Cancelled", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
agentPicker.show(); |
|
|
|
agentPicker.show(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -734,25 +660,20 @@ public class SettingsActivity extends Activity { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void agentPicker() { |
|
|
|
public void agentPicker() { |
|
|
|
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder( |
|
|
|
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity); |
|
|
|
mActivity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agentStringPicker.setTitle(getResources().getString( |
|
|
|
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent)); |
|
|
|
R.string.title_user_agent)); |
|
|
|
|
|
|
|
final EditText getAgent = new EditText(this); |
|
|
|
final EditText getAgent = new EditText(this); |
|
|
|
agentStringPicker.setView(getAgent); |
|
|
|
agentStringPicker.setView(getAgent); |
|
|
|
agentStringPicker.setPositiveButton( |
|
|
|
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
String text = getAgent.getText().toString(); |
|
|
|
String text = getAgent.getText().toString(); |
|
|
|
mEditPrefs.putString( |
|
|
|
mEditPrefs.putString(PreferenceConstants.USER_AGENT_STRING, text); |
|
|
|
PreferenceConstants.USER_AGENT_STRING, text); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mAgentTextView.setText(getResources().getString( |
|
|
|
mAgentTextView.setText(getResources().getString(R.string.agent_custom)); |
|
|
|
R.string.agent_custom)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
agentStringPicker.show(); |
|
|
|
agentStringPicker.show(); |
|
|
@ -765,10 +686,8 @@ public class SettingsActivity extends Activity { |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
|
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
picker.setTitle(getResources().getString( |
|
|
|
picker.setTitle(getResources().getString(R.string.title_download_location)); |
|
|
|
R.string.title_download_location)); |
|
|
|
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
mDownloadLocation = mPreferences.getString( |
|
|
|
|
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
|
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
int n; |
|
|
|
int n; |
|
|
|
if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) { |
|
|
|
if (mDownloadLocation.contains(Environment.DIRECTORY_DOWNLOADS)) { |
|
|
@ -781,20 +700,16 @@ public class SettingsActivity extends Activity { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (which + 1) { |
|
|
|
switch (which + 1) { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
mEditPrefs |
|
|
|
mEditPrefs.putString( |
|
|
|
.putString( |
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mDownloadTextView |
|
|
|
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' |
|
|
|
.setText(Constants.EXTERNAL_STORAGE |
|
|
|
+ Environment.DIRECTORY_DOWNLOADS); |
|
|
|
+ '/' |
|
|
|
|
|
|
|
+ Environment.DIRECTORY_DOWNLOADS); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
downPicker(); |
|
|
|
downPicker(); |
|
|
@ -803,13 +718,11 @@ public class SettingsActivity extends Activity { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
picker.setNeutralButton( |
|
|
|
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -820,28 +733,23 @@ public class SettingsActivity extends Activity { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void homePicker() { |
|
|
|
public void homePicker() { |
|
|
|
final AlertDialog.Builder homePicker = new AlertDialog.Builder( |
|
|
|
final AlertDialog.Builder homePicker = new AlertDialog.Builder(mActivity); |
|
|
|
mActivity); |
|
|
|
homePicker.setTitle(getResources().getString(R.string.title_custom_homepage)); |
|
|
|
homePicker.setTitle(getResources().getString( |
|
|
|
|
|
|
|
R.string.title_custom_homepage)); |
|
|
|
|
|
|
|
final EditText getHome = new EditText(this); |
|
|
|
final EditText getHome = new EditText(this); |
|
|
|
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, |
|
|
|
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
|
|
|
Constants.HOMEPAGE); |
|
|
|
|
|
|
|
if (!mHomepage.startsWith("about:")) { |
|
|
|
if (!mHomepage.startsWith("about:")) { |
|
|
|
getHome.setText(mHomepage); |
|
|
|
getHome.setText(mHomepage); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
getHome.setText("http://www.google.com"); |
|
|
|
getHome.setText("http://www.google.com"); |
|
|
|
} |
|
|
|
} |
|
|
|
homePicker.setView(getHome); |
|
|
|
homePicker.setView(getHome); |
|
|
|
homePicker.setPositiveButton( |
|
|
|
homePicker.setPositiveButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
String text = getHome.getText().toString(); |
|
|
|
String text = getHome.getText().toString(); |
|
|
|
mEditPrefs |
|
|
|
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, text); |
|
|
|
.putString(PreferenceConstants.HOMEPAGE, text); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mHomepageText.setText(text); |
|
|
|
mHomepageText.setText(text); |
|
|
|
} |
|
|
|
} |
|
|
@ -851,21 +759,17 @@ public class SettingsActivity extends Activity { |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
public void downPicker() { |
|
|
|
public void downPicker() { |
|
|
|
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder( |
|
|
|
final AlertDialog.Builder downLocationPicker = new AlertDialog.Builder(mActivity); |
|
|
|
mActivity); |
|
|
|
|
|
|
|
LinearLayout layout = new LinearLayout(this); |
|
|
|
LinearLayout layout = new LinearLayout(this); |
|
|
|
downLocationPicker.setTitle(getResources().getString( |
|
|
|
downLocationPicker.setTitle(getResources().getString(R.string.title_download_location)); |
|
|
|
R.string.title_download_location)); |
|
|
|
|
|
|
|
final EditText getDownload = new EditText(this); |
|
|
|
final EditText getDownload = new EditText(this); |
|
|
|
getDownload.setBackgroundResource(0); |
|
|
|
getDownload.setBackgroundResource(0); |
|
|
|
mDownloadLocation = mPreferences.getString( |
|
|
|
mDownloadLocation = mPreferences.getString(PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, |
|
|
|
|
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
Environment.DIRECTORY_DOWNLOADS); |
|
|
|
int padding = Utils.convertToDensityPixels(this, 10); |
|
|
|
int padding = Utils.convertToDensityPixels(this, 10); |
|
|
|
|
|
|
|
|
|
|
|
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams( |
|
|
|
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams( |
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT, |
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); |
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getDownload.setLayoutParams(lparams); |
|
|
|
getDownload.setLayoutParams(lparams); |
|
|
|
getDownload.setTextColor(Color.DKGRAY); |
|
|
|
getDownload.setTextColor(Color.DKGRAY); |
|
|
@ -880,25 +784,20 @@ public class SettingsActivity extends Activity { |
|
|
|
layout.addView(v); |
|
|
|
layout.addView(v); |
|
|
|
layout.addView(getDownload); |
|
|
|
layout.addView(getDownload); |
|
|
|
if (API < 16) { |
|
|
|
if (API < 16) { |
|
|
|
layout.setBackgroundDrawable(getResources().getDrawable( |
|
|
|
layout.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.edit_text)); |
|
|
|
android.R.drawable.edit_text)); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
layout.setBackground(getResources().getDrawable( |
|
|
|
layout.setBackground(getResources().getDrawable(android.R.drawable.edit_text)); |
|
|
|
android.R.drawable.edit_text)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
downLocationPicker.setView(layout); |
|
|
|
downLocationPicker.setView(layout); |
|
|
|
downLocationPicker.setPositiveButton( |
|
|
|
downLocationPicker.setPositiveButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
String text = getDownload.getText().toString(); |
|
|
|
String text = getDownload.getText().toString(); |
|
|
|
mEditPrefs.putString( |
|
|
|
mEditPrefs.putString(PreferenceConstants.DOWNLOAD_DIRECTORY, text); |
|
|
|
PreferenceConstants.DOWNLOAD_DIRECTORY, text); |
|
|
|
|
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE |
|
|
|
mDownloadTextView.setText(Constants.EXTERNAL_STORAGE + '/' + text); |
|
|
|
+ '/' + text); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
downLocationPicker.show(); |
|
|
|
downLocationPicker.show(); |
|
|
@ -911,8 +810,8 @@ public class SettingsActivity extends Activity { |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity); |
|
|
|
picker.setTitle(getResources().getString(R.string.home)); |
|
|
|
picker.setTitle(getResources().getString(R.string.home)); |
|
|
|
mHomepage = mPreferences.getString( |
|
|
|
mHomepage = mPreferences |
|
|
|
PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
|
|
|
.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE); |
|
|
|
int n; |
|
|
|
int n; |
|
|
|
if (mHomepage.contains("about:home")) { |
|
|
|
if (mHomepage.contains("about:home")) { |
|
|
|
n = 1; |
|
|
|
n = 1; |
|
|
@ -928,35 +827,29 @@ public class SettingsActivity extends Activity { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (which + 1) { |
|
|
|
switch (which + 1) { |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
mEditPrefs.putString( |
|
|
|
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
|
|
|
PreferenceConstants.HOMEPAGE, |
|
|
|
|
|
|
|
"about:home"); |
|
|
|
"about:home"); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mHomepageText |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
.setText(getResources().getString( |
|
|
|
R.string.action_homepage)); |
|
|
|
R.string.action_homepage)); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
mEditPrefs.putString( |
|
|
|
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
|
|
|
PreferenceConstants.HOMEPAGE, |
|
|
|
|
|
|
|
"about:blank"); |
|
|
|
"about:blank"); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mHomepageText.setText(getResources() |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
.getString(R.string.action_blank)); |
|
|
|
R.string.action_blank)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
mEditPrefs.putString( |
|
|
|
mEditPrefs.putString(PreferenceConstants.HOMEPAGE, |
|
|
|
PreferenceConstants.HOMEPAGE, |
|
|
|
|
|
|
|
"about:bookmarks"); |
|
|
|
"about:bookmarks"); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mEditPrefs.commit(); |
|
|
|
mHomepageText.setText(getResources() |
|
|
|
mHomepageText.setText(getResources().getString( |
|
|
|
.getString( |
|
|
|
R.string.action_bookmarks)); |
|
|
|
R.string.action_bookmarks)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
@ -966,13 +859,11 @@ public class SettingsActivity extends Activity { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
picker.setNeutralButton( |
|
|
|
picker.setNeutralButton(getResources().getString(R.string.action_ok), |
|
|
|
getResources().getString(R.string.action_ok), |
|
|
|
|
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
int which) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -987,8 +878,7 @@ public class SettingsActivity extends Activity { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
startActivity(new Intent(mContext, |
|
|
|
startActivity(new Intent(mContext, AdvancedSettingsActivity.class)); |
|
|
|
AdvancedSettingsActivity.class)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -1000,8 +890,7 @@ public class SettingsActivity extends Activity { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri |
|
|
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri |
|
|
|
.parse("http://twitter.com/ACRDevelopment"), mContext, |
|
|
|
.parse("http://twitter.com/ACRDevelopment"), mContext, MainActivity.class)); |
|
|
|
MainActivity.class)); |
|
|
|
|
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|