Clean up SettingsActivity and AdvancedSettingsActivity
* field that are overwritten from every class instance SHOULD NOT be "static"
* some field could and was converted to local variables
* add missing "private" qualifier here and there
* action bar may be null, added checking for this
* remove wrapping all method body in try-catch, moved it to method call
* removed redundant field and local variable initializations
* single-char string replaced with char
* redundant qualifiers ("SettingsActivity.this" etc.) was removed
@ -29,18 +30,14 @@ public class AdvancedSettingsActivity extends Activity {
@@ -29,18 +30,14 @@ public class AdvancedSettingsActivity extends Activity {
@ -50,19 +47,26 @@ public class AdvancedSettingsActivity extends Activity {
@@ -50,19 +47,26 @@ public class AdvancedSettingsActivity extends Activity {
@ -195,7 +203,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -195,7 +203,7 @@ public class AdvancedSettingsActivity extends Activity {
messageHandler=newMessageHandler();
}
staticclassMessageHandlerextendsHandler{
privateclassMessageHandlerextendsHandler{
@Override
publicvoidhandleMessage(Messagemsg){
@ -215,10 +223,9 @@ public class AdvancedSettingsActivity extends Activity {
@@ -215,10 +223,9 @@ public class AdvancedSettingsActivity extends Activity {
@ -232,7 +239,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -232,7 +239,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -246,7 +253,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -246,7 +253,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -260,7 +267,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -260,7 +267,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -274,7 +281,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -274,7 +281,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -288,7 +295,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -288,7 +295,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -301,7 +308,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -301,7 +308,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -315,7 +322,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -315,7 +322,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -328,7 +335,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -328,7 +335,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -341,7 +348,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -341,7 +348,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -355,7 +362,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -355,7 +362,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -369,7 +376,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -369,7 +376,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -383,7 +390,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -383,7 +390,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -397,7 +404,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -397,7 +404,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -411,7 +418,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -411,7 +418,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -424,7 +431,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -424,7 +431,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr1(RelativeLayoutview){
privatevoidr1(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -436,7 +443,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -436,7 +443,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr2(RelativeLayoutview){
privatevoidr2(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -448,7 +455,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -448,7 +455,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidrClearHistoryExit(RelativeLayoutview){
privatevoidrClearHistoryExit(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -460,7 +467,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -460,7 +467,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidrClearCookiesExit(RelativeLayoutview){
privatevoidrClearCookiesExit(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -472,7 +479,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -472,7 +479,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr3(RelativeLayoutview){
privatevoidr3(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -484,7 +491,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -484,7 +491,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr4(RelativeLayoutview){
privatevoidr4(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -502,7 +509,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -502,7 +509,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr5(RelativeLayoutview){
privatevoidr5(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -514,7 +521,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -514,7 +521,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr6(RelativeLayoutview){
privatevoidr6(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -526,7 +533,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -526,7 +533,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr7(RelativeLayoutview){
privatevoidr7(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -538,7 +545,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -538,7 +545,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr8(RelativeLayoutview){
privatevoidr8(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -586,7 +593,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -586,7 +593,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr11(RelativeLayoutview){
privatevoidr11(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -599,7 +606,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -599,7 +606,7 @@ public class AdvancedSettingsActivity extends Activity {
}
voidr12(RelativeLayoutview){
privatevoidr12(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -611,7 +618,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -611,7 +618,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr13(RelativeLayoutview){
privatevoidr13(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -622,7 +629,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -622,7 +629,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr14(RelativeLayoutview){
privatevoidr14(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -633,7 +640,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -633,7 +640,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidr15(RelativeLayoutview){
privatevoidr15(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -680,7 +687,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -680,7 +687,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidrIncognitoCookies(RelativeLayoutview){
privatevoidrIncognitoCookies(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -693,7 +700,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -693,7 +700,7 @@ public class AdvancedSettingsActivity extends Activity {
@ -704,7 +711,7 @@ public class AdvancedSettingsActivity extends Activity {
@@ -704,7 +711,7 @@ public class AdvancedSettingsActivity extends Activity {
});
}
voidrClearCache(RelativeLayoutview){
privatevoidrClearCache(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -725,11 +732,10 @@ public class AdvancedSettingsActivity extends Activity {
@@ -725,11 +732,10 @@ public class AdvancedSettingsActivity extends Activity {
@ -739,11 +745,11 @@ public class AdvancedSettingsActivity extends Activity {
@@ -739,11 +745,11 @@ public class AdvancedSettingsActivity extends Activity {
if(mSystemBrowser){
try{
Browser.clearHistory(getContentResolver());
}catch(NullPointerExceptionignored){
}catch(Exceptionignored){
}
}
SettingsController.setClearHistory(true);
Utils.trimCache(AdvancedSettingsActivity.this);
Utils.trimCache(this);
messageHandler.sendEmptyMessage(1);
}
@ -754,21 +760,23 @@ public class AdvancedSettingsActivity extends Activity {
@@ -754,21 +760,23 @@ public class AdvancedSettingsActivity extends Activity {
messageHandler.sendEmptyMessage(2);
}
voidr9(RelativeLayoutview){
privatevoidr9(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
publicvoidonClick(Viewv){
try{
importFromStockBrowser();
}catch(Exceptione){
// ignored exception
// TODO add logging
}
}
});
}
voidr10(RelativeLayoutview){
privatevoidr10(RelativeLayoutview){
view.setOnClickListener(newOnClickListener(){
@Override
@ -811,7 +819,6 @@ public class AdvancedSettingsActivity extends Activity {
@@ -811,7 +819,6 @@ public class AdvancedSettingsActivity extends Activity {
@ -820,11 +827,10 @@ public class AdvancedSettingsActivity extends Activity {
@@ -820,11 +827,10 @@ public class AdvancedSettingsActivity extends Activity {
@ -839,13 +845,10 @@ public class AdvancedSettingsActivity extends Activity {
@@ -839,13 +845,10 @@ public class AdvancedSettingsActivity extends Activity {