protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Saved); savedTripsView = FindViewById <ListView>(Resource.Id.saved_listView1); _bannerad = BannerAdWrapper.ConstructStandardBanner(this, AdSize.SmartBanner, "ca-app-pub-6665335742989505/2028275471"); _bannerad.Bottom = 0; _bannerad.CustomBuild(); var layout = FindViewById <LinearLayout>(Resource.Id.saved_LinearLayout2); layout.AddView(_bannerad); pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); prefEdit = pref.Edit(); savedItemsList = new List <string>(); UpdateList(); adapter = new ArrayAdapter <string>(this, Resource.Layout.SavedListItems, savedItemsList); savedTripsView.Adapter = adapter; savedTripsView.ItemClick += SavedTripsView_ItemClick; savedTripsView.ItemLongClick += SavedTripsView_ItemLongClick; Toast.MakeText(this, "Press and Hold Trip For More Options", ToastLength.Short).Show(); }//OnCreate()
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Options); _bannerad = BannerAdWrapper.ConstructStandardBanner(this, AdSize.LargeBanner, "ca-app-pub-6665335742989505/9551542272"); _bannerad.Bottom = 0; _bannerad.CustomBuild(); var layout = FindViewById <LinearLayout>(Resource.Id.options_LinearLayout1); layout.AddView(_bannerad); pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); prefEdit = pref.Edit(); enableStops = pref.GetBoolean("enableStops", true); showKMs = pref.GetBoolean("showKMs", true); portraitView = pref.GetBoolean("portraitView", true); SetRadioButtons(); RadioButton kilometersRadioButton = FindViewById <RadioButton>(Resource.Id.options_KilometersRadioButton); RadioButton milesRadioButton = FindViewById <RadioButton>(Resource.Id.options_MilesRadioButton); RadioButton enableStopsRadioButton = FindViewById <RadioButton>(Resource.Id.options_EnableStopsRadioButton); RadioButton disableStopsRadioButton = FindViewById <RadioButton>(Resource.Id.options_DisableStopsRadioButton); RadioButton portraitRadioButton = FindViewById <RadioButton>(Resource.Id.options_PortraitRadioButton); RadioButton landscapeRadioButton = FindViewById <RadioButton>(Resource.Id.options_LandscapeRadioButton); kilometersRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("showKMs", true); prefEdit.Apply(); }; milesRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("showKMs", false); prefEdit.Apply(); }; enableStopsRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("enableStops", true); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Stops Will Only Affect New Trips", ToastLength.Short).Show(); }; disableStopsRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("enableStops", false); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Stops Will Only Affect New Trips", ToastLength.Short).Show(); }; portraitRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("portraitView", true); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Screen Orientation Won't Affect Started Trips", ToastLength.Short).Show(); prefEdit.PutBoolean("changeOrientation", true); prefEdit.Apply(); }; landscapeRadioButton.Click += (sender, e) => { prefEdit.PutBoolean("portraitView", false); prefEdit.Apply(); Toast.MakeText(this, "Changes Made to Screen Orientation Won't Affect Started Trips", ToastLength.Short).Show(); prefEdit.PutBoolean("changeOrientation", true); prefEdit.Apply(); }; }//OnCreate()
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Splash); _bannerad = BannerAdWrapper.ConstructStandardBanner(this, AdSize.SmartBanner, "ca-app-pub-6665335742989505/3563884270"); _bannerad.Bottom = 0; _bannerad.CustomBuild(); var layout = FindViewById<LinearLayout>(Resource.Id.splash_LinearLayout1); layout.AddView(_bannerad); pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private); prefEdit = pref.Edit(); if (CheckSelfPermission(Manifest.Permission.WriteExternalStorage) != Android.Content.PM.Permission.Granted) { CheckFolderPermissions(); } if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) != Android.Content.PM.Permission.Granted) { CheckGPSPermissions(); } if (CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Android.Content.PM.Permission.Granted) { CreateImagesFolder(); } CreateDatabase(); prefEdit.PutBoolean("procedeSave", false); prefEdit.Apply(); if(pref.Contains("enableStops") == false) { prefEdit.PutBoolean("enableStops", true); prefEdit.Apply(); } if (pref.Contains("showKMs") == false) { prefEdit.PutBoolean("showKMs", true); prefEdit.Apply(); } if (pref.Contains("portraitView") == false) { prefEdit.PutBoolean("portraitView", true); prefEdit.Apply(); } if (pref.Contains("changeOrientation") == false) { prefEdit.PutBoolean("changeOrientation", true); prefEdit.Apply(); } portraitView = pref.GetBoolean("portraitView", true); Button splash_NewButton = FindViewById<Button>(Resource.Id.splash_NewButton); Button splash_SavedButton = FindViewById<Button>(Resource.Id.splash_SavedButton); Button splash_OptionsButton = FindViewById<Button>(Resource.Id.splash_OptionsButton); splash_NewButton.Click += (object sender, EventArgs e) => { if (portraitView) { Intent mainActivity = new Intent(this, typeof(MainActivity)); StartActivity(mainActivity); } else { Intent mainActivityLandscape = new Intent(this, typeof(MainActivityLandscape)); StartActivity(mainActivityLandscape); } Finish(); }; splash_SavedButton.Click += (object sender, EventArgs e) => { Intent savedTripsActivity = new Intent(this, typeof(SavedTripsActivity)); StartActivity(savedTripsActivity); }; splash_OptionsButton.Click += (object sender, EventArgs e) => { Intent optionsActivity = new Intent(this, typeof(OptionsActivity)); StartActivity(optionsActivity); }; }//OnCreate