protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetTheme(PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetInt("ThemeStyle", Resource.Style.Theme_Sherlock)); dbHelper = new NotesDbAdapter(this); dbHelper.Open(); SetContentView(Resource.Layout.NoteEdit); scriptureTitle = (TextView)FindViewById(Resource.Id.scriptureTitle); scriptureText = (TextView)FindViewById(Resource.Id.scriptureTextContent); titleText = (EditText)FindViewById(Resource.Id.title); bodyText = (EditText)FindViewById(Resource.Id.body); var confirmButton = (Button)FindViewById(Resource.Id.confirm); rowId = ((savedInstanceState == null) ? null : savedInstanceState.GetSerializable(NotesDbAdapter.KeyRowId)) as Long; if (this.rowId == null) { var extras = Intent.Extras; this.rowId = extras != null ? new Long(extras.GetLong(NotesDbAdapter.KeyRowId)) : null; } PopulateFields(); confirmButton.Click += delegate { SaveState(); SetResult(Result.Ok); Finish(); }; }
public MySaveCallback(ParseObject testObject, NoteScripture n, Context context) { _testObject = testObject; _n = n; dbHelper = new NotesDbAdapter(context); dbHelper.Open(); }
public NoteScripture GetNoteByParseId(long rowId) { NotesDbAdapter dbHelper; dbHelper = new NotesDbAdapter(context); dbHelper.Open(); ICursor note = dbHelper.FetchNote(rowId); 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)) }; return n; }
public Dialog PresentationDialog(Activity activity, string title, string message = "", bool save = true) { LayoutInflater inflater = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService); View layout = inflater.Inflate(Resource.Layout.HTMLWebView, null); AlertDialog.Builder dialog = new AlertDialog.Builder(activity, Android.Resource.Style.ThemeDeviceDefaultNoActionBarFullscreen); dialog.SetTitle(title); dialog.SetIcon(Resource.Drawable.Icon); dialog.SetNegativeButton("X", (o, args) => { // Do something }); NotesDbAdapter dbHelper = new NotesDbAdapter(activity); dbHelper.Open(); if (save) { dialog.SetPositiveButton("Save", (o, args) => { AlertDialog.Builder alert = new AlertDialog.Builder(activity, Android.Resource.Style.ThemeDeviceDefaultNoActionBarFullscreen); EditText input = new EditText(activity); input.Hint = "favorite title"; alert.SetTitle("Add Favorite - " + title); alert.SetMessage(Html.FromHtml("<i>Favorite Title:</i>")); alert.SetView(input); alert.SetPositiveButton("Save", (o2, args2) => { long id = dbHelper.CreateNote(title, message, input.Text, " ", "GEMFAVORITE"); }); alert.SetNegativeButton("X", (o2, args2) => { }); alert.Show(); }); } //TextView textview = layout.FindViewById<TextView>(Resource.Id.htmltextbox); //textview.MovementMethod = LinkMovementMethod.Instance; //textview.SetText(Html.FromHtml(message), TextView.BufferType.Normal); WebView PresentationWebView = layout.FindViewById<WebView>(Resource.Id.htmlWebView); var client = new NWTBibleWebView(activity, Language); PresentationWebView.SetWebViewClient(client); PresentationWebView.Settings.JavaScriptEnabled = true; PresentationWebView.Settings.PluginsEnabled = true; PresentationWebView.Settings.BuiltInZoomControls = true; PresentationWebView.Settings.DefaultFontSize = UserFontSize(activity); PresentationWebView.LoadDataWithBaseURL("file:///android_asset/", message, "text/html", "utf-8", null); dialog.SetView(layout); return dialog.Create(); }
public override bool OnOptionsItemSelected(Xamarin.ActionbarSherlockBinding.Views.IMenuItem item) { ThisApp.doHighlight = false; if (ThisApp.ReaderKind == ReaderKind.BibleReader) { // Number of chapters in the selected book int chapterNum = int.Parse(ThisApp.selectedChapter.ChapterNumber); offset = chapterNum; } else if (ThisApp.ReaderKind == ReaderKind.PublicationReader) { // Number of chapters in the selected book int pageNum = ThisApp.selectedPublication.CurrentPage; offset = pageNum; } switch (item.ItemId) { case global::Android.Resource.Id.Home: Toggle(); return true; case (PREVIOUS_MENU): ThisApp.selectedPublication.CurrentPage--; offset--; ReloadReader(); return true; case (NEXT_MENU): ThisApp.selectedPublication.CurrentPage++; offset++; ReloadReader(); return true; case (GOTO_MENU): ThisApp.GoToArticleDialog(this).Show(); return true; case (TRANSLATE_MENU): ThisApp.TranslateLanguageDialog(this).Show(); return true; case (NOTE_MENU): reader.InitializeNoteParadigm(); return true; case (SAVE_MENU): NotesDbAdapter dbHelper = new NotesDbAdapter(this); dbHelper.Open(); long id = dbHelper.CreateNote(reader.Title, ThisApp.WolArticle, reader.Title, " ", "WOLFAVORITE"); return true; case (HIGHLIGHT_MENU): return true; case (TODAY_MENU): offset = dailyTextToday; ReloadReader(); return true; } return base.OnOptionsItemSelected(item); }