|
|
@ -139,7 +139,7 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
|
|
|
|
|
|
|
|
// List
|
|
|
|
// List
|
|
|
|
private final List<LightningView> mWebViewList = new ArrayList<>(); |
|
|
|
private final List<LightningView> mWebViewList = new ArrayList<>(); |
|
|
|
private List<HistoryItem> mBookmarkList; |
|
|
|
private final List<HistoryItem> mBookmarkList = new ArrayList<>(); |
|
|
|
private LightningView mCurrentView; |
|
|
|
private LightningView mCurrentView; |
|
|
|
private WebView mWebView; |
|
|
|
private WebView mWebView; |
|
|
|
|
|
|
|
|
|
|
@ -164,8 +164,7 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
private Activity mActivity; |
|
|
|
private Activity mActivity; |
|
|
|
|
|
|
|
|
|
|
|
// Primatives
|
|
|
|
// Primatives
|
|
|
|
private boolean mSystemBrowser = false, mIsNewIntent = false, mFullScreen, mColorMode, |
|
|
|
private boolean mSystemBrowser = false, mIsNewIntent = false, mFullScreen, mColorMode, mDarkTheme; |
|
|
|
mDarkTheme; |
|
|
|
|
|
|
|
private int mOriginalOrientation, mBackgroundColor, mIdGenerator; |
|
|
|
private int mOriginalOrientation, mBackgroundColor, mIdGenerator; |
|
|
|
private String mSearchText, mUntitledTitle, mHomepage, mCameraPhotoPath; |
|
|
|
private String mSearchText, mUntitledTitle, mHomepage, mCameraPhotoPath; |
|
|
|
|
|
|
|
|
|
|
@ -200,6 +199,8 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
|
|
|
|
|
|
|
|
public abstract void updateHistory(final String title, final String url); |
|
|
|
public abstract void updateHistory(final String title, final String url); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract void updateCookiePreference(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
@ -318,7 +319,8 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
mBookmarkManager = BookmarkManager.getInstance(mActivity.getApplicationContext()); |
|
|
|
mBookmarkManager = BookmarkManager.getInstance(mActivity.getApplicationContext()); |
|
|
|
mBookmarkList = mBookmarkManager.getBookmarks(true); |
|
|
|
mBookmarkList.clear(); |
|
|
|
|
|
|
|
mBookmarkList.addAll(mBookmarkManager.getBookmarks(true)); |
|
|
|
if (mBookmarkList.size() == 0 && mPreferences.getDefaultBookmarks()) { |
|
|
|
if (mBookmarkList.size() == 0 && mPreferences.getDefaultBookmarks()) { |
|
|
|
for (String[] array : BookmarkManager.DEFAULT_BOOKMARKS) { |
|
|
|
for (String[] array : BookmarkManager.DEFAULT_BOOKMARKS) { |
|
|
|
HistoryItem bookmark = new HistoryItem(array[0], array[1]); |
|
|
|
HistoryItem bookmark = new HistoryItem(array[0], array[1]); |
|
|
@ -715,13 +717,6 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
mProxyUtils.updateProxySettings(this); |
|
|
|
mProxyUtils.updateProxySettings(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* Override this if class overrides BrowserActivity |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void updateCookiePreference() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) { |
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) { |
|
|
|
if (keyCode == KeyEvent.KEYCODE_ENTER) { |
|
|
|
if (keyCode == KeyEvent.KEYCODE_ENTER) { |
|
|
@ -803,7 +798,7 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
HistoryItem bookmark = new HistoryItem(mCurrentView.getUrl(), |
|
|
|
HistoryItem bookmark = new HistoryItem(mCurrentView.getUrl(), |
|
|
|
mCurrentView.getTitle()); |
|
|
|
mCurrentView.getTitle()); |
|
|
|
if (mBookmarkManager.addBookmark(bookmark) && mBookmarkList != null) { |
|
|
|
if (mBookmarkManager.addBookmark(bookmark)) { |
|
|
|
mBookmarkList.add(bookmark); |
|
|
|
mBookmarkList.add(bookmark); |
|
|
|
Collections.sort(mBookmarkList, new SortIgnoreCase()); |
|
|
|
Collections.sort(mBookmarkList, new SortIgnoreCase()); |
|
|
|
notifyBookmarkDataSetChanged(); |
|
|
|
notifyBookmarkDataSetChanged(); |
|
|
@ -829,8 +824,6 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
* adapter doesn't always change when notifyDataChanged gets called. |
|
|
|
* adapter doesn't always change when notifyDataChanged gets called. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void notifyBookmarkDataSetChanged() { |
|
|
|
private void notifyBookmarkDataSetChanged() { |
|
|
|
mBookmarkAdapter.clear(); |
|
|
|
|
|
|
|
mBookmarkAdapter.addAll(mBookmarkList); |
|
|
|
|
|
|
|
mBookmarkAdapter.notifyDataSetChanged(); |
|
|
|
mBookmarkAdapter.notifyDataSetChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1111,8 +1104,10 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
url = intent.getDataString(); |
|
|
|
url = intent.getDataString(); |
|
|
|
} |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
int num = 0; |
|
|
|
|
|
|
|
String source = null; |
|
|
|
if (intent != null && intent.getExtras() != null) { |
|
|
|
if (intent != null && intent.getExtras() != null) { |
|
|
|
num = intent.getExtras().getInt(getPackageName() + ".Origin"); |
|
|
|
num = intent.getExtras().getInt(getPackageName() + ".Origin"); |
|
|
|
|
|
|
|
source = intent.getExtras().getString("SOURCE"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (num == 1) { |
|
|
|
if (num == 1) { |
|
|
|
mCurrentView.loadUrl(url); |
|
|
|
mCurrentView.loadUrl(url); |
|
|
@ -1122,7 +1117,7 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
url = null; |
|
|
|
url = null; |
|
|
|
} |
|
|
|
} |
|
|
|
newTab(url, true); |
|
|
|
newTab(url, true); |
|
|
|
mIsNewIntent = true; |
|
|
|
mIsNewIntent = (source == null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1403,13 +1398,12 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
if (mCurrentView != null) { |
|
|
|
if (mCurrentView != null) { |
|
|
|
mCurrentView.resumeTimers(); |
|
|
|
mCurrentView.resumeTimers(); |
|
|
|
mCurrentView.onResume(); |
|
|
|
mCurrentView.onResume(); |
|
|
|
|
|
|
|
} |
|
|
|
mHistoryDatabase = HistoryDatabase.getInstance(getApplicationContext()); |
|
|
|
mHistoryDatabase = HistoryDatabase.getInstance(getApplicationContext()); |
|
|
|
mBookmarkList = mBookmarkManager.getBookmarks(true); |
|
|
|
mBookmarkList.clear(); |
|
|
|
|
|
|
|
mBookmarkList.addAll(mBookmarkManager.getBookmarks(true)); |
|
|
|
notifyBookmarkDataSetChanged(); |
|
|
|
notifyBookmarkDataSetChanged(); |
|
|
|
} |
|
|
|
|
|
|
|
initializePreferences(); |
|
|
|
initializePreferences(); |
|
|
|
if (mWebViewList != null) { |
|
|
|
|
|
|
|
for (int n = 0; n < mWebViewList.size(); n++) { |
|
|
|
for (int n = 0; n < mWebViewList.size(); n++) { |
|
|
|
if (mWebViewList.get(n) != null) { |
|
|
|
if (mWebViewList.get(n) != null) { |
|
|
|
mWebViewList.get(n).initializePreferences(this); |
|
|
|
mWebViewList.get(n).initializePreferences(this); |
|
|
@ -1417,7 +1411,6 @@ public abstract class BrowserActivity extends ThemableActivity implements Browse |
|
|
|
mWebViewList.remove(n); |
|
|
|
mWebViewList.remove(n); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|