public override bool IsViewFromObject(global::Android.Views.View p0, Java.Lang.Object p1) { var holder = (ObjectJavaBox <Tuple <ViewGroup, Page, int> >)p1; ViewGroup frame = holder.Instance.Item1; return(p0 == frame); }
public override int GetItemPosition(Java.Lang.Object item) { // The int is the current index. var holder = (ObjectJavaBox <Tuple <ViewGroup, Page, int> >)item; Element parent = holder.Instance.Item2.RealParent; if (parent == null) { return(PositionNone); } // Unfortunately we can't just call CarouselPage.GetIndex, because we need to know // if the item has been removed. We could update MultiPage<T> to set removed items' index // to -1 to support this if it ever becomes an issue. int index = ((CarouselPage)parent).Children.IndexOf(holder.Instance.Item2); if (index == -1) { return(PositionNone); } if (index != holder.Instance.Item3) { holder.Instance = new Tuple <ViewGroup, Page, int>(holder.Instance.Item1, holder.Instance.Item2, index); return(index); } return(PositionUnchanged); }
protected bool ChooseFile(IValueCallback filePathCallback, Intent intent, string title) { if (_activity == null) { return(false); } Action <Result, Intent> callback = (resultCode, intentData) => { if (filePathCallback == null) { return; } Java.Lang.Object result = ParseResult(resultCode, intentData); filePathCallback.OnReceiveValue(result); }; _requestCodes = _requestCodes ?? new List <int>(); int newRequestCode = ActivityResultCallbackRegistry.RegisterActivityResultCallback(callback); _requestCodes.Add(newRequestCode); _activity.StartActivityForResult(Intent.CreateChooser(intent, title), newRequestCode); return(true); }
public override void OnViewRecycled(Java.Lang.Object holder) { if (holder is TemplatedItemViewHolder templatedItemViewHolder) { templatedItemViewHolder.Recycle(ItemsView); } base.OnViewRecycled(holder); }
public override void DestroyItem(ViewGroup p0, int p1, Java.Lang.Object p2) { var holder = (ObjectJavaBox <Tuple <ViewGroup, Page, int> >)p2; Page destroyedPage = holder.Instance.Item2; IVisualElementRenderer renderer = Platform.GetRenderer(destroyedPage); renderer.View.RemoveFromParent(); holder.Instance.Item1.RemoveFromParent(); }
private void PopulateView(View gv, PwGroup pw) { _pwGroup = pw; ImageView iv = (ImageView)gv.FindViewById(Resource.Id.icon); Database db; try { db = App.Kp2a.FindDatabaseForElement(pw); } catch (Exception e) { //for some reason, since Android 12 we get here when the database is reloaded (after making remote changes and selecting sync) //we can just ignore this. Console.WriteLine(e); return; } db.DrawableFactory.AssignDrawableTo(iv, _groupBaseActivity, db.KpDatabase, pw.IconId, pw.CustomIconUuid, true); gv.FindViewById(Resource.Id.icon).Visibility = ViewStates.Visible; gv.FindViewById(Resource.Id.check_mark).Visibility = ViewStates.Invisible; _textview.Text = pw.Name; if (_defaultTextColor == null) { _defaultTextColor = _textview.TextColors.DefaultColor; } if (_groupBaseActivity.IsBeingMoved(_pwGroup.Uuid)) { int elementBeingMoved = Context.Resources.GetColor(Resource.Color.element_being_moved); _textview.SetTextColor(new Color(elementBeingMoved)); } else { _textview.SetTextColor(new Color((int)_defaultTextColor)); } _label.Text = _groupBaseActivity.GetString(Resource.String.group) + " - "; uint numEntries = CountEntries(pw); if (numEntries == 1) { _label.Text += Context.GetString(Resource.String.Entry_singular); } else { Java.Lang.Object obj = (int)numEntries; _label.Text += Context.GetString(Resource.String.Entry_plural, obj); } }
public override void OnViewRecycled(Java.Lang.Object holder) { if (holder is SelectableViewHolder selectable) { _currentViewHolders.Remove(selectable); selectable.Clicked -= SelectableClicked; selectable.IsSelected = false; } base.OnViewRecycled(holder); }
public override void OnResourceReady(Java.Lang.Object resource, ITransition transition) { try { if (MAdapter.AttachmentList?.Count > 0) { var item = MAdapter.AttachmentList[Position]; if (item != null && string.IsNullOrEmpty(item.Thumb?.FileUrl)) { var fileName = item.FileUrl.Split('/').Last(); var fileNameWithoutExtension = fileName.Split('.').First(); var pathImage = Methods.Path.FolderDcimImage + "/" + fileNameWithoutExtension + ".png"; var videoImage = Methods.MultiMedia.GetMediaFrom_Gallery(Methods.Path.FolderDcimImage, fileNameWithoutExtension + ".png"); if (videoImage == "File Dont Exists") { if (resource is Bitmap bitmap) { Methods.MultiMedia.Export_Bitmap_As_Image(bitmap, fileNameWithoutExtension, Methods.Path.FolderDcimImage); File file2 = new File(pathImage); var photoUri = FileProvider.GetUriForFile(MAdapter.ActivityContext, MAdapter.ActivityContext.PackageName + ".fileprovider", file2); Glide.With(MAdapter.ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(ViewHolder.Image); item.Thumb = new Attachments.VideoThumb { FileUrl = photoUri.ToString() }; } } else { File file2 = new File(pathImage); var photoUri = FileProvider.GetUriForFile(MAdapter.ActivityContext, MAdapter.ActivityContext.PackageName + ".fileprovider", file2); Glide.With(MAdapter.ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(ViewHolder.Image); item.Thumb = new Attachments.VideoThumb { FileUrl = photoUri.ToString() }; } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private static Java.Lang.Object[] CreateJavaStringArray(List <string> inputList) { if (inputList == null) { return(null); } var toReturn = new Java.Lang.Object[inputList.Count]; for (var i = 0; i < inputList.Count; i++) { toReturn[i] = new Java.Lang.String(inputList[i]); } return(toReturn); }
public override void OnViewRecycled(Java.Lang.Object holder) { try { if (holder != null) { if (holder is MentionAdapterViewHolder viewHolder) Glide.With(ActivityContext).Clear(viewHolder.Image); } base.OnViewRecycled(holder); } catch (Exception e) { Console.WriteLine(e); } }
public static TObject ToNetObject <TObject>(this Java.Lang.Object value) { if (value == null) { return(default(TObject)); } if (!(value is JavaHolder)) { throw new InvalidOperationException("Unable to convert to .NET object. Only Java.Lang.Object created with .ToJavaObject() can be converted."); } TObject returnVal; try { returnVal = (TObject)((JavaHolder)value).Instance; } finally { value.Dispose(); } return(returnVal); }
private void PopulateView(View gv, PwGroup pw) { _pwGroup = pw; ImageView iv = (ImageView)gv.FindViewById(Resource.Id.icon); Database db = App.Kp2a.FindDatabaseForElement(pw); db.DrawableFactory.AssignDrawableTo(iv, _groupBaseActivity, db.KpDatabase, pw.IconId, pw.CustomIconUuid, true); gv.FindViewById(Resource.Id.icon).Visibility = ViewStates.Visible; gv.FindViewById(Resource.Id.check_mark).Visibility = ViewStates.Invisible; _textview.Text = pw.Name; if (_defaultTextColor == null) { _defaultTextColor = _textview.TextColors.DefaultColor; } if (_groupBaseActivity.IsBeingMoved(_pwGroup.Uuid)) { int elementBeingMoved = Context.Resources.GetColor(Resource.Color.element_being_moved); _textview.SetTextColor(new Color(elementBeingMoved)); } else { _textview.SetTextColor(new Color((int)_defaultTextColor)); } _label.Text = _groupBaseActivity.GetString(Resource.String.group) + " - "; uint numEntries = CountEntries(pw); if (numEntries == 1) { _label.Text += Context.GetString(Resource.String.Entry_singular); } else { Java.Lang.Object obj = (int)numEntries; _label.Text += Context.GetString(Resource.String.Entry_plural, obj); } }
public void OnSuccess(Java.Lang.Object obj) { owner.HandlePendingAction(); owner.UpdateUI(); }
public override bool IsViewFromObject(View view, Java.Lang.Object @object) { return(view == @object); }
#pragma warning disable CS0672 // Member overrides obsolete member public override void DestroyItem(View container, int position, Java.Lang.Object @object) #pragma warning restore CS0672 // Member overrides obsolete member { ((ViewGroup)container).RemoveView((View)@object); }
/// <summary> /// <para> /// Handles a request to tear down the most recently created event stream. /// </para> /// <para> /// Any uncaught exception thrown by this method will be caught by the channel implementation and logged. /// An error result message will be sent back to Flutter. /// </para> /// <para> /// The channel implementation may call this method with null arguments to separate a pair of two consecutive set up requests. /// Such request pairs may occur during Flutter hot restart. /// Any uncaught exception thrown in this situation will be logged without notifying Flutter. /// </para> /// <para> /// Invoked when the first listener is registered with the Stream associated to this channel on the Flutter side. /// </para> /// </summary> /// <param name="arguments">Stream configuration arguments, possibly null.</param> /// <param name="events">An <see cref="EventChannel.IEventSink"/> for emitting events to the Flutter receiver.</param> public void OnListen(Java.Lang.Object arguments, EventChannel.IEventSink events) { _events = events; }
//public override ICharSequence GetPageTitleFormatted(int position) //{ // return new Java.Lang.String("Problem " + (position + 1)); //} public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object @object) { container.RemoveView((View)@object); }
public abstract void OnComplete(string response, Java.Lang.Object state);
public Object Convert(Java.Lang.Object p0) { return(Convert((JSONObject)p0)); }
public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object obj) { container.RemoveView((LinearLayout)obj); }
public override void OnItemRangeChanged(int positionStart, int itemCount, Java.Lang.Object payload) { base.OnItemRangeChanged(positionStart, itemCount, payload); _onDataChange?.Invoke(); }
public static T Cast <T>(Java.Lang.Object obj) where T : class { var propertyInfo = obj.GetType().GetProperty("Instance"); return(propertyInfo == null ? null : propertyInfo.GetValue(obj, null) as T); }
public override void OnLoadFinished(Android.Support.V4.Content.Loader p0, Java.Lang.Object p1) { OnLoadFinished(p0, p1.JavaCast <Android.Support.V7.Util.SortedList> ()); }