//App Loading screen //Add code for new search type adapter protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.search_Layout); SetTitle(Resource.String.app_name); Spinner spinner2 = FindViewById <Spinner>(Resource.Id.spinner1), spinner = FindViewById <Spinner>(Resource.Id.spinner2); SetTheme(Resource.Style.AppTheme); SearchView search = FindViewById <SearchView>(Resource.Id.searchView1); search.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); documents = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("All", "All"), new KeyValuePair <string, string>("Creed", "Creed"), new KeyValuePair <string, string>("Confession", "Confession"), new KeyValuePair <string, string>("Catechism", "Catechism") }; List <string> documentTypes = new List <string>(); foreach (var item in documents) { documentTypes.Add(item.Key); } spinner2.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner2_ItemSelected); var adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.docTypes, Android.Resource.Layout.SimpleSpinnerItem); adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner2.Adapter = adapter1; files = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string> ("Westminster Confession of Faith 1646", "Westminster Confession of Faith 1646"), new KeyValuePair <string, string>("2nd London Baptist Confession of Faith", "2nd London Baptist Confession of Faith"), new KeyValuePair <string, string>("1618 Belgic Confession Of Faith", "1618 Belgic Confession Of Faith"), new KeyValuePair <string, string>("1658 Savoy Declaration", "1658 Savoy Declaration"), new KeyValuePair <string, string> ("Westminster Larger Catechism", "Westminster Larger Catechism"), new KeyValuePair <string, string>("Westminster Shorter Catechism", "Westminster Shorter Catechism"), new KeyValuePair <string, string>("Heidelberg Catechism", "Heidelberg Catechism"), new KeyValuePair <string, string>("Apostle\'s Creed", "Apostle\'s Creed"), new KeyValuePair <string, string>("Nicene Creed", "Nicene Creed"), new KeyValuePair <string, string>("Athanasian Creed", "Athanasian Creed") }; List <string> catechismFiles = new List <string>(); foreach (var item in files) { catechismFiles.Add(item.Key); } spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner1_ItemSelected); var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.all_docs_list, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; FindViewById <RadioButton>(Resource.Id.topicRadio).PerformClick(); FloatingActionButton button = FindViewById <FloatingActionButton>(Resource.Id.searchFAB); button.Click += delegate { Search(search.Query); }; }
public void SearchType(View view) { KeyEvent enter = new KeyEvent(KeyEventActions.Down, Keycode.Enter); SearchView searchView = FindViewById <SearchView>(Resource.Id.searchView1); RadioButton radio = ((RadioButton)view); TextView text = FindViewById <TextView>(Resource.Id.searchTVFAB); if (radio == FindViewById <RadioButton>(Resource.Id.topicRadio)) { if (radio.Checked) { searchView.Enabled = true; searchView.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); searchView.SetInputType(Android.Text.InputTypes.ClassText); searchView.QueryTextSubmit += Search_QueryTextSubmit; searchView.SetQueryHint("Search By topic"); text.Text = "Search"; } } //Chapter/Question Number Search else if (radio == FindViewById <RadioButton>(Resource.Id.chapterRadio)) { if (radio.Checked) { searchView.Enabled = true; searchView.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); searchView.QueryTextSubmit += Search_QueryTextSubmit; searchView.SetInputType(Android.Text.InputTypes.ClassNumber); searchView.SetQueryHint("Search By Number..."); text.Text = "Search"; } } else if (radio == FindViewById <RadioButton>(Resource.Id.viewAllRadio)) { text.Text = "Read"; searchView.Enabled = false; //if (!creedOpen) //{ // searchView.SetIconifiedByDefault(true); // searchView.Enabled = false; //} } }
protected override void OnCreate(Bundle savedInstanceState) { //base.OnCreate(); base.OnCreate(savedInstanceState); string[] permissions = new string[2]; permissions[0] = Manifest.Permission.WriteExternalStorage; permissions[1] = Manifest.Permission.ReadExternalStorage; // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); Spinner spinner1 = FindViewById <Spinner>(Resource.Id.spinner1), spinner2 = FindViewById <Spinner>(Resource.Id.spinner2); ActivityCompat.RequestPermissions(this, permissions, 1); if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) == (int)Permission.Granted) { if (!File.Exists(dbPath)) { using (BinaryReader br = new BinaryReader(Android.App.Application.Context.Assets.Open(dbName))) { using (BinaryWriter bw = new BinaryWriter(new FileStream(dbPath, FileMode.Create))) { byte[] buffer = new byte[2048]; int len = 0; while ((len = br.Read(buffer, 0, buffer.Length)) > 0) { bw.Write(buffer, 0, len); } } } } // We have permission, go ahead and use the camera. using (var conn = new SQLite.SQLiteConnection(dbPath)) { // var cmd2= new SQLite.SQLiteCommand(conn); var cmd = new SQLite.SQLiteCommand(conn); //var cmd1 = new SQLite.SQLiteCommand(conn); cmd.CommandText = "select * from DocumentType"; var docTypes = cmd.ExecuteQuery <DocumentType>(); cmd.CommandText = "select * from DocumentTitle"; var r = cmd.ExecuteQuery <DocumentTitle>(); List <string> items = new List <string>(); items.Add("All"); foreach (var item in docTypes) { items.Add(item.DocumentTypeName); } var adapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, items); adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner1.ItemSelected += Spinner1_ItemSelected; spinner1.Adapter = adapter1; items = new List <string>(); foreach (var item in r) { items.Add(item.Title); } var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, items); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner2.ItemSelected += Spinner2_ItemSelected; spinner2.Adapter = adapter; SearchView search = FindViewById <SearchView>(Resource.Id.searchView1); search.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); search.QueryTextSubmit += Search_QueryTextSubmit; } } else { ActivityCompat.RequestPermissions(this, permissions, 1); this.Recreate(); } FindViewById <FloatingActionButton>(Resource.Id.searchFAB).Click += delegate { Search(FindViewById <SearchView>(Resource.Id.searchView1).Query); }; }
//App Loading screen protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); SetTitle(Resource.String.app_name); AppCenter.Start("c8e96422-f89a-45cf-b331-0c3bc585ee00", typeof(Analytics), typeof(Crashes)); SetTheme(Resource.Style.AppTheme); SearchView search = FindViewById <SearchView>(Resource.Id.searchView1); search.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); search.QueryTextSubmit += Search_QueryTextSubmit; string[] permissions = new string[2]; permissions[0] = Manifest.Permission.WriteExternalStorage; permissions[1] = Manifest.Permission.ReadExternalStorage; // Set our view from the "main" layout resource Spinner spinner1 = FindViewById <Spinner>(Resource.Id.spinner1), spinner2 = FindViewById <Spinner>(Resource.Id.spinner2); //ActivityCompat.RequestPermissions(this, permissions, 1); if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) == (int)Permission.Granted) { if (!File.Exists(dbPath)) { using (BinaryReader binreader = new BinaryReader(Android.App.Application.Context.Assets.Open(dbName))) { using (BinaryWriter binwriter = new BinaryWriter(new FileStream(dbPath, FileMode.Create))) { byte[] buffer = new byte[2048]; int len = 0; while ((len = binreader.Read(buffer, 0, buffer.Length)) > 0) { binwriter.Write(buffer, 0, len); } } } } using (var conn = new SQLite.SQLiteConnection(dbPath)) { var cmd = new SQLite.SQLiteCommand(conn); cmd.CommandText = "select * from DocumentType"; var docTypes = cmd.ExecuteQuery <DocumentType>(); cmd.CommandText = "select * from DocumentTitle"; var r = cmd.ExecuteQuery <DocumentTitle>(); List <string> items = new List <string>(); items.Add("All"); foreach (var item in docTypes) { items.Add(item.DocumentTypeName); } var adapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, items); adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner1.ItemSelected += Spinner1_ItemSelected; spinner1.Adapter = adapter1; items = new List <string>(); foreach (var item in r) { items.Add(item.Title); } var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, items); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner2.ItemSelected += Spinner2_ItemSelected; spinner2.Adapter = adapter; search.SetImeOptions(Android.Views.InputMethods.ImeAction.Go); search.QueryTextSubmit += Search_QueryTextSubmit; FindViewById(Resource.Id.helpButton).Click += delegate { SetContentView(Resource.Layout.main); creedOpen = false; catechismOpen = false; confessionOpen = false; helpOpen = true; // SetContentView(Resource.Layout.main); FindViewById <TextView>(Resource.Id.appTitle).Text = "Help Page"; FindViewById <TextView>(Resource.Id.searchByLabel).Text = GetString(Resource.String.catechism_help); FindViewById <TextView>(Resource.Id.catechismPgh).Text = "Hitting the No Answers Checkbox will remove answers from your search results, '\n" + "thus affecting the overall search results on the page.\n" + " Hit the No proofs checkbox to exclude proofs from the search results\n"; FindViewById <TextView>(Resource.Id.confessionHelp).Text = GetString(Resource.String.confession_help); FindViewById <TextView>(Resource.Id.confessionPgh).Text = GetString(Resource.String.confessionPgh); FindViewById <TextView>(Resource.Id.creedHelp).Text = "Creed Help:"; FindViewById <TextView>(Resource.Id.creedPgh).Text = GetString(Resource.String.creedPgh); FindViewById <TextView>(Resource.Id.otherStuff).Text = "Other Stuff:"; FindViewById <TextView>(Resource.Id.otherPgh).Text = GetString(Resource.String.other_pgh); FindViewById <TextView>(Resource.Id.sourceTV).Text = "All documents listed below are public domain, the websites below helped me with collecting them. \n A big thanks for inspiration for this app came from this website." + "\n\nApostle's Creed: https://reformed.org/documents/apostles_creed.html " + "\n1618 Belgic Confession: https://reformed.org/documents/BelgicConfession.html " + "\n1646 Westminster Confession of Faith: https://reformed.org/documents/wcf_with_proofs/index.html" + "\n1689 London Baptist Confession of Faith: https://reformed.org/documents/baptist_1689.html" + "\n1658 Savoy Declaration of Faith and Order: https://reformed.org/documents/Savoy_Declaration/index.html" + "\nWestminster Shorter Catechism: https://reformed.org/documents/wsc/index.html" + " \nWestminster Larger Catechism: https://reformed.org/documents/wlc_w_proofs/index.html " + "\nHeidelberg Catechism: https://reformed.org/documents/heidelberg.html " + "\nNicean Creed: https://reformed.org/documents/nicene.html " + "\nAthanasian Creed: https://reformed.org/documents/athanasian.html "; FindViewById(Resource.Id.floatingActionButton).Click += delegate { this.Recreate(); }; }; } } else { ActivityCompat.RequestPermissions(this, permissions, 1); this.Recreate(); } FindViewById <FloatingActionButton>(Resource.Id.searchFAB).Click += delegate { Search(FindViewById <SearchView>(Resource.Id.searchView1).Query); }; }