mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
CB-8814 Deprecate ScrollEvent
This commit is contained in:
parent
b27d283f21
commit
581252febc
@ -76,7 +76,6 @@ public interface CordovaWebViewEngine {
|
|||||||
void onPageStarted(String newUrl);
|
void onPageStarted(String newUrl);
|
||||||
void onReceivedError(int errorCode, String description, String failingUrl);
|
void onReceivedError(int errorCode, String description, String failingUrl);
|
||||||
void onPageFinishedLoading(String url);
|
void onPageFinishedLoading(String url);
|
||||||
void onScrollChanged(int l, int t, int oldl, int oldt);
|
|
||||||
boolean onNavigationAttempt(String url);
|
boolean onNavigationAttempt(String url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,14 +573,6 @@ public class CordovaWebViewImpl implements CordovaWebView {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScrollChanged(int l, int t, int oldl, int oldt) {
|
|
||||||
// TODO: scrolling is perf-sensitive, so we'd probably be better to no use postMessage
|
|
||||||
// here, and also not to create any new objects.
|
|
||||||
ScrollEvent myEvent = new ScrollEvent(l, t, oldl, oldt, getView());
|
|
||||||
pluginManager.postMessage("onScrollChanged", myEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationAttempt(String url) {
|
public boolean onNavigationAttempt(String url) {
|
||||||
// Give plugins the chance to handle the url
|
// Give plugins the chance to handle the url
|
||||||
|
@ -22,11 +22,9 @@ package org.apache.cordova;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This can be used by any view, including native views
|
* @deprecated As of release 4.0. Use view.getViewTreeObserver().addOnScrollChangedListener(...) instead.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
|
||||||
public class ScrollEvent {
|
public class ScrollEvent {
|
||||||
|
|
||||||
public int l, t, nl, nt;
|
public int l, t, nl, nt;
|
||||||
|
@ -62,8 +62,13 @@ public class SystemWebView extends WebView implements CordovaWebViewEngine.Engin
|
|||||||
@Override
|
@Override
|
||||||
public void onScrollChanged(int l, int t, int oldl, int oldt)
|
public void onScrollChanged(int l, int t, int oldl, int oldt)
|
||||||
{
|
{
|
||||||
super.onScrollChanged(l, t, oldl, oldt);
|
// TODO: scrolling is perf-sensitive, so we'd be better to not use postMessage
|
||||||
parentEngine.client.onScrollChanged(l, t, oldl, oldt);
|
// here, and also not create any new objects. Instead, plugins should use:
|
||||||
|
// webView.getView().getViewTreeObserver().addOnScrollChangedListener(...)
|
||||||
|
if (parentEngine != null && parentEngine.pluginManager != null) {
|
||||||
|
ScrollEvent myEvent = new ScrollEvent(l, t, oldl, oldt, this);
|
||||||
|
parentEngine.pluginManager.postMessage("onScrollChanged", myEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user