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); }
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(); }
private void DoMoreAction(object sender, EventArgs e) { var inflater = (LayoutInflater)_context.GetSystemService(Context.LayoutInflaterService); using (var dialogView = inflater.Inflate(Resource.Layout.lyt_feed_popup, null)) { dialogView.SetMinimumWidth((int)(ItemView.Width * 0.8)); var flag = dialogView.FindViewById <Button>(Resource.Id.flag); flag.Text = AppSettings.LocalizationManager.GetText(_post.Flag ? LocalizationKeys.UnFlagComment : LocalizationKeys.FlagComment); flag.Typeface = Style.Semibold; var hide = dialogView.FindViewById <Button>(Resource.Id.hide); hide.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.HidePost); hide.Typeface = Style.Semibold; var edit = dialogView.FindViewById <Button>(Resource.Id.editpost); edit.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.EditComment); edit.Typeface = Style.Semibold; var delete = dialogView.FindViewById <Button>(Resource.Id.deletepost); delete.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.DeleteComment); delete.Typeface = Style.Semibold; if (_post.Author == AppSettings.User.Login) { flag.Visibility = hide.Visibility = ViewStates.Gone; edit.Visibility = delete.Visibility = _post.CashoutTime < DateTime.Now ? ViewStates.Gone : ViewStates.Visible; } var cancel = dialogView.FindViewById <Button>(Resource.Id.cancel); cancel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Cancel); cancel.Typeface = Style.Semibold; flag.Click -= DoFlagAction; flag.Click += DoFlagAction; hide.Click -= DoHideAction; hide.Click += DoHideAction; edit.Click -= EditOnClick; edit.Click += EditOnClick; delete.Click -= DeleteOnClick; delete.Click += DeleteOnClick; cancel.Click -= DoDialogCancelAction; cancel.Click += DoDialogCancelAction; _moreActionsDialog.SetContentView(dialogView); dialogView.SetBackgroundColor(Color.Transparent); _moreActionsDialog.Window.FindViewById(Resource.Id.design_bottom_sheet).SetBackgroundColor(Color.Transparent); _moreActionsDialog.Show(); } }
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(); }
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 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); } }; }
private void OpenAccountProperties(UserInfo account) { var inflater = (LayoutInflater)GetSystemService(LayoutInflaterService); using (var dialogView = inflater.Inflate(Resource.Layout.lyt_account_popup, null)) { var logout = dialogView.FindViewById <Button>(Resource.Id.logout); logout.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Logout); logout.Typeface = Style.Semibold; var switchAccount = dialogView.FindViewById <Button>(Resource.Id.switch_account); switchAccount.Text = $"{AppSettings.LocalizationManager.GetText(LocalizationKeys.SwitchTo)} {account.Login}"; switchAccount.Typeface = Style.Semibold; if (account.Chain != AppSettings.User.Chain) { switchAccount.Visibility = ViewStates.Visible; } var cancel = dialogView.FindViewById <Button>(Resource.Id.cancel); cancel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Cancel); cancel.Typeface = Style.Semibold; logout.Click += (sender, e) => { OnAdapterDeleteAccount(account); _propertiesActionsDialog.Dismiss(); }; switchAccount.Click += (sender, e) => { OnAdapterPickAccount(account); _propertiesActionsDialog.Dismiss(); }; cancel.Click += (sender, e) => { _propertiesActionsDialog.Dismiss(); }; _propertiesActionsDialog.SetContentView(dialogView); dialogView.SetBackgroundColor(Color.Transparent); _propertiesActionsDialog.Window.FindViewById(Resource.Id.design_bottom_sheet).SetBackgroundColor(Color.Transparent); _propertiesActionsDialog.Show(); } }
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(); }
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(); }
private void DoMoreAction(object sender, EventArgs e) { var inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); using (var dialogView = inflater.Inflate(Resource.Layout.lyt_feed_popup, null)) { dialogView.SetMinimumWidth((int)(ItemView.Width * 0.8)); var flag = dialogView.FindViewById <Button>(Resource.Id.flag); flag.Text = AppSettings.LocalizationManager.GetText(Post.Flag ? LocalizationKeys.UnFlagPost : LocalizationKeys.FlagPost); flag.Typeface = Style.Semibold; var title = dialogView.FindViewById <TextView>(Resource.Id.post_alert_title); title.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.ActionWithPost); title.Typeface = Style.Semibold; var promote = dialogView.FindViewById <Button>(Resource.Id.promote); promote.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Promote); promote.Typeface = Style.Semibold; promote.Visibility = ViewStates.Visible; var hide = dialogView.FindViewById <Button>(Resource.Id.hide); hide.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.HidePost); hide.Typeface = Style.Semibold; hide.Visibility = ViewStates.Visible; var edit = dialogView.FindViewById <Button>(Resource.Id.editpost); edit.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.EditPost); edit.Typeface = Style.Semibold; var delete = dialogView.FindViewById <Button>(Resource.Id.deletepost); delete.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.DeletePost); delete.Typeface = Style.Semibold; if (Post.Author == AppSettings.User.Login) { flag.Visibility = hide.Visibility = ViewStates.Gone; edit.Visibility = delete.Visibility = Post.CashoutTime < DateTime.Now ? ViewStates.Gone : ViewStates.Visible; } var sharepost = dialogView.FindViewById <Button>(Resource.Id.sharepost); sharepost.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Sharepost); sharepost.Typeface = Style.Semibold; sharepost.Visibility = ViewStates.Visible; var copylink = dialogView.FindViewById <Button>(Resource.Id.copylink); copylink.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.CopyLink); copylink.Typeface = Style.Semibold; copylink.Visibility = ViewStates.Visible; var cancel = dialogView.FindViewById <Button>(Resource.Id.cancel); cancel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Cancel); cancel.Typeface = Style.Semibold; promote.Click -= PromoteOnClick; promote.Click += PromoteOnClick; flag.Click -= DoFlagAction; flag.Click += DoFlagAction; hide.Click -= DoHideAction; hide.Click += DoHideAction; edit.Click -= EditOnClick; edit.Click += EditOnClick; delete.Click -= DeleteOnClick; delete.Click += DeleteOnClick; sharepost.Click -= DoShareAction; sharepost.Click += DoShareAction; copylink.Click -= DoCopyLinkAction; copylink.Click += DoCopyLinkAction; cancel.Click -= DoDialogCancelAction; cancel.Click += DoDialogCancelAction; _moreActionsDialog.SetContentView(dialogView); _moreActionsDialog.Window.FindViewById(Resource.Id.design_bottom_sheet) .SetBackgroundColor(Color.Transparent); var dialogPadding = (int)Android.Util.TypedValue.ApplyDimension(Android.Util.ComplexUnitType.Dip, 10, Context.Resources.DisplayMetrics); _moreActionsDialog.Window.DecorView.SetPadding(dialogPadding, dialogPadding, dialogPadding, dialogPadding); _moreActionsDialog.Show(); var bottomSheet = _moreActionsDialog.FindViewById <FrameLayout>(Resource.Id.design_bottom_sheet); BottomSheetBehavior.From(bottomSheet).State = BottomSheetBehavior.StateExpanded; } }
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(); }; }
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(); }
public void OnClick(View view) { switch (view.Id) { case Resource.Id.btn_dialog_1: #region 简单对话框 new AlertDialog.Builder(view.Context) .SetMessage(view.Context.GetString(Resource.String.main_dialog_simple_title)) .SetPositiveButton(view.Context.GetString(Resource.String.dialog_ok), (sender, args) => { }) .Show(); #endregion break; case Resource.Id.btn_dialog_2: #region 简单对话框 new AlertDialog.Builder(view.Context) .SetTitle(view.Context.GetString(Resource.String.main_dialog_simple_title)) .SetMessage(view.Context.GetString(Resource.String.main_dialog_simple_message)) .SetPositiveButton(view.Context.GetString(Resource.String.dialog_ok), (sender, args) => { }) .SetNegativeButton(view.Context.GetString(Resource.String.dialog_cancel), (sender, args) => { }) .SetNeutralButton(view.Context.GetString(Resource.String.dialog_neutral), (sender, args) => { }) .Show(); #endregion break; case Resource.Id.btn_dialog_3: #region 单选对话框 String[] singleChoiceItems = Resources.GetStringArray(Resource.Array.dialog_choice_array); int itemSelected = 0; new AlertDialog.Builder(view.Context) .SetTitle(view.Context.GetString(Resource.String.main_dialog_single_choice)) .SetSingleChoiceItems(singleChoiceItems, itemSelected, new DialogClickListener()) .SetNegativeButton(view.Context.GetString(Resource.String.dialog_cancel), (sender, args) => { }) .Show(); #endregion break; case Resource.Id.btn_dialog_4: #region 多选对话框 String[] multiChoiceItems = Resources.GetStringArray(Resource.Array.dialog_choice_array); bool[] checkedItems = { true, false, false, false, false }; new AlertDialog.Builder(view.Context) .SetTitle(view.Context.GetString(Resource.String.main_dialog_multi_choice)) .SetMultiChoiceItems(multiChoiceItems, checkedItems, (sender, args) => { }) .SetPositiveButton(view.Context.GetString(Resource.String.dialog_ok), (sender, args) => { }) .SetNegativeButton(view.Context.GetString(Resource.String.dialog_cancel), (sender, args) => { }) .Show(); #endregion break; case Resource.Id.btn_dialog_5: #region 进度条对话框 ProgressDialog progressDialog = new ProgressDialog(view.Context); progressDialog.SetMessage(view.Context.GetString(Resource.String.main_dialog_progress_title)); progressDialog.Show(); #endregion break; case Resource.Id.btn_dialog_6: #region 进度条对话框 ProgressDialog horizontalProgressDialog = new ProgressDialog(view.Context); horizontalProgressDialog.SetProgressStyle(ProgressDialogStyle.Horizontal); horizontalProgressDialog.SetMessage(view.Context.GetString(Resource.String.main_dialog_progress_title)); horizontalProgressDialog.SetCancelable(false); horizontalProgressDialog.Max = 100; horizontalProgressDialog.Show(); new System.Threading.Thread(() => { int progress = 0; while (progress <= 100) { horizontalProgressDialog.Progress = progress; if (progress == 100) { horizontalProgressDialog.Dismiss(); } try { System.Threading.Thread.Sleep(35); } catch (Exception e) { throw e; } progress++; } }).Start(); #endregion break; case Resource.Id.btn_dialog_7: #region 日期对话框 DatePickerDialog datePickerDialog = new DatePickerDialog(view.Context, this, currentDate.Year, currentDate.Month - 1, currentDate.Day); datePickerDialog.Show(); #endregion break; case Resource.Id.btn_dialog_8: #region 时间对话框 TimePickerDialog timePickerDialog = new TimePickerDialog(view.Context, this, currentDate.Hour, currentDate.Minute, true); timePickerDialog.Show(); #endregion break; case Resource.Id.btn_dialog_9: #region 底部对话框 BottomSheetDialog mBottomSheetDialog = new BottomSheetDialog(view.Context); View dialogView = Activity.LayoutInflater.Inflate(Resource.Layout.dialog_bottom_sheet, null); Button btn_dialog_bottom_sheet_ok = dialogView.FindViewById <Button>(Resource.Id.btn_dialog_bottom_sheet_ok); Button btn_dialog_bottom_sheet_cancel = dialogView.FindViewById <Button>(Resource.Id.btn_dialog_bottom_sheet_cancel); ImageView img_bottom_dialog = dialogView.FindViewById <ImageView>(Resource.Id.img_bottom_dialog); Glide.With(this).Load(Resource.Drawable.bottom_dialog).Into(img_bottom_dialog); mBottomSheetDialog.SetContentView(dialogView); btn_dialog_bottom_sheet_ok.SetOnClickListener(new DialogOnClick(mBottomSheetDialog)); btn_dialog_bottom_sheet_cancel.SetOnClickListener(new DialogOnClick(mBottomSheetDialog)); mBottomSheetDialog.Show(); #endregion break; case Resource.Id.btn_dialog_10: #region 全屏对话框 Dialog fullscreenDialog = new Dialog(view.Context, Resource.Style.DialogFullscreen); fullscreenDialog.SetContentView(Resource.Layout.dialog_fullscreen); ImageView img_full_screen_dialog = fullscreenDialog.FindViewById <ImageView>(Resource.Id.img_full_screen_dialog); Glide.With(this).Load(Resource.Drawable.google_assistant).Into(img_full_screen_dialog); ImageView img_dialog_fullscreen_close = fullscreenDialog.FindViewById <ImageView>(Resource.Id.img_dialog_fullscreen_close); img_dialog_fullscreen_close.SetOnClickListener(new DialogOnClick(fullscreenDialog)); fullscreenDialog.Show(); #endregion break; case Resource.Id.btn_dialog_11: #region POPUP MENU PopupMenu popupMenu = new PopupMenu(view.Context, btn_dialog_11); popupMenu.MenuInflater.Inflate(Resource.Menu.popup_menu_main, popupMenu.Menu); popupMenu.SetOnMenuItemClickListener(this); popupMenu.Show(); #endregion break; } }
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(); }