[Android] Use non-deprecated constructor for GestureDetector (#1227)
* Use non-deprecated constructor for GestureDetector * Only grab Context once * Only get Context once
This commit is contained in:
Родитель
785d59ad22
Коммит
355a864c0c
|
@ -85,16 +85,18 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
GestureDetector InitializeTapAndPanDetector()
|
||||
{
|
||||
var context = Control.Context;
|
||||
var listener = new InnerGestureListener(new TapGestureHandler(() => View),
|
||||
new PanGestureHandler(() => View, Control.Context.FromPixels));
|
||||
new PanGestureHandler(() => View, context.FromPixels));
|
||||
|
||||
return new GestureDetector(listener);
|
||||
return new GestureDetector(context, listener);
|
||||
}
|
||||
|
||||
ScaleGestureDetector InitializeScaleDetector()
|
||||
{
|
||||
var listener = new InnerScaleListener(new PinchGestureHandler(() => View), Control.Context.FromPixels);
|
||||
var detector = new ScaleGestureDetector(Control.Context, listener, Control.Handler);
|
||||
var context = Control.Context;
|
||||
var listener = new InnerScaleListener(new PinchGestureHandler(() => View), context.FromPixels);
|
||||
var detector = new ScaleGestureDetector(context, listener, Control.Handler);
|
||||
ScaleGestureDetectorCompat.SetQuickScaleEnabled(detector, true);
|
||||
|
||||
return detector;
|
||||
|
|
Загрузка…
Ссылка в новой задаче