|
|
@ -403,7 +403,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
updateUrl(currentView.getUrl(), true); |
|
|
|
updateUrl(currentView.getUrl(), true); |
|
|
|
} else if (hasFocus && currentView != null) { |
|
|
|
} else if (hasFocus && currentView != null) { |
|
|
|
String url = currentView.getUrl(); |
|
|
|
String url = currentView.getUrl(); |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (UrlUtils.isSpecialUrl(url)) { |
|
|
|
mSearch.setText(""); |
|
|
|
mSearch.setText(""); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mSearch.setText(url); |
|
|
|
mSearch.setText(url); |
|
|
@ -691,7 +691,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); |
|
|
|
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_share: |
|
|
|
case R.id.action_share: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
Intent shareIntent = new Intent(Intent.ACTION_SEND); |
|
|
|
Intent shareIntent = new Intent(Intent.ACTION_SEND); |
|
|
|
shareIntent.setType("text/plain"); |
|
|
|
shareIntent.setType("text/plain"); |
|
|
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, currentView.getTitle()); |
|
|
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, currentView.getTitle()); |
|
|
@ -703,7 +703,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
openBookmarks(); |
|
|
|
openBookmarks(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_copy: |
|
|
|
case R.id.action_copy: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); |
|
|
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); |
|
|
|
ClipData clip = ClipData.newPlainText("label", currentView.getUrl()); |
|
|
|
ClipData clip = ClipData.newPlainText("label", currentView.getUrl()); |
|
|
|
clipboard.setPrimaryClip(clip); |
|
|
|
clipboard.setPrimaryClip(clip); |
|
|
@ -717,7 +717,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
openHistory(); |
|
|
|
openHistory(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_add_bookmark: |
|
|
|
case R.id.action_add_bookmark: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentView.getTitle(), |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentView.getTitle(), |
|
|
|
currentView.getUrl())); |
|
|
|
currentView.getUrl())); |
|
|
|
} |
|
|
|
} |
|
|
@ -893,24 +893,38 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
void handleNewIntent(Intent intent) { |
|
|
|
void handleNewIntent(Intent intent) { |
|
|
|
|
|
|
|
|
|
|
|
String url = null; |
|
|
|
final String url; |
|
|
|
if (intent != null) { |
|
|
|
if (intent != null) { |
|
|
|
url = intent.getDataString(); |
|
|
|
url = intent.getDataString(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = null; |
|
|
|
} |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
int num = 0; |
|
|
|
String source = null; |
|
|
|
final String source; |
|
|
|
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"); |
|
|
|
source = intent.getExtras().getString("SOURCE"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
source = null; |
|
|
|
} |
|
|
|
} |
|
|
|
if (num == 1) { |
|
|
|
if (num == 1) { |
|
|
|
loadUrlInCurrentView(url); |
|
|
|
loadUrlInCurrentView(url); |
|
|
|
} else if (url != null) { |
|
|
|
} else if (url != null) { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
Utils.showSnackbar(this, R.string.message_blocked_local); |
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
|
|
|
url = null; |
|
|
|
builder.setCancelable(true) |
|
|
|
|
|
|
|
.setMessage(R.string.message_blocked_local) |
|
|
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null) |
|
|
|
|
|
|
|
.setPositiveButton(R.string.action_open, new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
newTab(url, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.show(); |
|
|
|
|
|
|
|
} else { |
|
|
|
newTab(url, true); |
|
|
|
newTab(url, true); |
|
|
|
|
|
|
|
} |
|
|
|
mIsNewIntent = (source == null); |
|
|
|
mIsNewIntent = (source == null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -986,7 +1000,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
int current = tabsManager.positionOf(currentTab); |
|
|
|
int current = tabsManager.positionOf(currentTab); |
|
|
|
|
|
|
|
|
|
|
|
if (!tabToDelete.getUrl().startsWith(Constants.FILE) && !isIncognito()) { |
|
|
|
if (!UrlUtils.isSpecialUrl(tabToDelete.getUrl()) && !isIncognito()) { |
|
|
|
mPreferences.setSavedUrl(tabToDelete.getUrl()); |
|
|
|
mPreferences.setSavedUrl(tabToDelete.getUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
final boolean isShown = tabToDelete.isShown(); |
|
|
|
final boolean isShown = tabToDelete.isShown(); |
|
|
@ -1014,7 +1028,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (currentTab != null && (currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
if (currentTab != null && (UrlUtils.isSpecialUrl(currentTab.getUrl()) |
|
|
|
|| currentTab.getUrl().equals(mHomepage))) { |
|
|
|
|| currentTab.getUrl().equals(mHomepage))) { |
|
|
|
closeActivity(); |
|
|
|
closeActivity(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1273,7 +1287,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
mEventBus.post(new BrowserEvents.CurrentPageUrl(url)); |
|
|
|
mEventBus.post(new BrowserEvents.CurrentPageUrl(url)); |
|
|
|
if (shortUrl && !url.startsWith(Constants.FILE)) { |
|
|
|
if (shortUrl && !UrlUtils.isSpecialUrl(url)) { |
|
|
|
switch (mPreferences.getUrlBoxContentChoice()) { |
|
|
|
switch (mPreferences.getUrlBoxContentChoice()) { |
|
|
|
case 0: // Default, show only the domain
|
|
|
|
case 0: // Default, show only the domain
|
|
|
|
url = url.replaceFirst(Constants.HTTP, ""); |
|
|
|
url = url.replaceFirst(Constants.HTTP, ""); |
|
|
@ -1292,7 +1306,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (UrlUtils.isSpecialUrl(url)) { |
|
|
|
url = ""; |
|
|
|
url = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
mSearch.setText(url); |
|
|
|
mSearch.setText(url); |
|
|
@ -1320,7 +1334,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
if (!url.startsWith(Constants.FILE)) { |
|
|
|
if (!UrlUtils.isSpecialUrl(url)) { |
|
|
|
new Thread(update).start(); |
|
|
|
new Thread(update).start(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|