public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { ((ViewHolder.timeLine)(holder)).created_.Text = DateTime.Parse(rows_[position].createdAt_).ToString("HH:mm:ss"); ((ViewHolder.timeLine)(holder)).content_.Text = rows_[position].content_; ((ViewHolder.timeLine)(holder)).content_.Enabled = rows_[position].enabled; ((ViewHolder.timeLine)(holder)).content_.Click += (sender, e) => { TableLayout tableLayout = new TableLayout(activity_.ApplicationContext); tableLayout.SetGravity(GravityFlags.Bottom | GravityFlags.CenterHorizontal); tableLayout.SetBackgroundColor(Color.Argb(100, 160, 160, 160)); activity_.AddContentView(tableLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); WindowManagerLayoutParams layoutParams = new WindowManagerLayoutParams( 600, 600, WindowManagerTypes.SystemOverlay, WindowManagerFlags.NotTouchable | WindowManagerFlags.NotFocusable, Android.Graphics.Format.Translucent); ImageView imageView = new ImageView(activity_.ApplicationContext); imageView.SetImageResource(awesome.Resource.Drawable.met); imageView.SetPadding(0, 0, 0, 50); tableLayout.AddView(imageView, layoutParams); var upAnimation = new Utilities.Animation.Horizontal() .StartPos(imageView.GetX(), imageView.GetY()) .MoveDistance(-80) .Duration(100) .Build(); var downAnimation = new Utilities.Animation.Horizontal() .StartPos(imageView.GetX(), imageView.GetY() - 80) .MoveDistance(80) .Duration(100) .Build(); imageView.StartAnimation(upAnimation); upAnimation.AnimationEnd += (_1, _2) => { imageView.StartAnimation(downAnimation); }; downAnimation.AnimationEnd += (_1, _2) => { imageView.StartAnimation(upAnimation); }; new Handler().PostDelayed(() => { ((ViewGroup)tableLayout.Parent).RemoveView(tableLayout); }, 500); onRowClicked(rows_[position]); ((Android.Widget.TextView)sender).Enabled = false; rows_[position].enabled = false; }; }
public ScheduleCustomHeader(Context context) { Context = context; HeaderLayout = new TableLayout(context); density = Context.Resources.DisplayMetrics; HeaderLayout.SetBackgroundColor(Color.Argb(255, 214, 214, 214)); HeaderLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, density.HeightPixels / 14); AddHeaderViews(); }
public ScheduleAppointmentEditor(Context context, SfSchedule _schedule) { mContext = context; sfSchedule = _schedule; density = mContext.Resources.DisplayMetrics; EditorLayout = new TableLayout(context); EditorLayout.SetBackgroundColor(Color.White); EditorLayout.StretchAllColumns = true; EditorLayout.SetPaddingRelative(30, 30, 30, 30); EditorLayout.LayoutParameters = new ViewGroup.LayoutParams((density.WidthPixels), (density.HeightPixels)); AddInputControls(); }
/// <summary> /// inits the views /// </summary> private void InitViews() { tlCustomize = FindViewById <TableLayout>(Resource.Id.tlCustomize); tlCustomize.SetBackgroundColor(background); btnBallColor = FindViewById <Button>(Resource.Id.btnBallColor); btnBatColor = FindViewById <Button>(Resource.Id.btnBatColor); btnBrickColor = FindViewById <Button>(Resource.Id.btnBrickColor); btnBackgroundColor = FindViewById <Button>(Resource.Id.btnBackgroundColor); btnRandom = FindViewById <Button>(Resource.Id.btnRandom); btnDefult = FindViewById <Button>(Resource.Id.btnDefult); btnBack = FindViewById <Button>(Resource.Id.btnBack); ChangeButtonsColors(); btnBallColor.SetOnClickListener(this); btnBatColor.SetOnClickListener(this); btnBrickColor.SetOnClickListener(this); btnBackgroundColor.SetOnClickListener(this); btnDefult.SetOnClickListener(this); btnRandom.SetOnClickListener(this); btnBack.SetOnClickListener(this); }
//Things to do when initialized protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set view from the main layout resource SetContentView(Resource.Layout.Main); gestureListener = new GestureListener(); gestureListener.SwipeLeftEvent += GestureLeft; gestureDetector = new GestureDetector(this, gestureListener); TableLayout table = FindViewById <TableLayout>(Resource.Id.table); //Button home = FindViewById<Button> (Resource.Id.home); table.SetBackgroundColor(Android.Graphics.Color.LightCyan); FrameLayout frame = FindViewById <FrameLayout> (Resource.Id.frameLayout); //when frame layout (Home dir button) is clicked, it goes home! frame.Click += delegate { homeDir(); }; //list/re-list all the directories listDirectory(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { container.RemoveAllViews(); this.container = container; LinearLayout root = new LinearLayout(container.Context); root.Orientation = Android.Widget.Orientation.Vertical; root.SetPadding(10, 0, 0, 0); orderTitleView = new TextView(container.Context); orderTitleView.SetTextSize(ComplexUnitType.Sp, 28); orderTitleView.SetTextColor(Color.DarkBlue); orderTitleView.Click += OrderTitleView_Click; root.AddView(orderTitleView); nameEditText = new EditText(container.Context); nameEditText.SetTextSize(ComplexUnitType.Sp, 30); nameEditText.SetTextColor(Color.Black); nameEditText.SetMaxLines(1); nameEditText.TextChanged += NameEditText_TextChanged; nameEditText.Visibility = ViewStates.Gone; root.AddView(nameEditText); LinearLayout title = new LinearLayout(container.Context); TextView nameView = new TextView(container.Context); nameView.Text = "Item"; nameView.SetTextSize(ComplexUnitType.Sp, 25); nameView.SetWidth(600); nameView.SetPadding(10, 0, 0, 0); nameView.SetTextColor(Color.Black); TextView priceView = new TextView(container.Context); priceView.Text = "Price (£)"; priceView.SetTextSize(ComplexUnitType.Sp, 25); priceView.SetTextColor(Color.Black); title.AddView(nameView); title.AddView(priceView); root.AddView(title); ScrollView scrollView = new ScrollView(container.Context); layout = new TableLayout(container.Context); layout.SetBackgroundColor(Color.White); scrollView.AddView(layout); root.AddView(scrollView); LinearLayout footer = new LinearLayout(container.Context); if (container.Parent.Parent is CurrentOrderLayout) { customerTypeButton = new Button(container.Context); customerTypeButton.Text = "Customer Type"; customerTypeButton.Click += CustomerTypeButton_Click; customerTypeButton.SetTextSize(ComplexUnitType.Sp, 23); footer.AddView(customerTypeButton); customerTypeText = new TextView(container.Context); customerTypeText.SetTextSize(ComplexUnitType.Sp, 23); customerTypeText.SetTextColor(Color.Black); customerTypeText.SetPadding(10, 0, 0, 0); footer.AddView(customerTypeText); customerTypeButton.LayoutParameters.Height = 120; customerTypeText.LayoutParameters.Width = 150; } totalView = new TextView(container.Context); totalView.TextSize = 35; totalView.SetTextColor(Color.Black); if (container.Parent.Parent is CurrentOrderLayout) { totalView.SetPadding(120, 10, 0, 10); } else { totalView.SetPadding(580, 10, 0, 10); } totalView.Text = "£ 0.00"; footer.AddView(totalView); root.AddView(footer); //footer.LayoutParameters.Width = 500; if (container.Parent.Parent is CurrentOrderLayout) { LinearLayout buttonsLayout = new LinearLayout(container.Context); buttonsLayout.Orientation = Android.Widget.Orientation.Horizontal; //buttonsLayout.SetPadding(220, 0, 0, 0); Button voidButton = new Button(container.Context); voidButton.Text = "Void"; voidButton.Click += VoidButton_Click; voidButton.SetTextSize(ComplexUnitType.Sp, 23); Button completeButton = new Button(container.Context); completeButton.Text = "Complete Order"; completeButton.Click += CompleteButton_Click; completeButton.SetTextSize(ComplexUnitType.Sp, 23); Button payButton = new Button(container.Context); payButton.Text = "Pay Order"; payButton.Click += PayButton_Click; payButton.SetTextSize(ComplexUnitType.Sp, 23); buttonsLayout.AddView(voidButton); buttonsLayout.AddView(completeButton); buttonsLayout.AddView(payButton); root.AddView(buttonsLayout); voidButton.LayoutParameters.Height = 120; completeButton.LayoutParameters.Height = 120; payButton.LayoutParameters.Height = 120; } else if (container.Parent is LiveOrdersLayout) { LiveOrdersLayout layout = (LiveOrdersLayout)container.Parent; if (layout.LiveOrdersFragment.ListAdapter.Count > 1) { LinearLayout buttonsLayout = new LinearLayout(container.Context); buttonsLayout.Orientation = Android.Widget.Orientation.Horizontal; buttonsLayout.SetPadding(500, 0, 0, 0); navigateButton = new Button(container.Context); navigateButton.Text = "Go To Order"; navigateButton.SetTextSize(ComplexUnitType.Sp, 23); navigateButton.Click += NavigateButton_Click; buttonsLayout.AddView(navigateButton); navigateButton.LayoutParameters.Height = 120; root.AddView(buttonsLayout); } else { orderTitleView.Text = ""; } } container.AddView(root); scrollView.LayoutParameters.Height = 470; if (container.Parent is LiveOrdersLayout) { currentOrder = OrderModel.GetFirstLiveOrderModel(); } else { currentOrder = OrderModel.GetCurrentOrderModel(); } if (currentOrder.OrderNumber == 0) { currentOrder.OrderNumber = svc.GetNewOrderNumber(); } PopulateOrder(currentOrder); return(base.OnCreateView(inflater, container, savedInstanceState)); }