summaryrefslogtreecommitdiff
path: root/AndroidNative
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2017-04-06 13:19:52 (GMT)
committerGitHub <noreply@github.com>2017-04-06 13:19:52 (GMT)
commit425fafb05723a299a5eaa0f6d801f87bdf7141fa (patch)
treea9e38aa0a0252e6a6d2da6990303d82f2163a5a9 /AndroidNative
parent829a4bda76166ddffce5a0e84538183b9527a1bd (diff)
downloadxamarin-forms-425fafb05723a299a5eaa0f6d801f87bdf7141fa.zip
xamarin-forms-425fafb05723a299a5eaa0f6d801f87bdf7141fa.tar.gz
xamarin-forms-425fafb05723a299a5eaa0f6d801f87bdf7141fa.tar.bz2
Android fastrenderers (#845)
* 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
Diffstat (limited to 'AndroidNative')
-rw-r--r--AndroidNative/FormsViewGroup/src/com/xamarin/forms/platform/android/FormsViewGroup.java130
1 files changed, 130 insertions, 0 deletions
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 2168f32..3abf452 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);
+ }
+}
+
}