public CalendarAdapter(Activity activity, BottomSheetDialog dialog, List <HMEvent> list) { mData = list; mDialog = dialog; mActivity = activity; NotifyDataSetChanged(); }
protected virtual void OnMoreItemSelected(ShellSection shellSection, BottomSheetDialog dialog) { ChangeSection(shellSection); dialog.Dismiss(); dialog.Dispose(); }
protected virtual bool OnItemSelected(IMenuItem item) { var id = item.ItemId; if (id == MoreTabId) { _bottomSheetDialog = CreateMoreBottomSheet(OnMoreItemSelected); _bottomSheetDialog.Show(); _bottomSheetDialog.DismissEvent += OnMoreSheetDismissed; } else { var shellSection = ShellItem.Items[id]; if (item.IsChecked) { OnTabReselected(shellSection); } else { return(ChangeSection(shellSection)); } } return(true); }
private async void Ada_ItemClick(object sender, int e) { var item = await Detail.GetVideo(_id, (_exRecyclerView.ViewAdapter as DetailListAdapter).Items[e].Set, LanguageHelper.PrefLang); var dlg = new BottomSheetDialog(this); var layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; layout.AddView(GetHeaderText("Choose Quality")); if (item.OriginalQuality != null) { layout.AddView(CreateRow("Source", item.OriginalQuality)); } if (item.HighQuality != null) { layout.AddView(CreateRow("720P", item.HighQuality)); } if (item.MediumQuality != null) { layout.AddView(CreateRow("480P", item.MediumQuality)); } if (item.LowQuality != null) { layout.AddView(CreateRow("240P", item.LowQuality)); } dlg.SetContentView(layout); dlg.SetCancelable(false); dlg.Show(); }
protected virtual bool OnItemSelected(IMenuItem item) { var id = item.ItemId; if (id == MoreTabId) { var items = CreateTabList(ShellItem); _bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(OnMoreItemSelected, Context, items, _bottomView.MaxItemCount); _bottomSheetDialog.Show(); _bottomSheetDialog.DismissEvent += OnMoreSheetDismissed; } else { var shellSection = ShellItem.Items[id]; if (item.IsChecked) { OnTabReselected(shellSection); } else { return(ChangeSection(shellSection)); } } return(true); }
void Destroy() { if (ShellItem != null) { UnhookEvents(ShellItem); } ((IShellController)ShellContext?.Shell)?.RemoveAppearanceObserver(this); if (_bottomSheetDialog != null) { _bottomSheetDialog.DismissEvent -= OnMoreSheetDismissed; _bottomSheetDialog?.Dispose(); _bottomSheetDialog = null; } _navigationArea?.Dispose(); _appearanceTracker?.Dispose(); _outerLayout?.Dispose(); if (_bottomView != null) { _bottomView?.SetOnNavigationItemSelectedListener(null); _bottomView?.Background?.Dispose(); _bottomView?.Dispose(); } _bottomView = null; _navigationArea = null; _appearanceTracker = null; _outerLayout = null; }
protected override void OnCreate(Bundle savedInstanceState) { int bottomsheetStyle = Resource.Style.GFD_BottomSheetDialog; base.OnCreate(savedInstanceState); if (ETC.useLightTheme) { SetTheme(Resource.Style.GFS_Toolbar_Light); bottomsheetStyle = Resource.Style.GFD_BottomSheetDialog_Light; } // Create your application here SetContentView(Resource.Layout.GFAnimationLayout); SetSupportActionBar(FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.GFAnimationMainToolbar)); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.Main_Other_GFAnimation); recyclerView = FindViewById <RecyclerView>(Resource.Id.GFAnimationRecyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); sheetDialog = new BottomSheetDialog(this, bottomsheetStyle); var adapter = new GFAnimationListAdapter(); adapter.ItemClick += Adapter_ItemClick; recyclerView.SetAdapter(adapter); CreateSheetDialog(); }
void BtStatus_Click(object sender, EventArgs e) { //show status share bottom sheet dialog mBottomSheetDialog_StatusPhoto = new BottomSheetDialog(this); View sheetView = LayoutInflater.Inflate(Resource.Layout.fragment_privacy_status_share, null); mBottomSheetDialog_StatusPhoto.SetContentView(sheetView); InitStatusPhotoDialog(sheetView); mBottomSheetDialog_StatusPhoto.Show(); }
void BtProfilePhoto_Click(object sender, EventArgs e) { //show profile photo share bottom sheet dialog mBottomSheetDialog_ProfilePhoto = new BottomSheetDialog(this); View sheetView = LayoutInflater.Inflate(Resource.Layout.fragment_privacy_profile_photo, null); mBottomSheetDialog_ProfilePhoto.SetContentView(sheetView); InitProfilePhotoDialog(sheetView); mBottomSheetDialog_ProfilePhoto.Show(); }
void BtChatWallPaper_Click(object sender, EventArgs e) { mBottomSheetDialog = new BottomSheetDialog(this.Activity); View sheetView = ParentActivity.LayoutInflater.Inflate(Resource.Layout.fragment_setting_chat_background, null); mBottomSheetDialog.SetContentView(sheetView); InitWallpaperDialog(sheetView); mBottomSheetDialog.Show(); }
void BtLang_Click(object sender, EventArgs e) { mBottomSheetDialog = new BottomSheetDialog(this.Activity); View sheetView = ParentActivity.LayoutInflater.Inflate(Resource.Layout.fragment_change_lang, null); mBottomSheetDialog.SetContentView(sheetView); InitSettingDialog(sheetView); mBottomSheetDialog.Show(); }
protected virtual void OnMoreItemSelected(ShellSection shellSection, BottomSheetDialog dialog) { ChangeSection(shellSection); dialog.Dismiss(); //should trigger OnMoreSheetDismissed, which will clean up the dialog if (dialog != _bottomSheetDialog) //should never be true, but just in case, prevent a leak { dialog.Dispose(); } }
void OnMoreItemSelected(int selectedIndex, BottomSheetDialog dialog) { if (selectedIndex >= 0 && _bottomNavigationView.SelectedItemId != selectedIndex && Element.Children.Count > selectedIndex) { Element.CurrentPage = Element.Children[selectedIndex]; } dialog.Dismiss(); dialog.DismissEvent -= OnMoreSheetDismissed; dialog.Dispose(); }
public async void PlaylistMore(PlaylistItem item) { BottomSheetDialog bottomSheet = new BottomSheetDialog(MainActivity.instance); View bottomView = MainActivity.instance.LayoutInflater.Inflate(Resource.Layout.BottomSheet, null); bottomView.FindViewById <TextView>(Resource.Id.bsTitle).Text = item.Name; bottomView.FindViewById <TextView>(Resource.Id.bsArtist).Text = item.Owner; Picasso.With(MainActivity.instance).Load(item.ImageURL).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(bottomView.FindViewById <ImageView>(Resource.Id.bsArt)); bottomSheet.SetContentView(bottomView); List <BottomSheetAction> actions = new List <BottomSheetAction> { new BottomSheetAction(Resource.Drawable.Play, MainActivity.instance.Resources.GetString(Resource.String.play_in_order), (sender, eventArg) => { PlaylistManager.PlayInOrder(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Shuffle, MainActivity.instance.Resources.GetString(Resource.String.random_play), (sender, eventArg) => { PlaylistManager.Shuffle(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Queue, MainActivity.instance.Resources.GetString(Resource.String.add_to_queue), (sender, eventArg) => { PlaylistManager.AddToQueue(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Download, MainActivity.instance.Resources.GetString(Resource.String.download), (sender, eventArg) => { YoutubeManager.DownloadPlaylist(item, true, false); bottomSheet.Dismiss(); }) }; if (await PlaylistManager.IsForked(item)) { actions.Add(new BottomSheetAction(Resource.Drawable.Delete, MainActivity.instance.Resources.GetString(Resource.String.unfork), (sender, eventArg) => { PlaylistManager.Unfork(item); bottomSheet.Dismiss(); })); } else { actions.Add(new BottomSheetAction(Resource.Drawable.LibraryAdd, MainActivity.instance.Resources.GetString(Resource.String.add_to_library), (sender, eventArg) => { PlaylistManager.ForkPlaylist(item); bottomSheet.Dismiss(); })); } bottomSheet.FindViewById <ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions); bottomSheet.Show(); }
protected virtual void OnMoreSheetDismissed(object sender, EventArgs e) { OnShellSectionChanged(); if (_bottomSheetDialog != null) { _bottomSheetDialog.DismissEvent -= OnMoreSheetDismissed; _bottomSheetDialog.Dispose(); _bottomSheetDialog = null; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Activity_calendar); // Set toolbar Android.Widget.Toolbar toolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbar); toolbar.Title = "Calendar"; SetActionBar(toolbar); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetDisplayShowHomeEnabled(true); mCalendarView = FindViewById <CalendarView>(Resource.Id.calendar); initCalendar(); mCalendarView.DayClick += (o, e) => { bool hasEvent = false; foreach (KeyValuePair <string, List <HMEvent> > entry in mDict) { String dateStr = new SimpleDateFormat("MM-dd-yyyy").Format(e.P0.Calendar.Time); if (entry.Key.Equals(dateStr)) { List <HMEvent> events = entry.Value; RecyclerView recyclerView = new RecyclerView(this); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); BottomSheetDialog dialog = new BottomSheetDialog(this); CalendarAdapter adapter = new CalendarAdapter(this, dialog, events); recyclerView.SetAdapter(adapter); dialog.SetContentView(recyclerView); dialog.Show(); dialog.SetOnDismissListener(this); if (!mAdapterDict.ContainsKey(dateStr)) { mAdapterDict.Add(dateStr, adapter); } hasEvent = true; break; } } if (!hasEvent) { Intent intent = new Intent(this, typeof(CalendarEditAcitvity)); StartActivityForResult(intent, CalendarAdapter.ADD); } }; }
public CommentViewHolder(View itemView, Action <Post> likeAction, Action <Post> userAction, Action <Post, VotersType> votersAction, Action <Post> flagAction, Action <Post> hideAction, Action <Post> replyAction, Action <Post> deleteAction, Action rootClickAction) : base(itemView) { _avatar = itemView.FindViewById <CircleImageView>(Resource.Id.avatar); _author = itemView.FindViewById <TextView>(Resource.Id.sender_name); _comment = itemView.FindViewById <TextView>(Resource.Id.comment_text); _likes = itemView.FindViewById <TextView>(Resource.Id.likes); _flags = itemView.FindViewById <TextView>(Resource.Id.flags); _cost = itemView.FindViewById <TextView>(Resource.Id.cost); _likeOrFlag = itemView.FindViewById <ImageButton>(Resource.Id.like_btn); _reply = itemView.FindViewById <TextView>(Resource.Id.reply_btn); _time = itemView.FindViewById <TextView>(Resource.Id.time); _more = itemView.FindViewById <ImageButton>(Resource.Id.more); _rootView = itemView.FindViewById <RelativeLayout>(Resource.Id.root_view); _author.Typeface = Style.Semibold; _comment.Typeface = _likes.Typeface = _cost.Typeface = _reply.Typeface = Style.Regular; _likeAction = likeAction; _userAction = userAction; _flagAction = flagAction; _hideAction = hideAction; _replyAction = replyAction; _rootAction = rootClickAction; _votersAction = votersAction; _deleteAction = deleteAction; _likeOrFlag.Click += Like_Click; _avatar.Click += UserAction; _author.Click += UserAction; _cost.Click += UserAction; _more.Click += DoMoreAction; _reply.Click += ReplyAction; _rootView.Click += Root_Click; _likes.Click += DoLikersAction; _flags.Click += DoFlagersAction; _context = itemView.RootView.Context; _moreActionsDialog = new BottomSheetDialog(_context); _moreActionsDialog.Window.RequestFeature(WindowFeatures.NoTitle); _more.Visibility = BasePresenter.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Invisible; _reply.Visibility = BasePresenter.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Gone; }
public void Show(string respondentId, string fullname) { var currentTopActivity = Mvx.Resolve <IMvxAndroidCurrentTopActivity>(); BottomSheetDialog dialog = new BottomSheetDialog(currentTopActivity.Activity); dialog.SetContentView(Resource.Layout.menu_bottom_sheet); //FrameLayout history = dialog.FindViewById<FrameLayout>(Resource.Id.historyFrame); FrameLayout favorite = dialog.FindViewById <FrameLayout>(Resource.Id.favoriteFrame); FrameLayout location = dialog.FindViewById <FrameLayout>(Resource.Id.locationFrame); favorite.Click += async delegate { dialog.Dismiss(); bool successfullFavorite = await Mvx.Resolve <IDialog>().ShowFavoriteConfirmationDialog(); if (successfullFavorite) { InsertFavouriteContact(respondentId); } }; location.Click += async delegate { dialog.Dismiss(); bool successfullRequest = await Mvx.Resolve <IDialog>().ShowDialog(); if (successfullRequest) { Mvx.Resolve <IDialog>().showConfirmationDialog(); NotificationItem notify = new NotificationItem() { SenderId = SearchViewModel.user, SenderMessage = "wants to know your status", RespondentId = fullname, MessageType = "request" }; await Mvx.Resolve <INotification>().InsertTodo(notify); InsertRecentContact(respondentId); Mvx.Resolve <IDialog>().hideConfirmationDialog(); } }; //history.Click += delegate { Toast.MakeText(Application.Context, "history", ToastLength.Short).Show(); }; dialog.Show(); }
protected override Dialog CreateDialog(ActionSheetConfig config) { var dlg = new BottomSheetDialog(this.Activity); var layout = new LinearLayout(this.Activity) { Orientation = Orientation.Vertical }; if (!String.IsNullOrWhiteSpace(config.Title)) { layout.AddView(this.GetHeaderText(config.Title)); } if (!String.IsNullOrWhiteSpace(config.Message)) { layout.AddView(this.GetText(config.Message, false)); } foreach (var action in config.Options) { layout.AddView(this.CreateRow(action, false)); } if (config.Destructive != null) { layout.AddView(this.CreateDivider()); layout.AddView(this.CreateRow(config.Destructive, true)); } if (config.Cancel != null) { if (config.Destructive == null) { layout.AddView(this.CreateDivider()); } layout.AddView(this.CreateRow(config.Cancel, false)); } dlg.SetContentView(layout); dlg.SetCancelable(false); return(dlg); }
public CommentViewHolder(View itemView, Action <ActionType, Post> commentAction, Action rootClickAction) : base(itemView) { _avatar = itemView.FindViewById <CircleImageView>(Resource.Id.avatar); _author = itemView.FindViewById <TextView>(Resource.Id.sender_name); _comment = itemView.FindViewById <TextView>(Resource.Id.comment_text); _likes = itemView.FindViewById <TextView>(Resource.Id.likes); _flags = itemView.FindViewById <TextView>(Resource.Id.flags); _cost = itemView.FindViewById <TextView>(Resource.Id.cost); _likeOrFlag = itemView.FindViewById <ImageButton>(Resource.Id.like_btn); _reply = itemView.FindViewById <TextView>(Resource.Id.reply_btn); _time = itemView.FindViewById <TextView>(Resource.Id.time); _more = itemView.FindViewById <ImageButton>(Resource.Id.more); _rootView = itemView.FindViewById <RelativeLayout>(Resource.Id.root_view); _reply.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Reply); _author.Typeface = Style.Semibold; _comment.Typeface = _likes.Typeface = _cost.Typeface = _reply.Typeface = Style.Regular; _commentAction = commentAction; _rootAction = rootClickAction; _likeOrFlag.Click += Like_Click; _avatar.Click += UserAction; _author.Click += UserAction; _cost.Click += UserAction; _more.Click += DoMoreAction; _reply.Click += ReplyAction; _rootView.Click += Root_Click; _likes.Click += DoLikersAction; _flags.Click += DoFlagersAction; _context = itemView.RootView.Context; _moreActionsDialog = new BottomSheetDialog(_context); _moreActionsDialog.Window.RequestFeature(WindowFeatures.NoTitle); _more.Visibility = AppSettings.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Invisible; _reply.Visibility = AppSettings.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Gone; }
private void ShareBottomDialog() { View bottomSheetLayout = LayoutInflater.Inflate(Resource.Layout.btm_share_dlg, null); (bottomSheetLayout.FindViewById(Resource.Id.button_close)).Click += (o, s) => { //Close mBottomSheetDialog.Dismiss(); }; (bottomSheetLayout.FindViewById(Resource.Id.fb)).Click += (o, s) => { //Close mBottomSheetDialog.Dismiss(); ShareFacebook(); }; (bottomSheetLayout.FindViewById(Resource.Id.insta)).Click += (o, s) => { //Close mBottomSheetDialog.Dismiss(); ShareInstagram(); }; (bottomSheetLayout.FindViewById(Resource.Id.whatsapp)).Click += (o, s) => { //Close mBottomSheetDialog.Dismiss(); ShareWhatsUp(); }; (bottomSheetLayout.FindViewById(Resource.Id.twitter)).Click += (o, s) => { //Close mBottomSheetDialog.Dismiss(); ShareTwitter(); }; mBottomSheetDialog = new BottomSheetDialog(this); mBottomSheetDialog.SetContentView(bottomSheetLayout); mBottomSheetDialog.Show(); }
public void More(int position) { string path = paths[position]; string displayPath = pathDisplay[position]; BottomSheetDialog bottomSheet = new BottomSheetDialog(MainActivity.instance); View bottomView = MainActivity.instance.LayoutInflater.Inflate(Resource.Layout.BottomSheet, null); bottomView.FindViewById <TextView>(Resource.Id.bsTitle).Text = displayPath; bottomView.FindViewById <TextView>(Resource.Id.bsArtist).Text = path; bottomView.FindViewById <ImageView>(Resource.Id.bsArt).Visibility = ViewStates.Gone; bottomSheet.SetContentView(bottomView); bottomSheet.FindViewById <ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, new List <BottomSheetAction> { new BottomSheetAction(Resource.Drawable.Folder, Resources.GetString(Resource.String.list_songs), (sender, eventArg) => { ListSongs(displayPath, path); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Play, Resources.GetString(Resource.String.play_in_order), (sender, eventArg) => { LocalManager.PlayInOrder(path); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Shuffle, Resources.GetString(Resource.String.random_play), (sender, eventArg) => { LocalManager.ShuffleAll(path); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.PlaylistAdd, Resources.GetString(Resource.String.add_to_playlist), (sender, eventArg) => { GetPlaylist(path); bottomSheet.Dismiss(); }) }); bottomSheet.Show(); }
private async void bindControls() { btnWriteComments = FindViewById <Button>(Resource.Id.footbar_write_comment); btnWriteComments.Click += delegate { BottomSheetDialog bottomSheetDiaolog = new BottomSheetDialog(this); var inflater = GetSystemService(Context.LayoutInflaterService) as LayoutInflater; EditText textComments = FindViewById <EditText>(Resource.Id.text_comments); View view = inflater.Inflate(Resource.Layout.write_comments, null); TextView textCancel = view.FindViewById <TextView>(Resource.Id.text_cancel); textCancel.Click += delegate { bottomSheetDiaolog.Dismiss(); }; TextView textSend = view.FindViewById <TextView>(Resource.Id.text_send_comments); textSend.Click += async delegate { string content = textComments.Text; if (string.IsNullOrWhiteSpace(content)) { Msg.AppMsg.MakeText(this, "请输入评论内容", Msg.AppMsg.STYLE_INFO).Show(); return; } Dialog waitDialog = CommonHelper.CreateLoadingDialog(this, "正在发送评论数据,请稍后..."); try { waitDialog.Show(); if (await BlogService.AddArticleComments(CommonHelper.token, article.BlogApp, article.Id, content)) { Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_success), Msg.AppMsg.STYLE_INFO).Show(); bottomSheetDiaolog.Dismiss(); } else { Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_fail), Msg.AppMsg.STYLE_INFO).Show(); } } catch (Exception ex) { Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_fail), Msg.AppMsg.STYLE_INFO).Show(); Log.Debug("error:", ex.Message); } finally { waitDialog.Cancel(); } }; bottomSheetDiaolog.SetContentView(view); bottomSheetDiaolog.Show(); }; webView = FindViewById <PullableWebView>(Resource.Id.webview); ptrl = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view); ptrl.setOnRefreshListener(this); webView.Settings.DefaultTextEncodingName = "utf-8"; webView.Settings.LoadsImagesAutomatically = true; webView.SetWebViewClient(new MyWebViewClient()); webView.ScrollBarStyle = ScrollbarStyles.InsideOverlay; webView.Settings.JavaScriptEnabled = false; webView.Settings.SetSupportZoom(false); webView.Settings.BuiltInZoomControls = false; webView.Settings.CacheMode = CacheModes.CacheElseNetwork; webView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); //webView.Settings.UseWideViewPort = true;//设置此属性,可任意比例缩放 btnViewComments = FindViewById <Button>(Resource.Id.footbar_comments); btnViewComments.Click += delegate { Intent intent = new Intent(this, typeof(ArticleCommentsActivity)); intent.PutExtra("current", JsonConvert.SerializeObject(article)); StartActivity(intent); }; CommonHelper.InitalShare(this, null, true, article.Author, article.Title, article.Avatar, article.Url); CommonHelper.InitalBookMark(this, article.Url, article.Title); await ptrl.AutoRefresh(); }
public void More(int Position) { bool local = Position <= LocalPlaylists.Count; PlaylistItem item = local ? LocalPlaylists[Position] : YoutubePlaylists[Position - LocalPlaylists.Count]; BottomSheetDialog bottomSheet = new BottomSheetDialog(MainActivity.instance); View bottomView = LayoutInflater.Inflate(Resource.Layout.BottomSheet, null); bottomView.FindViewById <TextView>(Resource.Id.bsTitle).Text = item.Name; if (!local || item.SyncState != SyncState.False) { bottomView.FindViewById <TextView>(Resource.Id.bsArtist).Text = item.Owner; Picasso.With(MainActivity.instance).Load(item.ImageURL).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(bottomView.FindViewById <ImageView>(Resource.Id.bsArt)); } else { bottomView.FindViewById <TextView>(Resource.Id.bsArtist).Text = item.Count + " element" + (item.Count == 1 ? "" : "s"); bottomView.FindViewById <ImageView>(Resource.Id.bsArt).Visibility = ViewStates.Gone; } bottomSheet.SetContentView(bottomView); if (item.SyncState == SyncState.Error) { bottomSheet.FindViewById <ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, new List <BottomSheetAction> { //new BottomSheetAction(Resource.Drawable.SyncDisabled, Resources.GetString(Resource.String.stop_sync), (sender, eventArg) => //{ // PlaylistManager.StopSyncingDialog(item, () => // { // PlaylistItem LocalPlaylist = new PlaylistItem(YoutubePlaylists[Position - LocalPlaylists.Count].Name, item.LocalID, YoutubePlaylists[Position - LocalPlaylists.Count].Count); // LocalPlaylists.Add(LocalPlaylist); // if (LocalPlaylists.Count == 3 && LocalPlaylists[1].Name == "EMPTY") // { // LocalPlaylists.RemoveAt(1); // adapter.NotifyItemChanged(1); // } // else // adapter.NotifyItemInserted(LocalPlaylists.Count); // YoutubePlaylists[Position - LocalPlaylists.Count].LocalID = 0; // YoutubePlaylists[Position - LocalPlaylists.Count].SyncState = SyncState.False; // PlaylistHolder holder = (PlaylistHolder)ListView.GetChildViewHolder(ListView.GetChildAt(Position)); // holder.sync.Visibility = ViewStates.Gone; // holder.SyncLoading.Visibility = ViewStates.Gone; // }); // bottomSheet.Dismiss(); //}), new BottomSheetAction(Resource.Drawable.Delete, Resources.GetString(Resource.String.delete), (sender, eventArg) => { PlaylistManager.Delete(item, () => { if (local) { LocalPlaylists.RemoveAt(Position); adapter.NotifyItemRemoved(Position); if (LocalPlaylists.Count == 1) { LocalPlaylists.Add(new PlaylistItem("EMPTY", -1) { Owner = Resources.GetString(Resource.String.local_playlist_empty) }); adapter.NotifyItemInserted(1); } } else { YoutubePlaylists.RemoveAt(Position - LocalPlaylists.Count); adapter.NotifyItemRemoved(Position); if (YoutubePlaylists.Count == 1) { YoutubePlaylists.Add(new PlaylistItem("EMPTY", null) { Owner = Resources.GetString(Resource.String.youtube_playlist_empty) }); adapter.NotifyItemInserted(LocalPlaylists.Count + YoutubePlaylists.Count); } } }); bottomSheet.Dismiss(); }) }); bottomSheet.Show(); return; } List <BottomSheetAction> actions = new List <BottomSheetAction> { new BottomSheetAction(Resource.Drawable.Play, Resources.GetString(Resource.String.play_in_order), (sender, eventArg) => { PlaylistManager.PlayInOrder(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Shuffle, Resources.GetString(Resource.String.random_play), (sender, eventArg) => { PlaylistManager.Shuffle(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Queue, Resources.GetString(Resource.String.add_to_queue), (sender, eventArg) => { PlaylistManager.AddToQueue(item); bottomSheet.Dismiss(); }) }; if (local || item.HasWritePermission) { actions.AddRange(new BottomSheetAction[] { new BottomSheetAction(Resource.Drawable.Edit, Resources.GetString(Resource.String.rename), (sender, eventArg) => { PlaylistManager.Rename(item, () => { adapter.NotifyItemChanged(Position); }); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Delete, Resources.GetString(Resource.String.delete), (sender, eventArg) => { PlaylistManager.Delete(item, () => { if (local) { LocalPlaylists.RemoveAt(Position); adapter.NotifyItemRemoved(Position); if (LocalPlaylists.Count == 1) { LocalPlaylists.Add(new PlaylistItem("EMPTY", -1) { Owner = Resources.GetString(Resource.String.local_playlist_empty) }); adapter.NotifyItemInserted(1); } } else { YoutubePlaylists.RemoveAt(Position - LocalPlaylists.Count); adapter.NotifyItemRemoved(Position); if (YoutubePlaylists.Count == 1) { YoutubePlaylists.Add(new PlaylistItem("EMPTY", null) { Owner = Resources.GetString(Resource.String.youtube_playlist_empty) }); adapter.NotifyItemInserted(LocalPlaylists.Count + YoutubePlaylists.Count); } } }); bottomSheet.Dismiss(); }) }); } if (item.SyncState == SyncState.True) { actions.AddRange(new BottomSheetAction[] { new BottomSheetAction(Resource.Drawable.Sync, Resources.GetString(Resource.String.sync_now), (sender, eventArg) => { YoutubeManager.DownloadPlaylist(item, true, true); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.SyncDisabled, Resources.GetString(Resource.String.stop_sync), (sender, eventArg) => { PlaylistManager.StopSyncingDialog(item, () => { PlaylistItem LocalPlaylist = new PlaylistItem(YoutubePlaylists[Position - LocalPlaylists.Count].Name, item.LocalID, YoutubePlaylists[Position - LocalPlaylists.Count].Count); LocalPlaylists.Add(LocalPlaylist); if (LocalPlaylists.Count == 3 && LocalPlaylists[1].Name == "EMPTY") { LocalPlaylists.RemoveAt(1); adapter.NotifyItemChanged(1); } else { adapter.NotifyItemInserted(LocalPlaylists.Count); } YoutubePlaylists[Position - LocalPlaylists.Count].LocalID = 0; YoutubePlaylists[Position - LocalPlaylists.Count].SyncState = SyncState.False; PlaylistHolder holder = (PlaylistHolder)ListView.GetChildViewHolder(ListView.GetChildAt(Position)); holder.sync.Visibility = ViewStates.Gone; holder.SyncLoading.Visibility = ViewStates.Gone; }); bottomSheet.Dismiss(); }) }); } else if (!local) { actions.Add(new BottomSheetAction(Resource.Drawable.Sync, Resources.GetString(Resource.String.sync), (sender, eventArg) => { YoutubeManager.DownloadPlaylist(item, true, true); bottomSheet.Dismiss(); })); if (!item.HasWritePermission) { actions.Add(new BottomSheetAction(Resource.Drawable.Delete, Resources.GetString(Resource.String.unfork), (sender, eventArg) => { if (item.SyncState == SyncState.Error) { PlaylistManager.StopSyncing(item); } PlaylistManager.Unfork(item); YoutubePlaylists.RemoveAt(Position - LocalPlaylists.Count); adapter.NotifyItemRemoved(Position); bottomSheet.Dismiss(); })); } } bottomSheet.FindViewById <ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions); bottomSheet.Show(); }
public FeedViewHolder(View itemView, Action <ActionType, Post> postAction, Action <string> tagAction, int height) : base(itemView) { Context = itemView.Context; PhotoPagerType = PostPagerType.Feed; _avatar = itemView.FindViewById <CircleImageView>(Resource.Id.profile_image); _author = itemView.FindViewById <TextView>(Resource.Id.author_name); _gallery = itemView.FindViewById <ImageView>(Resource.Id.gallery); _photosViewPager = itemView.FindViewById <ViewPager>(Resource.Id.post_photos_pager); _pagerTabLayout = ItemView.FindViewById <TabLayout>(Resource.Id.dot_selector); _pagerTabLayout.SetupWithViewPager(_photosViewPager, true); var parameters = _photosViewPager.LayoutParameters; parameters.Height = height; _photosViewPager.LayoutParameters = parameters; _photosViewPager.Adapter = new PostPhotosPagerAdapter(Context, _photosViewPager.LayoutParameters, (post) => postAction.Invoke(PhotoPagerType == PostPagerType.Feed ? ActionType.Photo : ActionType.Preview, post)); _title = itemView.FindViewById <PostCustomTextView>(Resource.Id.first_comment); _commentSubtitle = itemView.FindViewById <TextView>(Resource.Id.comment_subtitle); _time = itemView.FindViewById <TextView>(Resource.Id.time); _likes = itemView.FindViewById <TextView>(Resource.Id.likes); _flags = itemView.FindViewById <TextView>(Resource.Id.flags); _flagsIcon = itemView.FindViewById <ImageView>(Resource.Id.flagIcon); _cost = itemView.FindViewById <TextView>(Resource.Id.cost); _likeOrFlag = itemView.FindViewById <ImageButton>(Resource.Id.btn_like); More = itemView.FindViewById <ImageButton>(Resource.Id.more); _topLikers = itemView.FindViewById <LinearLayout>(Resource.Id.top_likers); NsfwMask = itemView.FindViewById <RelativeLayout>(Resource.Id.nsfw_mask); _nsfwMaskMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_message); NsfwMaskSubMessage = NsfwMask.FindViewById <TextView>(Resource.Id.mask_submessage); _nsfwMaskCloseButton = NsfwMask.FindViewById <ImageButton>(Resource.Id.mask_close); _nsfwMaskActionButton = NsfwMask.FindViewById <Button>(Resource.Id.nsfw_mask_button); _author.Typeface = Style.Semibold; _time.Typeface = Style.Regular; _likes.Typeface = Style.Semibold; _flags.Typeface = Style.Semibold; _cost.Typeface = Style.Semibold; _title.Typeface = Style.Regular; _commentSubtitle.Typeface = Style.Regular; _nsfwMaskMessage.Typeface = Style.Light; NsfwMaskSubMessage.Typeface = Style.Light; _moreActionsDialog = new BottomSheetDialog(Context); _moreActionsDialog.Window.RequestFeature(WindowFeatures.NoTitle); _title.MovementMethod = new LinkMovementMethod(); _title.SetHighlightColor(Color.Transparent); _postAction = postAction; _tagAction = tagAction; _likeOrFlag.Click += DoLikeAction; _avatar.Click += DoUserAction; _author.Click += DoUserAction; _cost.Click += DoUserAction; _commentSubtitle.Click += DoCommentAction; _likes.Click += DoLikersAction; _topLikers.Click += DoLikersAction; _flags.Click += DoFlagersAction; _flagsIcon.Click += DoFlagersAction; _nsfwMaskCloseButton.Click += NsfwMaskCloseButtonOnClick; _nsfwMaskActionButton.Click += NsfwMaskActionButtonOnClick; More.Click += DoMoreAction; More.Visibility = BasePresenter.User.IsAuthenticated ? ViewStates.Visible : ViewStates.Invisible; _title.Click += OnTitleOnClick; _title.TagAction += _tagAction; if (_title.OnMeasureInvoked == null) { _title.OnMeasureInvoked += OnTitleOnMeasureInvoked; } }
void OnMoreItemSelected(int shellSectionIndex, BottomSheetDialog dialog) { OnMoreItemSelected(ShellItem.Items[shellSectionIndex], dialog); }
void OnMoreItemSelected(int shellSectionIndex, BottomSheetDialog dialog) { OnMoreItemSelected(ShellItemController.GetItems()[shellSectionIndex], dialog); }
protected virtual BottomSheetDialog CreateMoreBottomSheet(Action <int, BottomSheetDialog> selectCallback) { var bottomSheetDialog = new BottomSheetDialog(Context); var bottomSheetLayout = new LinearLayout(Context); using (var bottomShellLP = new LP(LP.MatchParent, LP.WrapContent)) bottomSheetLayout.LayoutParameters = bottomShellLP; bottomSheetLayout.Orientation = Orientation.Vertical; // handle the more tab for (int i = _bottomView.MaxItemCount - 1; i < ShellItem.Items.Count; i++) { var closure_i = i; var shellContent = ShellItem.Items[i]; using (var innerLayout = new LinearLayout(Context)) { innerLayout.SetClipToOutline(true); innerLayout.SetBackground(CreateItemBackgroundDrawable()); innerLayout.SetPadding(0, (int)Context.ToPixels(6), 0, (int)Context.ToPixels(6)); innerLayout.Orientation = Orientation.Horizontal; using (var param = new LP(LP.MatchParent, LP.WrapContent)) innerLayout.LayoutParameters = param; // technically the unhook isn't needed // we dont even unhook the events that dont fire void clickCallback(object s, EventArgs e) { selectCallback(closure_i, bottomSheetDialog); if (!innerLayout.IsDisposed()) { innerLayout.Click -= clickCallback; } } innerLayout.Click += clickCallback; var image = new ImageView(Context); var lp = new LinearLayout.LayoutParams((int)Context.ToPixels(32), (int)Context.ToPixels(32)) { LeftMargin = (int)Context.ToPixels(20), RightMargin = (int)Context.ToPixels(20), TopMargin = (int)Context.ToPixels(6), BottomMargin = (int)Context.ToPixels(6), Gravity = GravityFlags.Center }; image.LayoutParameters = lp; lp.Dispose(); image.ImageTintList = ColorStateList.ValueOf(Color.Black.MultiplyAlpha(0.6).ToAndroid()); ShellContext.ApplyDrawableAsync(shellContent, ShellSection.IconProperty, icon => { if (!image.IsDisposed()) { image.SetImageDrawable(icon); } }); innerLayout.AddView(image); using (var text = new TextView(Context)) { text.Typeface = "sans-serif-medium".ToTypeFace(); text.SetTextColor(AColor.Black); text.Text = shellContent.Title; lp = new LinearLayout.LayoutParams(0, LP.WrapContent) { Gravity = GravityFlags.Center, Weight = 1 }; text.LayoutParameters = lp; lp.Dispose(); innerLayout.AddView(text); } bottomSheetLayout.AddView(innerLayout); } } bottomSheetDialog.SetContentView(bottomSheetLayout); bottomSheetLayout.Dispose(); return(bottomSheetDialog); }
private async void More(object s, EventArgs e) { Song item = await MusicPlayer.GetItem(); BottomSheetDialog bottomSheet = new BottomSheetDialog(MainActivity.instance); View bottomView = MainActivity.instance.LayoutInflater.Inflate(Resource.Layout.BottomSheet, null); bottomView.FindViewById <TextView>(Resource.Id.bsTitle).Text = item.Title; bottomView.FindViewById <TextView>(Resource.Id.bsArtist).Text = item.Artist; if (item.AlbumArt == -1 || item.IsYt) { Picasso.With(MainActivity.instance).Load(item.Album).Placeholder(Resource.Drawable.noAlbum).Transform(new RemoveBlackBorder(true)).Into(bottomView.FindViewById <ImageView>(Resource.Id.bsArt)); } else { var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); var songAlbumArtUri = ContentUris.WithAppendedId(songCover, item.AlbumArt); Picasso.With(MainActivity.instance).Load(songAlbumArtUri).Placeholder(Resource.Drawable.noAlbum).Resize(400, 400).CenterCrop().Into(bottomView.FindViewById <ImageView>(Resource.Id.bsArt)); } bottomSheet.SetContentView(bottomView); List <BottomSheetAction> actions = new List <BottomSheetAction> { new BottomSheetAction(Resource.Drawable.Timer, Resources.GetString(Resource.String.timer), (sender, eventArg) => { SleepDialog(); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.PlaylistAdd, Resources.GetString(Resource.String.add_to_playlist), (sender, eventArg) => { PlaylistManager.AddSongToPlaylistDialog(item); bottomSheet.Dismiss(); }) }; if (item.IsYt) { actions.AddRange(new BottomSheetAction[] { new BottomSheetAction(Resource.Drawable.PlayCircle, Resources.GetString(Resource.String.create_mix_from_song), (sender, eventArg) => { YoutubeManager.CreateMixFromSong(item); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.Download, Resources.GetString(Resource.String.download), (sender, eventArg) => { Console.WriteLine("&Trying to download " + item.Title); YoutubeManager.Download(new[] { item }); bottomSheet.Dismiss(); }), new BottomSheetAction(Resource.Drawable.OpenInBrowser, Resources.GetString(Resource.String.open_youtube), (sender, eventArg) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("vnd.youtube://" + MusicPlayer.queue[MusicPlayer.CurrentID()].YoutubeID)); StartActivity(intent); bottomSheet.Dismiss(); }) }); if (item.ChannelID != null && item.ChannelID != "") { actions.Add(new BottomSheetAction(Resource.Drawable.account, Resources.GetString(Resource.String.goto_channel), (sender, eventArg) => { ChannelManager.OpenChannelTab(item.ChannelID); bottomSheet.Dismiss(); })); } } else { actions.Add(new BottomSheetAction(Resource.Drawable.Edit, Resources.GetString(Resource.String.edit_metadata), (sender, eventArg) => { LocalManager.EditMetadata(item, MusicPlayer.CurrentID()); bottomSheet.Dismiss(); })); } bottomSheet.FindViewById <ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions); bottomSheet.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); root_view = FindViewById <View>(Resource.Id.root_view); show_with_single_line_items_button = FindViewById <Button>(Resource.Id.show_with_single_line_items_button); show_with_double_line_items_button = FindViewById <Button>(Resource.Id.show_with_double_line_items_button); show_bottom_sheet_dialog_button = FindViewById <Button>(Resource.Id.show_bottom_sheet_dialog_button); show_with_single_line_items_button.Click += delegate { var bottomSheet = BottomSheet.NewInstance( new List <BottomSheetItem> { new BottomSheetItem( Resource.Id.bottom_sheet_item_flag, Resource.Drawable.ic_flag, Resources.GetString(Resource.String.bottom_sheet_item_flag_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_reply, Resource.Drawable.ic_reply, Resources.GetString(Resource.String.bottom_sheet_item_reply_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_forward, Resource.Drawable.ic_forward, Resources.GetString(Resource.String.bottom_sheet_item_forward_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_delete, Resource.Drawable.ic_trash_can, Resources.GetString(Resource.String.bottom_sheet_item_delete_title) ) }); bottomSheet.Show(SupportFragmentManager, null); }; show_with_double_line_items_button.Click += delegate { var bottomSheet = BottomSheet.NewInstance( new List <BottomSheetItem> { new BottomSheetItem( Resource.Id.bottom_sheet_item_camera, Resource.Drawable.ic_camera, Resources.GetString(Resource.String.bottom_sheet_item_camera_title), Resources.GetString(Resource.String.bottom_sheet_item_camera_subtitle) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_gallery, Resource.Drawable.ic_gallery, Resources.GetString(Resource.String.bottom_sheet_item_gallery_title), Resources.GetString(Resource.String.bottom_sheet_item_gallery_subtitle) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_videos, Resource.Drawable.ic_videos, Resources.GetString(Resource.String.bottom_sheet_item_videos_title), Resources.GetString(Resource.String.bottom_sheet_item_videos_subtitle) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_manage, Resource.Drawable.ic_wrench, Resources.GetString(Resource.String.bottom_sheet_item_manage_title), Resources.GetString(Resource.String.bottom_sheet_item_manage_subtitle) ) }); bottomSheet.Show(SupportFragmentManager, null); }; show_bottom_sheet_dialog_button.Click += delegate { var bottomSheetDialog = new BottomSheetDialog( this, new List <BottomSheetItem> { new BottomSheetItem( Resource.Id.bottom_sheet_item_clock, Resource.Drawable.ic_clock, Resources.GetString(Resource.String.bottom_sheet_item_clock_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_alarm, Resource.Drawable.ic_alarm, Resources.GetString(Resource.String.bottom_sheet_item_alarm_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_stop_watch, Resource.Drawable.ic_stop_watch, Resources.GetString(Resource.String.bottom_sheet_item_stop_watch_title) ), new BottomSheetItem( Resource.Id.bottom_sheet_item_time_zone, Resource.Drawable.ic_time_zone, Resources.GetString(Resource.String.bottom_sheet_item_time_zone_title) ) }); bottomSheetDialog.OnItemClickListener = this; bottomSheetDialog.Show(); }; }