public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(Resource.Layout.fragment_menu, null); RecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.recyclerview); adapter = new MenuListAdapter((IMvxAndroidBindingContext)this.BindingContext); var mvxViewModelLoader = Mvx.Resolve <IMvxViewModelLoader>(); var vmRequest = MvxViewModelRequest.GetDefaultRequest(typeof(SideMenuViewModel)); ViewModel = mvxViewModelLoader.LoadViewModel(vmRequest, null) as SideMenuViewModel; adapter.ViewModel = ViewModel; var linearLayoutManager = new LinearLayoutManager(Context); var dividerItemDecoration = new DividerItemDecoration(RecyclerView.Context, linearLayoutManager.Orientation); RecyclerView.SetLayoutManager(linearLayoutManager); RecyclerView.AddItemDecoration(dividerItemDecoration); RecyclerView.Adapter = adapter; adapter.ItemClick += OnItemClick; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(Resource.Layout.fragment_menu, null); RecyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.recyclerview); adapter = new MenuListAdapter((IMvxAndroidBindingContext)this.BindingContext); adapter.ViewModel = ViewModel; RecyclerView.Adapter = adapter; var bindingSet = this.CreateBindingSet <MenuChildFragment, OtherViewModel>(); bindingSet.Bind(RecyclerView).For(v => v.ItemsSource).To(v => v.ItemsCollection); bindingSet.Apply(); return(view); }
public View CreateMessageList() { Adapter = new MessageListAdaptor() { Data = MessageDummy.Create(100) }; //Adapter.FlickAnimationSpeed = 0.7f; //Adapter.FlickDistanceMultiplierRange = new Vector2(0.2f, 1.3f); //Adapter.FlickThreshold = 0.1f; popupAnimation = new Animation(100); Layer root = NUIApplication.GetDefaultWindow().GetDefaultLayer(); contentBlurView = new GaussianBlurView(40, 3.0f, PixelFormat.RGBA8888, 1.0f, 1.0f, false) { Size = new Size(360, 360), }; message = new MessageList(Adapter) { Size = new Size(360, 360), PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.Center, }; contentBlurView.Add(message); MenuListAdapter menuListAdapter = new MenuListAdapter() { Data = new List <object> { new MenuData() { Title = "Write", ResourceUrl = "send_message.png" }, new MenuData() { Title = "Delete", ResourceUrl = "delete.png" }, new MenuData() { Title = "Settings", ResourceUrl = "settings.png" } } }; menuPopup = new MenuList(menuListAdapter) { Size = new Size(360, 360), }; menuPopup.Hide(); menuPopup.TouchEvent += (object source, View.TouchEventArgs args) => { if (args.Touch.GetState(0) == PointStateType.Finished) { HidePopup(); } return(true); }; //contentBlurView.Add(menuPopup); optionButton = new MoreOption() { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight, PivotPoint = Tizen.NUI.PivotPoint.CenterRight, }; optionButton.TouchEvent += (object sender, View.TouchEventArgs args) => { MoreOption target = args.Touch.GetHitView(0) as MoreOption; if (target) { if (args.Touch.GetState(0) == PointStateType.Down && args.Touch.GetLocalPosition(0).X > 50) { optionButton.ShowTouchEffect(); } else if (args.Touch.GetState(0) == PointStateType.Finished) { if (optionButton.IsPressed && args.Touch.GetLocalPosition(0).X > 50) { ShowPopup(); } optionButton.HideTouchEffect(); } else if (args.Touch.GetState(0) == PointStateType.Interrupted) { optionButton.HideTouchEffect(); } } return(true); }; contentBlurView.Add(optionButton); return(contentBlurView); }