public override View CreateNodeView(TreeNode node, Java.Lang.Object value) { var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; View view = inflater.Inflate(Resource.Layout.layout_selectable_header, null, false); var iconTreeItem = value.JavaCast <IconTreeItem>(); tvValue = view.FindViewById <TextView>(Resource.Id.node_value); tvValue.Text = iconTreeItem.Text; PrintView iconView = view.FindViewById <PrintView>(Resource.Id.icon); iconView.SetIconText(iconTreeItem.Icon); arrowView = view.FindViewById <PrintView>(Resource.Id.arrow_icon); if (node.IsLeaf) { arrowView.Visibility = ViewStates.Gone; } nodeSelector = view.FindViewById <CheckBox>(Resource.Id.node_selector); nodeSelector.CheckedChange += (sender, e) => { node.Selected = e.IsChecked; foreach (var childNode in node.Children) { TreeView.SelectNode(childNode, e.IsChecked); } }; nodeSelector.Checked = node.Selected; return(view); }
public bool OnLongClick(TreeNode node, Java.Lang.Object value) { IconTreeItem item = value.JavaCast <IconTreeItem>(); Toast.MakeText(activity, "Long click: " + item.Text, ToastLength.Short).Show(); return(true); }
public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object jChild, View dependency) { if (dependency is T view) { var child = jChild.JavaCast <View>(); if (_dependsOnView) { //TODO this 4dp margin is actual shadow layout height, which is 4 dp in bottomBar library ver. 2.0.2 float transitionY = view.TranslationY - view.Height + (State != StateExpanded ? PixelSizeConverter.DpToPx(4) : 0); child.TranslationY = System.Math.Min(transitionY, 0); } if (view.TranslationY >= view.Height) { _dependsOnView = false; view.Visibility = ViewStates.Gone; } if (State != StateExpanded) { _dependsOnView = true; view.Visibility = ViewStates.Visible; } return(false); } return(base.OnDependentViewChanged(parent, jChild, dependency)); }
public int Compare(Java.Lang.Object o1, Java.Lang.Object o2) { var lhs = o1.JavaCast <Size>(); var rhs = o2.JavaCast <Size>(); return(Long.Signum(lhs.Width * lhs.Height - rhs.Width * rhs.Height)); }
public override View CreateNodeView(TreeNode node, Java.Lang.Object value) { var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; View view = inflater.Inflate(Resource.Layout.layout_social_node, null, false); var socialItem = value.JavaCast <SocialItem>(); PrintView iconView = view.FindViewById <PrintView>(Resource.Id.icon); iconView.SetIconText(socialItem.Icon); TextView connectionsLabel = view.FindViewById <TextView>(Resource.Id.connections); var rdm = new Random(); connectionsLabel.Text = rdm.Next(150) + " connections"; TextView userNameLabel = view.FindViewById <TextView>(Resource.Id.username); userNameLabel.Text = NAMES[rdm.Next(4)]; TextView sizeText = view.FindViewById <TextView>(Resource.Id.size); sizeText.Text = rdm.Next(10) + " items"; return(view); }
public override void OnNestedPreScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object jChild, View target, int dx, int dy, int[] consumed, int type) { base.OnNestedPreScroll(coordinatorLayout, jChild, target, dx, dy, consumed, type); var child = jChild.JavaCast <View>(); child.TranslationY = System.Math.Max(child.Height, child.TranslationY + dy); }
protected override void OnPostExecute(Java.Lang.Object result) { if (imageViewReference != null && result != null) { var bitmap = result.JavaCast <Bitmap>(); ImageView imageView; if (imageViewReference.TryGetTarget(out imageView)) { try { var bitmapWorkerTask = GetBitmapWorkerTask(imageView); if (this == bitmapWorkerTask && imageView != null) { if (Finished != null) { Finished(this, bitmap); } else { imageView.SetImageBitmap(bitmap); } } } catch { } } } }
public override View CreateNodeView(TreeNode node, Java.Lang.Object value) { var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; View view = inflater.Inflate(Resource.Layout.layout_icon_node, null, false); var iconTreeItem = value.JavaCast <IconTreeItem>(); var tvValue = view.FindViewById <TextView>(Resource.Id.node_value); tvValue.Text = iconTreeItem.Text; PrintView iconView = view.FindViewById <PrintView>(Resource.Id.icon); iconView.SetIconText(iconTreeItem.Icon); arrowView = view.FindViewById <PrintView>(Resource.Id.arrow_icon); view.FindViewById(Resource.Id.btn_addFolder).Click += (sender, e) => { TreeNode newFolder = new TreeNode(new IconTreeItem(Resource.String.ic_folder, "New Folder")); TreeView.AddNode(node, newFolder); }; view.FindViewById(Resource.Id.btn_delete).Click += (sender, e) => { TreeView.RemoveNode(node); }; //if My computer if (node.Level == 1) { view.FindViewById(Resource.Id.btn_delete).Visibility = ViewStates.Gone; } return(view); }
public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object jChild, View dependency) { var behavior = GetBottomSheetBehavior(dependency); if (behavior != null) { int peekHeight = behavior.PeekHeight; // The default peek height is -1, which // gets resolved to a 16:9 ratio with the parent var actualPeek = behavior.PeekHeight >= 0 ? behavior.PeekHeight : (int)(9 * (double)parent.Height / 16); // Only perform alpha change when view is between "hidden"/"collapsed" and open states if (dependency.Top <= actualPeek) { // calculate effective view area var fullHeight = actualPeek - parent.Height; // var dy = dependency.Top - parent.Height; var fractionPosition = (float)dependency.Top / fullHeight; if (fractionPosition >= 0 && fractionPosition <= 1) { var child = jChild.JavaCast <View>(); child.Alpha = fractionPosition; return(true); } } } return(false); }
/// <summary> /// On Geofence Request Result /// </summary> /// <param name="result"></param> public void OnResult(Java.Lang.Object result) { var res = result.JavaCast <IResult>(); int statusCode = res.Status.StatusCode; string message = string.Empty; switch (res.Status.StatusCode) { case Android.Gms.Location.GeofenceStatusCodes.SuccessCache: case Android.Gms.Location.GeofenceStatusCodes.Success: if (CurrentRequestType == RequestType.Add) { message = string.Format("{0} - {1}", CrossGeofence.Id, "Successfully added Geofence."); foreach (GeofenceCircularRegion region in Regions.Values) { CrossGeofence.GeofenceListener.OnMonitoringStarted(region.Id); } } else { message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence Update Received"); } break; case Android.Gms.Location.GeofenceStatusCodes.Error: message = string.Format("{0} - {1}", CrossGeofence.Id, "Error adding Geofence."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyGeofences: message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many geofences."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyPendingIntents: message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many pending intents."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceNotAvailable: message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence not available."); break; } System.Diagnostics.Debug.WriteLine(message); if (statusCode != Android.Gms.Location.GeofenceStatusCodes.Success && statusCode != Android.Gms.Location.GeofenceStatusCodes.SuccessCache && IsMonitoring) { // Rather than force killing all running geofences, delegate action on geofence failures to the application. // This lets the application decide to ignore the error, perform retry logic, stop monitoring as below, or any other behavior. // StopMonitoringAllRegions(); ((GeofenceImplementation)CrossGeofence.Current).LocationHasError = true; if (!string.IsNullOrEmpty(message)) { CrossGeofence.GeofenceListener.OnError(message); } } }
protected override void OnBeforeClusterItemRendered(Java.Lang.Object item, MarkerOptions markerOptions) { var clusterItem = item.JavaCast <MyItem>(); BitmapDescriptor icon = BitmapDescriptorFactory.FromResource(GetResourceForPin(clusterItem.IconType)); markerOptions.SetIcon(icon).SetTitle(clusterItem.Title); }
/// <summary> /// On Geofence Request Result /// </summary> /// <param name="result"></param> public void OnResult(Java.Lang.Object result) { var res = result.JavaCast <IResult>(); int statusCode = res.Status.StatusCode; string message = string.Empty; switch (res.Status.StatusCode) { case Android.Gms.Location.GeofenceStatusCodes.SuccessCache: case Android.Gms.Location.GeofenceStatusCodes.Success: if (CurrentRequestType == RequestType.Add) { message = string.Format("{0} - {1}", CrossGeofence.Id, "Successfully added Geofence."); foreach (GeofenceCircularRegion region in Regions.Values) { CrossGeofence.GeofenceListener.OnMonitoringStarted(region.Id); } } else { message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence Update Received"); } break; case Android.Gms.Location.GeofenceStatusCodes.Error: message = string.Format("{0} - {1}", CrossGeofence.Id, "Error adding Geofence."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyGeofences: message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many geofences."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyPendingIntents: message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many pending intents."); break; case Android.Gms.Location.GeofenceStatusCodes.GeofenceNotAvailable: message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence not available."); break; } System.Diagnostics.Debug.WriteLine(message); if (statusCode != Android.Gms.Location.GeofenceStatusCodes.Success && statusCode != Android.Gms.Location.GeofenceStatusCodes.SuccessCache && IsMonitoring) { StopMonitoringAllRegions(); if (!string.IsNullOrEmpty(message)) { CrossGeofence.GeofenceListener.OnError(message); } } }
void IOnSuccessListener.OnSuccess(JObject result) { var result_ = result.JavaCast <JavaList <Barcode> >(); if (!result_.Any_Nullable()) { return; } OnSuccess(result_ !); }
//Since Java bytecode does not support generics, casting between types can be messy. Handle everything here. public void OnResult(Java.Lang.Object raw) { Exception nodeException, messageException; try { // Get the message that was send var nodeResult = raw.JavaCast <INodeApiGetConnectedNodesResult>(); _nodes = nodeResult.Nodes; foreach (var node in _nodes) { WearableClass.MessageApi.SendMessage(_mGoogleApiClient, node.Id, path, new byte[0]) .SetResultCallback(this); //will go to second try/catch block } return; } catch (Exception e) { nodeException = e; } try { //check that it worked correctly var messageResult = raw.JavaCast <IMessageApiSendMessageResult>(); if (!messageResult.Status.IsSuccess) { Log.Error(TAG, "Failed to connect to Google Api Client with status " + messageResult.Status); } return; } catch (Exception e) { messageException = e; } //Will never get here Log.Warn(TAG, "Unexpected type for OnResult"); Log.Error(TAG, "Node Exception", nodeException); Log.Error(TAG, "Message Exception", messageException); }
public override bool OnLayoutChild(CoordinatorLayout parent, Java.Lang.Object cChild, int layoutDirection) { // return base.OnLayoutChild(parent, child, layoutDirection); var child = cChild.JavaCast <View>(); // First let the parent lay it out if (_state != StateDragging && _state != StateSettling) { if (parent.FitsSystemWindows && !child.FitsSystemWindows) { child.SetFitsSystemWindows(true); } parent.OnLayoutChild(child, layoutDirection); } // Offset the bottom sheet _parentHeight = parent.Height; _minOffset = System.Math.Max(0, _parentHeight - child.Height); _maxOffset = System.Math.Max(_parentHeight - _peekHeight, _minOffset); /** * New behavior */ switch (_state) { case StateAnchorPoint: ViewCompat.OffsetTopAndBottom(child, AnchorPoint); break; case StateExpanded: ViewCompat.OffsetTopAndBottom(child, _minOffset); break; case StateHidden: if (Hideable) { ViewCompat.OffsetTopAndBottom(child, _parentHeight); } break; case StateCollapsed: ViewCompat.OffsetTopAndBottom(child, _maxOffset); break; } ; if (_viewDragHelper == null) { _viewDragHelper = ViewDragHelper.Create(parent, _dragCallback); } _viewRef = new WeakReference <View>(child); _nestedScrollingChildRef = new WeakReference <View>(FindScrollingChild(child)); return(true); }
public void OnSuccess(Java.Lang.Object result) { Logger.D(TAG, "Success:"); AuthenticationResult aresult = result.JavaCast <AuthenticationResult> (); if (aresult != null) { Logger.V(TAG, "token:" + (aresult.AccessToken)); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage(aresult.AccessToken); builder.SetTitle(aresult.ExpiresOn.ToString()); builder.Create().Show(); } }
public void OnResult(Java.Lang.Object result) { var dataItemResult = result.JavaCast <IDataApiDataItemResult> (); if (dataItemResult.Status.IsSuccess && dataItemResult.DataItem != null) { var configDataItem = dataItemResult.DataItem; var dataMapItem = DataMapItem.FromDataItem(configDataItem); SetupAllPickers(dataMapItem.DataMap); } else { SetupAllPickers(null); } }
public override bool OnTouchEvent(CoordinatorLayout parent, Java.Lang.Object cChild, MotionEvent ev) { var child = cChild.JavaCast <View>(); if (!child.IsShown) { return(false); } var action = ev.ActionMasked; if (_state == StateDragging && action == MotionEventActions.Down) { return(true); } // Detect scroll direction for ignoring collapsible if (_lastStableState == StateAnchorPoint && action == MotionEventActions.Move) { if (ev.GetY() > _initialY && !Collapsible) { Reset(); return(false); } } if (_viewDragHelper == null) { _viewDragHelper = ViewDragHelper.Create(parent, _dragCallback); } _viewDragHelper.ProcessTouchEvent(ev); if (action == MotionEventActions.Down) { Reset(); } // The ViewDragHelper tries to capture only the top-most View. We have to explicitly tell it // to capture the bottom sheet in case it is not captured and the touch slop is passed. if (action == MotionEventActions.Move && !_ignoreEvents && System.Math.Abs(_initialY - ev.GetY()) > _viewDragHelper.TouchSlop) { _viewDragHelper.CaptureChildView(child, ev.GetPointerId(ev.ActionIndex)); } return(!_ignoreEvents); }
public override View CreateNodeView(TreeNode node, Java.Lang.Object value) { var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; View view = inflater.Inflate(Resource.Layout.layout_profile_node, null, false); var tvValue = view.FindViewById <TextView>(Resource.Id.node_value); var iconTreeItem = value.JavaCast <IconTreeItem>(); tvValue.Text = iconTreeItem.Text; PrintView iconView = view.FindViewById <PrintView>(Resource.Id.icon); iconView.SetIconText(iconTreeItem.Icon); return(view); }
public override View CreateNodeView(TreeNode node, Java.Lang.Object value) { var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; View view = inflater.Inflate(Resource.Layout.layout_place_node, null, false); var placeItem = value.JavaCast <PlaceItem>(); var placeName = view.FindViewById <TextView>(Resource.Id.place_name); placeName.Text = placeItem.Name; Random r = new Random(); bool like = r.Next(2) > 0; PrintView likeView = view.FindViewById <PrintView>(Resource.Id.like); likeView.SetIconText(like ? Resource.String.ic_thumbs_up: Resource.String.ic_thumbs_down); return(view); }
public void OnSingleManifest(Object obj) { var manifest = obj.JavaCast<HlsPlaylist>(); if (_canceled) { return; } var mainHandler = _player.MainHandler; var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize)); var bandwidthMeter = new DefaultBandwidthMeter(); var timestampAdjusterProvider = new PtsTimestampAdjusterProvider(); var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent); var chunkSource = new HlsChunkSource(true , dataSource , _url , manifest , DefaultHlsTrackSelector.NewDefaultInstance(_context) , bandwidthMeter , timestampAdjusterProvider , HlsChunkSource.AdaptiveModeSplice); var sampleSource = new HlsSampleSource(chunkSource , loadControl , BufferSegments*BufferSegmentSize , mainHandler , _player , VideoPlayer.TypeVideo); var videoRenderer = new MediaCodecVideoTrackRenderer(_context , sampleSource , MediaCodecSelector.Default , (int) VideoScalingMode.ScaleToFit , 5000 , mainHandler , _player , 50); var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource , MediaCodecSelector.Default , null , true , _player.MainHandler , _player , AudioCapabilities.GetCapabilities(_context) , (int) Stream.Music); // TODO: The Id3Parser is currently not part of the binding //MetadataTrackRenderer id3Renderer = new MetadataTrackRenderer(sampleSource, new Id3Parser(), player, mainHandler.getLooper()); var closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, _player, mainHandler.Looper); var renderers = new TrackRenderer[VideoPlayer.RendererCount]; renderers[VideoPlayer.TypeVideo] = videoRenderer; renderers[VideoPlayer.TypeAudio] = audioRenderer; //renderers[DemoPlayer.TYPE_METADATA] = id3Renderer; renderers[VideoPlayer.TypeText] = closedCaptionRenderer; _player.OnRenderers(renderers, bandwidthMeter); }
public virtual Object Evaluate(float fraction, Object startValue, Object endValue) { return Evaluate (fraction, startValue.JavaCast<Number> (), endValue.JavaCast<Number> ()); }
public bool OnResourceReady(Java.Lang.Object result, Java.Lang.Object model, ITarget target, DataSource dataSource, bool isFirstResource) { tcsDrawable.TrySetResult(result.JavaCast <Drawable>()); return(false); // True would prevent target.OnResourceReady from being called - not necessary here }
public override void OnNestedPreScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object cChild, View target, int dx, int dy, int[] consumed, int type) { var child = cChild.JavaCast <View>(); _nestedScrollingChildRef.TryGetTarget(out View scrollingChild); if (target != scrollingChild) { return; } _scrollVelocityTracker.RecordScroll(dy); int currentTop = child.Top; int newTop = currentTop - dy; // Force stop at the anchor - do not go from collapsed to expanded in one scroll if ((_lastStableState == StateCollapsed && newTop < AnchorPoint) || (_lastStableState == StateExpanded && newTop > AnchorPoint)) { consumed[1] = dy; ViewCompat.OffsetTopAndBottom(child, AnchorPoint - currentTop); DispatchOnSlide(child.Top); _nestedScrolled = true; return; } if (dy > 0) { // Upward if (newTop < _minOffset) { consumed[1] = currentTop - _minOffset; ViewCompat.OffsetTopAndBottom(child, -consumed[1]); SetStateInternal(StateExpanded); } else { consumed[1] = dy; ViewCompat.OffsetTopAndBottom(child, -dy); SetStateInternal(StateDragging); } } else if (dy < 0) { // Downward if (!ViewCompat.CanScrollVertically(target, -1)) { if (newTop <= _maxOffset || Hideable) { // Restrict STATE_COLLAPSED if restrictedState is set if (Collapsible == true || (Collapsible == false && (AnchorPoint - newTop) >= 0)) { consumed[1] = dy; ViewCompat.OffsetTopAndBottom(child, -dy); SetStateInternal(StateDragging); } } else { consumed[1] = currentTop - _maxOffset; ViewCompat.OffsetTopAndBottom(child, -consumed[1]); SetStateInternal(StateCollapsed); } } } DispatchOnSlide(child.Top); _nestedScrolled = true; }
public void OnResponse(Java.Lang.Object p0) { _onResponse?.Invoke(p0.JavaCast <T>()); }
public override void OnStopNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object cChild, View target, int type) { var child = cChild.JavaCast <View>(); if (child.Top == _minOffset) { SetStateInternal(StateExpanded); _lastStableState = StateExpanded; return; } _nestedScrollingChildRef.TryGetTarget(out View nestedChildRedTarget); if (target != nestedChildRedTarget || !_nestedScrolled) { return; } int top; int targetState; // Are we flinging up? float scrollVelocity = _scrollVelocityTracker.ScrollVelocity; if (scrollVelocity > _minimumVelocity) { if (_lastStableState == StateCollapsed) { // Fling from collapsed to anchor top = AnchorPoint; targetState = StateAnchorPoint; } else if (_lastStableState == StateAnchorPoint) { // Fling from anchor to expanded top = _minOffset; targetState = StateExpanded; } else { // We are already expanded top = _minOffset; targetState = StateExpanded; } } else // Are we flinging down? if (scrollVelocity < -_minimumVelocity) { if (_lastStableState == StateExpanded) { // Fling to from expanded to anchor top = AnchorPoint; targetState = StateAnchorPoint; } else if (Collapsible == true) { if (_lastStableState == StateAnchorPoint) { // Fling from anchor to collapsed top = _maxOffset; targetState = StateCollapsed; } else { // We are already collapsed top = _maxOffset; targetState = StateCollapsed; } } else { top = AnchorPoint; targetState = StateAnchorPoint; } } // Not flinging, just settle to the nearest state else { // Collapse? int currentTop = child.Top; if (currentTop > AnchorPoint * 1.25 && Collapsible == true) { // Multiply by 1.25 to account for parallax. The currentTop needs to be pulled down 50% of the anchor point before collapsing. top = _maxOffset; targetState = StateCollapsed; } // Expand? else if (currentTop < AnchorPoint * 0.5) { top = _minOffset; targetState = StateExpanded; } // Snap back to the anchor else { top = AnchorPoint; targetState = StateAnchorPoint; } } _lastStableState = targetState; if (_viewDragHelper.SmoothSlideViewTo(child, child.Left, top)) { SetStateInternal(StateSettling); ViewCompat.PostOnAnimation(child, new SettleRunnable(this, child, targetState)); } else { SetStateInternal(targetState); } _nestedScrolled = false; }
protected override int SizeOf(Java.Lang.Object key, Java.Lang.Object value) { return(value.JavaCast <Bitmap>().ByteCount / 1024); }
public void OnClusterItemInfoWindowClick(Java.Lang.Object item) { var currentMarker = item.JavaCast <MyItem>(); Toast.MakeText(this, "Title: " + currentMarker.Title, ToastLength.Short).Show(); }
public override bool OnInterceptTouchEvent(CoordinatorLayout parent, Java.Lang.Object cChild, MotionEvent ev) { var child = cChild.JavaCast <View>(); if (!child.IsShown) { _ignoreEvents = true; return(false); } var action = ev.ActionMasked; if (action == MotionEventActions.Down) { Reset(); } switch (action) { case MotionEventActions.Up: case MotionEventActions.Cancel: _touchingScrollingChild = false; _activePointerId = MotionEvent.InvalidPointerId; // Reset the ignore flag if (_ignoreEvents) { _ignoreEvents = false; return(false); } break; case MotionEventActions.Down: _scrollVelocityTracker.Clear(); int initialX = (int)ev.GetX(); _initialY = (int)ev.GetY(); if (_state == StateAnchorPoint) { _activePointerId = ev.GetPointerId(ev.ActionIndex); _touchingScrollingChild = true; } else { _nestedScrollingChildRef.TryGetTarget(out View scroll); if (scroll != null && parent.IsPointInChildBounds(scroll, initialX, _initialY)) { _activePointerId = ev.GetPointerId(ev.ActionIndex); _touchingScrollingChild = true; } } _ignoreEvents = _activePointerId == MotionEvent.InvalidPointerId && !parent.IsPointInChildBounds(child, initialX, _initialY); break; case MotionEventActions.Move: break; } if (!_ignoreEvents && _viewDragHelper.ShouldInterceptTouchEvent(ev)) { return(true); } // We have to handle cases that the ViewDragHelper does not capture the bottom sheet because // it is not the top most view of its parent. This is not necessary when the touch event is // happening over the scrolling content as nested scrolling logic handles that case. _nestedScrollingChildRef.TryGetTarget(out View scroll1); return(action == MotionEventActions.Move && scroll1 != null && !_ignoreEvents && _state != StateDragging && !parent.IsPointInChildBounds(scroll1, (int)ev.GetX(), (int)ev.GetY()) && System.Math.Abs(_initialY - ev.GetY()) > _viewDragHelper.TouchSlop); }
public void OnClick(TreeNode node, Java.Lang.Object value) { IconTreeItem item = value.JavaCast <IconTreeItem>(); statusBar.Text = "Last clicked: " + item.Text; }
public override bool BlocksInteractionBelow(CoordinatorLayout parent, Java.Lang.Object child) { return(child.JavaCast <View> ().Visibility == ViewStates.Visible); }
public void OnSingleManifest(Object manifest) { if (_canceled) { return; } _manifest = manifest.JavaCast<MediaPresentationDescription>(); if (_manifest.Dynamic && _manifest.UtcTiming != null) { UtcTimingElementResolver.ResolveTimingElement(_manifestDataSource, _manifest.UtcTiming, _manifestFetcher.ManifestLoadCompleteTimestamp, this); } else { BuildRenderers(); } }
public void OnSingleManifest(Object obj) { var manifest = obj.JavaCast<SmoothStreamingManifest>(); if (_canceled) { return; } var mainHandler = _player.MainHandler; var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize)); var bandwidthMeter = new DefaultBandwidthMeter(mainHandler, _player); // Check drm support if necessary. IDrmSessionManager drmSessionManager = null; if (manifest.ProtectionElement != null) { if (ExoPlayerUtil.SdkInt < 18) { _player.OnRenderersError( new UnsupportedDrmException(UnsupportedDrmException.ReasonUnsupportedScheme)); return; } try { drmSessionManager = new StreamingDrmSessionManager(manifest.ProtectionElement.Uuid, _player.PlaybackLooper, _drmCallback, null, _player.MainHandler, _player); } catch (Exception e) { _player.OnRenderersError(e); return; } } // Build the video renderer. var videoDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent); var videoChunkSource = new SmoothStreamingChunkSource(_manifestFetcher , DefaultSmoothStreamingTrackSelector.NewVideoInstance(_context, true, false) , videoDataSource , new FormatEvaluatorAdaptiveEvaluator(bandwidthMeter) , LiveEdgeLatencyMs); var videoSampleSource = new ChunkSampleSource(videoChunkSource , loadControl , VideoBufferSegments*BufferSegmentSize , mainHandler , _player , VideoPlayer.TypeVideo); var videoRenderer = new MediaCodecVideoTrackRenderer(_context , videoSampleSource , MediaCodecSelector.Default , (int)VideoScalingMode.ScaleToFit , 5000 , drmSessionManager , true , mainHandler , _player , 50); // Build the audio renderer. var audioDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent); var audioChunkSource = new SmoothStreamingChunkSource(_manifestFetcher , DefaultSmoothStreamingTrackSelector.NewAudioInstance() , audioDataSource , null , LiveEdgeLatencyMs); var audioSampleSource = new ChunkSampleSource(audioChunkSource , loadControl , AudioBufferSegments*BufferSegmentSize , mainHandler , _player , VideoPlayer.TypeAudio); var audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource , MediaCodecSelector.Default , drmSessionManager , true , mainHandler , _player , AudioCapabilities.GetCapabilities(_context) , (int) Stream.Music); // Build the text renderer. var textDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent); var textChunkSource = new SmoothStreamingChunkSource(_manifestFetcher , DefaultSmoothStreamingTrackSelector.NewTextInstance() , textDataSource , null , LiveEdgeLatencyMs); var textSampleSource = new ChunkSampleSource(textChunkSource , loadControl , TextBufferSegments*BufferSegmentSize , mainHandler , _player , VideoPlayer.TypeText); var textRenderer = new TextTrackRenderer(textSampleSource , _player , mainHandler.Looper); // Invoke the callback. var renderers = new TrackRenderer[VideoPlayer.RendererCount]; renderers[VideoPlayer.TypeVideo] = videoRenderer; renderers[VideoPlayer.TypeAudio] = audioRenderer; renderers[VideoPlayer.TypeText] = textRenderer; _player.OnRenderers(renderers, bandwidthMeter); }
public override float GetScrimOpacity(CoordinatorLayout parent, Java.Lang.Object child) { return(child.JavaCast <View> ().Visibility == ViewStates.Visible ? 1f : 0f); }