@ -84,6 +84,7 @@ public class SettingsActivity extends Activity {
RelativeLayout layoutFullScreen = ( RelativeLayout ) findViewById ( R . id . layoutFullScreen ) ;
RelativeLayout layoutFullScreen = ( RelativeLayout ) findViewById ( R . id . layoutFullScreen ) ;
RelativeLayout layoutFlash = ( RelativeLayout ) findViewById ( R . id . layoutFlash ) ;
RelativeLayout layoutFlash = ( RelativeLayout ) findViewById ( R . id . layoutFlash ) ;
RelativeLayout layoutBlockAds = ( RelativeLayout ) findViewById ( R . id . layoutAdBlock ) ;
RelativeLayout layoutBlockAds = ( RelativeLayout ) findViewById ( R . id . layoutAdBlock ) ;
RelativeLayout layoutOrbot = ( RelativeLayout ) findViewById ( R . id . layoutUseOrbot ) ;
mSearchText = ( TextView ) findViewById ( R . id . searchText ) ;
mSearchText = ( TextView ) findViewById ( R . id . searchText ) ;
@ -129,15 +130,21 @@ 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 ( PreferenceConstants . LOCATION , false ) ;
boolean locationBool = mPreferences . getBoolean (
int flashNum = mPreferences . getInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
PreferenceConstants . LOCATION , false ) ;
boolean fullScreenBool = mPreferences . getBoolean ( PreferenceConstants . FULL_SCREEN , false ) ;
int flashNum = mPreferences . getInt (
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 , Constants . HOMEPAGE ) ;
mHomepage = mPreferences . getString ( PreferenceConstants . HOMEPAGE ,
mDownloadLocation = mPreferences . getString ( PreferenceConstants . DOWNLOAD_DIRECTORY ,
Constants . HOMEPAGE ) ;
mDownloadLocation = mPreferences . getString (
PreferenceConstants . DOWNLOAD_DIRECTORY ,
Environment . DIRECTORY_DOWNLOADS ) ;
Environment . DIRECTORY_DOWNLOADS ) ;
mDownloadTextView . setText ( Constants . EXTERNAL_STORAGE + "/" + mDownloadLocation ) ;
mDownloadTextView . setText ( Constants . EXTERNAL_STORAGE + "/"
+ mDownloadLocation ) ;
String code = "HOLO" ;
String code = "HOLO" ;
@ -157,8 +164,8 @@ public class SettingsActivity extends Activity {
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 ( )
mHomepageText . setText ( getResources ( ) . getString (
. 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 ) ) ;
@ -168,45 +175,52 @@ public class SettingsActivity extends Activity {
switch ( mAgentChoice ) {
switch ( mAgentChoice ) {
case 1 :
case 1 :
mAgentTextView . setText ( getResources ( ) . getString ( R . string . agent_default ) ) ;
mAgentTextView . setText ( getResources ( ) . getString (
R . string . agent_default ) ) ;
break ;
break ;
case 2 :
case 2 :
mAgentTextView . setText ( getResources ( ) . getString ( R . string . agent_desktop ) ) ;
mAgentTextView . setText ( getResources ( ) . getString (
R . string . agent_desktop ) ) ;
break ;
break ;
case 3 :
case 3 :
mAgentTextView . setText ( getResources ( ) . getString ( R . string . agent_mobile ) ) ;
mAgentTextView . setText ( getResources ( ) . getString (
R . string . agent_mobile ) ) ;
break ;
break ;
case 4 :
case 4 :
mAgentTextView . setText ( getResources ( ) . getString ( R . string . agent_custom ) ) ;
mAgentTextView . setText ( getResources ( ) . getString (
R . string . agent_custom ) ) ;
}
}
RelativeLayout r1 , r2 , r3 , r4 , licenses ;
RelativeLayout r1 , r2 , r3 , r4 , r5 , licenses ;
r1 = ( RelativeLayout ) findViewById ( R . id . setR1 ) ;
r1 = ( RelativeLayout ) findViewById ( R . id . setR1 ) ;
r2 = ( RelativeLayout ) findViewById ( R . id . setR2 ) ;
r2 = ( RelativeLayout ) findViewById ( R . id . setR2 ) ;
r3 = ( RelativeLayout ) findViewById ( R . id . setR3 ) ;
r3 = ( RelativeLayout ) findViewById ( R . id . setR3 ) ;
r4 = ( RelativeLayout ) findViewById ( R . id . setR4 ) ;
r4 = ( RelativeLayout ) findViewById ( R . id . setR4 ) ;
r5 = ( RelativeLayout ) findViewById ( R . id . setR5 ) ;
licenses = ( RelativeLayout ) findViewById ( R . id . layoutLicense ) ;
licenses = ( RelativeLayout ) findViewById ( R . id . layoutLicense ) ;
licenses . setOnClickListener ( new OnClickListener ( ) {
licenses . setOnClickListener ( new OnClickListener ( ) {
@Override
@Override
public void onClick ( View arg0 ) {
public void onClick ( View arg0 ) {
//NOTE: In order to comply with the open source license,
// NOTE: In order to comply with the open source license,
//it is advised that you leave this code so that the License
// it is advised that you leave this code so that the License
//Activity may be viewed by the user.
// Activity may be viewed by the user.
startActivity ( new Intent ( Constants . LICENSE_INTENT ) ) ;
startActivity ( new Intent ( Constants . LICENSE_INTENT ) ) ;
}
}
} ) ;
} ) ;
Switch location = new Switch ( this ) ;
Switch location = new Switch ( this ) ;
Switch fullScreen = new Switch ( this ) ;
Switch fullScreen = new Switch ( this ) ;
Switch flash = new Switch ( this ) ;
Switch flash = new Switch ( this ) ;
Switch adblock = new Switch ( this ) ;
Switch adblock = new Switch ( this ) ;
Switch orbot = new Switch ( this ) ;
r1 . addView ( location ) ;
r1 . addView ( location ) ;
r2 . addView ( fullScreen ) ;
r2 . addView ( fullScreen ) ;
r3 . addView ( flash ) ;
r3 . addView ( flash ) ;
r4 . addView ( adblock ) ;
r4 . addView ( adblock ) ;
r5 . addView ( orbot ) ;
location . setChecked ( locationBool ) ;
location . setChecked ( locationBool ) ;
fullScreen . setChecked ( fullScreenBool ) ;
fullScreen . setChecked ( fullScreenBool ) ;
if ( flashNum > 0 ) {
if ( flashNum > 0 ) {
@ -214,11 +228,13 @@ public class SettingsActivity extends Activity {
} else {
} else {
flash . setChecked ( false ) ;
flash . setChecked ( false ) ;
}
}
adblock . setChecked ( mPreferences . getBoolean ( PreferenceConstants . BLOCK_ADS , false ) ) ;
adblock . setChecked ( mPreferences . getBoolean (
PreferenceConstants . BLOCK_ADS , false ) ) ;
initSwitch ( location , fullScreen , flash , adblock ) ;
initSwitch ( location , fullScreen , flash , adblock , orbot ) ;
clickListenerForSwitches ( layoutLocation , layoutFullScreen , layoutFlash , layoutBlockAds ,
clickListenerForSwitches ( layoutLocation , layoutFullScreen , layoutFlash ,
location , fullScreen , flash , adblock ) ;
layoutBlockAds , layoutOrbot , location , fullScreen , flash ,
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 ) ;
@ -246,9 +262,10 @@ public class SettingsActivity extends Activity {
R . string . title_search_engine ) ) ;
R . string . title_search_engine ) ) ;
CharSequence [ ] chars = {
CharSequence [ ] chars = {
getResources ( ) . getString ( R . string . custom_url ) ,
getResources ( ) . getString ( R . string . custom_url ) ,
"Google" , "Android Search" , "Bing" , "Yahoo" , "StartPage" , "StartPage (Mobile)" ,
"Google" , "Android Search" , "Bing" , "Yahoo" ,
"DuckDuckGo (Privacy)" , "DuckDuckGo Lite (Privacy)" , "Baidu (Chinese)" ,
"StartPage" , "StartPage (Mobile)" ,
"Yandex (Russian)" } ;
"DuckDuckGo (Privacy)" , "DuckDuckGo Lite (Privacy)" ,
"Baidu (Chinese)" , "Yandex (Russian)" } ;
int n = mPreferences . getInt ( PreferenceConstants . SEARCH , 1 ) ;
int n = mPreferences . getInt ( PreferenceConstants . SEARCH , 1 ) ;
@ -258,7 +275,8 @@ public class SettingsActivity extends Activity {
@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 ,
which ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
switch ( which ) {
switch ( which ) {
case 0 :
case 0 :
@ -319,8 +337,8 @@ public class SettingsActivity extends Activity {
urlPicker . setTitle ( getResources ( ) . getString ( R . string . custom_url ) ) ;
urlPicker . setTitle ( getResources ( ) . getString ( R . string . custom_url ) ) ;
final EditText getSearchUrl = new EditText ( SettingsActivity . this ) ;
final EditText getSearchUrl = new EditText ( SettingsActivity . this ) ;
mSearchUrl = mPreferences
mSearchUrl = mPreferences . getString ( PreferenceConstants . SEARCH_URL ,
. getString ( PreferenceConstants . SEARCH_URL , Constants . GOOGLE_SEARCH ) ;
Constants . GOOGLE_SEARCH ) ;
getSearchUrl . setText ( mSearchUrl ) ;
getSearchUrl . setText ( mSearchUrl ) ;
urlPicker . setView ( getSearchUrl ) ;
urlPicker . setView ( getSearchUrl ) ;
urlPicker . setPositiveButton ( getResources ( )
urlPicker . setPositiveButton ( getResources ( )
@ -330,7 +348,8 @@ public class SettingsActivity extends Activity {
@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 , text ) ;
mEditPrefs . putString ( PreferenceConstants . SEARCH_URL ,
text ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mSearchText . setText ( getResources ( ) . getString (
mSearchText . setText ( getResources ( ) . getString (
R . string . custom_url )
R . string . custom_url )
@ -341,15 +360,16 @@ public class SettingsActivity extends Activity {
}
}
public void clickListenerForSwitches ( RelativeLayout one ,
public void clickListenerForSwitches ( RelativeLayout one ,
RelativeLayout two , RelativeLayout three , RelativeLayout layoutBlockAds , final Switch loc ,
RelativeLayout two , RelativeLayout three ,
final Switch full , final Switch flash , final Switch adblock ) {
RelativeLayout layoutBlockAds , RelativeLayout layoutOrbot , final Switch loc , final Switch full ,
layoutBlockAds . setOnClickListener ( new OnClickListener ( ) {
final Switch flash , final Switch adblock , final Switch orbot ) {
layoutBlockAds . setOnClickListener ( new OnClickListener ( ) {
@Override
@Override
public void onClick ( View v ) {
public void onClick ( View v ) {
adblock . setChecked ( ! adblock . isChecked ( ) ) ;
adblock . setChecked ( ! adblock . isChecked ( ) ) ;
}
}
} ) ;
} ) ;
one . setOnClickListener ( new OnClickListener ( ) {
one . setOnClickListener ( new OnClickListener ( ) {
@ -381,6 +401,14 @@ public class SettingsActivity extends Activity {
}
}
} ) ;
} ) ;
layoutOrbot . setOnClickListener ( new OnClickListener ( ) {
@Override
public void onClick ( View v ) {
orbot . setChecked ( ! orbot . isChecked ( ) ) ;
}
} ) ;
}
}
public void easterEgg ( ) {
public void easterEgg ( ) {
@ -401,8 +429,9 @@ public class SettingsActivity extends Activity {
} ) ;
} ) ;
}
}
public void initSwitch ( Switch location , Switch fullscreen , Switch flash , Switch adblock ) {
public void initSwitch ( Switch location , Switch fullscreen , Switch flash ,
adblock . setOnCheckedChangeListener ( new OnCheckedChangeListener ( ) {
Switch adblock , Switch orbot ) {
adblock . setOnCheckedChangeListener ( new OnCheckedChangeListener ( ) {
@Override
@Override
public void onCheckedChanged ( CompoundButton buttonView ,
public void onCheckedChanged ( CompoundButton buttonView ,
@ -410,7 +439,7 @@ public class SettingsActivity extends Activity {
mEditPrefs . putBoolean ( PreferenceConstants . BLOCK_ADS , isChecked ) ;
mEditPrefs . putBoolean ( PreferenceConstants . BLOCK_ADS , isChecked ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
}
}
} ) ;
} ) ;
location . setOnCheckedChangeListener ( new OnCheckedChangeListener ( ) {
location . setOnCheckedChangeListener ( new OnCheckedChangeListener ( ) {
@ -432,7 +461,8 @@ public class SettingsActivity extends Activity {
if ( isChecked ) {
if ( isChecked ) {
getFlashChoice ( ) ;
getFlashChoice ( ) ;
} else {
} else {
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT ,
0 ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
}
}
@ -453,7 +483,8 @@ public class SettingsActivity extends Activity {
getResources ( ) . getString (
getResources ( ) . getString (
R . string . dialog_adobe_not_installed ) ) ;
R . string . dialog_adobe_not_installed ) ) ;
buttonView . setChecked ( false ) ;
buttonView . setChecked ( false ) ;
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT ,
0 ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
} else if ( ( API > = 17 ) & & isChecked ) {
} else if ( ( API > = 17 ) & & isChecked ) {
@ -471,7 +502,20 @@ public class SettingsActivity extends Activity {
@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 ( ) ;
}
} ) ;
orbot . setOnCheckedChangeListener ( new OnCheckedChangeListener ( ) {
@Override
public void onCheckedChanged ( CompoundButton buttonView ,
boolean isChecked ) {
mEditPrefs . putBoolean ( PreferenceConstants . USE_PROXY ,
isChecked ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
}
}
@ -490,7 +534,9 @@ public class SettingsActivity extends Activity {
new DialogInterface . OnClickListener ( ) {
new DialogInterface . OnClickListener ( ) {
@Override
@Override
public void onClick ( DialogInterface dialog , int id ) {
public void onClick ( DialogInterface dialog , int id ) {
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 1 ) ;
mEditPrefs
. putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT ,
1 ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
}
}
} )
} )
@ -501,14 +547,17 @@ public class SettingsActivity extends Activity {
@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 ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
mEditPrefs . putInt (
PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
}
}
@ -558,7 +607,8 @@ public class SettingsActivity extends Activity {
getResources ( ) . getString (
getResources ( ) . getString (
R . string . dialog_adobe_not_installed ) ) ;
R . string . dialog_adobe_not_installed ) ) ;
buttonView . setChecked ( false ) ;
buttonView . setChecked ( false ) ;
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT , 0 ) ;
mEditPrefs . putInt ( PreferenceConstants . ADOBE_FLASH_SUPPORT ,
0 ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
} else if ( ( API > 17 ) & & isChecked ) {
} else if ( ( API > 17 ) & & isChecked ) {
@ -576,7 +626,8 @@ public class SettingsActivity extends Activity {
@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 ( ) ;
}
}
@ -593,31 +644,35 @@ public class SettingsActivity extends Activity {
mActivity ) ;
mActivity ) ;
agentPicker . setTitle ( getResources ( ) . getString (
agentPicker . setTitle ( getResources ( ) . getString (
R . string . title_user_agent ) ) ;
R . string . title_user_agent ) ) ;
mAgentChoice = mPreferences . getInt ( PreferenceConstants . USER_AGENT , 1 ) ;
mAgentChoice = mPreferences . getInt (
agentPicker . setSingleChoiceItems ( R . array . user_agent , mAgentChoice - 1 ,
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 ( ) . getString (
mAgentTextView . setText ( getResources ( )
R . string . agent_default ) ) ;
. getString ( R . string . agent_default ) ) ;
break ;
break ;
case 2 :
case 2 :
mAgentTextView . setText ( getResources ( ) . getString (
mAgentTextView . setText ( getResources ( )
R . string . agent_desktop ) ) ;
. getString ( R . string . agent_desktop ) ) ;
break ;
break ;
case 3 :
case 3 :
mAgentTextView . setText ( getResources ( ) . getString (
mAgentTextView . setText ( getResources ( )
R . string . agent_mobile ) ) ;
. getString ( R . string . agent_mobile ) ) ;
break ;
break ;
case 4 :
case 4 :
mAgentTextView . setText ( getResources ( ) . getString (
mAgentTextView . setText ( getResources ( )
R . string . agent_custom ) ) ;
. getString ( R . string . agent_custom ) ) ;
agentPicker ( ) ;
agentPicker ( ) ;
break ;
break ;
}
}
@ -666,7 +721,8 @@ public class SettingsActivity extends Activity {
@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 ( PreferenceConstants . USER_AGENT_STRING , text ) ;
mEditPrefs . putString (
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 ) ) ;
@ -684,7 +740,8 @@ public class SettingsActivity extends Activity {
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 = - 1 ;
int n = - 1 ;
if ( mDownloadLocation . contains ( Environment . DIRECTORY_DOWNLOADS ) ) {
if ( mDownloadLocation . contains ( Environment . DIRECTORY_DOWNLOADS ) ) {
@ -702,12 +759,15 @@ public class SettingsActivity extends Activity {
switch ( which + 1 ) {
switch ( which + 1 ) {
case 1 :
case 1 :
mEditPrefs . putString ( PreferenceConstants . DOWNLOAD_DIRECTORY ,
mEditPrefs
Environment . DIRECTORY_DOWNLOADS ) ;
. putString (
PreferenceConstants . DOWNLOAD_DIRECTORY ,
Environment . DIRECTORY_DOWNLOADS ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mDownloadTextView . setText ( Constants . EXTERNAL_STORAGE
mDownloadTextView
+ "/"
. setText ( Constants . EXTERNAL_STORAGE
+ Environment . DIRECTORY_DOWNLOADS ) ;
+ "/"
+ Environment . DIRECTORY_DOWNLOADS ) ;
break ;
break ;
case 2 :
case 2 :
downPicker ( ) ;
downPicker ( ) ;
@ -738,7 +798,8 @@ public class SettingsActivity extends Activity {
homePicker . setTitle ( getResources ( ) . getString (
homePicker . setTitle ( getResources ( ) . getString (
R . string . title_custom_homepage ) ) ;
R . string . title_custom_homepage ) ) ;
final EditText getHome = new EditText ( SettingsActivity . this ) ;
final EditText getHome = new EditText ( SettingsActivity . this ) ;
mHomepage = mPreferences . getString ( PreferenceConstants . HOMEPAGE , Constants . HOMEPAGE ) ;
mHomepage = mPreferences . getString ( PreferenceConstants . HOMEPAGE ,
Constants . HOMEPAGE ) ;
if ( ! mHomepage . startsWith ( "about:" ) ) {
if ( ! mHomepage . startsWith ( "about:" ) ) {
getHome . setText ( mHomepage ) ;
getHome . setText ( mHomepage ) ;
} else {
} else {
@ -752,7 +813,8 @@ public class SettingsActivity extends Activity {
@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 . putString ( PreferenceConstants . HOMEPAGE , text ) ;
mEditPrefs
. putString ( PreferenceConstants . HOMEPAGE , text ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mHomepageText . setText ( text ) ;
mHomepageText . setText ( text ) ;
}
}
@ -769,7 +831,8 @@ public class SettingsActivity extends Activity {
R . string . title_download_location ) ) ;
R . string . title_download_location ) ) ;
final EditText getDownload = new EditText ( SettingsActivity . this ) ;
final EditText getDownload = new EditText ( SettingsActivity . this ) ;
getDownload . setBackgroundResource ( 0 ) ;
getDownload . setBackgroundResource ( 0 ) ;
mDownloadLocation = mPreferences . getString ( PreferenceConstants . DOWNLOAD_DIRECTORY ,
mDownloadLocation = mPreferences . getString (
PreferenceConstants . DOWNLOAD_DIRECTORY ,
Environment . DIRECTORY_DOWNLOADS ) ;
Environment . DIRECTORY_DOWNLOADS ) ;
int padding = Utils . convertToDensityPixels ( this , 10 ) ;
int padding = Utils . convertToDensityPixels ( this , 10 ) ;
@ -804,10 +867,11 @@ public class SettingsActivity extends Activity {
@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 ( PreferenceConstants . DOWNLOAD_DIRECTORY , text ) ;
mEditPrefs . putString (
PreferenceConstants . DOWNLOAD_DIRECTORY , text ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mDownloadTextView . setText ( Constants . EXTERNAL_STORAGE + "/"
mDownloadTextView . setText ( Constants . EXTERNAL_STORAGE
+ text ) ;
+ "/" + text ) ;
}
}
} ) ;
} ) ;
downLocationPicker . show ( ) ;
downLocationPicker . show ( ) ;
@ -820,7 +884,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 ( PreferenceConstants . HOMEPAGE , Constants . HOMEPAGE ) ;
mHomepage = mPreferences . getString (
PreferenceConstants . HOMEPAGE , Constants . HOMEPAGE ) ;
int n = - 1 ;
int n = - 1 ;
if ( mHomepage . contains ( "about:home" ) ) {
if ( mHomepage . contains ( "about:home" ) ) {
n = 1 ;
n = 1 ;
@ -841,20 +906,25 @@ public class SettingsActivity extends Activity {
switch ( which + 1 ) {
switch ( which + 1 ) {
case 1 :
case 1 :
mEditPrefs . putString ( PreferenceConstants . HOMEPAGE , "about:home" ) ;
mEditPrefs . putString (
PreferenceConstants . HOMEPAGE ,
"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 ( PreferenceConstants . HOMEPAGE , "about:blank" ) ;
mEditPrefs . putString (
PreferenceConstants . HOMEPAGE ,
"about:blank" ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mHomepageText . setText ( getResources ( )
mHomepageText . setText ( getResources ( )
. getString ( R . string . action_blank ) ) ;
. getString ( R . string . action_blank ) ) ;
break ;
break ;
case 3 :
case 3 :
mEditPrefs . putString ( PreferenceConstants . HOMEPAGE ,
mEditPrefs . putString (
PreferenceConstants . HOMEPAGE ,
"about:bookmarks" ) ;
"about:bookmarks" ) ;
mEditPrefs . commit ( ) ;
mEditPrefs . commit ( ) ;
mHomepageText . setText ( getResources ( )
mHomepageText . setText ( getResources ( )