From 425fafb05723a299a5eaa0f6d801f87bdf7141fa Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Thu, 6 Apr 2017 14:19:52 +0100 Subject: Android fastrenderers (#845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Obsolete IVisualElementRenderer.ViewGroup in favor of .View * Fix NRE * Changing TContainer in PlatformEffect to View * Fix "View" type * new VisualElementRenderer * First attempt at a fast(er) button renderer * Fast Label Renderer * Let's try that again. Behold: Label Fast Renderer * Move FrameRenderer into Fast Renderers * Fix Disposable on VisualElementRenderer * Simplify touch and click handlers * Drop empty if clause * [Android] Add initial Image fast renderer * Split accessibility out to a separate helper class; fix tapgesture bug with label * [Android] Small fixes to VisualElementRenderer * Move accessiblity stuff to a separate class (which needs a good name) * Prevent query from looking to parent for fast renderers * [Android] ImageRenderer refactoring * Fix elevation/z-index bugs with Button (e.g., 40173) * Move SetLabeledBy to Accessibilitizer * Un-break automation IDs for Labels * Move gesture handling to its own class * Split gesture and effect management into separate classes * Remove unneeded packager from LabelRenderer * LabelRenderer inherits from FormsTextView * Batch updates to View * Fix isOnParentRenderer check for non-Android platforms * [Controls] Update Xamarin.Forms.ControlGallery.iOS.csproj * [Android,IOS] Small fixes to rebase and use of Internals * [Android] Ignroe warning for now * Fast renderers now passing InputTransparent and IsEnabled tests * Fast and legacy renderers now pass the Enabled and InputTransparent tests * Change PlatformEffect back, default container to null * Fix mangled using directives --- .../forms/platform/android/FormsViewGroup.java | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'AndroidNative/FormsViewGroup') diff --git a/AndroidNative/FormsViewGroup/src/com/xamarin/forms/platform/android/FormsViewGroup.java b/AndroidNative/FormsViewGroup/src/com/xamarin/forms/platform/android/FormsViewGroup.java index 2168f323..3abf4522 100644 --- a/AndroidNative/FormsViewGroup/src/com/xamarin/forms/platform/android/FormsViewGroup.java +++ b/AndroidNative/FormsViewGroup/src/com/xamarin/forms/platform/android/FormsViewGroup.java @@ -93,4 +93,134 @@ public class FormsViewGroup extends ViewGroup { setTranslationX (translationX); setTranslationY (translationY); } + + package com.xamarin.forms.platform.android; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.ViewGroup; +import android.view.*; + + +public class FormsViewGroup extends ViewGroup { + + public FormsViewGroup(Context context) { + super(context); + // TODO Auto-generated constructor stub + } + + public FormsViewGroup(Context context, AttributeSet attrs) { + super(context, attrs); + // TODO Auto-generated constructor stub + } + + public FormsViewGroup(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + // TODO Auto-generated constructor stub + } + + public void measureAndLayout (int widthMeasureSpec, int heightMeasureSpec, int l, int t, int r, int b) + { + measure (widthMeasureSpec, heightMeasureSpec); + layout (l, t, r, b); + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + } + + boolean inputTransparent; + + protected void setInputTransparent (boolean value) + { + inputTransparent = value; + } + + protected boolean getInputTransparent () + { + return inputTransparent; + } + + @Override + public boolean onInterceptTouchEvent (MotionEvent ev) + { + if (inputTransparent) + return false; + + return super.onInterceptTouchEvent(ev); + } + + @Override + public boolean onTouchEvent (MotionEvent ev) + { + if (inputTransparent) + return false; + + return super.onTouchEvent(ev); + } + + public void sendBatchUpdate ( + float pivotX, + float pivotY, + int visibility, + boolean enabled, + float opacity, + float rotation, + float rotationX, + float rotationY, + float scale, + float translationX, + float translationY){ + setPivotX (pivotX); + setPivotY (pivotY); + + if (getVisibility () != visibility) + setVisibility (visibility); + + if (isEnabled () != enabled) + setEnabled (enabled); + + setAlpha (opacity); + setRotation (rotation); + setRotationX (rotationX); + setRotationY (rotationY); + setScaleX (scale); + setScaleY (scale); + setTranslationX (translationX); + setTranslationY (translationY); + } + + public static void sendViewBatchUpdate ( + View view, + float pivotX, + float pivotY, + int visibility, + boolean enabled, + float opacity, + float rotation, + float rotationX, + float rotationY, + float scale, + float translationX, + float translationY){ + view.setPivotX (pivotX); + view.setPivotY (pivotY); + + if (view.getVisibility () != visibility) + view.setVisibility (visibility); + + if (view.isEnabled () != enabled) + view.setEnabled (enabled); + + view.setAlpha (opacity); + view.setRotation (rotation); + view.setRotationX (rotationX); + view.setRotationY (rotationY); + view.setScaleX (scale); + view.setScaleY (scale); + view.setTranslationX (translationX); + view.setTranslationY (translationY); + } +} + } -- cgit v1.2.3