public override void OnListItemClick(ListView l, View v, int position, long id) { base.OnListItemClick(l, v, position, id); ThisApp.ReaderKind = ReaderKind.BibleReader; BibleVerse verse = highlightsList.ElementAt(position); // Set book ThisApp.selectedBook = ThisApp.allBibleBooks.Find(x => x.Name == verse.Book.Name); // Set chapter ThisApp.selectedChapter = new BibleChapter() { Book = ThisApp.selectedBook, ChapterNumber = verse.Chapter.ChapterNumber }; if (ReaderNavigationType.IsSelectingNavigation) { var act = Activity as ReaderActivity; act.ReloadActionBar(); Android.Support.V4.App.Fragment newContent = null; newContent = new ReaderFragment(); if (newContent != null) { act.SwitchContent(newContent); } } else if (ReaderNavigationType.IsSwipingNavigation) { var act = Activity as ReaderViewPagerActivity; act.UpdatePager(int.Parse(ThisApp.selectedChapter.ChapterNumber)); } XDocument doc = ThisApp.GetNWTFile(ThisApp.Language, ThisApp.selectedBook.Name.ToUpper()); List<string> collection = doc.Descendants("c").Select((element) => element.Value).ToList(); ThisApp.allBookChapters = collection; }
public override void OnListItemClick(ListView l, View v, int position, long id) { base.OnListItemClick(l, v, position, id); ThisApp.doHighlight = true; ThisApp.ReaderKind = ReaderKind.BibleReader; ICursor note = this.dbHelper.FetchNote(id); Activity.StartManagingCursor(note); NoteScripture n = new NoteScripture() { Id = int.Parse(note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyRowId))), Title = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyScriptureTitle)), Scripture = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyScriptureContent)), ScriptureForHighlight = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyScriptureForHighlight)), NoteTitle = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyTitle)), NoteBody = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyBody)), NWTId = note.GetString(note.GetColumnIndex(NotesDbAdapter.KeyNWTId)) }; ThisApp.selectedNote = n; Console.WriteLine(n.NWTId); string[] args = n.ScriptureForHighlight.Split(','); // Set book ThisApp.selectedBook = ThisApp.allBibleBooks.Find(x => x.Name == args[0]); // Set chapter ThisApp.selectedChapter = new BibleChapter() { Book = ThisApp.selectedBook, ChapterNumber = args[1].ToString() }; if (ReaderNavigationType.IsSelectingNavigation) { var act = Activity as ReaderActivity; act.ReloadActionBar(); Fragment newContent = null; newContent = new ReaderFragment(); if (newContent != null) { act.SwitchContent(newContent); } } else if (ReaderNavigationType.IsSwipingNavigation) { var act = Activity as ReaderViewPagerActivity; act.UpdatePager(int.Parse(args[1])); } XDocument doc = ThisApp.GetNWTFile(ThisApp.Language, ThisApp.selectedBook.Name.ToUpper()); List<string> collection = doc.Descendants("c").Select((element) => element.Value).ToList(); ThisApp.allBookChapters = collection; }
public PublicationLongClickListener(ReaderFragment view) { this.view = view; }
public PublicationTouchListener(ReaderFragment view) { this.view = view; }
public void SwitchContent(Fragment content) { if (ThisApp.ReaderKind == ReaderKind.BibleReader) { // Number of chapters in the selected book int chapterNum = int.Parse(ThisApp.selectedChapter.ChapterNumber); offset = chapterNum; } reader = content as ReaderFragment; contentFragment = content; SupportFragmentManager.BeginTransaction().Replace(Resource.Id.ContentFrame, content).Commit(); SlidingMenu.ShowContent(); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetTheme(PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetInt("ThemeStyle", Resource.Style.Theme_Sherlock)); RequestWindowFeature(WindowFeatures.ActionBar); SetSlidingActionBarEnabled(true); // Left menu if (PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetBoolean("notesReplace", false)) { leftMenuFragment = new NotesFragmentAdvanced(); rightMenuFragment = new MenuFragmentAdvanced(); } else { leftMenuFragment = new MenuFragmentAdvanced(); rightMenuFragment = new NotesFragmentAdvanced(); } contentFragment = new ReaderFragment(); reader = contentFragment as ReaderFragment; // Setup the left menu SetBehindContentView(Resource.Layout.MenuFrame); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.MenuFrame, leftMenuFragment).Commit(); // Setup the content SetContentView(Resource.Layout.ContentFrame); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.ContentFrame, contentFragment).Commit(); // Setup the right menu SlidingMenu.SetSecondaryMenu(Resource.Layout.MenuFrameSecondary); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.MenuFrameSecondary, rightMenuFragment).Commit(); // Get display dimensions of current oriented screen Display display = WindowManager.DefaultDisplay; Android.Util.DisplayMetrics metrics = new Android.Util.DisplayMetrics(); display.GetMetrics(metrics); int width = (int)(metrics.WidthPixels * .333); // Setup the sliding menu SlidingMenu.Mode = SlidingMenuBinding.Lib.SlidingMenu.LeftRight; //SlidingMenu.SetShadowWidthRes(Resource.Dimension.SlidingMenuShadowWidth); //SlidingMenu.SetShadowDrawable(Resource.Drawable.SlidingMenuShadow); SlidingMenu.SetBehindWidth(width * 2); //SlidingMenu.SetFadeDegree(0.35f); SlidingMenu.TouchModeAbove = SlidingMenuBinding.Lib.SlidingMenu.TouchmodeFullscreen; // Enable this so that we can toggle the menu when clicking the action bar home button in `OnOptionsItemSelected` SupportActionBar.SetDisplayHomeAsUpEnabled(true); if (ThisApp.ReaderKind == ReaderKind.BibleReader) { Console.WriteLine("Chapter " + ThisApp.selectedChapter.ChapterNumber.ToString()); // Number of chapters in the selected book int chapterNum = int.Parse(ThisApp.selectedChapter.ChapterNumber.ToString()); offset = chapterNum; Title = ThisApp.selectedChapter.BookAndChapter; } else if (ThisApp.ReaderKind == ReaderKind.PublicationReader) { Title = ThisApp.selectedPublicationArticle.ArticleTitle; } else if (ThisApp.ReaderKind == ReaderKind.DailyTextReader) { ThisApp.selectedDailyText = ThisApp.GetDailyText(reader.FormatDateTime(DateTime.Now)); Title = ThisApp.selectedDailyText.Date; } else if (ThisApp.ReaderKind == ReaderKind.WOLReader) { Title = "Watchtower Online Library"; } // Add the menu if user preferences loadNav = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetBoolean("topNavController", true); if (loadNav && !ThisApp.ReaderKind.Equals(ReaderKind.WOLReader)) { InitializeActionBarItemList(); Title = ""; } ThisApp.LanguageChanged += ThisApp_LanguageChanged; }