Пример #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
            {
                return(null);
            }
            View view = (convertView ?? m_Context.LayoutInflater.Inflate(Resource.Layout.item_review_order, parent, false));

            if (view == null)
            {
                return(null);
            }
            var       wrapper = view.Tag as ItemReviewMenuAdapterWrapper;
            MenuResto resto   = this.m_restos.ElementAt(position);

            if (wrapper == null)
            {
                wrapper = new ItemReviewMenuAdapterWrapper
                {
                    TVNama    = view.FindViewById <TextView>(Resource.Id.textViewNama),
                    TVHarga   = view.FindViewById <TextView>(Resource.Id.textViewHarga),
                    TVJumlah  = view.FindViewById <TextView>(Resource.Id.textViewJumlah),
                    IVGambar  = view.FindViewById <ImageView>(Resource.Id.imageViewURL),
                    BtnTambah = view.FindViewById <Button>(Resource.Id.buttonTambah),
                    BtnKurang = view.FindViewById <Button>(Resource.Id.buttonKurang),
                    BtnHapus  = view.FindViewById <Button>(Resource.Id.buttonHapus)
                };
                view.Tag              = wrapper;
                wrapper.TVNama.Text   = resto.menu_name;
                wrapper.TVHarga.Text  = "Rp. " + resto.menu_price.ToString();
                wrapper.TVJumlah.Text = resto.menu_jumlah_pesan.ToString();
                wrapper.Jumlah        = resto.menu_jumlah_pesan;
                ImageLoader.DisplayImage(resto.menu_url_image, wrapper.IVGambar, -1);

                wrapper.BtnTambah.Click += BtnTambah_Click;
                wrapper.BtnKurang.Click += BtnKurang_Click;
                wrapper.BtnHapus.Click  += BtnHapus_Click;

                wrapper.BtnTambah.Tag = wrapper;
                wrapper.BtnKurang.Tag = wrapper;
                wrapper.BtnHapus.Tag  = wrapper;
                wrapper.IVGambar.Tag  = wrapper;
                wrapper.TVNama.Tag    = wrapper;
                wrapper.TVHarga.Tag   = wrapper;

                wrapper.MenuResto       = resto;
                wrapper.IVGambar.Click += IVGambar_Click;
                wrapper.TVNama.Click   += IVGambar_Click;
                wrapper.TVHarga.Click  += IVGambar_Click;

                if (m_viewOnly)
                {
                    wrapper.BtnTambah.Visibility = ViewStates.Gone;
                    wrapper.BtnKurang.Visibility = ViewStates.Gone;
                    wrapper.BtnHapus.Visibility  = ViewStates.Gone;
                }
            }

            return(view);
        }
Пример #2
0
        private void BtnHapus_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            ItemReviewMenuAdapterWrapper wrapper   = (ItemReviewMenuAdapterWrapper)btn.Tag;
            ReviewOrderActivity          parentAct = (ReviewOrderActivity)m_Context;

            parentAct.RemoveItem(wrapper.MenuResto);
        }
Пример #3
0
        private void BtnTambah_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            ItemReviewMenuAdapterWrapper wrapper = (ItemReviewMenuAdapterWrapper)btn.Tag;

            wrapper.Jumlah++;
            wrapper.TVJumlah.Text = wrapper.Jumlah.ToString();
            wrapper.MenuResto.menu_jumlah_pesan = wrapper.Jumlah;
            ReviewOrderActivity parentAct = (ReviewOrderActivity)m_Context;

            parentAct.CalculateTotal();
        }
Пример #4
0
        private void IVGambar_Click(object sender, EventArgs e)
        {
            ItemReviewMenuAdapterWrapper wrapper = null;

            if (sender is ImageView)
            {
                ImageView imgv = (ImageView)sender;
                wrapper = (ItemReviewMenuAdapterWrapper)imgv.Tag;
            }
            if (sender is TextView)
            {
                TextView tcv = (TextView)sender;
                wrapper = (ItemReviewMenuAdapterWrapper)tcv.Tag;
            }
            string url = wrapper.MenuResto.menu_url_image;

            Android.App.FragmentTransaction       transaction  = m_Context.FragmentManager.BeginTransaction();
            Fragments.RestoMenuPopUpImageFragment signUpDialog = new Fragments.RestoMenuPopUpImageFragment(url, ImageLoader);
            signUpDialog.Show(transaction, "dialog fragment");
        }