Пример #1
0
        private async void Adapter_ItemClick(object sender, int e)
        {
            string pvFileName = pvList[e];

            try
            {
                if (!File.Exists(Path.Combine(pvPath, $"{pvFileName}.mp4")))
                {
                    var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBG);
                    builder.SetTitle(Resource.String.GFPVActivity_DownloadRequireDialog_Title);
                    builder.SetMessage(Resource.String.GFPVActivity_DownloadRequireDialog_Message);
                    builder.SetCancelable(true);
                    builder.SetPositiveButton(Resource.String.AlertDialog_Download, async delegate { await PVDownload(pvFileName, e); });
                    builder.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });

                    builder.Show();
                }
                else
                {
                    await RunPV(Path.Combine(pvPath, $"{pvFileName}.mp4"));
                }
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
            }
        }
Пример #2
0
        public override void OnBackPressed()
        {
            if (IsBooting == true)
            {
                return;
            }

            var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.GFD_Dialog);

            ad.SetTitle("ShutDown Zina OS");
            ad.SetMessage("Do you want to shutdown Zina OS?");
            ad.SetPositiveButton("Shutdown", delegate
            {
                IsBooting = true;
                _         = ShutdownZinaOS();
            });
            ad.SetNegativeButton("Cancel", delegate { });
            ad.SetCancelable(true);

            try
            {
                ad.Show();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
            }
        }
Пример #3
0
        private void InitFilterBox()
        {
            var inflater = LayoutInflater;

            try
            {
                View v = inflater.Inflate(Resource.Layout.FSTFilterLayout, null);

                for (int i = 0; i < typeFilters.Length; ++i)
                {
                    v.FindViewById <CheckBox>(typeFilters[i]).Checked = filterType[i];
                }

                var filterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical);
                filterBox.SetTitle(Resource.String.DBList_FilterBoxTitle);
                filterBox.SetView(v);
                filterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplyFilter(v); });
                filterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
                filterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetFilter(); });

                filterBox.Show();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.FilterBox_InitError, Snackbar.LengthLong);
            }
        }
Пример #4
0
        internal void ShowDownloadCheckMessage <T>(List <T> downloadList, string serverPath, string targetPath)
        {
            var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBG);

            ad.SetTitle(Resource.String.DBList_DownloadCropImageCheckTitle);
            ad.SetMessage(Resource.String.DBList_DownloadCropImageCheckMessage);
            ad.SetCancelable(true);
            ad.SetPositiveButton(Resource.String.AlertDialog_Download, delegate { _ = CropImageDownloadProcess(downloadList, serverPath, targetPath); });
            ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });

            ad.Show();
        }
Пример #5
0
        private void InitSortBox()
        {
            string[] sortTypeList =
            {
                Resources.GetString(Resource.String.Sort_SortMethod_Name),
                Resources.GetString(Resource.String.Sort_SortMethod_Number),
                Resources.GetString(Resource.String.Sort_SortMethod_ProductTime),
                Resources.GetString(Resource.String.Sort_SortMethod_HP),
                Resources.GetString(Resource.String.Sort_SortMethod_FR),
                Resources.GetString(Resource.String.Sort_SortMethod_EV),
                Resources.GetString(Resource.String.Sort_SortMethod_AC),
                Resources.GetString(Resource.String.Sort_SortMethod_AS),
            };

            try
            {
                View v = LayoutInflater.Inflate(Resource.Layout.CommonSorterLayout, null);

                var adapter = new ArrayAdapter(this, Resource.Layout.SpinnerListLayout, sortTypeList);
                adapter.SetDropDownViewResource(Resource.Layout.SpinnerListLayout);

                var sortSpinner = v.FindViewById <Spinner>(Resource.Id.CommonSortSpinner);

                sortSpinner.Adapter = adapter;
                sortSpinner.SetSelection((int)sortType);

                switch (sortOrder)
                {
                default:
                case SortOrder.Ascending:
                    v.FindViewById <RadioButton>(Resource.Id.CommonSortOrderAscending).Checked = true;
                    break;

                case SortOrder.Descending:
                    v.FindViewById <RadioButton>(Resource.Id.CommonSortOrderDescending).Checked = true;
                    break;
                }

                var filterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical);
                filterBox.SetTitle(Resource.String.DBList_SortBoxTitle);
                filterBox.SetView(v);
                filterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplySort(v); });
                filterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
                filterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetSort(); });

                filterBox.Show();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.SortBox_InitError, Snackbar.LengthLong);
            }
        }
