public static void Create(string title, string message, Android.Content.Context context) { Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(context); alert.SetInverseBackgroundForced(true); alert.SetTitle(title); alert.SetMessage(message); alert.SetPositiveButton("CLOSE", (senderAlert, args) => { alert.Dispose(); }); Android.App.Dialog dialog = alert.Create(); dialog.Show(); }
protected void GCMInit() { try { PackageInfo pInfo = this.Activity.PackageManager.GetPackageInfo(this.Activity.PackageName, 0); var shared = this.Activity.GetSharedPreferences(); var version = shared.GetInt(GetString(Resource.String.shared_preferences_version), 0); var temp = shared.GetString(GetString(Resource.String.shared_preferences_gcm_handle), null); if (temp != null) { GcmClient.UnRegister(Activity); } // If already registered for GCM, or if not connected to the internet proceed to login if (isNetworkAvailable()) { // Check for Google GCM int errorCode = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this.Activity); if (errorCode == ConnectionResult.Success) { GcmClient.Register(this.Activity, GcmBroadcastReceiver.SENDER_IDS); Insight.Track("GcmClient.Register"); } else { const int PLAY_SERVICES_RESOLUTION_REQUEST = 9000; Android.App.Dialog dialog = GooglePlayServicesUtil.GetErrorDialog(errorCode, this.Activity, PLAY_SERVICES_RESOLUTION_REQUEST); dialog.DismissEvent += delegate { this.Activity.Finish(); }; dialog.Show(); } } } catch (Exception e) { Insight.Report(e); } }
public void CreateTask() { Boolean connectivity = con.connectivity(); if (connectivity) { geolocation = geo.GetGeoLocation(Context); CreatetaskService(); } else { // db.InsertCreateTaskData(taskname, taskdescri, deadline,"mobile",markto,"no",listmapping2); Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(Activity); alertDiag.SetTitle("You don't have Internet connection. Check your connection or Save Task for Later"); alertDiag.SetMessage("press Ok to continue"); alertDiag.SetPositiveButton("Save", (senderAlert, args) => { //markingtaskforlaterAsync(); db.InsertCreateTaskData(taskname, taskdescri, deadline, "mobile", markto, "unassign", listmapping2, CreateTaskFrag.modelsaddcompliance); Toast.MakeText(Activity, "Task have been saved successfully. To assign Task manually sync the data. ", ToastLength.Long).Show(); }); alertDiag.SetNegativeButton("Cancel", (senderAlert, args) => { alertDiag.Dispose(); }); Android.App.Dialog diag = alertDiag.Create(); diag.Show(); tasknametext.Text = null; taskdescription.Text = null; deadlinetext.Text = null; markedontext.Text = null; designationtext.Text = null; nametext.Text = null; Toast.MakeText(Activity, "No Internet Connection. Data has been saved locally.", ToastLength.Long).Show(); } }
private async void LoadPopUpAsync(object sender, EventArgs e) { //string title = (sender as Button).Text; string title = (sender as RelativeLayout).Tag.ToString(); /* Disable the button */ (sender as RelativeLayout).Enabled = false; /* Find the current theme */ TypedValue attrValue = new TypedValue(); Activity.Theme.ResolveAttribute( Resource.Attribute.modThemeName, attrValue, true); /* Create the dialog box based on the current theme */ if (attrValue.String.ToString() == "ModAppCompatLightTheme") { _dialogBox = new Dialog(Activity, Resource.Style.ModAppCompatLightTheme); } else { _dialogBox = new Dialog(Activity, Resource.Style.ModAppCompatDarkTheme); } #region NOT NEEDED /*_dialogBox.Window.RequestFeature(WindowFeatures.NoTitle); * _dialogBox.RequestWindowFeature(1);*/ #endregion /* ViewModel Text must be passed to all these layouts */ switch (title) { case AndroidApp.FacilityCategory.Academics: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesAcademic); } break; case AndroidApp.FacilityCategory.Church: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesChurch); } break; case AndroidApp.FacilityCategory.Dining: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesDining); } break; case AndroidApp.FacilityCategory.Dorm: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesDorm); } break; case AndroidApp.FacilityCategory.Recreation: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesRecreation); } break; case AndroidApp.FacilityCategory.Service: { _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesService); } break; } _dialogBox.Window.SetWindowAnimations(Resource.Style.Base_Animation_AppCompat_DropDownUp); dialogToolbar = _dialogBox.Window.FindViewById <SupportToolbar>(Resource.Id.toolbar); dialogToolbar.SetNavigationIcon(Resource.Drawable.abc_ic_ab_back_material); dialogToolbar.Title = title;/* Or create a tag for each button and set its tag as the title */ dialogToolbar.NavigationClick += async(navSender, navEvent) => { await Task.Delay(150); _dialogBox.Dismiss(); }; await Task.Delay(150); _dialogBox.Show(); await Task.Delay(400); (sender as RelativeLayout).Enabled = true; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.Inflate(Resource.Layout.gstn_verification, container, false); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); con = new InternetConnection(); searchGST = (TextInputEditText)rootView.FindViewById(Resource.Id.searchGSTN); gstnProgress = (ProgressBar)rootView.FindViewById(Resource.Id.progressGST); tradeName1 = (TextView)rootView.FindViewById(Resource.Id.tradeName); gstnIdText1 = (TextView)rootView.FindViewById(Resource.Id.gstnId); regDate1 = (TextView)rootView.FindViewById(Resource.Id.regDate); mobileNumber1 = (TextView)rootView.FindViewById(Resource.Id.mobileNumberVer); linear1 = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion1); linear2 = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion2); linear3 = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion3); gridLayout = (LinearLayout)rootView.FindViewById(Resource.Id.gridVer); submitDataVer = (Button)rootView.FindViewById(Resource.Id.submitVerification); cameraVer = (ImageButton)rootView.FindViewById(Resource.Id.cameraVer); gridViewVer = (GridView)rootView.FindViewById(Resource.Id.gridViewVer); checkValidate = (CheckBox)rootView.FindViewById(Resource.Id.checkVerification); rg1 = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup1); rg2 = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup2); rg3 = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup3); rg4 = (LinearLayout)rootView.FindViewById(Resource.Id.myRadioGroup4); Yes1 = (RadioButton)rootView.FindViewById(Resource.Id.yes1); Yes2 = (RadioButton)rootView.FindViewById(Resource.Id.yes2); Yes3 = (RadioButton)rootView.FindViewById(Resource.Id.yes3); No1 = (RadioButton)rootView.FindViewById(Resource.Id.no1); No2 = (RadioButton)rootView.FindViewById(Resource.Id.no2); No3 = (RadioButton)rootView.FindViewById(Resource.Id.no3); Manufacturer = (CheckBox)rootView.FindViewById(Resource.Id.manufacturer); Trader = (CheckBox)rootView.FindViewById(Resource.Id.trader); ServiceDealer = (CheckBox)rootView.FindViewById(Resource.Id.serviceDealer); turnoverText = (TextInputEditText)rootView.FindViewById(Resource.Id.turnOver); otherText = (TextInputEditText)rootView.FindViewById(Resource.Id.otherText1); areaBusiness = (TextInputEditText)rootView.FindViewById(Resource.Id.area1); businessSelectButton = (Button)rootView.FindViewById(Resource.Id.mySelection); grid_adapter = new GridAdapter(Activity, Utilities.imageList); gridViewVer.Adapter = grid_adapter; tradeName1.Visibility = ViewStates.Gone; gstnIdText1.Visibility = ViewStates.Gone; regDate1.Visibility = ViewStates.Gone; mobileNumber1.Visibility = ViewStates.Gone; gridLayout.Visibility = ViewStates.Gone; submitDataVer.Visibility = ViewStates.Gone; cameraVer.Visibility = ViewStates.Gone; gridViewVer.Visibility = ViewStates.Gone; checkValidate.Visibility = ViewStates.Gone; linear1.Visibility = ViewStates.Gone; linear2.Visibility = ViewStates.Gone; linear3.Visibility = ViewStates.Gone; otherText.Visibility = ViewStates.Gone; areaBusiness.Visibility = ViewStates.Gone; turnoverText.Visibility = ViewStates.Gone; rg4.Visibility = ViewStates.Gone; businessSelectButton.Visibility = ViewStates.Gone; Yes1.Click += RadioButtonClick; No1.Click += RadioButtonClick; Yes2.Click += RadioButtonClick; No2.Click += RadioButtonClick; Yes3.Click += RadioButtonClick; No3.Click += RadioButtonClick; businessSelectButton.Click += delegate { try { Intent i = new Intent(Activity, typeof(BusinessTypeFragment)); Activity.StartActivity(i); //FragmentTransaction ft = FragmentManager.BeginTransaction(); //BusinessTypeFragment f4 = new BusinessTypeFragment(); //ft.Replace(Resource.Id.container, f4); //ft.AddToBackStack("BusinessTypeFragment"); //ft.Commit(); // FragmentManager.BeginTransaction().Add(Resource.Id.container, new BusinessTypeFragment()).Commit(); }catch (Exception ex) { } }; mobileNumber1.Click += delegate { AlertDialog.Builder alertDiag = new AlertDialog.Builder(Activity); alertDiag.SetTitle("Call Dialog"); alertDiag.SetMessage("Do you want to call?"); alertDiag.SetPositiveButton("Call", (senderAlert, args) => { try { var uri = Android.Net.Uri.Parse("tel:" + phoneNumber); var intent = new Intent(Intent.ActionDial, uri); StartActivity(intent); }catch (Exception e) { } }); alertDiag.SetNegativeButton("Cancel", (senderAlert, args) => { alertDiag.Dispose(); }); Android.App.Dialog diag = alertDiag.Create(); diag.Show(); }; cameraVer.Click += delegate { CameraPic(); }; searchGST.TextChanged += delegate { if (searchGST.Text.ToString().Length >= 15) { string searchText = searchGST.Text.ToString(); if (con.connectivity()) { GSTNSearch(searchText).Wait(); } else { Toast.MakeText(Activity, "Please connect to Internet.", ToastLength.Long).Show(); } } else { tradeName1.Visibility = ViewStates.Gone; gstnIdText1.Visibility = ViewStates.Gone; regDate1.Visibility = ViewStates.Gone; mobileNumber1.Visibility = ViewStates.Gone; gridLayout.Visibility = ViewStates.Gone; checkValidate.Visibility = ViewStates.Gone; submitDataVer.Visibility = ViewStates.Gone; cameraVer.Visibility = ViewStates.Gone; gridViewVer.Visibility = ViewStates.Gone; linear1.Visibility = ViewStates.Gone; linear2.Visibility = ViewStates.Gone; linear3.Visibility = ViewStates.Gone; otherText.Visibility = ViewStates.Gone; areaBusiness.Visibility = ViewStates.Gone; turnoverText.Visibility = ViewStates.Gone; rg4.Visibility = ViewStates.Gone; businessSelectButton.Visibility = ViewStates.Gone; } }; submitDataVer.Click += delegate { other = otherText.Text.ToString(); premisesArea = areaBusiness.Text.ToString(); if (checkValidate.Selected) { compoundingEligible = "Yes"; } else { compoundingEligible = "No"; } //if (Manufacturer.Selected) //{ // manuf = "Manufacturer"; //} //if (Trader.Selected) //{ // trad = "Trader"; //} //if (ServiceDealer.Selected) //{ // dealer = "Service Dealer"; //} turnOver = turnoverText.Text.ToString(); //if (!manuf.Equals("")) //{ // if (!combine.Equals("")) // { // combine += "," + manuf; // } // else // { // combine += manuf; // } //} //if (!trad.Equals("")) //{ // if (!combine.Equals("")) // { // combine += "," + trad; // } // else // { // combine += trad; // } //} //if (!dealer.Equals("")) //{ // if (!combine.Equals("")) // { // combine += "," + dealer; // } // else // { // combine += dealer; // } //} try { combine = string.Join(",", Utilities.GlobalBusinessList); }catch (Exception ex) { combine = ""; } if (address.Equals("")) { Toast.MakeText(Activity, "Please Select Address Status", ToastLength.Short).Show(); return; } if (businessStatus.Equals("")) { Toast.MakeText(Activity, "Please Select Business Status", ToastLength.Short).Show(); return; } if (registration.Equals("")) { Toast.MakeText(Activity, "Please Select Registration Status", ToastLength.Short).Show(); return; } if (Utilities.imageList.Count < 1) { Toast.MakeText(Activity, "Please Capture Atleast One Photograph.", ToastLength.Short).Show(); return; } if (con.connectivity()) { submitDataVer.Enabled = false; try { sendToServer(); }catch (Exception ex) { Toast.MakeText(Activity, "Something went wrong. Please try after sometime.", ToastLength.Long).Show(); PackageManager manager = Activity.PackageManager; PackageInfo info = manager.GetPackageInfo(Activity.PackageName, 0); info.VersionName.ToString(); int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"), address, businessStatus, registration, other, compoundingEligible, premisesArea, combine, turnOver, info.VersionName.ToString(), "no"); for (int j = 0; j < Utilities.imageList.Count; j++) { dba.insertImageDetail(i, Utilities.imageList[j].ImagePath, geo.GetGeoLocation(Activity)); } } } else { submitDataVer.Enabled = false; PackageManager manager = Activity.PackageManager; PackageInfo info = manager.GetPackageInfo(Activity.PackageName, 0); info.VersionName.ToString(); int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"), address, businessStatus, registration, other, compoundingEligible, premisesArea, combine, turnOver, info.VersionName.ToString(), "no"); for (int j = 0; j < Utilities.imageList.Count; j++) { dba.insertImageDetail(i, Utilities.imageList[j].ImagePath, geo.GetGeoLocation(Activity)); } Toast.MakeText(Activity, "Data Saved in Database.", ToastLength.Long).Show(); combine = ""; GSTIN = ""; rg1.ClearCheck(); address = ""; rg2.ClearCheck(); businessStatus = ""; rg3.ClearCheck(); registration = ""; other = ""; otherText.Text = ""; checkValidate.Checked = false; compoundingEligible = ""; premisesArea = ""; areaBusiness.Text = ""; turnoverText.Text = ""; Utilities.imageList.Clear(); turnOver = ""; Manufacturer.Checked = false; Trader.Checked = false; ServiceDealer.Checked = false; submitDataVer.Enabled = true; manuf = ""; trad = ""; dealer = ""; grid_adapter.NotifyDataSetChanged(); Utilities.GlobalBusinessList.Clear(); } }; return(rootView); }