public void RefreshTaskFragment(NewTaskFragment fragment) { AndroidX.AppCompat.App.AlertDialog.Builder builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); builder.SetTitle("Reset Work Space") .SetMessage("Would you like to start all over again?") .SetPositiveButton("Yes", (s, e) => { ResetView(fragment); }) .SetNegativeButton("Quit", (s, e) => { ResetView(fragment); QuitApplication(); }) .Show(); }
public void ResetView(NewTaskFragment fragment) { PathHelper.DeleteAllTempFiles(); //Delete all temp files in case. itemCountView.Text = "0"; toolbar.Subtitle = "Try again. I want to help."; if (fragment.fileChooserCard.Visibility == ViewStates.Gone || fragment.fileChooserCard.Visibility == ViewStates.Invisible) { fragment.fileChooserCard.Visibility = ViewStates.Visible; fragment.processingGroup.Visibility = ViewStates.Gone; } fragment.ImageFileNameModels.Clear(); fragment._recyclerView.GetAdapter().NotifyDataSetChanged(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); newTaskFragment = new NewTaskFragment(this); historyFragment = new HistoryFragment(this); donationFragment = new DonationFragment(); preferenceFragment = new PreferenceFragment(this); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.mainToolBar); SetSupportActionBar(toolbar); navigation = FindViewById <Google.Android.Material.BottomNavigation.BottomNavigationView>(Resource.Id.navigation); navigation.SetOnNavigationItemSelectedListener(this); ChangeFragment(newTaskFragment); MobileAds.Initialize(this); if (!ExtractRAdManager.UserHasDonated(this)) { interstitialAd = ExtractRAdManager.LoadAdInBackground(this); } if (AppCompatDelegate.DefaultNightMode == AppCompatDelegate.ModeNightYes) { navigation.ItemIconTintList = Android.Content.Res.ColorStateList.ValueOf(Android.Graphics.Color.GhostWhite); navigation.ItemTextColor = Android.Content.Res.ColorStateList.ValueOf(Android.Graphics.Color.GhostWhite); } else if (AppCompatDelegate.DefaultNightMode == AppCompatDelegate.ModeNightNo) { string accentColorString = "#" + GetColor(Resource.Color.colorAccent).ToString("X"); Android.Graphics.Color accentColor = Android.Graphics.Color.ParseColor(accentColorString); navigation.ItemIconTintList = Android.Content.Res.ColorStateList.ValueOf(accentColor); navigation.ItemTextColor = Android.Content.Res.ColorStateList.ValueOf(accentColor); } }