Пример #6
0
        private void Pickwallpaper_Click(object sender, EventArgs e)
        {
            var button = sender as Button;

            using (AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(button.Context))
            {
                int currentwallpapersetted = int.Parse(configurationManager.RetrieveAValue(ConfigurationParameters.ChangeWallpaper, "0"));
                builder.SetTitle(Resources.GetString(Resource.String.changewallpaper));
                builder.SetSingleChoiceItems(new string[] { button.Context.GetString(Resource.String.blackwallpaper), button.Context.GetString(Resource.String.defaultwallpaper), button.Context.GetString(Resource.String.pickwallpaper) }, currentwallpapersetted, OnDialogClickEventArgs);
                builder.Create();
                builder.Show();
            }
        }
        /**
         * Display a dialog prompting the user to pick a favorite food from a list, then record
         * the answer.
         */
        void AskFavoriteFood()
        {
            var choices = Resources.GetStringArray(Resource.Array.food_items);
            var ad      = new AndroidX.AppCompat.App.AlertDialog.Builder(this)
                          .SetCancelable(false)
                          .SetTitle(Resource.String.food_dialog_title)
                          .SetItems(choices, (sender, e) => {
                var food = choices[e.Which];
                SetUserFavoriteFood(food);
            }).Create();

            ad.Show();
        }
Пример #8
0
        public override void OnBackPressed()
        {
            var exitDialog = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.GFD_Dialog);

            exitDialog.SetTitle(Resource.String.Main_CheckExitTitle);
            exitDialog.SetMessage(Resource.String.Main_CheckExit);
            exitDialog.SetCancelable(true);
            exitDialog.SetPositiveButton(Resource.String.AlertDialog_Exit, delegate
            {
                FinishAffinity();
                Process.KillProcess(Process.MyPid());
            });
            exitDialog.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
            exitDialog.Show();
        }
        private void SelectCache()
        {
            string freeText    = Resources.GetString(Resource.String.SelectCache_FreeSpace);
            string requireText = Resources.GetString(Resource.String.SelectCache_RequireSpace);

            if (categoryCheck == null)
            {
                categoryCheck = new Dictionary <CacheCategory, bool>();
            }

            categoryCheck.Clear();

            cacheSelectView = LayoutInflater.Inflate(Resource.Layout.CacheSelectLayout, null);

            cacheSelectView.FindViewById <XTextView>(Resource.Id.CacheSelectNowFreeSpace).Text                = $"{freeText} : {freeSize}MB";
            cacheSelectView.FindViewById <XTextView>(Resource.Id.CacheSelectRequireSpace).Text                = $"{requireText} : {expectSize}MB";
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryDic).CheckedChange       += CacheSelectCategory_CheckedChange;
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOldGFD).CheckedChange    += CacheSelectCategory_CheckedChange;
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryGuideBook).CheckedChange += CacheSelectCategory_CheckedChange;
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryStory).CheckedChange     += CacheSelectCategory_CheckedChange;
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryPV).CheckedChange        += CacheSelectCategory_CheckedChange;
            cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOST).CheckedChange       += CacheSelectCategory_CheckedChange;
            //cacheSelectView.FindViewById<XCheckBox>(Resource.Id.CacheSelectCategoryCartoon).CheckedChange += CacheSelectCategory_CheckedChange;

            var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity, ETC.dialogBG);

            ad.SetTitle(Resource.String.SelectCache_Dialog_Title);
            ad.SetCancelable(true);
            ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
            ad.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate
            {
                categoryCheck.Add(CacheCategory.Dic, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryDic).Checked);
                categoryCheck.Add(CacheCategory.OldGFD, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOldGFD).Checked);
                categoryCheck.Add(CacheCategory.GuideBook, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryGuideBook).Checked);
                categoryCheck.Add(CacheCategory.Story, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryStory).Checked);
                categoryCheck.Add(CacheCategory.PV, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryPV).Checked);
                categoryCheck.Add(CacheCategory.OST, cacheSelectView.FindViewById <XCheckBox>(Resource.Id.CacheSelectCategoryOST).Checked);
                //categoryCheck.Add(CacheCategory.Cartoon, cacheSelectView.FindViewById<XCheckBox>(Resource.Id.CacheSelectCategoryCartoon).Checked);

                await DownloadAllCache();
            });
            ad.SetView(cacheSelectView);

            var dialog = ad.Show();
        }
Пример #10
0
        public static void ShowDialog(Context context, Action positive, Action negative,
                                      string question, string positiveAns, string negativeAns)
        {
            var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(context, Resource.Style.AppCompatAlertDialogStyle);

            dialog.SetMessage(question);

            dialog.SetNegativeButton(negativeAns, (thisalert, args) =>
            {
                negative();
            });

            dialog.SetPositiveButton(positiveAns, (thisalert, args) =>
            {
                positive();
            });

            dialog.Show();
        }
