New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for market:// urls #22091
Changes from all commits
File filter...
Jump to…
| @@ -20,6 +20,7 @@ | ||
| import android.widget.EditText; | ||
| import android.widget.ProgressBar; | ||
| import android.widget.TextView; | ||
| import android.util.Log; | ||
|
|
||
| import org.mozilla.servoview.ServoView; | ||
| import org.mozilla.servoview.Servo; | ||
| @@ -162,6 +163,19 @@ public void onHistoryChanged(boolean canGoBack, boolean canGoForward) { | ||
| mCanGoBack = canGoBack; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onAllowNavigation(String url) { | ||
| if (url.startsWith("market://")) { | ||
| try { | ||
| startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); | ||
| return false; | ||
| } catch (Exception e) { | ||
| Log.e("onAllowNavigation", e.toString()); | ||
paulrouget
Contributor
|
||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| public void onRedrawing(boolean redrawing) { | ||
| if (redrawing) { | ||
| mIdleText.setText("LOOP"); | ||
| @@ -128,6 +128,8 @@ public void suspend(boolean suspended) { | ||
| } | ||
|
|
||
| public interface Client { | ||
| boolean onAllowNavigation(String url); | ||
|
|
||
| void onLoadStarted(); | ||
|
|
||
| void onLoadEnded(); | ||
| @@ -191,6 +193,10 @@ public void onAnimatingChanged(boolean animating) { | ||
| mRunCallback.inGLThread(() -> mGfxCb.animationStateChanged(animating)); | ||
| } | ||
|
|
||
| public boolean onAllowNavigation(String url) { | ||
| return mClient.onAllowNavigation(url); | ||
paulrouget
Contributor
|
||
| } | ||
|
|
||
| public void onLoadStarted() { | ||
| mRunCallback.inUIThread(() -> mClient.onLoadStarted()); | ||
| } | ||
@paulrouget
Do we need to do something here?
To my knowledge, this exception will be thrown on 2 cases. If there is no app to handle the URL (play store is not installed) or there is a problem in parsing URL.