예제 #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
        private void ShowDialog(string title, string message)
        {
            var alert = new AndroidX.AppCompat.App.AlertDialog.Builder(this);

            alert.SetTitle(title);
            alert.SetMessage(message);
            alert.SetPositiveButton("OK", (s, e) => { });
            alert.Create().Show();
        }
예제 #5
0
        private async Task CheckUpdate()
        {
            await Task.Delay(100);

            bool isMissing = false;

            try
            {
                isMissing = CheckImage();

                if (!isMissing)
                {
                    using (WebClient wc = new WebClient())
                    {
                        string LocalVerPath = Path.Combine(ETC.systemPath, "ShortGuideVer.txt");

                        if (!File.Exists(LocalVerPath))
                        {
                            hasUpdate = true;
                        }
                        else
                        {
                            int serverVer = int.Parse(await wc.DownloadStringTaskAsync(Path.Combine(ETC.server, "ShortGuideVer.txt")));
                            int localVer  = 0;

                            using (StreamReader sr = new StreamReader(new FileStream(LocalVerPath, FileMode.Open, FileAccess.Read)))
                            {
                                localVer = int.Parse(sr.ReadToEnd());
                            }

                            hasUpdate = localVer < serverVer;
                        }
                    }
                }

                if (hasUpdate || isMissing)
                {
                    var builder = new AndroidX.AppCompat.App.AlertDialog.Builder(Activity);
                    builder.SetTitle(Resource.String.UpdateDialog_Title);
                    builder.SetMessage(Resource.String.UpdateDialog_Message);
                    builder.SetCancelable(true);
                    builder.SetPositiveButton(Resource.String.AlertDialog_Confirm, async delegate { await DownloadShortGuideImage(); });
                    builder.SetNegativeButton(Resource.String.AlertDialog_Cancel, delegate { });

                    var dialog = builder.Create();
                    dialog.Show();
                }
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, Activity);
                ETC.ShowSnackbar(snackbarLayoutF, Resource.String.UpdateCheck_Fail, Snackbar.LengthLong, Android.Graphics.Color.DarkRed);
            }
        }
예제 #6
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();
        }
예제 #7
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);
            }
        }
예제 #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
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                Xamarin.Essentials.Platform.Init(this, savedInstanceState);

                SetContentView(Resource.Layout.content_main);

                #region Fragment navigation

                BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);
                navigation?.SetOnNavigationItemSelectedListener(this);

                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, new HomeFragment())
                .Commit();

                #endregion

                #region Settings

                settings = Settings.Instance;

                #endregion

                #region App Center Crash (http: // appcenter.ms )

                if (settings.IsSendCrashes == true)
                {
                    AppCenter.Start(AppCenterId, new Type[] { typeof(Crashes) });

                    Crashes.SendingErrorReport += (sender, e) => CrashesSendingErrorReport(sender, e);

                    Crashes.ShouldAwaitUserConfirmation = () =>
                    {
                        AndroidX.AppCompat.App.AlertDialog.Builder alert = new AndroidX.AppCompat.App.AlertDialog.Builder(Platform.CurrentActivity);
                        alert.SetTitle("Confirm send");
                        alert.SetMessage("Send anonymous data about crashes in the app?");

                        alert.SetPositiveButton("Send", (senderAlert, args) =>
                        {
                            UserConfirmationDialog(UserConfirmation.Send);

                            Toast.MakeText(context, "Send", ToastLength.Short).Show();
                        });

                        alert.SetNegativeButton("Cancel", (senderAlert, args) =>
                        {
                            UserConfirmationDialog(UserConfirmation.DontSend);

                            Toast.MakeText(context, "Not Send", ToastLength.Short).Show();
                        });

                        Dialog dialog = alert.Create();
                        dialog.Show();

                        return(true);
                    };
                }

                #endregion

                if (settings.IsLogErrorStorage == true)
                {
                    Task.Run(() => PermissionsCheckRun());
                }
            }
            catch (Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(MainActivity), ex);
                #endregion
            }
        }
예제 #13
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);
            }
        }