Пример #11
0
        private void InitFilterBox()
        {
            try
            {
                View v = LayoutInflater.Inflate(Resource.Layout.DollFilterLayout, null);

                v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductHour).MaxValue      = 12;
                v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductMinute).MaxValue    = 59;
                v.FindViewById <NumberPicker>(Resource.Id.DollFilterProductNearRange).MaxValue = 20;

                for (int i = 0; i < gradeFilters.Length; ++i)
                {
                    v.FindViewById <CheckBox>(gradeFilters[i]).Checked = filterGrade[i];
                }
                for (int i = 0; i < typeFilters.Length; ++i)
                {
                    v.FindViewById <CheckBox>(typeFilters[i]).Checked = filterType[i];
                }
                for (int i = 0; i < productTimeFilters.Length; ++i)
                {
                    v.FindViewById <NumberPicker>(productTimeFilters[i]).Value = filterProductTime[i];
                }
                v.FindViewById <CheckBox>(modFilter).Checked = filterMod;

                var FilterBox = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBGVertical);
                FilterBox.SetTitle(Resource.String.DBList_FilterBoxTitle);
                FilterBox.SetView(v);
                FilterBox.SetPositiveButton(Resource.String.AlertDialog_Set, delegate { ApplyFilter(v); });
                FilterBox.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
                FilterBox.SetNeutralButton(Resource.String.AlertDialog_Reset, delegate { ResetFilter(); });

                FilterBox.Show();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.FilterBox_InitError, Snackbar.LengthLong);
            }
        }
Пример #12
0
        public static void ShowEditorAlert(this Android.App.Activity activity, string title, string placeholder, string text,
                                           string positiveAction, Action <string> onConfirmation,
                                           string neutralAction, Action onDismiss)
        {
            var view   = activity.LayoutInflater.Inflate(Resource.Layout.alert_editor, null);
            var editor = view.FindViewById <Android.Widget.EditText>(Resource.Id.editor);

            editor.Hint = placeholder;
            editor.Text = text;
            editor.SetSelection(0, editor.Text.Length);
            var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(activity).SetCancelable(false)
                         .SetIcon(Resource.Mipmap.ic_launcher)
                         .SetTitle(title)
                         .SetView(view)
                         .SetPositiveButton(positiveAction, (o, e) => onConfirmation?.Invoke(editor.Text))
                         .SetNeutralButton(neutralAction, (o, e) => onDismiss?.Invoke())
                         .Create();

            dialog.Window.SetSoftInputMode(Android.Views.SoftInput.StateVisible);
            dialog.Show();
            editor.RequestFocus();
        }
