Fix bug where certain apps wouldn't be considered to handle intents, cleaned up imports
This commit is contained in:
parent
a6b755e6c4
commit
9aed39c49c
@ -85,7 +85,7 @@ public class TabsManager {
|
||||
mPostInitializationWorkList.clear();
|
||||
}
|
||||
|
||||
public void doAfterInitialization(@NonNull Runnable runnable) {
|
||||
public synchronized void doAfterInitialization(@NonNull Runnable runnable) {
|
||||
if (mIsInitialized) {
|
||||
runnable.run();
|
||||
} else {
|
||||
@ -93,7 +93,7 @@ public class TabsManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void finishInitialization() {
|
||||
private synchronized void finishInitialization() {
|
||||
mIsInitialized = true;
|
||||
for (Runnable runnable : mPostInitializationWorkList) {
|
||||
runnable.run();
|
||||
|
@ -1,8 +1,5 @@
|
||||
package acr.browser.lightning.bus;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
public final class BrowserEvents {
|
||||
|
||||
private BrowserEvents() {
|
||||
|
@ -32,7 +32,6 @@ import acr.browser.lightning.BuildConfig;
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.MainActivity;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.dialog.BrowserDialog;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
@ -21,7 +21,6 @@ import java.net.URL;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -241,6 +241,8 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
case Constants.PROXY_MANUAL:
|
||||
manualProxyPicker();
|
||||
break;
|
||||
case Constants.NO_PROXY:
|
||||
break;
|
||||
}
|
||||
|
||||
mPreferenceManager.setProxyChoice(choice);
|
||||
|
@ -62,17 +62,15 @@ public class DrawableUtils {
|
||||
|
||||
|
||||
public static int mixColor(float fraction, int startValue, int endValue) {
|
||||
int startInt = startValue;
|
||||
int startA = (startInt >> 24) & 0xff;
|
||||
int startR = (startInt >> 16) & 0xff;
|
||||
int startG = (startInt >> 8) & 0xff;
|
||||
int startB = startInt & 0xff;
|
||||
int startA = (startValue >> 24) & 0xff;
|
||||
int startR = (startValue >> 16) & 0xff;
|
||||
int startG = (startValue >> 8) & 0xff;
|
||||
int startB = startValue & 0xff;
|
||||
|
||||
int endInt = endValue;
|
||||
int endA = (endInt >> 24) & 0xff;
|
||||
int endR = (endInt >> 16) & 0xff;
|
||||
int endG = (endInt >> 8) & 0xff;
|
||||
int endB = endInt & 0xff;
|
||||
int endA = (endValue >> 24) & 0xff;
|
||||
int endR = (endValue >> 16) & 0xff;
|
||||
int endG = (endValue >> 8) & 0xff;
|
||||
int endB = endValue & 0xff;
|
||||
|
||||
return (startA + (int) (fraction * (endA - startA))) << 24 |
|
||||
(startR + (int) (fraction * (endR - startR))) << 16 |
|
||||
|
@ -25,11 +25,11 @@ public class IntentUtils {
|
||||
private final Activity mActivity;
|
||||
|
||||
private static final Pattern ACCEPTED_URI_SCHEMA = Pattern.compile("(?i)"
|
||||
+ // switch on case insensitive matching
|
||||
'('
|
||||
+ // begin group for schema
|
||||
"(?:http|https|file)://" + "|(?:inline|data|about|javascript):" + "|(?:.*:.*@)"
|
||||
+ ')' + "(.*)");
|
||||
+ // switch on case insensitive matching
|
||||
'('
|
||||
+ // begin group for schema
|
||||
"(?:http|https|file)://" + "|(?:inline|data|about|javascript):" + "|(?:.*:.*@)"
|
||||
+ ')' + "(.*)");
|
||||
|
||||
public IntentUtils(Activity activity) {
|
||||
mActivity = activity;
|
||||
@ -54,7 +54,7 @@ public class IntentUtils {
|
||||
String packagename = intent.getPackage();
|
||||
if (packagename != null) {
|
||||
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:"
|
||||
+ packagename));
|
||||
+ packagename));
|
||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||
mActivity.startActivity(intent);
|
||||
return true;
|
||||
@ -87,7 +87,7 @@ public class IntentUtils {
|
||||
private boolean isSpecializedHandlerAvailable(Intent intent) {
|
||||
PackageManager pm = mActivity.getPackageManager();
|
||||
List<ResolveInfo> handlers = pm.queryIntentActivities(intent,
|
||||
PackageManager.GET_RESOLVED_FILTER);
|
||||
PackageManager.GET_RESOLVED_FILTER);
|
||||
if (handlers == null || handlers.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@ -102,7 +102,9 @@ public class IntentUtils {
|
||||
// to launch a new intent for every URL, using OR only
|
||||
// launches a new one if there is a non-browser app that
|
||||
// can handle it.
|
||||
if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) {
|
||||
// Previously we checked the number of data paths, but it is unnecessary
|
||||
// filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0
|
||||
if (filter.countDataAuthorities() == 0) {
|
||||
// Generic handler, skip
|
||||
continue;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import javax.inject.Singleton;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.dialog.BrowserDialog;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user