private void LoadArticle(NavStruct article) { Fragment fragment = new ArticleFragment(article, LibraryMode); fragment.RetainInstance = true; FragmentManager manager = Activity.SupportFragmentManager; FragmentTransaction transaction = manager.BeginTransaction(); transaction.SetTransition((int)FragmentTransit.FragmentFade); transaction.Add(Resource.Id.content_frame, fragment, null); transaction.AddToBackStack(null); transaction.Commit(); ((MainLibraryActivity)Activity).stacks[(int)LibraryMode].Push(fragment); }
private void SelectLibrary(Library library) { if (IsFinishing) { return; } App.STATE.CurrentLibrary = library; string tag = Enum.GetName(typeof(Library), library); FragmentTransaction transaction = SupportFragmentManager.BeginTransaction(); transaction.SetTransition((int)FragmentTransit.FragmentFade); Fragment fragment = SupportFragmentManager.FindFragmentByTag(tag); if (App.STATE.CanTranslate()) { if (fragment == null) { if (App.STATE.CurrentLibrary == Library.DailyText) { string date = App.FUNCTIONS.FormatDateTime(DateTime.Now); fragment = new ArticleFragment(NavStruct.Parse(date), library); fragment.RetainInstance = true; } //else if (App.STATE.CurrentLibrary == Library.Insight) //{ // fragment = new InsightLibraryFragment(); // fragment.RetainInstance = true; //} else { fragment = new LibraryFragment(); fragment.RetainInstance = true; } if (SelectedFragment != null) { transaction.Detach(SelectedFragment); } transaction.Add(Resource.Id.content_frame, fragment, tag); transaction.Commit(); } else { transaction.Detach(SelectedFragment); transaction.Attach(fragment); transaction.Commit(); } SelectedFragment = fragment; int index = App.STATE.Libraries.IndexOf(library); list.SetItemChecked(index, true); list.SetSelection(index); drawer.CloseDrawer(list); } else { // Temporary HACK SupportFragmentManager.PopBackStack(null, (int)PopBackStackFlags.Inclusive); SelectedFragment = null; transaction.Replace(Resource.Id.content_frame, new Fragment()).Commit(); RunOnUiThread(() => { list.Adapter = null; }); } Console.WriteLine("Current LibraryMode is " + App.STATE.CurrentLibrary.ToString()); }
public SeekBarListener(ArticleFragment fragment) { this.fragment = fragment; }