|
|
@ -147,38 +147,66 @@ public class LightningView { |
|
|
|
if (mWebView == null) { |
|
|
|
if (mWebView == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (mHomepage.startsWith("about:home")) { |
|
|
|
switch (mHomepage) { |
|
|
|
mWebView.loadUrl(StartPage.getHomepage(mActivity), mRequestHeaders); |
|
|
|
case "about:home": |
|
|
|
} else if (mHomepage.startsWith("about:bookmarks")) { |
|
|
|
loadStartpage(); |
|
|
|
loadBookmarkpage(); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
case "about:bookmarks": |
|
|
|
mWebView.loadUrl(mHomepage, mRequestHeaders); |
|
|
|
loadBookmarkpage(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
mWebView.loadUrl(mHomepage, mRequestHeaders); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void loadStartpage() { |
|
|
|
|
|
|
|
BrowserApp.getIOThread().execute(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
final String homepage = StartPage.getHomepage(mActivity); |
|
|
|
|
|
|
|
mActivity.runOnUiThread(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
mWebView.loadUrl(homepage, mRequestHeaders); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Load the HTML bookmarks page in this view |
|
|
|
* Load the HTML bookmarks page in this view |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void loadBookmarkpage() { |
|
|
|
public void loadBookmarkpage() { |
|
|
|
if (mWebView == null) |
|
|
|
if (mWebView == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
Bitmap folderIcon = ThemeUtils.getThemedBitmap(mActivity, R.drawable.ic_folder, false); |
|
|
|
BrowserApp.getIOThread().execute(new Runnable() { |
|
|
|
FileOutputStream outputStream = null; |
|
|
|
@Override |
|
|
|
File image = new File(mActivity.getCacheDir(), "folder.png"); |
|
|
|
public void run() { |
|
|
|
try { |
|
|
|
Bitmap folderIcon = ThemeUtils.getThemedBitmap(mActivity, R.drawable.ic_folder, false); |
|
|
|
outputStream = new FileOutputStream(image); |
|
|
|
FileOutputStream outputStream = null; |
|
|
|
folderIcon.compress(Bitmap.CompressFormat.PNG, 100, outputStream); |
|
|
|
File image = new File(mActivity.getCacheDir(), "folder.png"); |
|
|
|
folderIcon.recycle(); |
|
|
|
try { |
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
outputStream = new FileOutputStream(image); |
|
|
|
e.printStackTrace(); |
|
|
|
folderIcon.compress(Bitmap.CompressFormat.PNG, 100, outputStream); |
|
|
|
} finally { |
|
|
|
folderIcon.recycle(); |
|
|
|
Utils.close(outputStream); |
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
} |
|
|
|
e.printStackTrace(); |
|
|
|
File bookmarkWebPage = new File(mActivity.getFilesDir(), BookmarkPage.FILENAME); |
|
|
|
} finally { |
|
|
|
|
|
|
|
Utils.close(outputStream); |
|
|
|
BrowserApp.getBookmarkPage().buildBookmarkPage(null); |
|
|
|
} |
|
|
|
mWebView.loadUrl(Constants.FILE + bookmarkWebPage, mRequestHeaders); |
|
|
|
final File bookmarkWebPage = new File(mActivity.getFilesDir(), BookmarkPage.FILENAME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BrowserApp.getBookmarkPage().buildBookmarkPage(null); |
|
|
|
|
|
|
|
mActivity.runOnUiThread(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
mWebView.loadUrl(Constants.FILE + bookmarkWebPage, mRequestHeaders); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|