Пример #13
0
        public static void ShowAlert(this Android.App.Activity activity, string title, string message,
                                     string positiveAction, Action onPositive,
                                     string negativeAction, Action onNegative,
                                     bool negativeActionIsNeutral = true)
        {
            var dialog = new AndroidX.AppCompat.App.AlertDialog.Builder(activity)
                         .SetIcon(Resource.Mipmap.ic_launcher_round)
                         .SetCancelable(false)
                         .SetTitle(title)
                         .SetMessage(message)
                         .SetPositiveButton(positiveAction, (o, e) => onPositive?.Invoke());

            if (negativeActionIsNeutral)
            {
                dialog.SetNeutralButton(negativeAction, (o, e) => onNegative?.Invoke());
            }
            else
            {
                dialog.SetNegativeButton(negativeAction, (o, e) => onNegative?.Invoke());
            }

            dialog.Show();
        }
        private async Task DownloadAllCache()
        {
            var downloadURLs = new List <(string source, string target)>();

            var v = LayoutInflater.Inflate(Resource.Layout.SpinnerProgressDialogLayout, null);

            var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity, ETC.dialogBG);
            var pd = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity, ETC.dialogBGDownload);

            pd.SetTitle(Resource.String.SettingActivity_DownloadAllCache_DialogTitle);
            pd.SetMessage(Resource.String.SettingActivity_DownloadAllCache_DialogMessage);
            pd.SetCancelable(false);
            pd.SetView(v);

            var dialog = pd.Show();

            try
            {
                var statusText = v.FindViewById <TextView>(Resource.Id.SpinnerProgressStatusMessage);

                statusText.Text = "Ready download list...";

                await Task.Delay(100);

                var listThread = new Thread(new ThreadStart(delegate
                {
                    if (categoryCheck[CacheCategory.Dic])
                    {
                        ListDoll(downloadURLs);
                        ListEquip(downloadURLs);
                        ListFairy(downloadURLs);
                        ListEnemy(downloadURLs);
                        ListFST(downloadURLs);
                        ListCoalition(downloadURLs);
                        ListSkill(downloadURLs);
                    }
                    if (categoryCheck[CacheCategory.OldGFD])
                    {
                        ListOldGFD(downloadURLs);
                    }
                    if (categoryCheck[CacheCategory.GuideBook])
                    {
                        ListGuideBook(downloadURLs);
                    }
                    if (categoryCheck[CacheCategory.Story])
                    {
                        ListStory(downloadURLs);
                    }
                    if (categoryCheck[CacheCategory.PV])
                    {
                        ListPV(downloadURLs);
                    }
                    if (categoryCheck[CacheCategory.OST])
                    {
                        ListMusic(downloadURLs);
                    }

                    /*if (categoryCheck[CacheCategory.Cartoon])
                     * {
                     *  ListCartoon(downloadURLs);
                     * }*/
                }));

                listThread.Start();
                listThread.Join();

                using (var wc = new WebClient())
                {
                    var now   = 0;
                    var total = downloadURLs.Count;

                    wc.DownloadFileCompleted += (sender, e) => { statusText.Text = $"{++now}/{total}"; };

                    foreach (var(source, target) in downloadURLs)
                    {
                        try
                        {
                            await wc.DownloadFileTaskAsync(source, target);
                        }
                        catch
                        {
                            statusText.Text += " Retry";
                            await wc.DownloadFileTaskAsync(source, target);
                        }
                    }
                }

                Toast.MakeText(Activity, Resource.String.SettingActivity_DownloadAllCache_CompleteDialogMessage, ToastLength.Short).Show();
            }
            catch (Exception ex)
            {
                Toast.MakeText(Activity, Resource.String.SettingActivity_DownloadAllCache_FailDialogMessage, ToastLength.Short).Show();
            }
            finally
            {
                dialog.Dismiss();
            }
        }
Пример #15
0
        /// <summary>
        /// Check DB version & Refresh notification data
        /// </summary>
        private async Task CheckNetworkData()
        {
            await Task.Delay(100);

            //tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBChecking)})";

            try
            {
                // Check Server Status


                /*await Task.Run(async () =>
                 * {
                 *  // Check DB Version
                 *
                 *  if (await ETC.CheckDBVersion())
                 *  {
                 *      //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateAvailable)})"; });
                 *
                 *      var ad = new Android.Support.V7.App.AlertDialog.Builder(this, ETC.dialogBG);
                 *      ad.SetTitle(Resource.String.CheckDBUpdateDialog_Title);
                 *      ad.SetMessage(Resource.String.CheckDBUpdateDialog_Question);
                 *      ad.SetCancelable(true);
                 *      ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
                 *      ad.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate
                 *      {
                 *          await ETC.UpdateDB(this, true);
                 *
                 *          if (!await ETC.CheckDBVersion())
                 *          {
                 *              //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateNewest)})"; });
                 *          }
                 *          else
                 *          {
                 *              //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateAvailable)})"; });
                 *          }
                 *
                 *      });
                 *
                 *      RunOnUiThread(() => { ad.Show(); });
                 *  }
                 *  else
                 *  {
                 *      //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateNewest)})"; });
                 *  }
                 * });*/

                if (await ETC.CheckDBVersion())
                {
                    //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateAvailable)})"; });

                    var ad = new AndroidX.AppCompat.App.AlertDialog.Builder(this, ETC.dialogBG);
                    ad.SetTitle(Resource.String.CheckDBUpdateDialog_Title);
                    ad.SetMessage(Resource.String.CheckDBUpdateDialog_Question);
                    ad.SetCancelable(true);
                    ad.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });
                    ad.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate
                    {
                        await ETC.UpdateDB(this, true);

                        if (!await ETC.CheckDBVersion())
                        {
                            //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateNewest)})"; });
                        }
                        else
                        {
                            //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateAvailable)})"; });
                        }
                    });

                    RunOnUiThread(() => { ad.Show(); });
                }
                else
                {
                    //RunOnUiThread(() => { tv.Text = $"DB Ver.{ETC.dbVersion} ({Resources.GetString(Resource.String.Main_DBUpdateNewest)})"; });
                }
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                ETC.ShowSnackbar(snackbarLayout, Resource.String.Main_NotificationInitializeFail, Snackbar.LengthLong, Android.Graphics.Color.DarkRed);
            }
        }