protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView (Resource.Layout.MySoal_MessageDetailsLayout); toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#F44336")); //toolbar.SetNavigationIcon (Resource.Drawable.ic_next); //toolbar. //toolbar.SetNavigationOnClickListener (); mainTitle = FindViewById<TextView> (Resource.Id.tvMSMDLMainTitle); mainTitle.Text = Intent.GetStringExtra ("PMDTitle"); infoDetails = FindViewById<WebView> (Resource.Id.wvMSMDLDetails); infoDetails.Settings.JavaScriptEnabled = true; infoDetails.LoadDataWithBaseURL ("", Intent.GetStringExtra ("PMDContent"), "text/html", "UTF-8", ""); infoDetails.Settings.BuiltInZoomControls = true; SetSupportActionBar (toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled (true); }
protected override void OnCreate(Bundle savedInstanceState) { try { ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorDevis = sharedPreferences.Edit(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.UpdateMdp); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); SupportActionBar.Title = "Modifier Mot de passe"; ads1 = FindViewById <AdView>(Resource.Id.adView1mdpUpdate); ads2 = FindViewById <AdView>(Resource.Id.adView2mdpUpdate); var adRequest1 = new AdRequest.Builder().Build(); ads1.LoadAd(adRequest1); var adRequest2 = new AdRequest.Builder().Build(); ads2.LoadAd(adRequest2); nvmdp = FindViewById <EditText>(Resource.Id.editTextpassactUpdate); mpd = FindViewById <EditText>(Resource.Id.textInputEditTextmotdepasseUpdate); conmdp = FindViewById <EditText>(Resource.Id.textInputEditTextconmotdepasseUpdate); btnok = FindViewById <Button>(Resource.Id.buttonokUpdate); btnok.Click += delegate { //if (Passwordcheck(mpd.Text, sharedPreferences.GetString("Emailad", "")) == mpd.Text) //{ UpdatePassword(mpd.Text, "Admin", sharedPreferences.GetString("Emailad", "")); Intent intent = new Intent(this, typeof(Itemsapp)); intent.PutExtra("Emailadmin", Intent.GetStringExtra("Emailadmin")); StartActivity(intent); //} //else //{ //AlertDialog.Builder builder = new AlertDialog.Builder(this); //builder.SetTitle("avertissement").SetMessage("mot de passe incorrecte").SetPositiveButton("OK", (sender, args) => { builder.Dispose(); }).Show(); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Short).Show(); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.MySkool_AnnounceDetailsLayout); toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#F8A015")); //toolbar.SetNavigationIcon (Resource.Drawable.ic_arrow_up); SetSupportActionBar (toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled (true); string getArticleTitle = Intent.GetStringExtra ("ArticleTitle"); string getArticleContent = Intent.GetStringExtra ("ArticleContent"); mainTitle = FindViewById<TextView> (Resource.Id.tvMSADLMainTitle); mainTitle.Text = getArticleTitle.ToString(); infoDetails = FindViewById<WebView> (Resource.Id.wvMSADLDetails); infoDetails.Settings.JavaScriptEnabled = true; infoDetails.LoadDataWithBaseURL ("", getArticleContent.ToString(), "text/html", "UTF-8", ""); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.MySoal_ComposeMsgListPBTLayout); WebServices.MSPBTRootObject pbtList = GetPBTList (); pbtListArray = new List<string> (); pbtListIDArray = new List<string> (); foreach (var pbtListExtract in pbtList.pbt) { pbtListArray.Add (pbtListExtract.School.name); pbtListIDArray.Add (pbtListExtract.School.id); } listView = FindViewById<ListView>(Resource.Id.lvMSCMLPBTLpbt); listItems = new List<WebServices.MSPBTRootObject>(); listView.Adapter = new ArrayAdapter(this, Resource.Layout.MySoal_SimpleListItemModified, pbtListArray); listView.ChoiceMode = ChoiceMode.Multiple; toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#F44336")); SetSupportActionBar (toolbar); btnMSCMLPBTLSubmit = FindViewById<Button> (Resource.Id.btnMSCMLPBTLSubmit); btnMSCMLPBTLSubmit.Click += SetToAddress; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); pref = Application.GetSharedPreferences("backgroundColor_textColor", FileCreationMode.Private); result = pref.GetString("background", "White"); result2 = pref.GetString("textColor", "Black"); toolbar = FindViewById <V7ToolBar>(Resource.Id.toolbar); drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); tV1 = FindViewById <TextView>(Resource.Id.main_text); toolbar.SetTitle(Resource.String.title_name); toolbar.SetTitleTextColor(Color.White); SetSupportActionBar(toolbar); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); //navigationView.ItemTextColor = ColorStateList.ValueOf(Color.ParseColor(result2)); drawer.SetBackgroundColor(Color.ParseColor(result)); toolbar.SetBackgroundColor(Color.ParseColor(result2)); navigationView.SetBackgroundColor(Color.ParseColor(result2)); Task.Run(async() => await Update()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_color_status_bar); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); _btnChangeColor = FindViewById <Button>(Resource.Id.btn_change_color); _tvStatusAlpha = FindViewById <TextView>(Resource.Id.tv_status_alpha); _sbChangeAlpha = FindViewById <SeekBar>(Resource.Id.sb_change_alpha); SetSupportActionBar(_toolbar); SupportActionBar?.SetDisplayHomeAsUpEnabled(true); _btnChangeColor.Click += (s, e) => { var random = new Random(); _color = (int)(0xff000000 | random.Next(0xffffff)); _toolbar.SetBackgroundColor(new Color(_color)); Jaeger.StatusBarUtil.SetColor(this, _color, _alpha); }; _sbChangeAlpha.Max = 255; _sbChangeAlpha.ProgressChanged += (s, e) => { _alpha = e.Progress; Jaeger.StatusBarUtil.SetColor(this, _color, _alpha); _tvStatusAlpha.Text = _alpha.ToString(); }; _sbChangeAlpha.Progress = Jaeger.StatusBarUtil.DefaultStatusBarAlpha; }
protected override void OnLayout(bool changed, int l, int t, int r, int b) { base.OnLayout(changed, l, t, r, b); context = (Activity)Xamarin.Forms.Forms.Context; toolbar = context.FindViewById <Android.Support.V7.Widget.Toolbar>(Droid.Resource.Id.toolbar); var page = Application.Current?.MainPage?.Navigation?.NavigationStack?.Last(); if (!(page is HomePage)) { toolbar.SetPadding(0, 0, 0, 0); toolbar.Logo = null; toolbar.SetBackgroundColor(Android.Graphics.Color.ParseColor("#293862")); if (toolbar.NavigationIcon != null) { toolbar.SetNavigationIcon(Resource.Drawable.BackIcon); } } else { toolbar.SetLogo(Resource.Drawable.AutotjekLogo); var paddingLeft = (toolbar.Width - toolbar.Logo.MinimumWidth) / 2; toolbar.SetPadding(paddingLeft, 0, 0, 0); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); MyLog.Log(this, $"OnCreate..."); SetContentView(Resource.Layout.Main); if (Intent.Extras != null && Intent.Extras.ContainsKey(PassWebsiteKey)) { currentWebsiteKey = Intent.Extras.GetString(PassWebsiteKey); } else { Finish(); return; } var website = Config.GetWebsite(currentWebsiteKey); MyGlobal.ChangeStatusBarColor(Window, website.Color); toolBar = FindViewById <SupportToolBar>(Resource.Id.mainToolbar); toolBar.Title = website.Name; toolBar.SetBackgroundColor(Android.Graphics.Color.ParseColor(website.Color)); tabs = FindViewById <TabLayout>(Resource.Id.mainTabs); tabs.SetBackgroundColor(Android.Graphics.Color.ParseColor(website.Color)); ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.mainViewpager); SetUpViewPager(viewPager); tabs.SetupWithViewPager(viewPager); MyLog.Log(this, $"OnCreate...Done"); }
public override void SetAppearance(Android.Support.V7.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker, ShellAppearance appearance) { base.SetAppearance(toolbar, toolbarTracker, appearance); toolbar.SetBackgroundColor(new Android.Graphics.Color(Context.AndroidContext.GetColor(Resource.Color.BackgroundGradientStart))); toolbar.Elevation = 0F; toolbar.TranslationZ = 0F; }
protected override void OnCreate(Bundle savedInstanceState) { try { ISharedPreferences sharedPreferencesDevisDetail = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorfacture = sharedPreferencesDevisDetail.Edit(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.FactDetail); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); Devisref = FindViewById <EditText>(Resource.Id.textInputEditTextreffac); Devisref.Enabled = true; DevisEntreptise = FindViewById <EditText>(Resource.Id.textInputEditTextNomENtrepriseDetailFacture); DevisEntreptise.Enabled = true; DatedeCreation = FindViewById <EditText>(Resource.Id.editTextCreationDate); dateechence = FindViewById <EditText>(Resource.Id.editTextpaiementDatefacture); Devisref.Text = sharedPreferencesDevisDetail.GetString("IDFacture", ""); DevisEntreptise.Text = sharedPreferencesDevisDetail.GetString("Entreprise", ""); DatedeCreation.Text = sharedPreferencesDevisDetail.GetString("DateFacturation", ""); dateechence.Text = sharedPreferencesDevisDetail.GetString("DateEcheance", ""); var btnvalider = FindViewById <Button>(Resource.Id.buttonvaliderDetail); btnvalider.Click += delegate { Intent intent = new Intent(this, typeof(Updatefacture)); editorfacture.PutString("IDFacture", Devisref.Text); editorfacture.PutString("Entreprise", DevisEntreptise.Text); editorfacture.PutString("DateFacturation", DatedeCreation.Text); editorfacture.PutString("DateEcheance", dateechence.Text); editorfacture.Apply(); StartActivity(intent); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
public override void OnViewAdded(Android.Views.View child) { base.OnViewAdded(child); if (child.GetType() == typeof(Android.Support.V7.Widget.Toolbar)) { _toolbar = (Android.Support.V7.Widget.Toolbar)child; _toolbar.SetBackgroundColor(global::Android.Graphics.Color.White); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Produits); //var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); //toolbar.SetTitleTextColor(Android.Graphics.Color.White); //toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(40, 195, 195)); //SetActionBar(toolbar); //ActionBar.Title = "Produit/Service"; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); var spiner = FindViewById <Spinner>(Resource.Id.spinnerchoix); var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Produit, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spiner.Adapter = adapter; spiner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); //def les contrelleur // var codebarre = FindViewById<EditText>(Resource.Id.editTextcodebarre); var produitNom = FindViewById <EditText>(Resource.Id.textInputEditTextnomproduit); var prix = FindViewById <EditText>(Resource.Id.editTextPrix); var btnenregitProduit = FindViewById <Button>(Resource.Id.buttonproduit); btnenregitProduit.Click += delegate { InsetionProduit(produitNom.Text, float.Parse(prix.Text), toast); Intent intent = new Intent(this, typeof(ListProduitsDevis)); StartActivity(intent); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { try { ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorDevis = sharedPreferences.Edit(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.UpdateInfobanque); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); SupportActionBar.Title = "Modifier Vos Info bancaire"; nombanque = FindViewById <EditText>(Resource.Id.textInputEditTextNombanqueupdate); Bic = FindViewById <EditText>(Resource.Id.textInputEditTextBICupdate); IBAN = FindViewById <EditText>(Resource.Id.textInputEditTextIBANupdate); buttonsuivantbanque = FindViewById <Button>(Resource.Id.buttonsuivantbbanqueupdate); ads1 = FindViewById <AdView>(Resource.Id.adView1banqe); ads2 = FindViewById <AdView>(Resource.Id.adView2banqe); ads3 = FindViewById <AdView>(Resource.Id.adView3baque); var adRequest1 = new AdRequest.Builder().Build(); ads1.LoadAd(adRequest1); var adRequest2 = new AdRequest.Builder().Build(); ads2.LoadAd(adRequest2); var adRequest3 = new AdRequest.Builder().Build(); ads3.LoadAd(adRequest3); nombanque.Text = sharedPreferences.GetString("NomBanque", ""); Bic.Text = sharedPreferences.GetString("Bic", ""); IBAN.Text = sharedPreferences.GetString("Iban", ""); sharedPreferences.GetInt("ID", 0); buttonsuivantbanque.Click += delegate { UpdateInfobanque(sharedPreferences.GetInt("ID", 0), Bic.Text, IBAN.Text, nombanque.Text); Intent intent = new Intent(this, typeof(Itemsapp)); intent.PutExtra("Emailadmin", Intent.GetStringExtra("Emailadmin")); StartActivity(intent); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } // Create your application here }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Com.R0adkll.Slidr.Slidr.Attach(this); SetContentView(Resource.Layout.swipe_back_activity); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); _btnChangeColor = FindViewById <Button>(Resource.Id.btn_change_color); SetSupportActionBar(_toolbar); SupportActionBar?.SetDisplayHomeAsUpEnabled(true); _toolbar.SetBackgroundColor(new Color(_color)); _btnChangeColor.Click += (s, e) => { var random = new Random(); _color = (int)(0xff000000 | random.Next(0xffffff)); _toolbar.SetBackgroundColor(new Color(_color)); Jaeger.StatusBarUtil.SetColorForSwipeBack(this, _color, 38); }; }
protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e) { base.OnElementChanged(e); var memberInfo = typeof(CustomNavigationBarRenderer).BaseType; if (memberInfo != null) { var field = memberInfo.GetField(nameof(_toolbar), BindingFlags.Instance | BindingFlags.NonPublic); _toolbar = field.GetValue(this) as AToolbar; _toolbar.SetBackgroundColor(Color.Transparent.ToAndroid()); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.CartCheckOut); cartCheckOutButton = (Button)FindViewById(Resource.Id.cartCheckOutButton); cartCheckOutButton.Click += CartCheckOutButton_Click; toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolBarCart); toolbar.Click += Toolbar_Click; toolbar.SetNavigationIcon(Android.Resource.Drawable.IcMenuRevert); toolbar.SetBackgroundColor(Android.Graphics.Color.LightBlue); }
public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); shakeSwitch.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) { AppController.SetHandShakingSetting(e.IsChecked); Toast.MakeText(Application.Context, "Hand Shaking option is " + (e.IsChecked ? " Trun ON" : " Trun OFF"), ToastLength.Short).Show(); }; rdgTheme.CheckedChange += delegate { /** * get radio button's value */ String radioButton = viewFragmentLayout.FindViewById <RadioButton>(rdgTheme.CheckedRadioButtonId).Text; switch (radioButton) { case AppController.BLUE_THEME: // AppController.ThemeSetting(AppController.BLUE_THEME); // toolbar.SetBackgroundColor(Color.Blue); ThemeUtill.changeToTheme(mActivity, ThemeUtill.BLUE); break; case AppController.RED_THEME: AppController.ThemeSetting(AppController.RED_THEME); toolbar.SetBackgroundColor(Color.Red); break; case "Default Theme": AppController.ThemeSetting("Blue"); toolbar.SetBackgroundColor(new Color(21, 96, 243)); break; } }; }
private void Toolbar_ChildViewAdded(object sender, ChildViewAddedEventArgs e) { if (e.Child.GetType() == typeof(Android.Widget.TextView)) { var textView = (Android.Widget.TextView)e.Child; textView.Gravity = GravityFlags.Center; //toolbar.SetBackgroundColor(Color.White.ToAndroid()); toolbar.ChildViewAdded -= Toolbar_ChildViewAdded; } toolbar.SetForegroundGravity(GravityFlags.Center); toolbar.SetBackgroundColor(Color.Black.ToAndroid()); toolbar.SetForegroundGravity(GravityFlags.Center); toolbar.Background.SetAlpha(122); }
protected override void OnCreate(Bundle savedInstanceState) { ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorDevis = sharedPreferences.Edit(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.UpdateDevise); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); SupportActionBar.Title = "Modifier Devise"; var TextDevisactuel = FindViewById <TextView>(Resource.Id.textViewUpdateDevisactuel); TextDevisactuel.Text = Devise(sharedPreferences.GetString("Emailad", " ")); var spinnerDeviseupdate = FindViewById <Spinner>(Resource.Id.spinnerUpdateDevise); var btnvalider = FindViewById <Button>(Resource.Id.buttonUpdateDevise); btnvalider.Click += delegate { UpdateDevise(Email(sharedPreferences.GetString("Emailad", " ")), toast); Intent intent = new Intent(this, typeof(Itemsapp)); intent.PutExtra("Emailadmin", Intent.GetStringExtra("Emailadmin")); StartActivity(intent); }; var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Devise, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerDeviseupdate.Adapter = adapter; spinnerDeviseupdate.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); // Create your application here }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolBar); toolbar.SetTitle(Resource.String.app_name); toolbar.SetBackgroundColor(Android.Graphics.Color.LightBlue); toolbar.InflateMenu(Resource.Menu.optionMenu); toolbar.MenuItemClick += Toolbar_MenuItemClick; FragmentNavigate(new ItenFragment()); cartButton = (Button)FindViewById(Resource.Id.cartButton); cartButton.Click += CartButton_Click; }
protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e) { base.OnElementChanged(e); var memberInfo = typeof(CustomNavigationBarRenderer).BaseType; if (memberInfo != null) { var field = memberInfo.GetField(nameof(_toolbar), BindingFlags.Instance | BindingFlags.NonPublic); _toolbar = field.GetValue(this) as AToolbar; _toolbar.SetBackgroundColor(Color.Transparent.ToAndroid()); Activity context = Context as Activity; var window = context.Window; window.AddFlags(WindowManagerFlags.TranslucentStatus); context.Window.ClearFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } }
private async Task Update() { while (!stop) { await Task.Delay(400); result = pref.GetString("background", "White"); result2 = pref.GetString("textColor", "Black"); RunOnUiThread(() => { tV1.SetTextColor(Color.ParseColor(result2)); drawer.SetBackgroundColor(Color.ParseColor(result)); toolbar.SetBackgroundColor(Color.Black); navigationView.SetBackgroundColor(Color.ParseColor(result)); navigationView.ItemTextColor = ColorStateList.ValueOf(Color.ParseColor(result2)); }); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); slug = Intent.GetStringExtra("slug"); //slug = "22921645"; handler = new Handler(); postPresenter = new PostPresenter(this); SetContentView(Resource.Layout.post); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetBackgroundColor(Color.Transparent); toolbar.SetTitleTextColor(Color.White); toolbar.SetNavigationIcon(Resource.Drawable.ic_arrow_back_white_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.main_content); collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar); appbar = FindViewById <AppBarLayout>(Resource.Id.appbar); appbar.AddOnOffsetChangedListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); scrollView.ViewTreeObserver.AddOnScrollChangedListener(this); toolbarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle); titleImage = FindViewById <ImageView>(Resource.Id.titleImage); imgAvatar = FindViewById <ImageView>(Resource.Id.llAvatar); org = FindViewById <ImageView>(Resource.Id.org); txtColumnName = FindViewById <TextView>(Resource.Id.txtColumnName); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtBio = FindViewById <TextView>(Resource.Id.txtBio); postContent = FindViewById <PostWebView>(Resource.Id.postContent); txtTime = FindViewById <TextView>(Resource.Id.txtTime); swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.MyHealth_BWDetails); toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#009688")); SetSupportActionBar (toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled (true); string getMHWPDate = Intent.GetStringExtra ("MHBWDate"); string getMHWPTime = Intent.GetStringExtra ("MHBWTime"); string getMHBWWeight = Intent.GetStringExtra ("MHBWWeight"); string getMHBWBMI = Intent.GetStringExtra ("MHBWBMI"); string getMHBWFat = Intent.GetStringExtra ("MHBWFat"); string getMHBWLeanWeight = Intent.GetStringExtra ("MHBWLeanWeight"); string getMHBWBoneMass = Intent.GetStringExtra ("MHBWBoneMass"); string getMHBWStatus = Intent.GetStringExtra ("MHBWStatus"); TextView tvMHBWDDate = (TextView)FindViewById (Resource.Id.tvMHBWDDate); TextView tvMHBWDTime = (TextView)FindViewById (Resource.Id.tvMHBWDTime); TextView tvMHBWDWeight = (TextView)FindViewById (Resource.Id.tvMHBWDWeight); TextView tvMHBWDBMI = (TextView)FindViewById (Resource.Id.tvMHBWDBMI); TextView tvMHBWDFat = (TextView)FindViewById (Resource.Id.tvMHBWDFat); TextView tvMHBWDLeanWeight = (TextView)FindViewById (Resource.Id.tvMHBWDLeanWeight); TextView tvMHBWDBoneMass = (TextView)FindViewById (Resource.Id.tvMHBWDBoneMass); TextView tvMHBWDStatus = (TextView)FindViewById (Resource.Id.tvMHBWDStatus); ImageView ivMHBWDStatIcon = (ImageView)FindViewById (Resource.Id.ivMHBWDStatIcon); tvMHBWDDate.Text = getMHWPDate; tvMHBWDTime.Text = getMHWPTime; tvMHBWDWeight.Text = getMHBWWeight; tvMHBWDBMI.Text = getMHBWBMI; tvMHBWDFat.Text = getMHBWFat; tvMHBWDLeanWeight.Text = getMHBWLeanWeight; tvMHBWDBoneMass.Text = getMHBWBoneMass; tvMHBWDStatus.Text = getMHBWStatus; setIcon (getMHBWStatus, tvMHBWDStatus, ivMHBWDStatIcon); }
void InitializeView() { var linearLayout = new LinearLayout(this); linearLayout.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); linearLayout.Orientation = Orientation.Vertical; _toolbar = new Toolbar(this); _toolbar.Title = "Weather"; _toolbar.SetTitleTextColor(Android.Graphics.Color.DodgerBlue); _toolbar.SetBackgroundColor(Android.Graphics.Color.WhiteSmoke); _toolbar.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); linearLayout.AddView(_toolbar); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayShowTitleEnabled(true); var frameLayout = new FrameLayout(this); frameLayout.LayoutParameters = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); frameLayout.Id = new Random().Next(int.MaxValue); linearLayout.AddView(frameLayout); _listPage = new WeatherListPage(); _listPageFragment = _listPage.CreateSupportFragment(this); var ft = SupportFragmentManager.BeginTransaction(); ft.AddToBackStack(null); ft.Replace(frameLayout.Id, _listPageFragment); ft.Commit(); SetContentView(linearLayout); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.MySoal_MesejDihantarDetails); tvMSMDDKepada = (TextView)FindViewById (Resource.Id.tvMSMDDKepada); tvMSMDDSubjek = (TextView)FindViewById (Resource.Id.tvMSMDDSubjek); tvMSMDDIsi = (TextView)FindViewById (Resource.Id.tvMSMDDIsi); tvMSMDDKepada.Text = Intent.GetStringExtra ("SITo"); tvMSMDDSubjek.Text = Intent.GetStringExtra ("SISubject"); tvMSMDDIsi.Text = Intent.GetStringExtra ("SIContent"); toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#F44336")); SetSupportActionBar (toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled (true); }
private void nativeListView_OnItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { uiListView.RaiseItemLongPressEvent(e.Position - 1); return; if (!IsSelectedMode()) { // Code to execute on item long click //uiListView.RaiseItemLongPressEvent(); uiListView.MarkItemAsSelected(e.Position - 1); mainToolbar = mainActivity.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); mainToolbar.SetBackgroundColor(Android.Graphics.Color.DarkGray); mainToolbar.InflateMenu(Resource.Menu.NotificationMenu); mainToolbar.SetNavigationOnClickListener(new OnNavigationClickToolbar(mainActivity)); mainToolbar.MenuItemClick += Toolbar_MenuItemClick; //mainToolbar.NavigationClick += MainToolbar_NavigationClick; mainToolbar.Title = $"{uiListView.ItemsSelectedCount()} seleccionado"; } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.lyoutpdf); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); ads1 = FindViewById <AdView>(Resource.Id.adView1Lyoutpdf); ads2 = FindViewById <AdView>(Resource.Id.adView2Lyoutpdf); var adRequest1 = new AdRequest.Builder().Build(); ads1.LoadAd(adRequest1); var adRequest2 = new AdRequest.Builder().Build(); ads2.LoadAd(adRequest2); // Back Home SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); SupportActionBar.Title = "PDF"; var pdf = FindViewById <PDFView>(Resource.Id.pDFView1); a = Intent.GetStringExtra("a"); Java.IO.File fileStream = new Java.IO.File(a); pdf.FromFile(a).Show(); } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
void InitializeView() { var linearLayout = new LinearLayout(this); linearLayout.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); linearLayout.Orientation = Orientation.Vertical; _toolbar = new Toolbar(this); _toolbar.Title = "Weather"; _toolbar.SetTitleTextColor(Android.Graphics.Color.DodgerBlue); _toolbar.SetBackgroundColor(Android.Graphics.Color.WhiteSmoke); _toolbar.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); linearLayout.AddView(_toolbar); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayShowTitleEnabled(true); _refreshLayout = new SwipeRefreshLayout(this); _refreshLayout.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); _listView = new ListView(this); _listView.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); _listView.ChoiceMode = ChoiceMode.Single; _refreshLayout.AddView(_listView); linearLayout.AddView(_refreshLayout); SetContentView(linearLayout); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ItemEditActivity); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarMain); if (null != toolbar) { toolbar.SetBackgroundColor(Color.Gray); toolbar.SetTitleTextColor(Color.White); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.item_edit_string); } database = FirebaseDatabase.Instance; rowDataRef = database.GetReferenceFromUrl(Intent.GetStringExtra("rowReference")); rowSchemaRef = database.GetReferenceFromUrl(Intent.GetStringExtra("tableSource")).Child("columns"); rowSchemaRef.AddChildEventListener(columnListener); colorRef = database.GetReferenceFromUrl(Intent.GetStringExtra("colorSource")); deleteButton = FindViewById <RelativeLayout>(Resource.Id.relativeLayoutDelete); editButton = FindViewById <RelativeLayout>(Resource.Id.relativeLayoutCustomize); editContentLayout = FindViewById <LinearLayout>(Resource.Id.linearLayoutEditContent); if (colorRef != null) { colorRef.AddValueEventListener(colorListener); } deleteButton.SetOnClickListener(this); editButton.SetOnClickListener(this); row = new RowModel(columns, rowDataRef); editContentLayout.AddView(row.GetEditView(this).GetView(), 0); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ColumnsEditActivity); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarMain); if (null != toolbar) { toolbar.SetBackgroundColor(Color.LightGray); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.columns_edit_string); toolbar.SetTitleTextColor(Color.White); } database = FirebaseDatabase.Instance; tableRef = database.GetReferenceFromUrl(Intent.GetStringExtra("tableSource")); columnsRef = tableRef.Child("columns"); columnsData = tableRef.Child("column_data"); colorRef = database.GetReferenceFromUrl(Intent.GetStringExtra("colorSource")); columnsEditView = FindViewById <LinearLayout>(Resource.Id.linearLayoutEditContent); addButtonView = FindViewById(Resource.Id.relativeLayoutActionButtons); addButtonView.SetOnClickListener(this); addButtonView = FindViewById(Resource.Id.imageViewAdd); addButtonView.SetOnClickListener(this); if (colorRef != null) { colorRef.AddValueEventListener(colorListener); } columnsData.Child("new_column_id").AddValueEventListener(columnIdListener); columnsRef.AddChildEventListener(columnsDataListener); }
//private bool ToolbarVisible; //private int ContainerPadding; protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e) { base.OnElementChanged(e); var memberInfo = typeof(CustomNavigationBarRenderer).BaseType; if (memberInfo != null) { //var propVisible = memberInfo.GetProperty(nameof(ToolbarVisible), BindingFlags.Instance | BindingFlags.NonPublic); //ToolbarVisible = (bool)propVisible.GetValue(this); //var propPadding = memberInfo.GetProperty(nameof(ContainerPadding), BindingFlags.Instance | BindingFlags.NonPublic); //ContainerPadding = (int)propPadding.GetValue(this); var field = memberInfo.GetField(nameof(_toolbar), BindingFlags.Instance | BindingFlags.NonPublic); _toolbar = field.GetValue(this) as AToolbar; _toolbar.SetBackgroundColor(Color.Transparent.ToAndroid()); Activity context = Context as Activity; //context.Window.AddFlags(WindowManagerFlags.Fullscreen); //context.Window.DecorView.SetFitsSystemWindows(true); var window = context.Window; //window.ClearFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); window.AddFlags(WindowManagerFlags.TranslucentStatus); //window.SetStatusBarColor(Android.Graphics.Color.Rgb(116, 181, 13)); //window.SetStatusBarColor(Color.Red.ToAndroid()); context.Window.ClearFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); //context.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LayoutStable | (StatusBarVisibility)SystemUiFlags.Fullscreen; } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource // SetContentView(Resource.Layout.Fact); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); SetSupportActionBar(toolbar); //var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); //toolbar.SetTitleTextColor(Android.Graphics.Color.GreenYellow); //toolbar.SetBackgroundColor(Android.Graphics.Color.White); //SetActionBar(toolbar); //ActionBar.Title = "Liste de Facture"; var butonAjouterFact = FindViewById <FloatingActionButton>(Resource.Id.AjouterFact); // var btnaPiece = FindViewById<Button>(Resource.Id.buttonPiece); //butonAjouterFact.Click += delegate //{ // Intent intent = new Intent(this, typeof(F)); // StartActivity(intent); //}; }catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { try { ISharedPreferences sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editorDevis = sharedPreferences.Edit(); IDD = selectionCountDevis() + 1; base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ListDevise); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "List Devis"; toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154)); toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71)); toolbar.Title = "Liste Devis"; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); Android.Support.V7.App.ActionBarDrawerToggle toggle = new Android.Support.V7.App.ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); var hederview = navigationView.GetHeaderView(0); var imagelogo = hederview.FindViewById <ImageView>(Resource.Id.imageViewnavheaderlogo); var EmailHeader = hederview.FindViewById <TextView>(Resource.Id.EmailHeder); var NomEntreprise = hederview.FindViewById <TextView>(Resource.Id.NomHeader); ads1 = FindViewById <AdView>(Resource.Id.adView1ListDevis); ads2 = FindViewById <AdView>(Resource.Id.adView2ListDevis); var adRequest1 = new AdRequest.Builder().Build(); ads1.LoadAd(adRequest1); var adRequest2 = new AdRequest.Builder().Build(); ads2.LoadAd(adRequest2); imagelogo.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeByteArray(selectionInfoEntreprise(sharedPreferences.GetString("Emailadmin", ""))[0].Logo, 0, selectionInfoEntreprise(sharedPreferences.GetString("Emailadmin", ""))[0].Logo.Length)); EmailHeader.Text = selectionInfoEntreprise(sharedPreferences.GetString("Emailadmin", ""))[0].Email; NomEntreprise.Text = "Bonjour " + selectionInfoEntreprise(sharedPreferences.GetString("Emailadmin", ""))[0].NomClinet; var Ajouter = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton); var listDevis = FindViewById <ListView>(Resource.Id.listViewVpsHebergement); // List<Facturation.Class.Devis> devis = new List<Class.Devis>() { new Class.Devis("Dev1", "CFAO", "En cours", DateTime.Parse("10-10-2020"), DateTime.Parse("10-11-2020"), 500) }; if (selectionCountDevis() == 0) { listDevis.Adapter = new HomeScreenAdapterDevis(this, selectionlistDevis1()); } else { listDevis.Adapter = new HomeScreenAdapterDevis(this, selectionlistDevis()); } listDevis.ItemClick += OnListItemClick; Ajouter.Click += delegate { editorDevis.PutInt("IDDevis", selectionCountDevis() + 1); editorDevis.PutString("Entreprise", "Moi"); editorDevis.PutString("Emailadmin", sharedPreferences.GetString("Emailadmin", "")); editorDevis.PutString("DateCreation", DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year); editorDevis.PutString("DateValidite", DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year); editorDevis.PutString("Article", " "); editorDevis.PutFloat("Qte", 0); editorDevis.PutFloat("Prix", 0); editorDevis.PutString("titre", "Choisier votre client "); editorDevis.PutFloat("Tauxremise", 0); editorDevis.PutString("ImagePath", " "); editorDevis.PutString("Observation", " "); editorDevis.PutString("Emailadmin", sharedPreferences.GetString("Emailadmin", "")); editorDevis.Apply(); byte[] t = null; Intent intent = new Intent(this, typeof(Deviss)); intent.PutExtra("ImagePath", t); intent.PutExtra("Emailadmin", Intent.GetStringExtra("Emailadmin")); StartActivity(intent); }; } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } }
void UpdateToolbar() { if (_disposed) { return; } Context context = Context; var activity = (FormsAppCompatActivity)context; AToolbar bar = _toolbar; ActionBarDrawerToggle toggle = _drawerToggle; if (bar == null) { return; } bool isNavigated = NavigationPageController.StackDepth > 1; bar.NavigationIcon = null; Page currentPage = Element.CurrentPage; if (isNavigated) { if (toggle != null) { toggle.DrawerIndicatorEnabled = false; toggle.SyncState(); } if (NavigationPage.GetHasBackButton(currentPage)) { var icon = new DrawerArrowDrawable(activity.SupportActionBar.ThemedContext); icon.Progress = 1; bar.NavigationIcon = icon; var prevPage = Element.Peek(1); _defaultNavigationContentDescription = bar.SetNavigationContentDescription(prevPage, _defaultNavigationContentDescription); } } else { if (toggle != null && _masterDetailPage != null) { toggle.DrawerIndicatorEnabled = _masterDetailPage.ShouldShowToolbarButton(); toggle.SyncState(); } } Color tintColor = Element.BarBackgroundColor; if (Forms.IsLollipopOrNewer) { if (tintColor.IsDefault) { bar.BackgroundTintMode = null; } else { bar.BackgroundTintMode = PorterDuff.Mode.Src; bar.BackgroundTintList = ColorStateList.ValueOf(tintColor.ToAndroid()); } } else { if (tintColor.IsDefault && _backgroundDrawable != null) { bar.SetBackground(_backgroundDrawable); } else if (!tintColor.IsDefault) { if (_backgroundDrawable == null) { _backgroundDrawable = bar.Background; } bar.SetBackgroundColor(tintColor.ToAndroid()); } } Color textColor = Element.BarTextColor; if (!textColor.IsDefault) { bar.SetTitleTextColor(textColor.ToAndroid().ToArgb()); } bar.Title = currentPage.Title ?? ""; UpdateTitleIcon(); UpdateTitleView(); }
protected async override void OnCreate (Bundle savedInstanceState){ base.OnCreate (savedInstanceState); var prefs = this.GetSharedPreferences ("RunningAssistant.preferences", FileCreationMode.Private); SetContentView (Resource.Layout.agregar_negocio); mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar); mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView); SetSupportActionBar (mToolbar); //ESTA ES LA FLECHA PARA ATRÁS SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back); SupportActionBar.SetDisplayHomeAsUpEnabled (true); //SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.Title = "Añadir Negocio"; mItems = new List<Categoria> (); fossbytes = new List<byte[]>(); deleteimgnegocio = FindViewById<Button> (Resource.Id.deleteimgnegocio); esperadatos = FindViewById<ProgressBar> (Resource.Id.esperadatos); FragmentMap = FindViewById<LinearLayout> (Resource.Id.fragmentmap); mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); map = mapFrag.Map; Point size = new Point (); Display display = WindowManager.DefaultDisplay; display.GetSize (size); mScreenHeight = size.Y; mToolbar.SetBackgroundColor (Color.Argb (255, 51, 150, 209)); string tag="ASIGNACION"; //Asignacion de variables try{ Log.Debug(tag, "asigna"); nombre = FindViewById<EditText> (Resource.Id.nombre); Log.Debug(tag, "asigna"); descripcion = FindViewById<EditText> (Resource.Id.descripcion); Log.Debug(tag, "asigna"); sitioweb = FindViewById<EditText> (Resource.Id.sitioweb); Log.Debug(tag, "asigna"); email = FindViewById<EditText> (Resource.Id.email); Log.Debug(tag, "asigna"); telefono = FindViewById<EditText> (Resource.Id.telefonoedit); Log.Debug(tag, "asigna"); pais = FindViewById<EditText> (Resource.Id.pais); Log.Debug(tag, "asigna"); ciudad = FindViewById<EditText> (Resource.Id.ciudad); Log.Debug(tag, "asigna"); colonia = FindViewById<EditText> (Resource.Id.colonia); Log.Debug(tag, "asigna"); calle = FindViewById<EditText> (Resource.Id.calle); Log.Debug(tag, "asigna"); numero = FindViewById<EditText> (Resource.Id.numero); Log.Debug(tag, "asigna"); codigopostal = FindViewById<EditText> (Resource.Id.codigopostal); Log.Debug(tag, "asigna"); referencias = FindViewById<EditText> (Resource.Id.referencias); Log.Debug(tag, "asigna"); facebook = FindViewById<EditText> (Resource.Id.facebook); Log.Debug(tag, "asignaeste"); twitter = FindViewById<EditText> (Resource.Id.twitter); Log.Debug(tag, "asignaultimo"); whatsapp = FindViewById<EditText> (Resource.Id.whatsapp); Log.Debug(tag, "asignaultimoultimo"); tagsnegocio = FindViewById<EditText> (Resource.Id.tagsnegocio); Log.Debug(tag, "pasó"); //<!-- Dias de la semana --> Log.Debug(tag, "asigna"); lunes_a = FindViewById<TextView> (Resource.Id.lunes_a); Log.Debug(tag, "asigna"); lunes_c = FindViewById<TextView> (Resource.Id.lunes_c); Log.Debug(tag, "asigna"); martes_a = FindViewById<TextView> (Resource.Id.martes_a); Log.Debug(tag, "asigna"); martes_c = FindViewById<TextView> (Resource.Id.martes_c); Log.Debug(tag, "asigna"); miercoles_a = FindViewById<TextView> (Resource.Id.miercoles_a); Log.Debug(tag, "asigna"); miercoles_c = FindViewById<TextView> (Resource.Id.miercoles_c); Log.Debug(tag, "asigna"); jueves_a = FindViewById<TextView> (Resource.Id.jueves_a); Log.Debug(tag, "asigna"); jueves_c = FindViewById<TextView> (Resource.Id.jueves_c); Log.Debug(tag, "asigna"); viernes_a = FindViewById<TextView> (Resource.Id.viernes_a); Log.Debug(tag, "asigna"); viernes_c = FindViewById<TextView> (Resource.Id.viernes_c); Log.Debug(tag, "asigna"); sabado_a = FindViewById<TextView> (Resource.Id.sabado_a); Log.Debug(tag, "asigna"); sabado_c = FindViewById<TextView> (Resource.Id.sabado_c); Log.Debug(tag, "asigna"); domingo_a = FindViewById<TextView> (Resource.Id.domingo_a); Log.Debug(tag, "asigna"); domingo_c = FindViewById<TextView> (Resource.Id.domingo_c); Log.Debug(tag, "asigna"); //<!-- Radio Groups --> Log.Debug(tag, "asigna"); region = FindViewById<RadioGroup> (Resource.Id.region); Log.Debug(tag, "asigna"); reservaciones = FindViewById<RadioGroup> (Resource.Id.reservaciones); Log.Debug(tag, "asigna"); entregaadomicilio = FindViewById<RadioGroup> (Resource.Id.entregaadomicilio); Log.Debug(tag, "asigna"); parallevar = FindViewById<RadioGroup> (Resource.Id.parallevar); Log.Debug(tag, "asigna"); aceptatarjeta = FindViewById<RadioGroup> (Resource.Id.aceptatarjeta); Log.Debug(tag, "asigna"); ambientefamiliar = FindViewById<RadioGroup> (Resource.Id.ambientefamiliar); Log.Debug(tag, "asigna"); estacionamiento = FindViewById<RadioGroup> (Resource.Id.estacionamiento); Log.Debug(tag, "asigna"); nivelruido = FindViewById<RadioGroup> (Resource.Id.nivelruido); Log.Debug(tag, "asigna"); alcohol = FindViewById<RadioGroup> (Resource.Id.alcohol); Log.Debug(tag, "asigna"); tienetv = FindViewById<RadioGroup> (Resource.Id.tienetv); Log.Debug(tag, "asigna"); tienemeseros = FindViewById<RadioGroup> (Resource.Id.tienemeserios); Log.Debug(tag, "asigna"); enviarnegocio = FindViewById<Button> (Resource.Id.enviarnegociop); imhere=FindViewById<Button> (Resource.Id.imhere); }catch(Exception ex){ Log.Debug (tag, "f**k: "+ex); } //Se llena el Spinner de las categorías try{ categorias_array = await plifserver.FetchWeatherAsync("http://plif.mx/mobile/get_cats_neg"); objeto = categorias_array["respuesta"]; Log.Debug("AgregarNegocio", "Antes del Foreach"); foreach(JsonObject data in objeto){ Log.Debug("AgregarNegocio", "Entra Foreach: "+data["categorias"]["id"]+" "+data["categorias"]["nombre"]); mItems.Add(new Categoria(){ Id = data["categorias"]["id"], Nombre = data["categorias"]["nombre"] }); Log.Debug("AgregarNegocio", "Sale de Foreach"); } }catch(Exception ex){ Toast.MakeText (Application.Context, "Ocurrió un error al recuperar las categorías", ToastLength.Long).Show (); Log.Debug ("Foreach","ERRORRRR!!! "+ex.ToString()); } //Se asignan las categorias al spinnes Spinner categ = FindViewById<Spinner> (Resource.Id.categorias); MyNegociosAdapter adapter_c = new MyNegociosAdapter (Application.Context, mItems); categ.Adapter = adapter_c; //Se crea el event handler para las categorías try{ categ.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (c_spinner_ItemSelected); }catch(Exception ex){ Log.Debug ("Handler","Lel, error: "+ex.ToString()); } //ya aqui hacemos todo el desmadre enviarnegocio = FindViewById<Button> (Resource.Id.enviarnegociop); if (enviarnegocio == null) { Log.Debug (tag, "es nulo D:"); } hour = DateTime.Now.Hour; minute = DateTime.Now.Minute; //AQUI PARA PONER LAS HORAS!!!!! //INICIA LUNES lunes_a.InputType = Android.Text.InputTypes.Null; lunes_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat lunes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.lunes_ac); lunes_ac.Click += (object sender, EventArgs e) => { if(lunes_ac.Checked==true){ lunes_a.Text=""; lunes_a.Enabled=true; lunes_c.Text=""; lunes_c.Enabled=true; }else{ lunes_a.Text="Cerrado"; lunes_a.Enabled=false; lunes_c.Text="Cerrado"; lunes_c.Enabled=false; } }; lunes_ac.PerformClick (); lunes_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó lunes a"); currenthour=lunes_a; ShowDialog(TIME_DIALOG_ID); }; lunes_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó lunes c"); currenthour=lunes_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA LUNES //INICIA martes martes_a.InputType = Android.Text.InputTypes.Null; martes_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat martes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.martes_ac); martes_ac.Click += (object sender, EventArgs e) => { if(martes_ac.Checked==true){ martes_a.Text=""; martes_a.Enabled=true; martes_c.Text=""; martes_c.Enabled=true; }else{ martes_a.Text="Cerrado"; martes_a.Enabled=false; martes_c.Text="Cerrado"; martes_c.Enabled=false; } }; martes_ac.PerformClick (); martes_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó martes a"); currenthour=martes_a; ShowDialog(TIME_DIALOG_ID); }; martes_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó martes c"); currenthour=martes_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA martes //INICIA miercoles miercoles_a.InputType = Android.Text.InputTypes.Null; miercoles_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat miercoles_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.miercoles_ac); miercoles_ac.Click += (object sender, EventArgs e) => { if(miercoles_ac.Checked==true){ miercoles_a.Text=""; miercoles_a.Enabled=true; miercoles_c.Text=""; miercoles_c.Enabled=true; }else{ miercoles_a.Text="Cerrado"; miercoles_a.Enabled=false; miercoles_c.Text="Cerrado"; miercoles_c.Enabled=false; } }; miercoles_ac.PerformClick (); miercoles_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó miercoles a"); currenthour=miercoles_a; ShowDialog(TIME_DIALOG_ID); }; miercoles_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó miercoles c"); currenthour=miercoles_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA miercoles //INICIA jueves jueves_a.InputType = Android.Text.InputTypes.Null; jueves_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat jueves_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.jueves_ac); jueves_ac.Click += (object sender, EventArgs e) => { if(jueves_ac.Checked==true){ jueves_a.Text=""; jueves_a.Enabled=true; jueves_c.Text=""; jueves_c.Enabled=true; }else{ jueves_a.Text="Cerrado"; jueves_a.Enabled=false; jueves_c.Text="Cerrado"; jueves_c.Enabled=false; } }; jueves_ac.PerformClick (); jueves_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó jueves a"); currenthour=jueves_a; ShowDialog(TIME_DIALOG_ID); }; jueves_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó jueves c"); currenthour=jueves_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA jueves //INICIA viernes viernes_a.InputType = Android.Text.InputTypes.Null; viernes_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat viernes_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.viernes_ac); viernes_ac.Click += (object sender, EventArgs e) => { if(viernes_ac.Checked==true){ viernes_a.Text=""; viernes_a.Enabled=true; viernes_c.Text=""; viernes_c.Enabled=true; }else{ viernes_a.Text="Cerrado"; viernes_a.Enabled=false; viernes_c.Text="Cerrado"; viernes_c.Enabled=false; } }; viernes_ac.PerformClick (); viernes_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó viernes a"); currenthour=viernes_a; ShowDialog(TIME_DIALOG_ID); }; viernes_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó viernes c"); currenthour=viernes_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA viernes //INICIA sabado sabado_a.InputType = Android.Text.InputTypes.Null; sabado_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat sabado_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.sabado_ac); sabado_ac.Click += (object sender, EventArgs e) => { if(sabado_ac.Checked==true){ sabado_a.Text=""; sabado_a.Enabled=true; sabado_c.Text=""; sabado_c.Enabled=true; }else{ sabado_a.Text="Cerrado"; sabado_a.Enabled=false; sabado_c.Text="Cerrado"; sabado_c.Enabled=false; } }; sabado_ac.PerformClick (); sabado_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó sabado a"); currenthour=sabado_a; ShowDialog(TIME_DIALOG_ID); }; sabado_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó sabado c"); currenthour=sabado_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA sabado //INICIA domingo domingo_a.InputType = Android.Text.InputTypes.Null; domingo_c.InputType = Android.Text.InputTypes.Null; Android.Support.V7.Widget.SwitchCompat domingo_ac = FindViewById<Android.Support.V7.Widget.SwitchCompat> (Resource.Id.domingo_ac); domingo_ac.Click += (object sender, EventArgs e) => { if(domingo_ac.Checked==true){ domingo_a.Text=""; domingo_a.Enabled=true; domingo_c.Text=""; domingo_c.Enabled=true; }else{ domingo_a.Text="Cerrado"; domingo_a.Enabled=false; domingo_c.Text="Cerrado"; domingo_c.Enabled=false; } }; domingo_ac.PerformClick (); domingo_a.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó domingo a"); currenthour=domingo_a; ShowDialog(TIME_DIALOG_ID); }; domingo_c.Click += (object sender, EventArgs e) => { Log.Debug(tag,"Clickeó domingo c"); currenthour=domingo_c; ShowDialog(TIME_DIALOG_ID); }; //TERMINA domingo //TERMINA LO DE PARA PONER LAS HORAS imhere.Click += async (object sender, EventArgs e) => { Log.Debug(tag, "I am here!!"); if(lat =="" && lng ==""){ //aun no hay geo Log.Debug(tag,"Aun no hay geo"); Toast.MakeText (Application.Context, "Aún estamos localizando tu ubicación. Inténtalo en un momento!", ToastLength.Long).Show (); }else{ geo_lat=lat; geo_long=lng; Geocoder geocoder = new Geocoder(Application.Context, Java.Util.Locale.Default); IList<Address> lista; lista = await geocoder.GetFromLocationAsync(Convert.ToDouble(lat), Convert.ToDouble(lng), 10); Address address = lista.FirstOrDefault(); if(address!=null){ StringBuilder deviceAddress = new StringBuilder(); //Obtener calle y número string[] lines = Regex.Split(address.GetAddressLine(0), " "); string calle=""; string colonia=address.GetAddressLine(1); for(int j=0; j<=lines.Length-2; j++ ){ calle=calle+lines[j]+" "; } string numero=lines[lines.Length-1]; string codigopostal=""; string[] cpciudad=Regex.Split(address.GetAddressLine(2), " "); codigopostal=cpciudad[0]; string preciudad=""; for(int k=1; k<=cpciudad.Length-1; k++){ preciudad=preciudad+cpciudad[k]; } string[] getciudad=Regex.Split(preciudad, ","); string ciudad=getciudad[0]; string paiss="Mexico"; // Toast.MakeText (Application.Context, "La calle es: "+calle, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.calle).Text=calle; // Toast.MakeText (Application.Context, "El número es: "+numero, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.numero).Text=numero; // Toast.MakeText (Application.Context, "La Colonia es: "+colonia, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.colonia).Text=colonia; // Toast.MakeText (Application.Context, "El Codigo Postal es: "+codigopostal, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.codigopostal).Text=codigopostal; // Toast.MakeText (Application.Context, "La ciudad es: "+ciudad, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.codigopostal).Text=codigopostal; // Toast.MakeText (Application.Context, "El País es: "+paiss, ToastLength.Long).Show (); FindViewById<EditText> (Resource.Id.pais).Text=paiss; } } }; Button replicar = FindViewById<Button> (Resource.Id.replicar); LinearLayout horarioscontainer = FindViewById<LinearLayout> (Resource.Id.horarioscontainer); TextView horariostext = FindViewById<TextView> (Resource.Id.horariostext); horariostext.Click += delegate { if(showinghorarios){ horarioscontainer.Visibility=ViewStates.Gone; showinghorarios=false; }else{ horarioscontainer.Visibility=ViewStates.Visible; showinghorarios=true; } }; replicar.Click += delegate { string lunesa = lunes_a.Text; string lunesc = lunes_c.Text; martes_a.Text=lunesa; martes_c.Text=lunesc; miercoles_a.Text=lunesa; miercoles_c.Text=lunesc; jueves_a.Text=lunesa; jueves_c.Text=lunesc; viernes_a.Text=lunesa; viernes_c.Text=lunesc; sabado_a.Text=lunesa; sabado_c.Text=lunesc; domingo_a.Text=lunesa; domingo_c.Text=lunesc; }; Log.Debug (tag,"Aquí iniciamos a poner los botones de las imagenes"); GridLayout imgnegocioprev = FindViewById<GridLayout> (Resource.Id.imgnegocioprev); TextView masimagenesnegocio = FindViewById<TextView> (Resource.Id.masimagenesnegocio); //INICIAN BOTONES DE IMAGENES imagennegocio=FindViewById<Button> (Resource.Id.imagennegocio); imagennegocio.Click += async (object sender, EventArgs e) => { source=1; ProcesarImagenes(imgnegocioprev, 3, masimagenesnegocio); }; Log.Debug (tag,"pasamos el de imagen negocio"); imagencamaranegocio = FindViewById<Button> (Resource.Id.imagencamaranegocio); imagencamaranegocio.Click += async (object sender, EventArgs e) => { source=2; ProcesarImagenes(imgnegocioprev, 3, masimagenesnegocio); }; //TERMINAN BOTONES DE IMAGENES Log.Debug (tag,"pasamos el de imagen camara negocio"); deleteimgnegocio.Click += async (sender, e) => { //LinearLayout imgcomprev = FindViewById<LinearLayout> (Resource.Id.imgcomprev); //LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); Log.Debug("DELETEBUTTON","Inician las layouts"); if(imgnegocioprev.ChildCount>0){ imgnegocioprev.RemoveAllViews(); } Log.Debug("DELETEBUTTON","vistas removidas"); if(imagencomentario!=null){ imagencomentario.Recycle(); imagencomentario=null; } Log.Debug("DELETEBUTTON","reciclado"); //deleteimgrev.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)"); //layoutdejaimagenes.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes"); fossbytes.Clear(); Log.Debug("DELETEBUTTON","El Arraylist de bytes se resetea"); imgcount=0; Log.Debug("DELETEBUTTON","se resetea el contador de cuantas imagenes se subieron"); masimagenesnegocio.Text="Carga 3 imágenes más!"; Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes"); }; enviarnegocio.Click += async (object sender, EventArgs e) => { Log.Debug("boton","hizoclick"); if(nombre.Text == "" || descripcion.Text == "" || sitioweb.Text == "" || email.Text == "" || telefono.Text == "" || pais.Text == "" || ciudad.Text == "" || colonia.Text == "" || calle.Text == "" || numero.Text == "" || codigopostal.Text == "" || referencias.Text == "" || facebook.Text == "" || twitter.Text == "" || whatsapp.Text=="" || tagsnegocio.Text==""){ Toast.MakeText (Application.Context, "Te faltan algunos campos de llenar, por favor revísalos!", ToastLength.Long).Show (); }else{ //Información completa. //http://plif.mx/AgregarNegociop?droid //Aqui nos quedamos. Hay que añadir también enviando=true; enviarnegocio.Visibility=ViewStates.Gone; ProgressBar enviandonegocio= FindViewById<ProgressBar> (Resource.Id.enviandonegocio); enviandonegocio.Visibility=ViewStates.Visible; Dictionary<string, string> diccionario = new Dictionary<string, string>(); diccionario.Add("nombre_completo", prefs.GetString("nombre", null)); diccionario.Add("email_user", prefs.GetString("email", null)); diccionario.Add("id_user", prefs.GetString("id",null)); diccionario.Add("nombre",nombre.Text); diccionario.Add("desc",descripcion.Text); int selectedregion = region.CheckedRadioButtonId; RadioButton nameregion = FindViewById<RadioButton> (selectedregion); string nameregiontext=nameregion.Text; switch(nameregiontext){ case "Durango": //Toast.MakeText (Application.Context, "Region Durango", ToastLength.Long).Show (); diccionario.Add("estado","9"); break; case "Torreón": //Toast.MakeText (Application.Context, "Region Torreon", ToastLength.Long).Show (); diccionario.Add("estado","3"); break; case "Mazatlán": //Toast.MakeText (Application.Context, "Region Mazatlan", ToastLength.Long).Show (); diccionario.Add("estado","2"); break; case "Zacatecas": //Toast.MakeText (Application.Context, "Region Zacatecas", ToastLength.Long).Show (); diccionario.Add("estado","4"); break; default: //Toast.MakeText (Application.Context, "None of the above", ToastLength.Long).Show (); diccionario.Add("estado","0"); break; }//switch región diccionario.Add("categoria",cat_id); diccionario.Add("ubicacion",ciudad.Text); diccionario.Add("email",email.Text); diccionario.Add("sitioweb",sitioweb.Text); diccionario.Add("telefono",telefono.Text); diccionario.Add("facebook",facebook.Text); diccionario.Add("twitter",twitter.Text); diccionario.Add("google",""); //No hay campo para google+ diccionario.Add("pais",pais.Text); //diccionario.Add("ciudad","Durango"); //Todos van a ser Durango ahorita diccionario.Add("ciudad",ciudad.Text); diccionario.Add("geo_long",geo_long); diccionario.Add("geo_lat",geo_lat); diccionario.Add("cp",codigopostal.Text); diccionario.Add("colonia",codigopostal.Text); diccionario.Add("calle",calle.Text); diccionario.Add("numero",numero.Text); diccionario.Add("tags",tagsnegocio.Text); diccionario.Add("sub_categoria","0"); //aun no hay campo de subcategoría diccionario.Add("referencias",referencias.Text); //AÑADIMOS AL DICCIONARIO LOS HORARIOS: diccionario.Add("lunes_de",lunes_a.Text); diccionario.Add("lunes_a",lunes_c.Text); diccionario.Add("martes_de",martes_a.Text); diccionario.Add("martes_a",martes_c.Text); diccionario.Add("miercoles_de",miercoles_a.Text); diccionario.Add("miercoles_a",miercoles_c.Text); diccionario.Add("jueves_de",jueves_a.Text); diccionario.Add("jueves_a",jueves_c.Text); diccionario.Add("viernes_de",viernes_a.Text); diccionario.Add("viernes_a",viernes_c.Text); diccionario.Add("sabado_de",sabado_a.Text); diccionario.Add("sabado_a",sabado_c.Text); diccionario.Add("domingo_de",domingo_a.Text); diccionario.Add("domingo_a",domingo_c.Text); //AÑADIMOS AL DICCIONARIO LA INFORMACION ADICIONAL //acepta reservaciones diccionario.Add("reservation",FindViewById<RadioButton> (reservaciones.CheckedRadioButtonId).Text); //entrega a domicilio diccionario.Add("delivery",FindViewById<RadioButton> (entregaadomicilio.CheckedRadioButtonId).Text); //para llevar diccionario.Add("take-out",FindViewById<RadioButton> (parallevar.CheckedRadioButtonId).Text); //acepta tarjeta diccionario.Add("credit",FindViewById<RadioButton> (aceptatarjeta.CheckedRadioButtonId).Text); //familiar diccionario.Add("kids",FindViewById<RadioButton> (ambientefamiliar.CheckedRadioButtonId).Text); //estacionamiento diccionario.Add("parking",FindViewById<RadioButton> (estacionamiento.CheckedRadioButtonId).Text); //ruido diccionario.Add("noise",FindViewById<RadioButton> (nivelruido.CheckedRadioButtonId).Text); //alcohol diccionario.Add("alcohol",FindViewById<RadioButton> (alcohol.CheckedRadioButtonId).Text); //tiene tv diccionario.Add("tv",FindViewById<RadioButton> (tienetv.CheckedRadioButtonId).Text); //tiene meseros diccionario.Add("meseros",FindViewById<RadioButton> (tienemeseros.CheckedRadioButtonId).Text); //tiene wifi diccionario.Add("wi-fi","No"); //aun no hay campo de wifi //LIIISTO!!! LOS MANDAMOS POR POST CON EL MULTIPART string resp = await plifserver.PostMultiPartForm ("http://plif.mx/AgregarNegociop?droid", fossbytes, "nada", "file[]", "image/jpeg", diccionario, false); Log.Debug(tag,"Termina RESP!!!"); //Log.Debug(tag,"La respuesta es: "+resp); Toast.MakeText (Application.Context, "Tu negocio ha sido enviado con éxito y en breve será revisado. ¡Gracias por formar parte de Plif!", ToastLength.Long).Show (); Finish(); } }; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.registro_plif); mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar); mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView); SetSupportActionBar (mToolbar); //ESTA ES LA FLECHA PARA ATRÁS SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back); SupportActionBar.SetDisplayHomeAsUpEnabled (true); //SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.Title = "Formar parte de Plif"; mToolbar.SetBackgroundColor (Color.Argb (255, 51, 150, 209)); //INICIA LO QUE COPIE DEL FRAGMENT font = Typeface.CreateFromAsset(Application.Context.Assets, "Fonts/fa.ttf"); TextView subefoto = FindViewById<TextView> (Resource.Id.subefoto); TextView subeimagen = FindViewById<TextView> (Resource.Id.subeimagen); subefoto.SetTypeface(font, TypefaceStyle.Normal); subeimagen.SetTypeface (font, TypefaceStyle.Normal); fotocontainer = FindViewById<LinearLayout> (Resource.Id.fotocontainer); subefoto.Click += (object sender, EventArgs e) => { source=1; fossbytes=null; fossbytes = new List<byte[]>(); GetImage((async (b, p) => { string tag="ImagenGalería"; Log.Debug(tag,"Inicia GETIMAGE"); Java.IO.File f = new Java.IO.File(p[0]); stream = Application.Context.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f)); Bitmap temp =BitmapFactory.DecodeStream(stream); fotoperfil = FindViewById<ImageView> (Resource.Id.fotoperfil); fotoperfil.SetImageBitmap(temp); fotocontainer.Visibility=ViewStates.Visible; if(temp!=null){ Log.Debug("FOSSBYTES","Inicia conversión a bytes!"); byte[] tmp2 = pliffunctions.PathToByte2(p[0]); Log.Debug("FOSSBYTES","Termina conversión a bytes!"); fossbytes.Add(tmp2); } })); }; subeimagen.Click += (object sender, EventArgs e) => { source=2; fossbytes=null; fossbytes = new List<byte[]>(); GetImage((async (b, p) => { string tag = "FOTOREGISTRO"; Log.Debug(tag,"Inicia GETIMAGE"); Java.IO.File f = new Java.IO.File(p[0]); stream = Application.Context.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f)); Bitmap temp =BitmapFactory.DecodeStream(stream); fotoperfil = FindViewById<ImageView> (Resource.Id.fotoperfil); fotoperfil.SetImageBitmap(temp); fotocontainer.Visibility=ViewStates.Visible; if(temp!=null){ Log.Debug("FOSSBYTES","Inicia conversión a bytes!"); byte[] tmp2 = pliffunctions.PathToByte2(p[0]); Log.Debug("FOSSBYTES","Termina conversión a bytes!"); fossbytes.Add(tmp2); } })); }; registrarse = FindViewById<Button> (Resource.Id.registrar); TextView nombre = FindViewById<TextView> (Resource.Id.nombre); TextView apellidos = FindViewById<TextView> (Resource.Id.apellidos); TextView email = FindViewById<TextView> (Resource.Id.email); TextView pass1 = FindViewById<TextView> (Resource.Id.pass1); TextView pass2 = FindViewById<TextView> (Resource.Id.pass2); registrarse.Click += async (object sender, EventArgs e) => { nombre.Text="Gabino"; apellidos.Text="Rutiaga"; email.Text="*****@*****.**"; pass1.Text="hola"; pass2.Text="hola"; if(nombre.Text==""){ Toast.MakeText (Application.Context, "Por favor introduce tu nombre", ToastLength.Long).Show (); }else if(apellidos.Text==""){ Toast.MakeText (Application.Context, "Por favor introduce tus apellidos", ToastLength.Long).Show (); }else if(email.Text==""){ Toast.MakeText (Application.Context, "Por favor introduce tu correo electrónico", ToastLength.Long).Show (); }else if(pass1.Text==""){ Toast.MakeText (Application.Context, "Por favor introduce una contraseña", ToastLength.Long).Show (); }else if(pass1.Text!=pass2.Text){ Toast.MakeText (Application.Context, "Tus contraseñas no coinciden. por favor verifícalas", ToastLength.Long).Show (); }else if(fossbytes==null){ Toast.MakeText (Application.Context, "Sube una foto de perfil!", ToastLength.Long).Show (); }else{ ProgressBar esperaregistro = FindViewById<ProgressBar> (Resource.Id.esperaregistro); esperaregistro.Visibility=ViewStates.Visible; registrarse.Visibility=ViewStates.Gone; Log.Debug("FOSSBYTES","CANTIDAD DE ARCHIVOS EN EL FOSSBYTES ARRAY: "+fossbytes.Count()); datos = new Dictionary<string,string>(); datos.Add("nombre",nombre.Text); datos.Add("apellidos",apellidos.Text); datos.Add("email",email.Text); datos.Add("psw",pass1.Text); try{ Log.Debug("Try","Inicia envío de datos desde REGISTRO"); string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/registNewUser?droid", fossbytes, "nada", "file[]", "image/jpeg", datos, true); Log.Debug("RegistroPlif","Respuesta del servidor: "+resp); JsonValue respuesta = JsonValue.Parse(resp); string registroexitoso=respuesta["registro"]; if(registroexitoso=="true"){ Toast.MakeText (Application.Context, "Por favor activa tu cuenta con el email que te enviamos a "+email.Text, ToastLength.Long).Show (); Finish(); }else{ Toast.MakeText (Application.Context, "Parece que ya te encuentras registrado pero no has confirmado aún tu cuenta", ToastLength.Long).Show (); esperaregistro.Visibility=ViewStates.Gone; registrarse.Visibility=ViewStates.Visible; } }catch(Exception ex){ Log.Debug("ErrorRegistro","ocurrió un errorzote: "+ex); Toast.MakeText (Application.Context, "Ooops! Parece que nuestros sistemas están saturados en este momento. ¿Por que no lo intentas de nuevo en un momento?", ToastLength.Long).Show (); esperaregistro.Visibility=ViewStates.Gone; registrarse.Visibility=ViewStates.Visible; } } }; }