|
|
@ -146,97 +146,91 @@ public class LightningView { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getHomepage() { |
|
|
|
public String getHomepage() { |
|
|
|
String home; |
|
|
|
StringBuilder homepageBuilder = new StringBuilder(); |
|
|
|
home = HomepageVariables.HEAD; |
|
|
|
homepageBuilder.append(HomepageVariables.HEAD); |
|
|
|
|
|
|
|
String icon; |
|
|
|
|
|
|
|
String searchUrl; |
|
|
|
switch (mPreferences.getSearchChoice()) { |
|
|
|
switch (mPreferences.getSearchChoice()) { |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
// CUSTOM SEARCH
|
|
|
|
// CUSTOM SEARCH
|
|
|
|
home = home + "file:///android_asset/lightning.png"; |
|
|
|
icon = "file:///android_asset/lightning.png"; |
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = mPreferences.getSearchUrl(); |
|
|
|
home = home + mPreferences.getSearchUrl(); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
// GOOGLE_SEARCH;
|
|
|
|
// GOOGLE_SEARCH;
|
|
|
|
home = home + "file:///android_asset/google.png"; |
|
|
|
icon = "file:///android_asset/google.png"; |
|
|
|
// + "https://www.google.com/images/srpr/logo11w.png";
|
|
|
|
// "https://www.google.com/images/srpr/logo11w.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.GOOGLE_SEARCH; |
|
|
|
home = home + Constants.GOOGLE_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
// ANDROID SEARCH;
|
|
|
|
// ANDROID SEARCH;
|
|
|
|
home = home + "file:///android_asset/ask.png"; |
|
|
|
icon = "file:///android_asset/ask.png"; |
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.ASK_SEARCH; |
|
|
|
home = home + Constants.ASK_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
// BING_SEARCH;
|
|
|
|
// BING_SEARCH;
|
|
|
|
home = home + "file:///android_asset/bing.png"; |
|
|
|
icon = "file:///android_asset/bing.png"; |
|
|
|
// +
|
|
|
|
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png";
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Bing_logo_%282013%29.svg/500px-Bing_logo_%282013%29.svg.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.BING_SEARCH; |
|
|
|
home = home + Constants.BING_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
// YAHOO_SEARCH;
|
|
|
|
// YAHOO_SEARCH;
|
|
|
|
home = home + "file:///android_asset/yahoo.png"; |
|
|
|
icon = "file:///android_asset/yahoo.png"; |
|
|
|
// +
|
|
|
|
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Yahoo%21_logo.svg/799px-Yahoo%21_logo.svg.png";
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Yahoo%21_logo.svg/799px-Yahoo%21_logo.svg.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.YAHOO_SEARCH; |
|
|
|
home = home + Constants.YAHOO_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
case 5: |
|
|
|
// STARTPAGE_SEARCH;
|
|
|
|
// STARTPAGE_SEARCH;
|
|
|
|
home = home + "file:///android_asset/startpage.png"; |
|
|
|
icon = "file:///android_asset/startpage.png"; |
|
|
|
// + "https://startpage.com/graphics/startp_logo.gif";
|
|
|
|
// "https://startpage.com/graphics/startp_logo.gif";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.STARTPAGE_SEARCH; |
|
|
|
home = home + Constants.STARTPAGE_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
case 6: |
|
|
|
// STARTPAGE_MOBILE
|
|
|
|
// STARTPAGE_MOBILE
|
|
|
|
home = home + "file:///android_asset/startpage.png"; |
|
|
|
icon = "file:///android_asset/startpage.png"; |
|
|
|
// + "https://startpage.com/graphics/startp_logo.gif";
|
|
|
|
// "https://startpage.com/graphics/startp_logo.gif";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.STARTPAGE_MOBILE_SEARCH; |
|
|
|
home = home + Constants.STARTPAGE_MOBILE_SEARCH; |
|
|
|
|
|
|
|
case 7: |
|
|
|
case 7: |
|
|
|
// DUCK_SEARCH;
|
|
|
|
// DUCK_SEARCH;
|
|
|
|
home = home + "file:///android_asset/duckduckgo.png"; |
|
|
|
icon = "file:///android_asset/duckduckgo.png"; |
|
|
|
// +
|
|
|
|
|
|
|
|
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
|
|
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.DUCK_SEARCH; |
|
|
|
home = home + Constants.DUCK_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
case 8: |
|
|
|
// DUCK_LITE_SEARCH;
|
|
|
|
// DUCK_LITE_SEARCH;
|
|
|
|
home = home + "file:///android_asset/duckduckgo.png"; |
|
|
|
icon = "file:///android_asset/duckduckgo.png"; |
|
|
|
// +
|
|
|
|
|
|
|
|
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
|
|
// "https://duckduckgo.com/assets/logo_homepage.normal.v101.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.DUCK_LITE_SEARCH; |
|
|
|
home = home + Constants.DUCK_LITE_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
case 9: |
|
|
|
// BAIDU_SEARCH;
|
|
|
|
// BAIDU_SEARCH;
|
|
|
|
home = home + "file:///android_asset/baidu.png"; |
|
|
|
icon = "file:///android_asset/baidu.png"; |
|
|
|
// + "http://www.baidu.com/img/bdlogo.gif";
|
|
|
|
// "http://www.baidu.com/img/bdlogo.gif";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.BAIDU_SEARCH; |
|
|
|
home = home + Constants.BAIDU_SEARCH; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
case 10: |
|
|
|
// YANDEX_SEARCH;
|
|
|
|
// YANDEX_SEARCH;
|
|
|
|
home = home + "file:///android_asset/yandex.png"; |
|
|
|
icon = "file:///android_asset/yandex.png"; |
|
|
|
// +
|
|
|
|
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Yandex.svg/600px-Yandex.svg.png";
|
|
|
|
// "http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Yandex.svg/600px-Yandex.svg.png";
|
|
|
|
home = home + HomepageVariables.MIDDLE; |
|
|
|
searchUrl = Constants.YANDEX_SEARCH; |
|
|
|
home = home + Constants.YANDEX_SEARCH; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
// DEFAULT GOOGLE_SEARCH;
|
|
|
|
|
|
|
|
icon = "file:///android_asset/google.png"; |
|
|
|
|
|
|
|
searchUrl = Constants.GOOGLE_SEARCH; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
home = home + HomepageVariables.END; |
|
|
|
homepageBuilder.append(icon); |
|
|
|
|
|
|
|
homepageBuilder.append(HomepageVariables.MIDDLE); |
|
|
|
|
|
|
|
homepageBuilder.append(searchUrl); |
|
|
|
|
|
|
|
homepageBuilder.append(HomepageVariables.END); |
|
|
|
|
|
|
|
|
|
|
|
File homepage = new File(mActivity.getFilesDir(), "homepage.html"); |
|
|
|
File homepage = new File(mActivity.getFilesDir(), "homepage.html"); |
|
|
|
try { |
|
|
|
try { |
|
|
|
FileWriter hWriter = new FileWriter(homepage, false); |
|
|
|
FileWriter hWriter = new FileWriter(homepage, false); |
|
|
|
hWriter.write(home); |
|
|
|
hWriter.write(homepageBuilder.toString()); |
|
|
|
hWriter.close(); |
|
|
|
hWriter.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|