public virtual Com.Zhy.Adapter.Recyclerview.Base.ViewHolder SetMax(int viewId, int max) { Android.Widget.ProgressBar view = GetView <ProgressBar>(viewId); view.Max = (max); return(this); }
public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetProgress(int viewId, int progress) { Android.Widget.ProgressBar view = GetView <ProgressBar>(viewId); view.Progress = (progress); return(this); }
private void CreateProgressWindow() { Android.Widget.ProgressBar progress = new Android.Widget.ProgressBar(Android.App.Application.Context); window = new PopupWindow(progress, 60, 60); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); toolbar.SetTitle(Resource.String.titulo_toolbar); SetSupportActionBar(toolbar); listaReciclavelProdutos = FindViewById <RecyclerView>(Resource.Id.listaReciclavelProdutos); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.progressBar); botaoConfirmarPedido = FindViewById <Button>(Resource.Id.bt_confirmar_pedido); ll_confirmar_pedido = FindViewById <LinearLayout>(Resource.Id.ll_confirmar_pedido); ic_confirmar_pedido = FindViewById <ScrollView>(Resource.Id.ic_confirmar_pedido); ll_recebe_produtos = FindViewById <LinearLayout>(Resource.Id.ll_recebe_produtos); tv_quantidade_itens_selecionados = FindViewById <TextView>(Resource.Id.tv_quantidade_itens_selecionados); tv_valor_total_itens_selecionados = FindViewById <TextView>(Resource.Id.tv_valor_total_itens_selecionados); ll_resumo_itens_selecionados = FindViewById <LinearLayout>(Resource.Id.ll_resumo_itens_selecionados); inflater = (LayoutInflater)this.GetSystemService(Context.LayoutInflaterService); consumirDadosListarPromocoes(); botaoConfirmarPedido.Click += delegate { acaoBotaoConformeTela(); }; }
private void CreateProgressWindow() { Android.Widget.ProgressBar progress = new Android.Widget.ProgressBar(Xamarin.Forms.Forms.Context); window = new PopupWindow(progress, 60, 60); }
public void SetujOmiljenuMenzu(int indexOmiljene) { listaMenzi.RefreshLista(); MenzaItem item = listaMenzi.Lista[indexOmiljene]; view.FindViewById <TextView>(Resource.Id.ImeMojeMenze).Text = item.MenzaFull.Naziv; view.FindViewById <TextView>(Resource.Id.LokacijaMojeMenze).Text = item.MenzaFull.Lokacija; var radili = view.FindViewById <TextView>(Resource.Id.DaLiRadiMojaMenza); if (item.MenzaFull.VanrednoNeRadi) { radili.Text = "Vanredno NE RADI!"; radili.SetTextColor(Android.Graphics.Color.ParseColor("#ba1d1d")); } else { view.FindViewById <TextView>(Resource.Id.DaLiRadiMojaMenza).Text = "Trenutno ne radi!"; } view.FindViewById <TextView>(Resource.Id.GuzvaMojeMenzeText).Text = "Guzva u menzi: " + item.GuzvaFull.TrenutnaGuzvaZaJelo.ToString() + "%";; view.FindViewById <TextView>(Resource.Id.GuzvaNaSalteruMojeMenzeText).Text = "Guzva na salteru: " + item.GuzvaFull.TrenutnaGuzvaZaUplatu.ToString() + "%"; Android.Widget.ProgressBar bar = view.FindViewById <Android.Widget.ProgressBar>(Resource.Id.ProfilMojaMenzaBar); bar.Max = 100; bar.Progress = item.GuzvaFull.TrenutnaGuzvaZaJelo; bar = view.FindViewById <Android.Widget.ProgressBar>(Resource.Id.GuzvaNaSalteruMojaMenzaBar); bar.Max = 100; bar.Progress = item.GuzvaFull.TrenutnaGuzvaZaUplatu; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } var stackLayout = (VideoLayout)this.Element; var mainActivity = Forms.Context as MainActivity; var publiserLayout = new Android.Widget.LinearLayout(mainActivity) { Orientation = Orientation.Vertical, LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200) }; var subscriberLayout = new Android.Widget.LinearLayout(mainActivity) { Orientation = Orientation.Vertical, LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200) }; var loadingProggressBar = new Android.Widget.ProgressBar(mainActivity); loadingProggressBar.Visibility = ViewStates.Gone; subscriberLayout.AddView(loadingProggressBar); stackLayout.Children.Add(publiserLayout); stackLayout.Children.Add(subscriberLayout); mainActivity.SetLayouts(publiserLayout, subscriberLayout, loadingProggressBar); }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.ActivityIndicator> e) { base.OnElementChanged(e); var progress = new Android.Widget.ProgressBar(this.Context, null, 0, GoingFabric.Droid.Resource.Style.Widget_UIFabric_CircularProgress_Large_Primary); SetNativeControl(progress); }
public NavigationRenderer(Context context) : base(context) { ProgressBar = new AProgressBar(Context, null, Android.Resource.Attribute.ProgressBarStyleHorizontal) { Indeterminate = true, Visibility = ViewStates.Invisible, IndeterminateTintList = ColorStateList.ValueOf(Color.White.ToAndroid()) }; }
protected override Android.Widget.ProgressBar CreateNativeControl() { var progressbar = new Android.Widget.ProgressBar(Context, null, global::Android.Resource.Attribute.ProgressBarStyleHorizontal) { Indeterminate = false, Max = 10000, //Background = ResourcesCompat.GetDrawable(Context.Resources, Resource.Drawable.progressGradient, null) ProgressDrawable = ResourcesCompat.GetDrawable(Context.Resources, Resource.Drawable.progressGradient, null) }; return(progressbar); }
public MaterialActivityIndicatorRenderer(Context context) : base(context) { VisualElement.VerifyVisualFlagEnabled(); _control = new AProgressBar(new ContextThemeWrapper(context, Resource.Style.XamarinFormsMaterialProgressBarCircular), null, Resource.Style.XamarinFormsMaterialProgressBarCircular); _control.Indeterminate = true; AddView(_control); _visualElementRenderer = new VisualElementRenderer(this); _motionEventHelper = new MotionEventHelper(); }
public void ShowOverlay(string message, Xamarin.Forms.Color backgroundColor, float backgroundOpacity) { var alpha = (int)(255 * backgroundOpacity); dialog = new Dialog(Ctx, Resource.Style.ThemeNoTitleBar); Drawable d = new ColorDrawable(backgroundColor.ToAndroid()); d.SetAlpha(alpha); dialog.Window.SetBackgroundDrawable(d); var layout = new LinearLayout(Ctx); layout.Orientation = Android.Widget.Orientation.Vertical; layout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); var header = new LinearLayout(Ctx); var headerParameter = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); headerParameter.Weight = 1; header.LayoutParameters = headerParameter; var prg = new Android.Widget.ProgressBar(Ctx); prg.Indeterminate = true; prg.IndeterminateDrawable.SetColorFilter(Android.Graphics.Color.White, PorterDuff.Mode.Multiply); var parameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); parameters.Gravity = Android.Views.GravityFlags.Center; parameters.SetMargins(0, 10, 0, 10); prg.LayoutParameters = parameters; var txtField = new TextView(Ctx); txtField.Text = message; txtField.TextSize = 12;// 22; txtField.SetTextColor(Android.Graphics.Color.White); txtField.LayoutParameters = parameters; var footer = new LinearLayout(Ctx); var footerParameter = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); footerParameter.Weight = 1; footer.LayoutParameters = footerParameter; layout.AddView(header); layout.AddView(prg); layout.AddView(txtField); layout.AddView(footer); dialog.SetContentView(layout); dialog.Show(); }
/// <summary> /// Displays an activity indicator that cannot be dismissed by the user /// </summary> public void ShowActivityIndicator() { if (indicator == null) { Android.Widget.ProgressBar pbar = new Android.Widget.ProgressBar(MainActivity.Context); pbar.IndeterminateDrawable.SetColorFilter(new Android.Graphics.Color(ContextCompat.GetColor(MainActivity.Context, Resource.Color.primary)), PorterDuff.Mode.SrcAtop); //Sets the color indicator = new Dialog(MainActivity.Context, Resource.Style.MyTheme_TransparentDialog); //Transperent theme indicator.RequestWindowFeature((int)WindowFeatures.NoTitle); //Removes the title indicator.SetContentView(pbar); indicator.Window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent)); //Removes the background indicator.Window.ClearFlags(WindowManagerFlags.DimBehind); //Removes the dim behind the dialog indicator.SetCancelable(false); //Such that it can not be cancled by clicking outside the indicator indicator.Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; //スプラッシュ画面の設定 base.Window.RequestFeature(WindowFeatures.ActionBar); base.SetTheme(Resource.Style.MainTheme); base.OnCreate(savedInstanceState); base.SetTheme(Resource.Style.MainTheme); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init(); // プログレスバー(ダウンロード、アップロード時) // 呼び出し方 // 表示 => MessagingCenter.Send(App, "dialog_progress",true); // 非表示 => MessagingCenter.Send(App, "dialog_progress", false); AlertDialog alertDialog = null; MessagingCenter.Subscribe <LinkPage, bool>(this, "dialog_progress", (page, isVisible) => { if (alertDialog != null) { alertDialog.Dismiss(); alertDialog = null; } if (isVisible) { var progress = new Android.Widget.ProgressBar(this); progress.SetPadding(0, 30, 0, 30); alertDialog = new AlertDialog.Builder(this) .SetTitle("データ連携中です。") .SetView(progress) .SetCancelable(false) .Show(); } }); LoadApplication(new App()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.KeyGen); text = FindViewById <TextView>(Resource.Id.textView1); progBar = FindViewById <ProgressBar>(Resource.Id.progBar); finishedGen = FindViewById <Button>(Resource.Id.button1); startGen = FindViewById <Button>(Resource.Id.button2); pm = new PadManager(GetExternalFilesDir(null).ToString()); keys = new System.Collections.Generic.List <string>(); SetProgressBarIndeterminate(false); progBar.Progress = 0; progBar.Max = 100; finishedGen.Enabled = false; startGen.Click += StartGen_Click; finishedGen.Click += StartNfc_Click; _nfcAdapter = NfcAdapter.GetDefaultAdapter(this); if (_nfcAdapter == null) { text.Text = "NFC not available"; } if (pm == null) { text.Text = "Pad manager is null"; } // Get the contact name passed in through the intent when ViewContactActivity launches this intent contactName = Intent.GetStringExtra("contactName"); // stored in key "contactName" Identity.LoadUsername(GetExternalFilesDir(null).ToString()); myName = Identity.Username; text.Text = contactName; }
public X5WebChromeClient(AuthorizeViewRenderer renderer, Android.Widget.ProgressBar progressBar) { this.renderer = renderer; this.progressBar = progressBar; }
protected override void OnCreate(Bundle bundle) { //EditText TextIp = FindViewById<EditText>(Resource.Id.TextIpConfigura); base.OnCreate(bundle); Fecharthread = "N"; if (Validacoes.Nrplataformas + 1 == 1) { SetContentView(Resource.Layout.Layout1plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; ZeraBalanca1 = "N"; } if (Validacoes.Nrplataformas + 1 == 2) { SetContentView(Resource.Layout.Layout2plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TxtPesoPlat2); TxtBat2 = FindViewById <TextView>(Resource.Id.BateriaPlat2); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); TxtAguarde2 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress2); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnZerarPlataforma2 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat2); BotaoZeraBalanca2Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar2 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress2); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; ZeraBalanca1 = "N"; ZeraBalanca2 = "N"; } if (Validacoes.Nrplataformas + 1 == 3) { SetContentView(Resource.Layout.Layout3plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TxtPesoPlat2); TxtBat2 = FindViewById <TextView>(Resource.Id.BateriaPlat2); TxtPeso3 = FindViewById <TextView>(Resource.Id.TxtPesoPlat3); TxtBat3 = FindViewById <TextView>(Resource.Id.BateriaPlat3); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); TxtAguarde2 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress2); TxtAguarde3 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress3); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnZerarPlataforma2 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat2); BotaoZeraBalanca2Ativo = true; BtnZerarPlataforma3 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat3); BotaoZeraBalanca3Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar2 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress2); progressBar3 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress3); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; ZeraBalanca1 = "N"; ZeraBalanca2 = "N"; ZeraBalanca3 = "N"; } if (Validacoes.Nrplataformas + 1 == 4) { SetContentView(Resource.Layout.Layout4plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TxtPesoPlat2); TxtBat2 = FindViewById <TextView>(Resource.Id.BateriaPlat2); TxtPeso3 = FindViewById <TextView>(Resource.Id.TxtPesoPlat3); TxtBat3 = FindViewById <TextView>(Resource.Id.BateriaPlat3); TxtPeso4 = FindViewById <TextView>(Resource.Id.TxtPesoPlat4); TxtBat4 = FindViewById <TextView>(Resource.Id.BateriaPlat4); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); TxtAguarde2 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress2); TxtAguarde3 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress3); TxtAguarde4 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress4); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnZerarPlataforma2 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat2); BotaoZeraBalanca2Ativo = true; BtnZerarPlataforma3 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat3); BotaoZeraBalanca3Ativo = true; BtnZerarPlataforma4 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat4); BotaoZeraBalanca4Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar2 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress2); progressBar3 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress3); progressBar4 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress4); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; ZeraBalanca1 = "N"; ZeraBalanca2 = "N"; ZeraBalanca3 = "N"; ZeraBalanca4 = "N"; } if (Validacoes.Nrplataformas + 1 == 5) { SetContentView(Resource.Layout.Layout5plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TxtPesoPlat2); TxtBat2 = FindViewById <TextView>(Resource.Id.BateriaPlat2); TxtPeso3 = FindViewById <TextView>(Resource.Id.TxtPesoPlat3); TxtBat3 = FindViewById <TextView>(Resource.Id.BateriaPlat3); TxtPeso4 = FindViewById <TextView>(Resource.Id.TxtPesoPlat4); TxtBat4 = FindViewById <TextView>(Resource.Id.BateriaPlat4); TxtPeso5 = FindViewById <TextView>(Resource.Id.TxtPesoPlat5); TxtBat5 = FindViewById <TextView>(Resource.Id.BateriaPlat5); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); TxtAguarde2 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress2); TxtAguarde3 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress3); TxtAguarde4 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress4); TxtAguarde5 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress5); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnCalibrarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnZerarPlataforma2 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat2); BotaoZeraBalanca2Ativo = true; BtnZerarPlataforma3 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat3); BotaoZeraBalanca3Ativo = true; BtnZerarPlataforma4 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat4); BotaoZeraBalanca4Ativo = true; BtnZerarPlataforma5 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat5); BotaoZeraBalanca5Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar2 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress2); progressBar3 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress3); progressBar4 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress4); progressBar5 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress5); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; } if (Validacoes.Nrplataformas + 1 == 6) { SetContentView(Resource.Layout.Layout6plataformas); TxtPeso = FindViewById <TextView>(Resource.Id.TxtPeso); TxtPeso1 = FindViewById <TextView>(Resource.Id.TxtPesoPlat1); TxtBat1 = FindViewById <TextView>(Resource.Id.BateriaPlat1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TxtPesoPlat2); TxtBat2 = FindViewById <TextView>(Resource.Id.BateriaPlat2); TxtPeso3 = FindViewById <TextView>(Resource.Id.TxtPesoPlat3); TxtBat3 = FindViewById <TextView>(Resource.Id.BateriaPlat3); TxtPeso4 = FindViewById <TextView>(Resource.Id.TxtPesoPlat4); TxtBat4 = FindViewById <TextView>(Resource.Id.BateriaPlat4); TxtPeso5 = FindViewById <TextView>(Resource.Id.TxtPesoPlat5); TxtBat5 = FindViewById <TextView>(Resource.Id.BateriaPlat5); TxtPeso6 = FindViewById <TextView>(Resource.Id.TxtPesoPlat6); TxtBat6 = FindViewById <TextView>(Resource.Id.BateriaPlat6); TxtAguarde1 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress1); TxtAguarde2 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress2); TxtAguarde3 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress3); TxtAguarde4 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress4); TxtAguarde5 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress5); TxtAguarde6 = FindViewById <TextView>(Resource.Id.TxtAguardeProgress6); BtnZerarPlataforma1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerarPlataforma1); BotaoZeraBalanca1Ativo = true; BtnZerarPlataforma2 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat2); BotaoZeraBalanca2Ativo = true; BtnZerarPlataforma3 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat3); BotaoZeraBalanca3Ativo = true; BtnZerarPlataforma4 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat4); BotaoZeraBalanca4Ativo = true; BtnZerarPlataforma5 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat5); BotaoZeraBalanca5Ativo = true; BtnZerarPlataforma6 = FindViewById <Android.Widget.Button>(Resource.Id.btnPlat6); BotaoZeraBalanca6Ativo = true; progressBar1 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress1); progressBar2 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress2); progressBar3 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress3); progressBar4 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress4); progressBar5 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress5); progressBar6 = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress6); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.note_list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; ZeraBalanca1 = "N"; ZeraBalanca2 = "N"; ZeraBalanca3 = "N"; ZeraBalanca4 = "N"; ZeraBalanca5 = "N"; ZeraBalanca6 = "N"; } //==========================================================// // CRIAR BANCO DE DADOS // //==========================================================// mdTemp = new BancoDados("PRINCIPAL"); mdTemp.CreateDatabases("PRINCIPAL"); //==========================================================// Android.Widget.ImageButton BtnSair = FindViewById <Android.Widget.ImageButton>(Resource.Id.BtnSairPlataforma); Android.Widget.ImageButton BtnSalvar = FindViewById <Android.Widget.ImageButton>(Resource.Id.BtnSalvarPlataforma); this.threadBalanca = new Thread(ProcessoBalanca); if (this.threadBalanca != null) { this.threadBalanca.Start(); Validacoes.EstadoThread = "START"; } Validacoes.EstadoThread = "START"; Window.SetSoftInputMode(SoftInput.StateHidden); BtnSair.Click += delegate { BtnSair.Enabled = false; Fecharthread = "S"; threadBalanca.Interrupt(); Finish(); this.Dispose(); }; if (Validacoes.Nrplataformas + 1 >= 1) { BtnZerarPlataforma1.Click += delegate { if (BotaoZeraBalanca1Ativo == true) { progressBar1.Visibility = Android.Views.ViewStates.Visible; TxtAguarde1.Visibility = Android.Views.ViewStates.Visible; TxtAguarde1.SetTextColor(Android.Graphics.Color.Blue); TxtPeso1.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca1Ativo = false; ZeraBalanca1 = "S"; } }; } if (Validacoes.Nrplataformas + 1 >= 2) { BtnZerarPlataforma2.Click += delegate { if (BotaoZeraBalanca2Ativo == true) { progressBar2.Visibility = Android.Views.ViewStates.Visible; TxtAguarde2.Visibility = Android.Views.ViewStates.Visible; TxtAguarde2.SetTextColor(Android.Graphics.Color.Blue); TxtPeso2.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca2Ativo = false; ZeraBalanca2 = "S"; } }; } if (Validacoes.Nrplataformas + 1 >= 3) { BtnZerarPlataforma3.Click += delegate { if (BotaoZeraBalanca3Ativo == true) { progressBar3.Visibility = Android.Views.ViewStates.Visible; TxtAguarde3.Visibility = Android.Views.ViewStates.Visible; TxtAguarde3.SetTextColor(Android.Graphics.Color.Blue); TxtPeso3.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca3Ativo = false; ZeraBalanca3 = "S"; } }; } if (Validacoes.Nrplataformas + 1 >= 4) { BtnZerarPlataforma4.Click += delegate { if (BotaoZeraBalanca4Ativo == true) { progressBar4.Visibility = Android.Views.ViewStates.Visible; TxtAguarde4.Visibility = Android.Views.ViewStates.Visible; TxtAguarde4.SetTextColor(Android.Graphics.Color.Blue); TxtPeso4.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca4Ativo = false; ZeraBalanca4 = "S"; } }; } if (Validacoes.Nrplataformas + 1 >= 5) { BtnZerarPlataforma5.Click += delegate { if (BotaoZeraBalanca5Ativo == true) { progressBar5.Visibility = Android.Views.ViewStates.Visible; TxtAguarde5.Visibility = Android.Views.ViewStates.Visible; TxtAguarde5.SetTextColor(Android.Graphics.Color.Blue); TxtPeso5.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca5Ativo = false; ZeraBalanca5 = "S"; } }; } if (Validacoes.Nrplataformas + 1 >= 6) { BtnZerarPlataforma6.Click += delegate { if (BotaoZeraBalanca6Ativo == true) { progressBar6.Visibility = Android.Views.ViewStates.Visible; TxtAguarde6.Visibility = Android.Views.ViewStates.Visible; TxtAguarde6.SetTextColor(Android.Graphics.Color.Blue); TxtPeso6.Visibility = Android.Views.ViewStates.Invisible; BotaoZeraBalanca6Ativo = false; ZeraBalanca6 = "S"; } }; } }
public LoadingOverlay(Context context, bool withoutSpinner = false, PriceGrabber.CustomControls.Orientation orientation = PriceGrabber.CustomControls.Orientation.Portrait) : base(context) { Color mainColor = Color.LightBlue; try { mainColor = ((Xamarin.Forms.Color)Xamarin.Forms.Application.Current.Resources["LightBlue"]).ToAndroid(); } catch { } this.Alpha = 0.75f; this.SetBackgroundColor(mainColor); var contentHeight = (int)StaticDeviceInfo.Height; var contentWidth = (int)StaticDeviceInfo.Width; if (orientation == PriceGrabber.CustomControls.Orientation.Landscape) { contentHeight = contentHeight + contentWidth; contentWidth = contentHeight - contentWidth; contentHeight = contentHeight - contentWidth; } // SetMinimumWidth(contentWidth); //SetMinimumHeight(contentHeight); this.LayoutParameters = new ViewGroup.LayoutParams(-1, -1); LayoutParams lp; image = new ImageView(this.Context); // image.SetImageResource(Resource.Drawable.insigniaStar); image.SetMinimumHeight(contentHeight / 2); image.SetMinimumWidth(contentWidth / 2); lp = new LayoutParams(contentHeight / 2, contentWidth / 2); lp.AddRule(LayoutRules.CenterInParent); AddView(image, lp); spinner = new ProgressBar(this.Context); if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { spinner.SetForegroundGravity(GravityFlags.CenterVertical | GravityFlags.CenterHorizontal); } spinner.SetMinimumWidth(100); spinner.SetPadding(0, 0, 0, 50); spinner.IndeterminateDrawable.SetColorFilter(Color.White, PorterDuff.Mode.SrcIn); lp = new LayoutParams(100, 150); lp.AddRule(LayoutRules.CenterInParent); /*ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams( * ViewGroup.LayoutParams.MatchParent, * ViewGroup.LayoutParams.MatchParent);*/ if (!withoutSpinner && spinner.Parent == null) { AddView(spinner, lp); } label = new TextView(this.Context); // { Text = HPHData.LocalizableText("Loading data") }; label.Gravity = GravityFlags.Center; label.SetPadding(0, 100, 0, 0); label.SetTextColor(Color.White); label.SetText("Loading data", TextView.BufferType.Normal); try { var tf = Typeface.CreateFromAsset(MainActivity.Instance.Assets, "HPSimplified_Lt.ttf"); label.SetTypeface(tf, TypefaceStyle.Normal); } catch { } lp = new LayoutParams(300, 150); lp.AddRule(LayoutRules.CenterInParent); if (!withoutSpinner && label.Parent == null) { AddView(label, lp); } }
public static void getTiles(Android.Widget.ScrollView parent) { parent.RemoveAllViewsInLayout(); if (UserTiles != null) { UserTiles.Clear(); } UserTiles = new List <LinearLayout>(); int pixelDensity = (int)Android.Content.Res.Resources.System.DisplayMetrics.Density; ContextThemeWrapper mainContext = new ContextThemeWrapper(parent.Context, Resource.Style.MainLinearForUserTiles); LinearLayout MainLinear = new LinearLayout(mainContext); MainLinear.Orientation = Orientation.Vertical; parent.AddView(MainLinear); LinearLayout currentRow = null; int i = 0; foreach (User user in Controller._users) { if (i % 2 == 0) { ContextThemeWrapper rowContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileRowLayoutStyle); currentRow = new LinearLayout(rowContext); currentRow.Orientation = Orientation.Horizontal; } ContextThemeWrapper userTileContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileLayoutStyle); LinearLayout currentUser = new LinearLayout(userTileContext); currentUser.Orientation = Orientation.Vertical; currentUser.Id = i; ContextThemeWrapper userNameContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserNameCenteredText); TextView userName = new TextView(userNameContext); userName.Text = user.Name.FirstName; ContextThemeWrapper relativeLayoutStyle = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBorderStyle); FrameLayout currentUserBar = new FrameLayout(relativeLayoutStyle); ContextThemeWrapper PgBarFillContext = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBarFillStyle); Android.Widget.ProgressBar currentUserBarMask = new Android.Widget.ProgressBar(PgBarFillContext, null, Resource.Style.ProgressBarFillStyle); try { double progress = (1 - ((double)user.Used / user.Allocated)) * 100; currentUserBarMask.Progress = (int)(progress); } catch (DivideByZeroException) { double progress = (1 - ((double)user.Used / Controller._totalRemainder)) * 100; currentUserBarMask.Progress = (int)(progress); } currentUserBar.AddView(currentUserBarMask); currentUser.AddView(userName); currentUser.AddView(currentUserBar); UserTiles.Add(currentUser); currentRow.AddView(currentUser); MainLinear.RemoveView(currentRow); MainLinear.AddView(currentRow); i++; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LayoutCadastroPesagem); SetResult(Result.Canceled); //==========================================================// // CRIAR BANCO DE DADOS // //==========================================================// mdTemp = new BancoDados("PRINCIPAL"); mdTemp.CreateDatabases("PRINCIPAL"); //==========================================================// var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "CADASTRO DE PESAGEM"; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); spinnercliente = FindViewById <Spinner>(Resource.Id.SpinnerCliente); spinnerveiculo = FindViewById <Spinner>(Resource.Id.SpinnerVeiculo); spinnerproduto = FindViewById <Spinner>(Resource.Id.SpinnerProduto); Android.Support.V7.Widget.AppCompatImageButton BtnSair = FindViewById <Android.Support.V7.Widget.AppCompatImageButton>(Resource.Id.BtnSairPesagem); Android.Support.V7.Widget.AppCompatImageButton BtnSalvar = FindViewById <Android.Support.V7.Widget.AppCompatImageButton>(Resource.Id.BtnSalvarPesagem); TxtPeso = FindViewById <TextView>(Resource.Id.Txtpeso); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.list_progress); progressBar.Visibility = Android.Views.ViewStates.Visible; TxtProgress = FindViewById <TextView>(Resource.Id.TxtAguardeProgress); TxtProgress.Visibility = Android.Views.ViewStates.Visible; Fecharthread = "N"; var NomesClientes = CarregaCliente(); if (NomesClientes != null) { selecaocliente = new string[NomesClientes.Count]; for (int i = 0; NomesClientes.Count > i; i++) { selecaocliente[i] = NomesClientes[i].ToString(); } adapterccliente = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, selecaocliente); spinnercliente.Adapter = adapterccliente; } var NomesVeiculos = CarregaVeiculos(); if (NomesVeiculos != null) { selecaoveiculos = new string[NomesVeiculos.Count]; for (int i = 0; NomesVeiculos.Count > i; i++) { selecaoveiculos[i] = NomesVeiculos[i].ToString(); } adapterveiculo = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, selecaoveiculos); spinnerveiculo.Adapter = adapterveiculo; } var NomesProdutos = CarregaProdutos(); if (NomesProdutos != null) { selecaoprodutos = new string[NomesProdutos.Count]; for (int i = 0; NomesProdutos.Count > i; i++) { selecaoprodutos[i] = NomesProdutos[i].ToString(); } adapterproduto = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, selecaoprodutos); spinnerproduto.Adapter = adapterproduto; } //=================================================================================// spinnercliente.ItemSelected += (s, e) => { firstItemcliente = spinnercliente.SelectedItem.ToString(); if (firstItemcliente.Equals(spinnercliente.SelectedItem.ToString())) { } else { Toast.MakeText(this, "You have selected: " + e.Parent.GetItemIdAtPosition(e.Position).ToString(), ToastLength.Short).Show(); } }; spinnerveiculo.ItemSelected += (s, e) => { firstItemveiculo = spinnerveiculo.SelectedItem.ToString(); if (firstItemveiculo.Equals(spinnerveiculo.SelectedItem.ToString())) { } else { Toast.MakeText(this, "You have selected: " + e.Parent.GetItemIdAtPosition(e.Position).ToString(), ToastLength.Short).Show(); } }; spinnerproduto.ItemSelected += (s, e) => { firstItemproduto = spinnerproduto.SelectedItem.ToString(); if (firstItemproduto.Equals(spinnerproduto.SelectedItem.ToString())) { } else { Toast.MakeText(this, "You have selected: " + e.Parent.GetItemIdAtPosition(e.Position).ToString(), ToastLength.Short).Show(); } }; //=================================================================================// this.threadBalancaPesagem = new Thread(ProcessoBalancaPesagem); if (this.threadBalancaPesagem != null) { this.threadBalancaPesagem.Start(); Validacoes.EstadoThread = "START"; } CarregaListaPesagem(); //========================// // SAIR // //========================// BtnSair.Click += delegate { Fecharthread = "S"; threadBalancaPesagem.Interrupt(); Finish(); this.Dispose(); }; //========================// // SALVAR // //========================// BtnSalvar.Click += delegate { //==================================// // Valida Peso Estavel // //==================================// if (TxtPeso.CurrentTextColor == (Android.Graphics.Color.Red)) { Toast.MakeText(this, "PESO NÃO ESTÁ ESTAVEL!", ToastLength.Long).Show(); return; } //=========================// // Capturando Dados // //=========================// // Veiculos // //=========================// String[] veiculos = firstItemveiculo.Split("-"); int id_veiculo = int.Parse(veiculos[0]); string placa_veiculo = veiculos[1] + "-" + veiculos[2]; //=========================// // Clientes // //=========================// string[] clientes = firstItemcliente.Split("-"); int id_cliente = int.Parse(clientes[0]); string nome_cliente = clientes[1].ToString(); //=========================// // Produtos // //=========================// string[] produtos = firstItemproduto.Split("-"); int id_produto = int.Parse(produtos[0]); string nome_produto = produtos[1].ToString(); string Data = System.DateTime.Now.ToShortDateString(); string Hora = System.DateTime.Now.ToShortTimeString(); string Valores = id_veiculo + ",'" + placa_veiculo + "'," + id_cliente + ",'" + nome_cliente + "'," + id_produto + ",'" + nome_produto + "'," + Validacoes.Peso1 + "," + Validacoes.Peso2 + "," + Validacoes.Peso3 + "," + Validacoes.Peso4 + "," + Validacoes.Peso5 + "," + Validacoes.Peso6 + "," + int.Parse(TxtPeso.Text) + ",'" + Data + "','" + Hora + "'"; string Campos = "ID_VEICULO," + "VEICULO," + "ID_CLIENTE," + "CLIENTE," + "ID_PRODUTO," + "PRODUTO," + "PESO_PLAT1," + "PESO_PLAT2," + "PESO_PLAT3," + "PESO_PLAT4," + "PESO_PLAT5," + "PESO_PLAT6," + "PESO_TOTAL," + "DATA_CADASTRO," + "HORA_CADASTRO"; string sSQLQuery = "INSERT INTO " + "PESAGEM_REALIZADA " + "(" + Campos + ") " + "VALUES(" + Valores + ");"; sqldTemp.ExecSQL(sSQLQuery); Toast.MakeText(this, "REGISTRO GRAVADO COM SUCESSO", ToastLength.Long).Show(); CarregaListaPesagem(); }; }
public CustomWebChromeClient(Action <IValueCallback, Java.Lang.String, Java.Lang.String> callback, Android.Widget.ProgressBar progressBar) { this.callback = callback; this.progressBar = progressBar; }
//==================================================================// protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LayoutCalibracao); //=======================================================// // Referenciando Objetos // //=======================================================// TxtPeso1 = FindViewById <TextView>(Resource.Id.TextPeso1); TxtPeso2 = FindViewById <TextView>(Resource.Id.TextPeso2); TxtPeso3 = FindViewById <TextView>(Resource.Id.TextPeso3); TxtPeso4 = FindViewById <TextView>(Resource.Id.TextPeso4); TxtPeso5 = FindViewById <TextView>(Resource.Id.TextPeso5); TxtPeso6 = FindViewById <TextView>(Resource.Id.TextPeso6); TxtPeso7 = FindViewById <TextView>(Resource.Id.TxtPesoTotalCalibracao); // TxtNeg1 = FindViewById<TextView>(Resource.Id.TxtNeg1); //==============================================================================// TxtPesoCal1 = FindViewById <EditText>(Resource.Id.TextPesoCal1); TxtPesoCal2 = FindViewById <EditText>(Resource.Id.TextPesoCal2); TxtPesoCal3 = FindViewById <EditText>(Resource.Id.TextPesoCal3); TxtPesoCal4 = FindViewById <EditText>(Resource.Id.TextPesoCal4); TxtPesoCal5 = FindViewById <EditText>(Resource.Id.TextPesoCal5); TxtPesoCal6 = FindViewById <EditText>(Resource.Id.TextPesoCal6); BtnZerar1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar1); BtnZerar2 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar2); BtnZerar3 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar3); BtnZerar4 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar4); BtnZerar5 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar5); BtnZerar6 = FindViewById <Android.Widget.Button>(Resource.Id.BtnZerar6); BtnCalibrar1 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar1); BtnCalibrar2 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar2); BtnCalibrar3 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar3); BtnCalibrar4 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar4); BtnCalibrar5 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar5); BtnCalibrar6 = FindViewById <Android.Widget.Button>(Resource.Id.BtnCalibrar6); //==================================================================================// FrameLayout1 = FindViewById <FrameLayout>(Resource.Id.frameLayout1); FrameLayout11 = FindViewById <FrameLayout>(Resource.Id.frameLayout11); FrameLayout2 = FindViewById <FrameLayout>(Resource.Id.frameLayout2); FrameLayout21 = FindViewById <FrameLayout>(Resource.Id.frameLayout21); FrameLayout3 = FindViewById <FrameLayout>(Resource.Id.frameLayout3); FrameLayout31 = FindViewById <FrameLayout>(Resource.Id.frameLayout31); FrameLayout4 = FindViewById <FrameLayout>(Resource.Id.frameLayout4); FrameLayout41 = FindViewById <FrameLayout>(Resource.Id.frameLayout41); FrameLayout5 = FindViewById <FrameLayout>(Resource.Id.frameLayout5); FrameLayout51 = FindViewById <FrameLayout>(Resource.Id.frameLayout51); FrameLayout6 = FindViewById <FrameLayout>(Resource.Id.frameLayout6); FrameLayout61 = FindViewById <FrameLayout>(Resource.Id.frameLayout61); //==================================================================================// progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.list_progressCal); TxtProgress = FindViewById <Android.Widget.TextView>(Resource.Id.TxtAguardeProgressCal); //==================================================================================// BtnSair = FindViewById <Android.Widget.ImageButton>(Resource.Id.BtnSairComunicacao); TxtPeso7.Text = "0"; ProcessoBalanca(); Thread.Sleep(1000); //=================================================================================// this.threadBalanca1 = new System.Threading.Thread(AtualizaBalancas); if (this.threadBalanca1 != null) { this.threadBalanca1.Start(); Validacoes.EstadoThread = "START"; } BtnCalibrar1.Visibility = ViewStates.Invisible; BtnCalibrar2.Visibility = ViewStates.Invisible; BtnCalibrar3.Visibility = ViewStates.Invisible; BtnCalibrar4.Visibility = ViewStates.Invisible; BtnCalibrar5.Visibility = ViewStates.Invisible; BtnCalibrar6.Visibility = ViewStates.Invisible; TxtPesoCal1.Visibility = ViewStates.Invisible; TxtPesoCal2.Visibility = ViewStates.Invisible; TxtPesoCal3.Visibility = ViewStates.Invisible; TxtPesoCal4.Visibility = ViewStates.Invisible; TxtPesoCal5.Visibility = ViewStates.Invisible; TxtPesoCal6.Visibility = ViewStates.Invisible; int nrPlataformas = Validacoes.Nrplataformas + 1; if (nrPlataformas == 1) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; } FrameLayout2.Visibility = ViewStates.Invisible; FrameLayout21.Visibility = ViewStates.Invisible; FrameLayout3.Visibility = ViewStates.Invisible; FrameLayout31.Visibility = ViewStates.Invisible; FrameLayout4.Visibility = ViewStates.Invisible; FrameLayout41.Visibility = ViewStates.Invisible; FrameLayout5.Visibility = ViewStates.Invisible; FrameLayout51.Visibility = ViewStates.Invisible; FrameLayout6.Visibility = ViewStates.Invisible; FrameLayout61.Visibility = ViewStates.Invisible; } //=================================================================================// if (nrPlataformas == 2) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; BtnCalibrar2.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; TxtPesoCal2.Visibility = ViewStates.Visible; } FrameLayout3.Visibility = ViewStates.Invisible; FrameLayout31.Visibility = ViewStates.Invisible; FrameLayout4.Visibility = ViewStates.Invisible; FrameLayout41.Visibility = ViewStates.Invisible; FrameLayout5.Visibility = ViewStates.Invisible; FrameLayout51.Visibility = ViewStates.Invisible; FrameLayout6.Visibility = ViewStates.Invisible; FrameLayout61.Visibility = ViewStates.Invisible; } //=================================================================================// if (nrPlataformas == 3) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; BtnCalibrar2.Visibility = ViewStates.Visible; BtnCalibrar3.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; TxtPesoCal2.Visibility = ViewStates.Visible; TxtPesoCal3.Visibility = ViewStates.Visible; } FrameLayout4.Visibility = ViewStates.Invisible; FrameLayout41.Visibility = ViewStates.Invisible; FrameLayout5.Visibility = ViewStates.Invisible; FrameLayout51.Visibility = ViewStates.Invisible; FrameLayout6.Visibility = ViewStates.Invisible; FrameLayout61.Visibility = ViewStates.Invisible; } //=================================================================================// if (nrPlataformas == 4) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; BtnCalibrar2.Visibility = ViewStates.Visible; BtnCalibrar3.Visibility = ViewStates.Visible; BtnCalibrar4.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; TxtPesoCal2.Visibility = ViewStates.Visible; TxtPesoCal3.Visibility = ViewStates.Visible; TxtPesoCal4.Visibility = ViewStates.Visible; } FrameLayout5.Visibility = ViewStates.Invisible; FrameLayout51.Visibility = ViewStates.Invisible; FrameLayout6.Visibility = ViewStates.Invisible; FrameLayout61.Visibility = ViewStates.Invisible; } //=================================================================================// if (nrPlataformas == 5) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; BtnCalibrar2.Visibility = ViewStates.Visible; BtnCalibrar3.Visibility = ViewStates.Visible; BtnCalibrar4.Visibility = ViewStates.Visible; BtnCalibrar5.Visibility = ViewStates.Visible; FrameLayout6.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; TxtPesoCal2.Visibility = ViewStates.Visible; TxtPesoCal3.Visibility = ViewStates.Visible; TxtPesoCal4.Visibility = ViewStates.Visible; TxtPesoCal5.Visibility = ViewStates.Visible; } FrameLayout61.Visibility = ViewStates.Invisible; } if (nrPlataformas == 6) { if (Validacoes.SenhaCalibracao == true) { BtnCalibrar1.Visibility = ViewStates.Visible; BtnCalibrar2.Visibility = ViewStates.Visible; BtnCalibrar3.Visibility = ViewStates.Visible; BtnCalibrar4.Visibility = ViewStates.Visible; BtnCalibrar5.Visibility = ViewStates.Visible; BtnCalibrar6.Visibility = ViewStates.Visible; TxtPesoCal1.Visibility = ViewStates.Visible; TxtPesoCal2.Visibility = ViewStates.Visible; TxtPesoCal3.Visibility = ViewStates.Visible; TxtPesoCal4.Visibility = ViewStates.Visible; TxtPesoCal5.Visibility = ViewStates.Visible; TxtPesoCal6.Visibility = ViewStates.Visible; } } this.threadEnviaPeso = new System.Threading.Thread(AtualizaPeso); if (this.threadEnviaPeso != null) { this.threadEnviaPeso.Start(); Validacoes.EstadoThread = "START"; } //=================================================================================// Window.SetSoftInputMode(SoftInput.StateHidden); BtnSair.Click += delegate { try { Validacoes.SenhaCalibracao = false; Finish(); } catch { threadEnviaPeso.Interrupt(); Thread.Sleep(2000); threadEnviaPeso.Abort(); Finish(); } }; BtnZerar1.Click += async delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma1(); MensagemToast("PLATAFORMA ZERADA"); }; BtnCalibrar1.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma1(); MensagemToast("PLATAFORMA CALIBRADA"); }; BtnZerar2.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma(0x32); MensagemToast("PLATAFORMA ZERADA"); }; BtnCalibrar2.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma(0x32, TxtPesoCal2.Text); MensagemToast("PLATAFORMA CALIBRADA"); }; BtnZerar3.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma(0x33); MensagemToast("PLATAFORMA ZERADA"); }; BtnZerar4.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma(0x34); MensagemToast("PLATAFORMA ZERADA"); }; BtnCalibrar3.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma(0x33, TxtPesoCal3.Text); MensagemToast("PLATAFORMA CALIBRADA"); }; BtnCalibrar4.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma(0x34, TxtPesoCal4.Text); MensagemToast("PLATAFORMA CALIBRADA"); }; BtnZerar5.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma(0x35); MensagemToast("PLATAFORMA ZERADA"); }; BtnCalibrar5.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma(0x35, TxtPesoCal5.Text); MensagemToast("PLATAFORMA CALIBRADA"); }; BtnZerar6.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); ZerarPlataforma(0x36); MensagemToast("PLATAFORMA ZERADA"); }; BtnCalibrar6.Click += delegate { Bloquearbotoes(); MensagemToast("AGUARDE"); CalibrarPlataforma(0x36, TxtPesoCal6.Text); MensagemToast("PLATAFORMA CALIBRADA"); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.cam_activity); if (ActionBar != null) { ActionBar.Hide(); } autoFitTextureView = FindViewById <AutoFitTextureView>(Resource.Id.CameraTexture); bttBack = FindViewById <ImageButton>(Resource.Id.bttBack); bttFlash = FindViewById <ImageButton>(Resource.Id.bttFlash); bttSwitch = FindViewById <ImageButton>(Resource.Id.bttSwitchCamera); bttCapture = FindViewById <ImageButton>(Resource.Id.bttCapture); progressBar = FindViewById <Android.Widget.ProgressBar>(Resource.Id.progressBar_cyclic); bttBack.Click += (object sender, EventArgs e) => { Finish(); }; bttFlash.Click += (object sender, EventArgs e) => { try { if (FlashSupported) { FlashOn = !FlashOn; if (FlashOn) { bttFlash.SetImageResource(Resource.Drawable.flash_on); captureRequestBuilder.Set(CaptureRequest.FlashMode, (int)FlashMode.Torch); } else { bttFlash.SetImageResource(Resource.Drawable.flash_off); captureRequestBuilder.Set(CaptureRequest.FlashMode, (int)FlashMode.Off); } UpdatePreview(); } else { ShowToastMessage("Your camera not support flash!"); } } catch (System.Exception error) { ShowToastMessage("Failed to switch flash on/off"); DebugMessage("ErrorMessage: \n" + error.Message + "\n" + "Stacktrace: \n " + error.StackTrace); } }; bttSwitch.Click += (object sender, EventArgs e) => { if (IsBusy) { return; } else { IsBusy = true; } SwitchCamera(); }; bttCapture.Click += (object sender, EventArgs e) => { if (IsBusy) { return; } else { IsBusy = true; } TakePhoto(); }; autoFitTextureView.SurfaceTextureListener = this; cameraStateListener = new CameraStateListener() { Camera = this }; ORIENTATIONS.Append((int)SurfaceOrientation.Rotation0, 90); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation90, 0); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation180, 270); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation270, 180); OpenCamera(false); }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); var view = inflater.Inflate (Resource.Layout.Main2, container, false); radioButtonSalah = view.FindViewById<RadioButton> (Resource.Id.radioButtonSalah); radioButtonBetul = view.FindViewById<RadioButton> (Resource.Id.radioButtonBetul); rl_betul = view.FindViewById<RelativeLayout> (Resource.Id.rl_betul); rl_salah = view.FindViewById<RelativeLayout> (Resource.Id.rl_salah); rl_soalanTamat = view.FindViewById<RelativeLayout> (Resource.Id.rl_soalanTamat); btn_tryAgain = view.FindViewById<Button> (Resource.Id.btn_tryAgain); btn_nextQuestion = view.FindViewById<Button> (Resource.Id.btn_nextQuestion); btn_soalanTamat = view.FindViewById<Button> (Resource.Id.btn_soalanTamat); btn_Close = view.FindViewById<ImageButton> (Resource.Id.btn_Close); tv_QuestionNo = view.FindViewById<TextView> (Resource.Id.tv_QuestionNo); tv_QuestionIndicator = view.FindViewById<TextView> (Resource.Id.tv_QuestionIndicator); tv_Question = view.FindViewById<TextView> (Resource.Id.tv_Question); pb = view.FindViewById<Android.Widget.ProgressBar> (Resource.Id.progressbar_submitquiz); pb.Visibility = ViewStates.Gone; //get value from main currentQuestion = Arguments.GetInt ("currentQuestion"); anwser = Arguments.GetBoolean ("anwser"); //only get value if currentQuestion is 1 (data from main) if (currentQuestion == 1) { Console.Error.WriteLine(user_id = Arguments.GetString ("user_id")); Console.Error.WriteLine(event_id = Arguments.GetInt ("event_id")); Console.Error.WriteLine(imei = Arguments.GetString ("imei")); } tv_QuestionNo.Text = String.Format("Soalan {0} :",currentQuestion); tv_QuestionIndicator.Text = String.Format("{0}/{1}", currentQuestion, QuestionAnswer.questionList.Count); tv_Question.Text = QuestionAnswer.questionList[currentQuestion - 1]; radioButtonSalah.Click += RButtonSalah_Click; radioButtonBetul.Click += RButtonBetul_Click; btn_tryAgain.Click += btnTryAgain_Click; btn_nextQuestion.Click += btnNextQuestion_Click; //close quiz btn_Close.Click += btnClose_Click; return view; }
public Camera2Page() { Activity = this.Context as MainActivity; Activity.CamPage = this; if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { view = Activity.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false); } else { view = Activity.LayoutInflater.Inflate(Resource.Layout.CameraLayoutOld, this, false); } previousPhoto = view.FindViewById <ImageViewAsync>(Resource.Id.previousPhoto); OverlaySeekbar = view.FindViewById <SeekBar>(Resource.Id.overlaySeekbar); OverlaySeekbar.SetOnSeekBarChangeListener(this); if (App.SelectedCondition.Photos != null && App.SelectedCondition.Photos.Count > 0) { ShowHidePreviousPhoto(App.SelectedCondition.Photos[App.SelectedCondition.Photos.Count - 1]); } OverlaySeekbar.Visibility = (App.SelectedCondition.Photos.Count > 0) ? ViewStates.Visible : ViewStates.Gone; takePhotoButton = view.FindViewById <global::Android.Widget.Button>(Resource.Id.takePhotoButton); takePhotoButton.Click += TakePictureTapped; takePhotoButton.Enabled = false; switchCameraButton = view.FindViewById <global::Android.Widget.Button>(Resource.Id.switchCameraButton); switchCameraButton.Click += SwitchCameraButton_Click; switchCameraButton.Enabled = false; switchCameraButton.Visibility = ViewStates.Gone; spinner = view.FindViewById <Android.Widget.ProgressBar>(Resource.Id.progressBar1); spinner.Indeterminate = true; spinner.Visibility = ViewStates.Gone; if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { mStateListener = new CameraStateListener() { Page = this }; mSurfaceTextureListener = new CameraSurfaceTextureListener(this); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation0, 90); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation90, 0); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation180, 270); ORIENTATIONS.Append((int)SurfaceOrientation.Rotation270, 180); textureView = view.FindViewById <AutoFitTextureView>(Resource.Id.textureView); textureView.SurfaceTextureListener = mSurfaceTextureListener; string[] camPermissions = { Android.Manifest.Permission.Camera }; // Make sure we can use the camera if ((int)Android.OS.Build.VERSION.SdkInt >= 23 && Activity.CheckSelfPermission(camPermissions[0]) != (Permission.Granted)) { Toast.MakeText(Activity, AppResources.Camera_permissionNeeded, ToastLength.Long).Show(); Activity.RequestPermissions(camPermissions, CamPermReqId); } else { OpenCamera(); } } else { cameraType = CameraFacing.Back; textureView1 = view.FindViewById <TextureView>(Resource.Id.textureView); textureView1.SurfaceTextureListener = this; } AddView(view); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView(Resource.Layout.Login_Layout); btnLLLoginAuthBtn = (Android.Widget.Button)FindViewById (Resource.Id.btnLLLoginAuthBtn); etLLLoginUsername = (EditText)FindViewById (Resource.Id.etLLLoginUsername); etLLLoginPassword = (EditText)FindViewById (Resource.Id.etLLLoginPassword); //TextView tvLLUserNameLabel = (TextView)FindViewById (Resource.Id.tvLLUserNameLabel); //TextView tvLLPassLabel = (TextView)FindViewById (Resource.Id.tvLLPassLabel); //TextView tvLLCopyrightText = (TextView)FindViewById (Resource.Id.tvLLCopyrightText); //TextView tvLLTermsText = (TextView)FindViewById (Resource.Id.tvLLTermsText); //progressDialog = ProgressDialog.Show(this,"Sila tunggu","Sedang memuatkan..."); mProgressBar = FindViewById<Android.Widget.ProgressBar> (Resource.Id.progressBar1); //etLLLoginUsername.Text = "860815435145"; //etLLLoginUsername.Text = "850408115989"; etLLLoginUsername.Hint = Resources.GetString(Resource.String.login_username_hint); //etLLLoginPassword.Text = "password"; etLLLoginPassword.Hint = Resources.GetString(Resource.String.login_password_hint); mProgressBar.Visibility = ViewStates.Invisible; //string deviceToken = getAndroidDeviceToken (); /* if (getAndroidDeviceToken () != "") { deviceTokenGCM = deviceToken; progressDialog.Hide (); } else { getAndroidDeviceToken (); OnCreate (bundle); } */ //GetIMEIID (); btnLLLoginAuthBtn.Click += (object sender, EventArgs e) => { if(etLLLoginUsername.Text != "") { if(etLLLoginPassword.Text != "") { mProgressBar.Visibility = ViewStates.Visible; btnLLLoginAuthBtn.Enabled = false; etLLLoginUsername.Enabled = false; etLLLoginPassword.Enabled = false; //loadingDialog = ProgressDialog.Show (this, "Sila Tunggu", "Sedang Memuatkan..."); //Thread.Sleep (2000); ThreadPool.QueueUserWorkItem(o => processTheLogin(etLLLoginUsername.Text,etLLLoginPassword.Text,deviceTokenGCM,GetIMEIID ())); } else { //Log.Error Snackbar .Make(FindViewById(Android.Resource.Id.Content),Resource.String.login_password_warning,Snackbar.LengthLong) .SetAction(Resource.String.generallabel_okbtn,delegate {}) .Show(); //Toast.MakeText (this, "Sila isikan Kata Laluan anda...", ToastLength.Short).Show(); } } else { Snackbar .Make(FindViewById(Android.Resource.Id.Content),Resource.String.login_username_warning,Snackbar.LengthLong) .SetAction(Resource.String.generallabel_okbtn,delegate {}) .Show(); //Toast.MakeText (this, "Sila isikan Nama Pengguna...", ToastLength.Short).Show(); } }; /* Typeface fontface = Typeface.CreateFromAsset (Assets, "Fonts/Roboto-Regular.ttf"); tvLLUserNameLabel.SetTypeface (fontface,TypefaceStyle.Normal); tvLLUserNameLabel.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121")); tvLLPassLabel.SetTypeface (fontface,TypefaceStyle.Normal); tvLLPassLabel.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121")); etLLLoginUsername.SetTypeface (fontface,TypefaceStyle.Normal); etLLLoginUsername.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121")); etLLLoginPassword.SetTypeface (fontface,TypefaceStyle.Normal); etLLLoginPassword.SetTextColor (Android.Graphics.Color.ParseColor("#FF212121")); btnLLLoginAuthBtn.SetTypeface (fontface,TypefaceStyle.Normal); tvLLCopyrightText.SetTypeface (fontface,TypefaceStyle.Normal); tvLLTermsText.SetTypeface (fontface,TypefaceStyle.Normal); */ }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); //Ask for action bar to show Window.RequestFeature (WindowFeatures.ActionBar); SetContentView (Resource.Layout.MyQuiz_MainActivity); //get user_id from main uid = Intent.GetStringExtra("UserID"); Console.Error.WriteLine ("uid"+uid); //check for completion status try { QuizDB myquizDB = DB_access.getCompletionStat (uid); completionStat = myquizDB.completion_Stat; drawNo = myquizDB.draw_No; } catch { } //if completionStat true, display lucky number if (completionStat == 1) { Finish (); var activity2 = new Intent (this, typeof(ShowDrawCode)); activity2.PutExtra ("drawNo", drawNo); StartActivity (activity2); } et_eventCode = FindViewById<EditText> (Resource.Id.editText_kod); btn_send = FindViewById<Button> (Resource.Id.btnmasuk_kod); pb = FindViewById<Android.Widget.ProgressBar> (Resource.Id.progress_bar); pb.Visibility = ViewStates.Gone; btn_send.Click += async delegate { //show loading and hide send button pb.Visibility = ViewStates.Visible; btn_send.Visibility = ViewStates.Invisible; //get event code from user input event_code = et_eventCode.Text; //close keyboard InputMethodManager inputManager = (InputMethodManager) this.GetSystemService(Context.InputMethodService); inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways); //check if user enter event code if(event_code.Length != 0) { var isOnline = await Task.Factory.StartNew(() => Commonlib.IsOnline (this, Commonlib.dontCloseActivity)); if (isOnline == true) { ClickFunction(); } else { //hide loading and show send button pb.Visibility = ViewStates.Invisible; btn_send.Visibility = ViewStates.Visible; } } else { Snackbar snackbar = Snackbar .Make(btn_send,"Sila masukkan kod penyertaan.",Snackbar.LengthLong) .SetAction("OK",delegate {}); View snackbarView = snackbar.View; TextView tv = (TextView)snackbarView.FindViewById(Resource.Id.snackbar_text); tv.SetTextColor(Color.White); snackbar.Show(); //hide loading and show send button pb.Visibility = ViewStates.Invisible; btn_send.Visibility = ViewStates.Visible; } }; }
/// <summary> /// Will wire up the commands in the WebViewer control to the native method calls /// </summary> /// <param name="element"></param> private void InitializeCommands(HybridWebView element) { element.GoBack = () => { var ctrl = Control; if (ctrl == null) { return; } if (ctrl.CanGoBack()) { ctrl.GoBack(); } //else //{ //((MainActivity)_context).FinishAffinity(); //((MainActivity)_context).MoveTaskToBack(true); //((MainActivity)this.Context).StartActivity(new Intent(Intent.ActionMain).AddCategory(Intent.CategoryHome)); //} }; element.CanGoBackFunction = () => { var ctrl = Control; if (ctrl == null) { return(false); } return(ctrl.CanGoBack()); }; var progressBar = new Android.Widget.ProgressBar(_context, null, Android.Resource.Attribute.ProgressBarStyleHorizontal); // This allows you to show a file chooser dialog from the WebView Control.SetWebChromeClient(new CustomWebChromeClient((uploadMsg, acceptType, capture) => { MainActivity.UploadMessage = uploadMsg; if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat) { var i = new Intent(Intent.ActionGetContent); //To set all type of files i.SetType("*/*"); //Here File Chooser dialog is started as Activity, and it gives result while coming back from that Activity. ((MainActivity)this.Context).StartActivityForResult(Intent.CreateChooser(i, "File Chooser"), MainActivity.FILECHOOSER_RESULTCODE); } else { var i = new Intent(Intent.ActionOpenDocument); i.AddCategory(Intent.CategoryOpenable); //To set all image file types. You can change to whatever you need i.SetType("*/*"); //Here File Chooser dialog is started as Activity, and it gives result while coming back from that Activity. ((MainActivity)this.Context).StartActivityForResult(Intent.CreateChooser(i, "File Chooser"), MainActivity.FILECHOOSER_RESULTCODE); } }, progressBar)); Control.AddView(progressBar); }