Beispiel #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view                 = base.OnCreateView(inflater, container, savedInstanceState);
            fbView               = view.FindViewById <LinearLayout>(Resource.Id.fb_view);
            twitterView          = view.FindViewById <LinearLayout>(Resource.Id.twitter_view);
            instaView            = view.FindViewById <LinearLayout>(Resource.Id.insta_view);
            fbText               = fbView.FindViewById <TextView>(Resource.Id.networkText);
            twitterText          = twitterView.FindViewById <TextView>(Resource.Id.networkText);
            instaText            = instaView.FindViewById <TextView>(Resource.Id.networkText);
            fbNetworkImage       = fbView.FindViewById <ImageView>(Resource.Id.networkImage);
            fbNetworkLoader      = fbView.FindViewById <ImageView>(Resource.Id.networkLoader);
            twitterNetworkImage  = twitterView.FindViewById <ImageView>(Resource.Id.networkImage);
            twitterNetworkLoader = twitterView.FindViewById <ImageView>(Resource.Id.networkLoader);
            instaNetworkImage    = instaView.FindViewById <ImageView>(Resource.Id.networkImage);
            instaNetworkLoader   = instaView.FindViewById <ImageView>(Resource.Id.networkLoader);

            var recyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.more_recycler_view);

            if (recyclerView != null)
            {
                var layoutManager = new LinearLayoutManager(Activity);
                recyclerView.SetLayoutManager(layoutManager);
                recyclerView.ScrollChange += (s, e) =>
                {
                    OnScrollViewChanged(s, e, recyclerView.ScrollState);
                };
            }

            CreateBindings();
            UpdateControls();
            return(view);
        }
Beispiel #2
0
 public PollingViewHolder(LinearLayout pollingLayout) : base(pollingLayout)
 {
     mStatusView         = pollingLayout.FindViewById <TextView>(Resource.Id.tv_ending_status);
     mRedirectStatusView = pollingLayout.FindViewById <TextView>(Resource.Id.tv_redirect_status);
     mSourceIdView       = pollingLayout.FindViewById <TextView>(Resource.Id.tv_source_id);
     mSourceTypeView     = pollingLayout.FindViewById <TextView>(Resource.Id.tv_source_type);
 }
Beispiel #3
0
        internal BookmarkToolbar(Context context, CustomToolBarPdfViewerDemo sampleView) : base(context)
        {
            this.sampleView = sampleView;
            bookmarkFont    = sampleView.bookmarkFont;
            var inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);

            bookmarkLayout      = (LinearLayout)inflater.Inflate(Resources.GetLayout(Resource.Layout.bookmarkAndroidToolbar), this, true);
            backToViewerButton  = bookmarkLayout.FindViewById <Button>(Resource.Id.backToViewerButton);
            bookmarkCloseButton = bookmarkLayout.FindViewById <Button>(Resource.Id.bookmarkCloseButton);
            bookmarkTitle       = bookmarkLayout.FindViewById <LinearLayout>(Resource.Id.bookmarkTitleBar);
            if (sampleView.IsDeviceTablet)
            {
                bookmarkTitle.LayoutParameters.Height = (int)(47 * Resources.DisplayMetrics.Density);
                backToViewerButton.Visibility         = ViewStates.Invisible;
                bookmarkCloseButton.Click            += M_bookmarkCloseButton_Click;
                bookmarkCloseButton.Typeface          = sampleView.font;
            }
            else
            {
                bookmarkCloseButton.Visibility        = ViewStates.Invisible;
                bookmarkTitle.LayoutParameters.Height = (int)(60 * Resources.DisplayMetrics.Density);
                backToViewerButton.Click   += BackToViewerButton_Click;
                backToViewerButton.Typeface = sampleView.bookmarkFont;
            }
            bookmarkView         = bookmarkLayout.FindViewById <ListView>(Resource.Id.bookmarkListView);
            listAdapter          = new BookmarkListAdapter(context, this, Resources.DisplayMetrics.Density);
            bookmarkView.Adapter = listAdapter;
            SetBackgroundColor(Color.White);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (container == null)
            {
                return(null);
            }

            LinearLayout l = (LinearLayout)inflater.Inflate(Resource.Layout.mf, container, false);

            int pos = this.Arguments.GetInt("pos");

            TextView tv = (TextView)l.FindViewById(Resource.Id.viewID);

            tv.Text = "Position = " + pos;

            LinearLayout root     = (LinearLayout)l.FindViewById(Resource.Id.root);
            float        scale    = this.Arguments.GetFloat("scale");
            bool         isBlured = this.Arguments.GetBoolean("IsBlured");

            if (isBlured)
            {
                ViewHelper.SetAlpha(root, MyPagerAdapter.getMinAlpha());
                ViewHelper.SetRotationY(root, MyPagerAdapter.getMinDegree());
            }
            return(l);
        }
Beispiel #5
0
        protected override void ShowBrokenRule()
        {
            try
            {
                BreakRuleIndex += 1;
                BrokenRuleInfo RuleInfo = brokenRuleMessage.RuleInfo;
                mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable);
                LinearLayout  linearLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableBeiKe, null);
                TableTextView txt          = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_1);
                txt.SetText(BreakRuleIndex.ToString(), TextView.BufferType.Normal);
                txt.SetTextColor(Color.Red);

                txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_2);
                txt.SetText(RuleInfo.RuleName.ToString(), TextView.BufferType.Normal);
                txt.SetTextColor(Color.Red);

                txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_3);
                txt.SetText(RuleInfo.DeductedScores.ToString(), TextView.BufferType.Normal);
                txt.SetTextColor(Color.Red);

                txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_4);
                txt.SetText(RuleInfo.BreakTime.ToString("HH:mm:ss"), TextView.BufferType.Normal);
                txt.SetTextColor(Color.Red);

                txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_5);
                txt.SetText(RuleInfo.RuleCode, TextView.BufferType.Normal);
                txt.SetTextColor(Color.Red);

                mainLinerLayout.AddView(linearLayout);
            }
            catch (Exception ex)
            {
                Logger.Error("ShowBorkenRule", ex.Message);
            }
        }
Beispiel #6
0
        protected override void InitBrokenRules()
        {
            mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable);
            LinearLayout linearLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableBeiKe, null);

            TableTextView txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_1);

            txt.SetText("序号", TextView.BufferType.Normal);
            txt.SetTextColor(Color.Black);
            txt.SetBackgroundColor(Color.White);

            txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_2);
            txt.SetText("错误信息", TextView.BufferType.Normal);
            txt.SetTextColor(Color.Black);
            txt.SetBackgroundColor(Color.White);

            txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_3);
            txt.SetText("扣分", TextView.BufferType.Normal);
            txt.SetTextColor(Color.Black);
            txt.SetBackgroundColor(Color.White);

            txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_4);
            txt.SetText("时间", TextView.BufferType.Normal);
            txt.SetTextColor(Color.Black);
            txt.SetBackgroundColor(Color.White);

            txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_5);
            txt.SetText("代码", TextView.BufferType.Normal);
            txt.SetTextColor(Color.Black);
            txt.SetBackgroundColor(Color.White);

            mainLinerLayout.AddView(linearLayout);
        }
Beispiel #7
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            LinearLayout view = (LinearLayout)convertView;

            if (view == null)
            {
                LayoutInflater vi = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
                view = (LinearLayout)vi.Inflate(Resource.Layout.inventory_row,
                                                null);

                _viewHolder     = new ViewHolderItem();
                _viewHolder.Epc = (TextView)view
                                  .FindViewById(Resource.Id.inventory_item);
                _viewHolder.Counter = (TextView)view
                                      .FindViewById(Resource.Id.inventory_item_counter);

                view.Tag = _viewHolder;
            }
            else
            {
                _viewHolder = (ViewHolderItem)view.Tag;
            }
            var item = _items[position];

            if (item != null)
            {
                if (_viewHolder != null)
                {
                    _viewHolder.Epc.Text     = item.TagId;
                    _viewHolder.Counter.Text = (item.Counter.ToString());
                }
            }
            return(view);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            LinearLayout view = (LinearLayout)inflater.Inflate(Resource.Layout.coffee_tab_layout, container, false);

            //Get Arguments
            float  scale      = Arguments.GetFloat("SCALE");
            bool   isBlured   = Arguments.GetBoolean("IS_BLURED");
            string coffeeName = Arguments.GetString("COFFEE_NAME");

            //Set Image (IdentifierName has to be lower case for drawables!)
            int id = Resources.GetIdentifier(coffeeName.ToLower(), "drawable", Activity.PackageName);

            view.FindViewById <ImageView>(Resource.Id.content).SetImageResource(id);

            LinearLayout root = (LinearLayout)view.FindViewById(Resource.Id.root);

            if (isBlured)
            {
                ViewHelper.SetAlpha(root, CarouselPagerAdapter.GetMinAlpha());
                ViewHelper.SetRotationY(root, CarouselPagerAdapter.GetMinDegree());
                ViewHelper.SetScaleX(root, scale);
                ViewHelper.SetScaleY(root, scale);
            }
            return(view);
        }
Beispiel #9
0
        private void setOnClick(LinearLayout lay, int i)
        {
            lay.Click += (object sender, EventArgs e) => {
                if (selectedLayout != null)
                {
                    TextView  oldTextView1 = (TextView)selectedLayout.FindViewById(Resource.Id.text3);
                    TextView  oldTextView2 = (TextView)selectedLayout.FindViewById(Resource.Id.text4);
                    ImageView newImageView = (ImageView)selectedLayout.FindViewById(Resource.Id.imageview1);
                    oldTextView1.SetTextColor(Color.ParseColor("#ffffff"));
                    oldTextView2.SetTextColor(Color.ParseColor("#ffffff"));
                    newImageView.SetImageResource(selectedData.Type);
                }
                TextView  newTextView1  = (TextView)lay.FindViewById(Resource.Id.text3);
                TextView  newTextView12 = (TextView)lay.FindViewById(Resource.Id.text4);
                ImageView newimageView  = (ImageView)lay.FindViewById(Resource.Id.imageview1);

                WeatherData data = dataSource[i];
                newTextView1.SetTextColor(Color.ParseColor("#fbb03b"));
                newTextView12.SetTextColor(Color.ParseColor("#fbb03b"));
                newimageView.SetImageResource(data.SelectedType);
                ImageView imageView = (ImageView)linearLayout.FindViewById(Resource.Id.imageview);
                imageView.SetImageResource(data.Type);
                TextView degreeText = (TextView)linearLayout.FindViewById(Resource.Id.text);


                String          s2  = "" + data.Temperature + (char)0x00B0 + "/12";
                SpannableString ss2 = new SpannableString(s2);
                ss2.SetSpan(new RelativeSizeSpan(2f), 0, 4, SpanTypes.ExclusiveExclusive);
                degreeText.SetText(ss2, TextView.BufferType.Normal);
                TextView dayText = (TextView)linearLayout.FindViewById(Resource.Id.text1);
                dayText.Text   = dataSource[i].Date;
                selectedData   = data;
                selectedLayout = lay;
            };
        }
Beispiel #10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootView             = (LinearLayout)inflater.Inflate(Resource.Layout.guessing_image_fragment, container, false);
            keyboardContainer    = rootView.FindViewById <LinearLayout>(Resource.Id.keyboardContainer);
            solution             = rootView.FindViewById <TextView>(Resource.Id.solution);
            clearAll             = rootView.FindViewById <FButton>(Resource.Id.clearAll);
            delete               = rootView.FindViewById <FButton>(Resource.Id.delete);
            slika                = rootView.FindViewById <ImageView>(Resource.Id.image);
            slika.TransitionName = image.Name;

            if (!clearAll.HasOnClickListeners)
            {
                clearAll.Click += ClearAllClick;
            }

            if (!delete.HasOnClickListeners)
            {
                delete.Click += DeleteClick;
            }

            InitFields();
            InitateKeyboard();

            return(rootView);
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_HomeScreen);

            var movies = await new HomeScreenPage().GetMovies();

            npMovies   = movies.Where(x => x.HasReleased).ToList();
            csMovies   = movies.Where(x => !x.HasReleased).ToList();
            NowPlaying = FindViewById <LinearLayout>(Resource.Id.now_playing);
            ComingSoon = FindViewById <LinearLayout>(Resource.Id.coming_soon);

            Nptv      = NowPlaying.FindViewById <TextView>(Resource.Id.MovText);
            Nptv.Text = "Now Playing";
            Cstv      = ComingSoon.FindViewById <TextView>(Resource.Id.MovText);
            Cstv.Text = "Coming soon";

            NpGallery = NowPlaying.FindViewById <Gallery>(Resource.Id.GalleryView);
            CsGallery = ComingSoon.FindViewById <Gallery>(Resource.Id.GalleryView);

            //NpGallery = FindViewById<Gallery>(Resource.Id.GalleryView);
            //CsGallery = FindViewById<Gallery>(Resource.Id.GalleryView2);

            var editText1 = FindViewById <EditText>(Resource.Id.editText1);

            radioGroup                = FindViewById <RadioGroup>(Resource.Id.radioGroup);
            editText1.TextChanged    += Onsearch;
            radioGroup.CheckedChange += onCheckedChanged;
            PopulateList();
        }
Beispiel #12
0
        private void MyViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            myGameStatus.Text = myViewModel.Game.Status;
            bool updateAll = e.PropertyName.Equals("UpdateAll");

            if (e.PropertyName.Equals(nameof(myViewModel.CurrentFunction)) || updateAll)
            {
                statButtonLayout.FindViewById <TextView>(Resource.Id.headerButtonText).Text = myViewModel.CurrentFunction.GetDescription();
                string turnoverText = myViewModel.CurrentFunction == EZoneFunction.Attack ? "Balverlies" : "Onderschepping";
                statButtonLayout.FindViewById <Button>(Resource.Id.turnoverButton).Text = turnoverText;
            }
            if (e.PropertyName.Equals(nameof(myViewModel.HomeScore)) || updateAll)
            {
                myHomeScoreTextView.Text = myViewModel.HomeScore.ToString();
            }
            if (e.PropertyName.Equals(nameof(myViewModel.AwayScore)) || updateAll)
            {
                myAwayScoreTextView.Text = myViewModel.AwayScore.ToString();
            }
            if (e.PropertyName.Equals("Shot") || updateAll)
            {
                cardViewLeft.FindViewById <TextView>(Resource.Id.headerText).Text = "Schoten";
                cardViewLeft.FindViewById <TextView>(Resource.Id.statText).Text   = myViewModel.GetShotCount().ToString();

                cardViewRight.FindViewById <TextView>(Resource.Id.headerText).Text = "Rebounds";
                cardViewRight.FindViewById <TextView>(Resource.Id.statText).Text   = myViewModel.GetReboundCount().ToString();
            }
            if (e.PropertyName.Equals(nameof(myViewModel.CurrentPlayers)) || updateAll)
            {
                myCurrentPlayersLayout.AddViews(myViewModel.GetPlayers());
            }
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var result = results[position];

            if (position % 2 == 0)
            {
                // Try to reuse convertView if it's not  null, otherwise inflate it from our item layout
                FrameLayout view = (convertView is FrameLayout ? convertView :
                                    context.Inflate(Resource.Layout.ItemListItem, parent, false)) as FrameLayout;

                var captionAccent = view.FindViewById <TextView>(Resource.Id.captionAccent);
                var text          = view.FindViewById <TextView>(Resource.Id.text);

                captionAccent.SetText(result.CaptionAccent, TextView.BufferType.Normal);
                text.SetText(result.Text, TextView.BufferType.Normal);

                return(view);
            }
            else
            {
                // Try to reuse convertView if it's not  null, otherwise inflate it from our item layout
                LinearLayout view = (convertView is LinearLayout ? convertView :
                                     context.Inflate(Resource.Layout.EntryListItem, parent, false)) as LinearLayout;

                var itemText = view.FindViewById <TextView>(Resource.Id.itemText);
                var summary  = view.FindViewById <TextView>(Resource.Id.summary);

                itemText.SetText(result.CaptionAccent, TextView.BufferType.Normal);
                summary.SetText(result.Text, TextView.BufferType.Normal);

                return(view);
            }
        }
        protected override void AssingViews(View view)
        {
            llMedicalTestFirstStep      = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestOne);
            llMedicalTestSecondStep     = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestTwo);
            llMedicalTestThirdStep      = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestThree);
            llMedicalTestConclusionStep = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestConfirmation);

            tvtitle       = view.FindViewById <TextView>(Resource.Id.title);
            btBack        = view.FindViewById(Resource.Id.buttonBack);
            btBack.Click += (o, e) => presenter.BackClicked();


            //FirstStepViews

            btFirstStepYes        = llMedicalTestFirstStep.FindViewById <TextView>(Resource.Id.btYes);
            btFirstStepYes.Click += (o, e) => presenter.QuestionFirstStepClicked(true);

            btFirstStepNo        = llMedicalTestFirstStep.FindViewById <TextView>(Resource.Id.btNo);
            btFirstStepNo.Click += (o, e) => presenter.QuestionFirstStepClicked(false);

            btSkipQuestionOne        = llMedicalTestFirstStep.FindViewById <TextView>(Resource.Id.btSkipQuestion);
            btSkipQuestionOne.Click += (o, e) => presenter.QuestionFirstStepClicked((bool?)null);



            //SecondStepViews
            btSecondStepYes        = llMedicalTestSecondStep.FindViewById <TextView>(Resource.Id.btYes);
            btSecondStepYes.Click += (o, e) => presenter.QuestionSecondStepClicked(true);

            btSecondStepNo        = llMedicalTestSecondStep.FindViewById <TextView>(Resource.Id.btNo);
            btSecondStepNo.Click += (o, e) => presenter.QuestionSecondStepClicked(false);

            btSkipQuestionTwo        = llMedicalTestSecondStep.FindViewById <TextView>(Resource.Id.btSkipQuestion);
            btSkipQuestionTwo.Click += (o, e) => presenter.QuestionSecondStepClicked((bool?)null);



            //ThirsStepViews
            btThirdStepYes        = llMedicalTestThirdStep.FindViewById <TextView>(Resource.Id.btYes);
            btThirdStepYes.Click += (o, e) => presenter.QuestionThirdStepClicked(true);

            btThirdStepNo        = llMedicalTestThirdStep.FindViewById <TextView>(Resource.Id.btNo);
            btThirdStepNo.Click += (o, e) => presenter.QuestionThirdStepClicked(false);

            btSkipQuestionThree        = llMedicalTestThirdStep.FindViewById <TextView>(Resource.Id.btSkipQuestion);
            btSkipQuestionThree.Click += (o, e) => presenter.QuestionThirdStepClicked((bool?)null);



            //ConclusionStepViews

            btConfirmForm              = llMedicalTestConclusionStep.FindViewById <TextView>(Resource.Id.btConfirm);
            btConfirmForm.Click       += (o, e) => presenter.TestFinished();
            tvRiskConclusion           = llMedicalTestConclusionStep.FindViewById <TextView>(Resource.Id.tvRiskConclusion);
            tvCovidDiagnosedConclusion =
                llMedicalTestConclusionStep.FindViewById <TextView>(Resource.Id.tvCovidDiagnosedConclusion);
            tvDangerWorkConclusion =
                llMedicalTestConclusionStep.FindViewById <TextView>(Resource.Id.tvDangerWorkConclusion);
        }
        private void InitButtonBar(LinearLayout rootView)
        {
            confirmButton        = rootView.FindViewById <Button>(Resource.Id.base_okBtn);
            confirmButton.Click += ConfirmButton_Click;

            cancelButton        = rootView.FindViewById <Button>(Resource.Id.base_cancelBtn);
            cancelButton.Click += CancelButton_Click;
        }
Beispiel #16
0
        // void rundb()
        // {
        //     FirebaseOptions firebaseOptions = new FirebaseOptions.Builder().SetApiKey(" AIzaSyBQev9ULBFWqD31zfTr8ovFSGlURNDM2S4 ").SetDatabaseUrl("https://eticaret-feebb.firebaseio.com/").SetApplicationId("eticaret-feebb").Build();

        //     FirebaseApp firebaseApp = FirebaseApp.InitializeApp(this, firebaseOptions);


        //     FirebaseDatabase firebaseDatabase = FirebaseDatabase.GetInstance(firebaseApp);

        //     DatabaseReference databaseReference = firebaseDatabase.Reference.Database.Reference;


        //     databaseReference.AddChildEventListener(this);
        //     databaseReference.AddValueEventListener(this);



        //     databaseReference.Child("Person").SetValue(new Person() { name = "mali", age = 20 }).AddOnCompleteListener(this).AddOnFailureListener(this);
        // }
        //async Task RunAsycn()
        // {
        //     FirebaseOptions firebaseOptions = new FirebaseOptions.Builder().SetApiKey(" AIzaSyBQev9ULBFWqD31zfTr8ovFSGlURNDM2S4 ").SetDatabaseUrl("https://eticaret-feebb.firebaseio.com/").SetApplicationId("eticaret-feebb").Build();

        //     FirebaseApp firebaseApp = FirebaseApp.InitializeApp(this, firebaseOptions);


        //     FirebaseDatabase firebaseDatabase = FirebaseDatabase.GetInstance(firebaseApp);

        //     DatabaseReference databaseReference = firebaseDatabase.Reference.Database.Reference;


        //     databaseReference.AddChildEventListener(this);
        //     databaseReference.AddValueEventListener(this);


        //     // databaseReference.Push().Child("Person").SetValue(new Person() { name = "mali", age = 20 }).AddOnCompleteListener(this).AddOnFailureListener(this);
        //     await databaseReference.Child("Person").SetValueAsync(new Person() { name = "mali", age = 20 });
        //    //databaseReference.NotifyAll();

        // }
        #endregion



        void CreateItems(TableQuery <Product> products)
        {
            //clear all views on the grid layout so I can create what I want to create
            mainLayout.RemoveAllViews();
            //read the database and get the image and product id and create all

            for (int i = 0; i < products.Count(); i++)
            {
                LinearLayout linearLayout = (LinearLayout)LayoutInflater.Inflate(Resource.Layout.basicCart, null);

                Button button = linearLayout.FindViewById <Button>(Resource.Id.cartShowButton);
                button.Tag    = products.ElementAt(i).ProductID;
                button.Click += Button_Click;
                ImageView image = linearLayout.FindViewById <ImageView>(Resource.Id.cartImage);
                image.SetImageDrawable(GetDrawable(products.ElementAt(i).ProductImage));

                #region No need for now
                //linearLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
                //linearLayout.LayoutParameters.Width = DpToPixel(this, 180);
                //linearLayout.LayoutParameters.Height = DpToPixel(this, 150);

                //linearLayout.Orientation = Orientation.Vertical;
                //ImageView image = View.Inflate(this,)
                //image.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
                //image.LayoutParameters.Width = DpToPixel(this, 154);
                //image.LayoutParameters.Height = DpToPixel(this, 93);
                //image.SetImageResource(Resource.Drawable.sportShoe);
                //image.SetForegroundGravity(GravityFlags.Center);
                //linearLayout.AddView(image);
                //Button button = new Button(this);
                //button.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
                ////set buttons tag to its product id so when we click the button we can find the product that
                ////we are looking for
                //button.LayoutParameters.Width = DpToPixel(this, 90);
                //button.LayoutParameters.Height = DpToPixel(this, 35);
                //button.Text = "VIEW";
                //Drawable img = GetDrawable(Resource.Drawable.search);
                // //img.Wait();

                //img.SetBounds(0, 0, 100, 80);
                //button.SetCompoundDrawables(img, null, null, null);
                //button.CompoundDrawableTintList = GetColorStateList(Resource.Color.white);
                //button.Gravity = GravityFlags.CenterHorizontal;
                //button.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFAA66CC"));
                //button.TextAlignment = TextAlignment.Center;

                //button.SetTextColor(GetColorStateList(Resource.Color.white));
                //button.Tag = i;
                //button.Click += Button_Click;
                //linearLayout.AddView(button);


                //gridLayout.Wait();
                #endregion
                mainLayout.AddView(linearLayout);
            }
        }
        public ErrorViewSwitcher(Context context, LinearLayout errorView)
        {
            _contextReference = new WeakReference <Context>(context);
            _errorView        = errorView;

            _imageView  = errorView.FindViewById <ImageView>(Resource.Id.image_error);
            _textView   = errorView.FindViewById <TextView>(Resource.Id.text_error);
            _buttonView = errorView.FindViewById <Button>(Resource.Id.button_retry);
        }
 private void GenerateProductDetails()
 {
     foreach (KeyValuePair <string, string> detail in this.ProductDetails)
     {
         LinearLayout detailLayout = (LinearLayout)this.LayoutInflater.Inflate(Resource.Layout.product_details_item, null);
         detailLayout.FindViewById <TextView> (Resource.Id.product_detail_name).Text  = this.GetStringResourceByName(detail.Key);
         detailLayout.FindViewById <TextView> (Resource.Id.product_detail_value).Text = detail.Value;
         this.ProductDetailList.AddView(detailLayout);
     }
 }
Beispiel #19
0
        private void UndateControls()
        {
            FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.tv_areas_join), FontsConstants.PN_R, (float)0.04);
            FontHelper.UpdateFont(view.FindViewById <TextView>(Resource.Id.tv_or), FontsConstants.PN_R, (float)0.04);
            FontHelper.UpdateFont(view.FindViewById <Button>(Resource.Id.invite_button), FontsConstants.PN_B, (float)0.04);

            FontHelper.UpdateFont(areasDetailsView.FindViewById <TextView>(Resource.Id.title), FontsConstants.PN_B, (float)0.055);
            FontHelper.UpdateFont(areasDetailsView.FindViewById <TextView>(Resource.Id.description), FontsConstants.PN_R, (float)0.037);
            FontHelper.UpdateFont(areasDetailsView.FindViewById <TextView>(Resource.Id.subscribed_text), FontsConstants.PN_R, (float)0.035);
            FontHelper.UpdateFont(areasDetailsView.FindViewById <Button>(Resource.Id.btn_invite_code), FontsConstants.PN_R, (float)0.037);
        }
Beispiel #20
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var          entry = entries[position];
            LinearLayout view  = (convertView ??
                                  context.Inflate(Resource.Layout.EntryListItem, parent, false)) as LinearLayout;
            var itemText = view.FindViewById <TextView>(Resource.Id.itemText);
            var summary  = view.FindViewById <TextView>(Resource.Id.summary);

            itemText.SetText(entry.ItemText, TextView.BufferType.Normal);
            summary.SetText(entry.Summary, TextView.BufferType.Normal);
            return(view);
        }
Beispiel #21
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            int poss = positionImg;

            if (container == null)
            {
                return(null);
            }

            LinearLayout l = (LinearLayout)inflater.Inflate(Resource.Layout.mf, container, false);


            //string p = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "photo1.jpg");

            //Bitmap bitmap = BitmapFactory.DecodeFile(p);
            //ResizeImage("p");


            int pos = this.Arguments.GetInt("pos");

            LinearLayout root = (LinearLayout)l.FindViewById(Resource.Id.root);
            ImageView    img  = (ImageView)l.FindViewById(Resource.Id.content);

            // seul la premiere image a une taille normale. les autres sont à l'échele 0.7
            if (pos != MainActivity.FIRST_PAGE)
            {
                ViewHelper.SetScaleX(root, MainActivity.SMALL_SCALE);
                ViewHelper.SetScaleY(root, MainActivity.SMALL_SCALE);
            }
            else
            {
                ViewHelper.SetScaleX(root, MainActivity.BIG_SCALE);
                ViewHelper.SetScaleY(root, MainActivity.BIG_SCALE);
            }

            img.Click += img_Click;


            int resourceId = (int)typeof(Resource.Drawable).GetField("photo" + pos).GetVa‌​lue(null);

            img.SetImageResource(resourceId);

            float scale    = this.Arguments.GetFloat("scale");
            bool  isBlured = this.Arguments.GetBoolean("IsBlured");

            if (isBlured)
            {
                ViewHelper.SetAlpha(root, MyPagerAdapter.getMinAlpha());
                ViewHelper.SetRotationY(root, MyPagerAdapter.getMinDegree());
            }
            return(l);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <RootPage> e)
        {
            base.OnElementChanged(e);
            var activity = (FormsAppCompatActivity)Context;

            if (e.NewElement != null)
            {
                foreach (var item in Element.Children)
                {
                    if (item is HomeTabbedPage)
                    {
                        barPage = item as HomeTabbedPage;
                        barPage.CurrentPageChanged += delegate(object sender, System.EventArgs ev)
                        {
                            if (barPage.CurrentPage is AccountPage)
                            {
                                Element.HasSearchBar = false;
                            }
                            else
                            {
                                Element.HasSearchBar = true;
                            }
                        };
                    }
                    if (item is SearchPage)
                    {
                        searchPage = item as SearchPage;
                    }
                }
                rootView        = activity.LayoutInflater.Inflate(Resource.Layout.RootView, null) as LinearLayout;
                searchContainer = rootView.FindViewById <FrameLayout>(Resource.Id.search_view_container);

                searchEditContent = rootView.FindViewById <EditText>(Resource.Id.search_edit_content);
                searchEditContent.OnFocusChangeListener = this;
                searchEditContent.AddTextChangedListener(this);
                searchEditContent.SetOnEditorActionListener(this);

                searchBackButton = rootView.FindViewById <ImageButton>(Resource.Id.search_back_button);
                searchBackButton.SetOnClickListener(this);

                searchCloseButton = rootView.FindViewById <ImageButton>(Resource.Id.search_close_button);
                searchCloseButton.SetOnClickListener(this);

                rootContainer    = rootView.FindViewById <FrameLayout>(Resource.Id.root_container);
                rootContainer.Id = rootContainer.GetHashCode();

                ViewGroup.AddView(rootView);

                SwitchBarPage();
            }
        }
Beispiel #23
0
        //这样是可以的但是没有办法定位到索引
        private void Txt_LongClick(object sender, View.LongClickEventArgs e)
        {
            try
            {
                TableTextView tv = (TableTextView)sender;
                int           id = Convert.ToInt32(tv.Tag.ToString().Trim());
                // Toast.MakeText(this, id.ToString(), ToastLength.Long);

                var examContentRuleItem = ExamContext.Rules.Where(s => s.Id == id).FirstOrDefault();
                ExamContext.Rules.Remove(examContentRuleItem);
                //把分数加回去
                ExamContext.Score.AddScore(examContentRuleItem.DeductedScores);
                //更新分数
                tvScore.Text = string.Format("{0}", ExamContext.ExamScore);

                //扣分之后需要把分加回去

                var removeItem = lstRules.Where(s => s.Id == id).FirstOrDefault();
                lstRules.Remove(removeItem);

                mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable);
                mainLinerLayout.RemoveAllViews();
                //不可以只移除界面显示需要移除内存里面的东西
                for (int i = lstRules.Count; i > 0; i--)
                {
                    var item = lstRules[i - 1];
                    relativeLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableNew, null);
                    TableTextView txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_1);
                    txt.SetText(item.ExamItemName, TextView.BufferType.Normal);
                    txt.SetTextColor(Color.Red);

                    txt.Tag        = item.Id.ToString();
                    txt.LongClick += Txt_LongClick;


                    txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_2);
                    txt.SetText(item.DeductedScores.ToString(), TextView.BufferType.Normal);
                    txt.SetTextColor(Color.Red);

                    txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_3);
                    txt.SetText(item.RuleName, TextView.BufferType.Normal);
                    txt.SetTextColor(Color.Red);

                    mainLinerLayout.AddView(relativeLayout);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, GetType().ToString());
            }
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;      // re-use an existing view, if one is available

            if (view == null)             // otherwise create a new one
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.ListItem, null);
            }

            LinearLayout lin = view.FindViewById <LinearLayout> (Resource.Id.list_item);
            LinearLayout colour = view.FindViewById <LinearLayout> (Resource.Id.order_colour);
            TextView     coffee, cafe, orderDate;

            coffee    = lin.FindViewById <TextView> (Resource.Id.txtItemCoffee);
            cafe      = lin.FindViewById <TextView> (Resource.Id.txtItemCafe);
            orderDate = lin.FindViewById <TextView> (Resource.Id.txtItemOrder);


            if (items [position].OrderStatus != "black")
            {
                if (items [position].OrderStatus == "red")
                {
                    colour.SetBackgroundColor(Android.Graphics.Color.Red);
                    orderDate.Text = string.Concat("Expected delivery time: ", items[position].OrderTime.AddMinutes(TempStorage.GetPrepTime(items [position].CafeId)).ToShortTimeString());
                }
                else if (items [position].OrderStatus == "yellow")
                {
                    colour.SetBackgroundColor(Android.Graphics.Color.Yellow);
                    orderDate.Text = string.Concat("Expected delivery time: ", items[position].OrderTime.AddMinutes(TempStorage.GetPrepTime(items [position].CafeId)).ToShortTimeString());
                }
                else if (items [position].OrderStatus == "green")
                {
                    colour.SetBackgroundColor(Android.Graphics.Color.Green);
                    orderDate.Text = string.Concat("Expected delivery time: ", items[position].OrderTime.AddMinutes(TempStorage.GetPrepTime(items [position].CafeId)).ToShortTimeString());
                }
            }
            else
            {
                colour.SetBackgroundColor(Android.Graphics.Color.ParseColor("#FFFFFF"));
                orderDate.Text = items [position].OrderTime.ToString("F");
            }



            coffee.Text = string.Concat(items[position].Size, " ", items [position].Coffee, " ($", items[position].Price, ")");
            cafe.Text   = items [position].CafeName;



            return(view);
        }
 private void SetupFooterBar()
 {
     _footerBar         = FindViewById <LinearLayout>(Resource.Id.footer_bar);
     _prevButton        = _footerBar.FindViewById <TextView>(Resource.Id.prev_button);
     _prevButton.Click += (sender, e) =>
     {
         PrevPage(_viewPager);
     };
     _nextButton        = _footerBar.FindViewById <TextView>(Resource.Id.next_button);
     _nextButton.Click += (sender, e) =>
     {
         NextPage(_viewPager);
     };
 }
        public UserTagView(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
        {
            LinearLayout cardView = (LinearLayout)LayoutInflater.From(context)
                                    .Inflate(Resource.Layout.layout_user_tag_view, null);

            avatarView   = (CircleImageView)cardView.FindViewById(Resource.Id.user_avatar);
            userNameText = (TextView)cardView.FindViewById(Resource.Id.user_name);
            ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, Resources.GetDimensionPixelSize(Resource.Dimension.user_tag_view_height));
            //getResources().getDimensionPixelSize(Resource.Dimension.user_tag_view_height));
            this.AddView(cardView, lp);
            IOnClickListener onclickModel = new OnClickListener(this);

            cardView.SetOnClickListener(onclickModel);
        }
Beispiel #27
0
        /// <summary>
        /// Метод, предназначенный для подключения трех основых страниц к приложению.
        /// </summary>
        private void CreatePages()
        {
            LinearLayout General = FindViewById <LinearLayout>(Resource.Id.General);

            // Находим страничку с картой.
            mapPage = General.FindViewById <LinearLayout>(Resource.Id.Map);
            General.RemoveView(mapPage);
            ContextThemeWrapper wrapper  = new ContextThemeWrapper(this, Resource.Style.AppTheme);
            LayoutInflater      inflater = (LayoutInflater)wrapper.GetSystemService(LayoutInflaterService);

            // Страничка с поиском.
            searchPage = inflater.Inflate(Resource.Layout.PageSearch, null) as LinearLayout;
            // Страничка с настройками.
            settingsPage = inflater.Inflate(Resource.Layout.PageSetting, null) as LinearLayout;
            // Привязка страничек к кнопкам переключения.
            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager1);
            TabLayout tab = FindViewById <TabLayout>(Resource.Id.sliding_tabs);

            // Установка основных вкладок для приложения.
            viewPager.Adapter = new MyPagerAdapter(this, searchPage, mapPage, settingsPage);
            // Установка главной страницы для приложения.
            viewPager.CurrentItem = 1;

            // Привязка заголовков к страницам.
            tab.SetupWithViewPager(viewPager);

            // Установка изображений и текста, для отдельных "табов".
            for (int i = 0; i < iconsForTabs.Length; i++)
            {
                tab.GetTabAt(i).SetText(textForTabs[i]);
                Drawable icon = new BitmapDrawable(bitmapFromVector(ApplicationContext, iconsForTabs[i], 1));
                tab.GetTabAt(i).SetIcon(icon);
            }
        }
        protected override void AssingViews(View view)
        {
            llMedicalTestFirstStep = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestOne);
            llMedicalInfo          = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestConfirmation);


            llMedicalInfo.FindViewById <TextView>(Resource.Id.tvDescription).Visibility = ViewStates.Gone;

            llMedicalInfo.FindViewById <TextView>(Resource.Id.tvDescriptionTwo).Text =
                Resources.GetString(Resource.String.medical_info_description_two_text);

            llMedicalInfo.FindViewById <ImageView>(Resource.Id.ivRiskNext).Visibility =
                ViewStates.Visible;

            llMedicalInfo.FindViewById <ImageView>(Resource.Id.ivPreviousDiagnosedCovidNext).Visibility =
                ViewStates.Invisible;

            llMedicalInfo.FindViewById <ImageView>(Resource.Id.ivDangerWorkNext).Visibility = ViewStates.Invisible;

            llMedicalInfo.FindViewById <LinearLayout>(Resource.Id.llStepBars).Visibility = ViewStates.Gone;

            llMedicalTestFirstStep.FindViewById <LinearLayout>(Resource.Id.llStepBars).Visibility = ViewStates.Gone;


            //Si pulsamos sobre colectivo de riesgo nos muestra la pantalla correspondiente para poder modificarlo
            llMedicalInfo.FindViewById <LinearLayout>(Resource.Id.llModifyRiskConclusion).Click +=
                (o, e) => presenter.ModifyRiskClicked();


            tvRiskConclusion           = llMedicalInfo.FindViewById <TextView>(Resource.Id.tvRiskConclusion);
            tvCovidDiagnosedConclusion = llMedicalInfo.FindViewById <TextView>(Resource.Id.tvCovidDiagnosedConclusion);
            tvDangerWorkConclusion     = llMedicalInfo.FindViewById <TextView>(Resource.Id.tvDangerWorkConclusion);


            btFirstStepYes = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestOne)
                             .FindViewById <TextView>(Resource.Id.btYes);
            btFirstStepYes.Click += (o, e) => presenter.QuestionFirstStepClicked(true);

            btFirstStepNo = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestOne)
                            .FindViewById <TextView>(Resource.Id.btNo);
            btFirstStepNo.Click += (o, e) => presenter.QuestionFirstStepClicked(false);

            btFirstStepSkipQuestion = view.FindViewById <LinearLayout>(Resource.Id.llMedicalTestOne)
                                      .FindViewById <TextView>(Resource.Id.btSkipQuestion);
            btFirstStepSkipQuestion.Click += (o, e) => presenter.QuestionFirstStepClicked(null);


            buttonBack        = view.FindViewById(Resource.Id.buttonBack);
            buttonBack.Click += (o, e) => presenter.BackClicked();

            btConfirm            = llMedicalInfo.FindViewById <TextView>(Resource.Id.btConfirm);
            btConfirm.Visibility = ViewStates.Gone;

            /*btConfirm.Text = Context.GetString( Resource.String.medical_info_button_text);
             * btConfirm.SetBackgroundResource(Resource.Drawable.button_white);
             * btConfirm.SetTextColor(new Android.Graphics.Color(ContextCompat.GetColor(Context, Resource.Color.colorBlackTwo)));
             */

            btConfirm.Click += (sender, args) => presenter.ModifyDataClicked();
        }
        private AlertDialog.Builder CreateDialog(string title, RSSSources _source)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle(title);
            LinearLayout inputLayout = (LinearLayout)LayoutInflater.Inflate(Resource.Layout.NewRSSSourceEntry, null);

            nameInput             = (EditText)inputLayout.FindViewById(Resource.Id.editTextName);
            nameInput.Text        = _source.Name;
            urlInput              = (EditText)inputLayout.FindViewById(Resource.Id.editTextURL);
            urlInput.Text         = _source.Url;
            descriptionInput      = (EditText)inputLayout.FindViewById(Resource.Id.editTextDescription);
            descriptionInput.Text = _source.Description;
            builder.SetView(inputLayout);

            return(builder);
        }
        public void MarkQuestionLeftBlank(int index)
        {
            LinearLayout questionStatusElement = (LinearLayout)questions_container.GetChildAt(index);

            if (questionStatusElement != null)
            {
                TextView questionText   = (TextView)questionStatusElement.FindViewById(Resource.Id.question);
                TextView questionStatus = (TextView)questionStatusElement.FindViewById(Resource.Id.status);
                if (questionStatus.Text.Equals(GetString(Resource.String.question_unanswered)))
                {
                    questionText.SetTextColor(Color.Yellow);
                    questionStatus.SetText(Resource.String.question_left_blank, TextView.BufferType.Normal);
                    num_skipped++;
                }
            }
        }
Beispiel #31
0
		/// <summary>
		/// 初始化
		/// </summary>
		private void InitViews()
		{
			ll_tab_bottom_server = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_server);
			ll_tab_bottom_my = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_my);
			ll_tab_bottom_finance = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_finance);
			btn_tab_bottom_server = ll_tab_bottom_server.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_server);
			tv_tab_bottom_server = ll_tab_bottom_server.FindViewById<TextView> (Resource.Id.tv_tab_bottom_server);
			btn_tab_bottom_finance = ll_tab_bottom_finance.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_finance);
			tv_tab_bottom_finance = ll_tab_bottom_finance.FindViewById<TextView> (Resource.Id.tv_tab_bottom_finance);

			btn_tab_bottom_my = ll_tab_bottom_my.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_my);
			tv_tab_bottom_my = ll_tab_bottom_my.FindViewById<TextView> (Resource.Id.tv_tab_bottom_my);
			//设置触发事件
			ll_tab_bottom_server.SetOnClickListener (this);
			ll_tab_bottom_finance.SetOnClickListener (this);
			ll_tab_bottom_my.SetOnClickListener (this);
		}
Beispiel #32
0
        public void OnAdLoaded(IAd ad)
        {
            Android.Util.Log.Debug (TAG, "Native Ad Loaded");

            if (ad != nativeAd) {
                return;
            }

            // Add ad into the ad container.
            nativeAdContainer = FindViewById<LinearLayout> (Resource.Id.native_ad_container);

            var inflater = LayoutInflater.From (this);
            adView = (LinearLayout)inflater.Inflate (Resource.Layout.NativeAdView, nativeAdContainer, false);
            nativeAdContainer.AddView (adView);

            // Create native UI using the ad metadata.
            var nativeAdIcon = adView.FindViewById<ImageView> (Resource.Id.native_ad_icon);
            var nativeAdTitle = adView.FindViewById<TextView> (Resource.Id.native_ad_title);
            var nativeAdBody = adView.FindViewById<TextView> (Resource.Id.native_ad_body);
            var nativeAdMedia = adView.FindViewById<MediaView> (Resource.Id.native_ad_media);
            var nativeAdSocialContext = adView.FindViewById<TextView> (Resource.Id.native_ad_social_context);
            var nativeAdCallToAction = adView.FindViewById<Button> (Resource.Id.native_ad_call_to_action);

            // Setting the Text.
            nativeAdSocialContext.Text = nativeAd.AdSocialContext;
            nativeAdCallToAction.Text = nativeAd.AdCallToAction;
            nativeAdTitle.Text = nativeAd.AdTitle;
            nativeAdBody.Text = nativeAd.AdBody;

            // Downloading and setting the ad icon.
            var adIcon = nativeAd.AdIcon;
            NativeAd.DownloadAndDisplayImage (adIcon, nativeAdIcon);

            // Download and setting the cover image.
            var adCoverImage = nativeAd.AdCoverImage;
            nativeAdMedia.SetNativeAd (nativeAd);

            // Add adChoices icon
            if (adChoicesView == null) {
                adChoicesView = new AdChoicesView (this, nativeAd, true);
                adView.AddView (adChoicesView, 0);
            }

            nativeAd.RegisterViewForInteraction (adView);
        }
        private void generateUserImage(List<UserDB>users, LinearLayout shell)
        {
            Bitmap blank = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.defaultuserimage);
            Bitmap smallBlank = null;
            byte[] img = null;
            ImageView prof1, prof2, prof3, prof4;
            prof1 = shell.FindViewById<ImageView>(Resource.Id.imgProfile1);
            prof2 = prof3 = prof4 = null;
            if (users.Count > 1)
            {
                smallBlank = Bitmap.CreateScaledBitmap(blank, (int)imageSize [0] / 2, (int)imageSize [0] / 2, false);
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                smallBlank.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
                img = ms.ToArray();
                prof2 = shell.FindViewById<ImageView>(Resource.Id.imgProfile2);
                prof3 = shell.FindViewById<ImageView>(Resource.Id.imgProfile3);
                prof4 = shell.FindViewById<ImageView>(Resource.Id.imgProfile4);
            }
            float imageXY = imageSize [0] / 2;

            List<UserDB> newUsers = users.Where(s => s.AccountID != AndroidData.CurrentUser.AccountID && s != null).ToList();

            if (newUsers.Count == 0 || (newUsers.Count == 1 && newUsers [0].Picture.Length == 0))
                return;

            List<byte[]> userImages = new List<byte[]>();
            for (int n = 0; n < newUsers.Count; ++n)
            {
                if (newUsers [n].Picture.Length > 0)
                {
                    using (Bitmap sm = BitmapFactory.DecodeByteArray(newUsers[n].Picture, 0, newUsers[n].Picture.Length))
                    {
                        using (Bitmap smScale = Bitmap.CreateScaledBitmap(sm, (int)imageXY, (int)imageXY, false))
                        {
                            using (System.IO.MemoryStream mm = new System.IO.MemoryStream())
                            {
                                smScale.Compress(Bitmap.CompressFormat.Jpeg, 80, mm);
                                userImages.Add(mm.ToArray());
                            }
                        }
                    }
                } else
                {
                    if (Contacts.ContactsUtil.contactFilenames.Contains(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, newUsers [n].AccountGuid)))
                    {
                        using (Bitmap small = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, newUsers [n].AccountGuid)))
                        {
                            using (Bitmap smallUser = Bitmap.CreateScaledBitmap (small, (int)imageXY, (int)imageXY, false))
                            {
                                using (System.IO.MemoryStream m = new System.IO.MemoryStream ())
                                {
                                    smallUser.Compress(Bitmap.CompressFormat.Jpeg, 80, m);
                                    userImages.Add(m.ToArray());
                                }
                            }
                        }
                    } else
                        userImages.Add(img);
                }
            }

            Bitmap [] bitmaps = new Bitmap[userImages.Count];

            for (int n = 0; n < userImages.Count; ++n)
            {
                bitmaps [n] = ImageHelper.CreateUserProfileImageForDisplay(userImages [n], (int)imageXY, (int)imageXY, this.Resources);
                if (bitmaps [n] == null)
                    bitmaps [n] = blank;
            }

            if (userImages.Count == 1 && users.Count == 1)
            {
                prof1.SetImageBitmap(bitmaps [0]);
            }

            int diff = users.Count - userImages.Count;
            switch (userImages.Count)
            {
                case 2:
                    prof1.SetImageBitmap(bitmaps [0]);
                    prof2.SetImageBitmap(bitmaps [1]);
                    break;
                case 3:
                    prof1.SetImageBitmap(bitmaps [0]);
                    prof2.SetImageBitmap(bitmaps [1]);
                    prof3.SetImageBitmap(bitmaps [2]);
                    break;
                case 4:
                    prof1.SetImageBitmap(bitmaps [0]);
                    prof2.SetImageBitmap(bitmaps [1]);
                    prof3.SetImageBitmap(bitmaps [2]);
                    prof3.SetImageBitmap(bitmaps [3]);
                    break;
            }
        }
Beispiel #34
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            confirmedcards.Clear();
                            potencialcards.Clear();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                     			if(geteventsresponse.available){
                                 	eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y)
                                        {
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                        for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                        }
                                        for(int m=0;m<eventcards.Count;m++){

                                        if(eventcards[m].eventinfo.have_contract!=null&&eventcards[m].eventinfo.have_contract.Equals("Y")){
                                            confirmedcards.Add(eventcards[m]);
                                        }else{
                                            potencialcards.Add(eventcards[m]);
                                        }
                                            if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                                App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                    (Tap5050WebResponse imgresponse)=>{
                                                        if(imgresponse.available){
                                                            var array=(byte[])imgresponse.parsedobject;
                                                            var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                            try{
                                                                Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);

                                                                //Bitmap imageWithBG = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, imageBitmap.GetConfig());  // Create another image the same size
                                                                //imageWithBG.EraseColor(global::Android.Graphics.Color.Transparent);
                                                                //Canvas canvas = new Canvas(imageWithBG);
                                                                //canvas.DrawBitmap(imageBitmap, 0f, 0f, null);
                                                                //imageBitmap.Recycle();

                                                                //var imageBitmaphandle=imageBitmap.Copy(imageBitmap.GetConfig(), true);
                                                                //var imageBitmaphandle = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, Bitmap.Config.Argb8888);

                                                                // for (int x = 0; x < imageBitmaphandle.Width; x++)
                                                                //{
                                                                //    for (int y = 0; y < imageBitmaphandle.Height; y++)
                                                                //    { d

                                                                //        if (imageBitmaphandle.GetPixel(x, y) == global::Android.Graphics.Color.White)
                                                                //        {
                                                                //            imageBitmaphandle.SetPixel(x, y, global::Android.Graphics.Color.Transparent);
                                                                //        }
                                                                //    }
                                                                //}

                                                                eventcards[flag.position].originalmap = Bitmap.CreateScaledBitmap(imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                                Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(50), TapUtil.dptodx(50), false);
                                                                eventcards[flag.position].imagemap=newbitmap;

                                                                nn_activity.RunOnUiThread(()=>{
                                                                    adapter.NotifyDataSetChanged();
                                                                });
                                                            }
                                                            catch(Exception e){
                                                                Console.WriteLine (e);
                                                            }
                                                        }
                                                    });
                                            }
                                        }

                                    //update tap
                                    nn_activity.RunOnUiThread(()=>{
                                        if(showconfirmed){

                                            adapter.ChangeListAndUpdate(confirmedcards);
                                        }
                                        else{
                                            adapter.ChangeListAndUpdate(potencialcards);
                                        }
                                    });

                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){

                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }

                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);

                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;

                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;

                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;

                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;

                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                        }// end of if eventcards.Count==0

                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents

                            //for pop alert for teanm events
                            popthread.ClearQueue();
                            teaminvitations.Clear();
                            teamrequests.Clear();
                            popinitialized=false;
                            //get invitation notifications
                            Dictionary<string, string> getinvitaitonsparameters = new Dictionary<string, string> ();
                            getinvitaitonsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetTeamInvitationNotification (getinvitaitonsparameters,(Tap5050WebResponse getinviationresponse)=>{
                                if(getinviationresponse.available){
                                    teaminvitations=(List<Tap5050TeamInvitation>)getinviationresponse.parsedobject;
                                    popthread.Push(teaminvitations);
                                    if(popinitialized){
                                        popthread.SetSignal();
                                    }
                                    popinitialized=true;
                                    //									if(teaminvitations.Count>0){
                                    //										var invitaioninfo=teaminvitations[0];
                                    //										nn_activity.ShowCustomNeutralAlterDialogFragment(TeamScreenData.InvitationPopTitle,string.Format(TeamScreenData.InvitationPopDetail,invitaioninfo.leader_first_name+" "+invitaioninfo.leader_last_name,invitaioninfo.group_name,invitaioninfo.event_name),
                                    //											TeamScreenData.InvitationPopPositive,TeamScreenData.InvitationPopNegative,TeamScreenData.InvitationPopNeurtal,"invitepop.relationships.team",invitaioninfo);
                                    //										teaminvitations.RemoveAt(0);
                                    //									}
                                }
                            });
                            //get all reqeust
                            Dictionary<string, string> getreqeustsparameters = new Dictionary<string, string> ();
                            getreqeustsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetJoinTeamRequestNotification (getreqeustsparameters,(Tap5050WebResponse getreqeustresponse)=>{
                                if(getreqeustresponse.available){
                                    teamrequests=(List<Tap5050TeamRequest>)getreqeustresponse.parsedobject;
                                    popthread.Push(teamrequests);
                                }
                                if(popinitialized){
                                    popthread.SetSignal();
                                }
                                popinitialized=true;

                            });

                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,GlobalScreenData.DefaultPositive,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
Beispiel #35
0
			public ViewHolder(LinearLayout ll) : base(ll)
			{
				Layout = ll;
				MenuText = ll.FindViewById<TextView>(Resource.Id.menuText);
			}
        private void CreateMessagesUI()
        {
            List<UserDB> participants = new List<UserDB>();
            bool moreThanOne = false, isCurrentMe = false;

            if (MessageConversations.clearView)
            {
                listWrapper.RemoveAllViewsInLayout();
                MessageConversations.clearView = false;
            }

            if (Contacts.SelectContactsUtil.selectedContacts.Count != 0)
                Contacts.SelectContactsUtil.selectedContacts.Clear();

            if (MessageConversations.currentConversationMessages [0].MessageRecipientDBList.Count > 1)
            {
                moreThanOne = true;
                for (int m = 0; m < MessageConversations.currentConversationMessages[0].MessageRecipientDBList.Count; ++m)
                {
                    if (MessageConversations.currentConversationMessages [0].MessageRecipientDBList [m].AccountGuid != AndroidData.CurrentUser.AccountID.ToString())
                    {
                        UserDB userDetails = dbm.GetUserWithAccountID(MessageConversations.currentConversationMessages [0].MessageRecipientDBList [m].AccountGuid);
                        participants.Add(userDetails);
                        ContactDB contact = new ContactDB();
                        contact.ContactUser = new LOLAccountManagement.User();
                        contact.ContactUser.AccountID = userDetails.AccountID;
                        Contacts.SelectContactsUtil.selectedContacts.Add(contact);
                    } else
                    {
                        UserDB userDetails = UserDB.ConvertFromUser(AndroidData.CurrentUser);
                        participants.Add(userDetails);
                    }
                }
            }

            if (moreThanOne)
            {
                string toReturn = "";
                List<UserDB> sortedList = new List<UserDB>();
                sortedList = participants.OrderBy(s => s.LastName).OrderBy(s => s.FirstName).ToList();
                foreach (UserDB eachItem in sortedList)
                    toReturn += string.Format("{0} {1}, ", eachItem.FirstName, eachItem.LastName);
                int last = toReturn.LastIndexOf(", ");
                toReturn = toReturn.Remove(last);

                using (LinearLayout btnlayout = new LinearLayout (context))
                {
                    btnlayout.Orientation = Android.Widget.Orientation.Vertical;
                    btnlayout.SetGravity(GravityFlags.Center);
                    btnlayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                    btnlayout.SetPadding((int)ImageHelper.convertDpToPixel(5f, context), 0, (int)ImageHelper.convertDpToPixel(5f, context), (int)ImageHelper.convertDpToPixel(10f, context));

                    using (TextView name = new TextView(context))
                    {
                        name.Text = toReturn;
                        name.SetTextSize(Android.Util.ComplexUnitType.Dip, 18f);
                        name.SetTextColor(Color.Black);
                        RunOnUiThread(() => btnlayout.AddView(name));
                    }

                    using (Button showAll = new Button (context))
                    {
                        showAll.Gravity = GravityFlags.CenterVertical;
                        showAll.Text = Application.Context.Resources.GetString(Resource.String.messageShowAllInConversation);
                        showAll.Click += (object sender, EventArgs e) => {
                            showParticipants(sender, e, participants); };
                        showAll.SetWidth((int)ImageHelper.convertDpToPixel(180f, context));
                        showAll.SetHeight((int)ImageHelper.convertDpToPixel(30f, context));
                        showAll.SetBackgroundResource(Resource.Drawable.button);
                        RunOnUiThread(() => btnlayout.AddView(showAll));
                    }
                    RunOnUiThread(() => listWrapper.AddView(btnlayout));
                }
            }
            myView = null;
            LayoutInflater factory = LayoutInflater.From(this);

            foreach (MessageDB message in MessageConversations.currentConversationMessages)
            {
                if (message != null)
                {
                    if (!moreThanOne)
                        myView = factory.Inflate(Resource.Layout.lstConversation, null);
                    else
                        myView = factory.Inflate(Resource.Layout.lstConversationMulti, null);

                    isCurrentMe = message.FromAccountID != AndroidData.CurrentUser.AccountID ? false : true;
                    LinearLayout shell = new LinearLayout(context);

                    shell.Orientation = Orientation.Horizontal;
                    shell.SetGravity(GravityFlags.CenterVertical);
                    shell.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                    shell.SetPadding(0, 0, 0, (int)ImageHelper.convertDpToPixel(5f, context));
                    RunOnUiThread(() => shell.AddView(myView));

                    UserDB whoAmI = new UserDB();
                    whoAmI = message.FromAccountID != AndroidData.CurrentUser.AccountID ? dbm.GetUserWithAccountID(message.FromAccountGuid) : UserDB.ConvertFromUser(AndroidData.CurrentUser);

                    ImageView userImage = shell.FindViewById<ImageView>(Resource.Id.imgProfile1);
                    if (Contacts.ContactsUtil.contactFilenames.Contains(message.FromAccountGuid))
                    {
                        using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, message.FromAccountGuid)))
                        {
                            using (MemoryStream ms = new MemoryStream ())
                            {
                                bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
                                byte[] image = ms.ToArray();
                                using (Bitmap myBitmap = ImageHelper.CreateUserProfileImageForDisplay(image, (int)imageSize[0], (int)imageSize[1], this.Resources))
                                {
                                    RunOnUiThread(delegate
                                    {
                                        userImage.SetImageBitmap(myBitmap);
                                    });
                                }
                            }
                        }
                    } else
                    {
                        userImage.LayoutParameters = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel(imageSize [0], context), (int)ImageHelper.convertDpToPixel(imageSize [1], context));
                        userImage.SetScaleType(ImageView.ScaleType.FitXy);
                        userImage.SetImageResource(Resource.Drawable.defaultuserimage);
                    }

                    int left = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth - (int)ImageHelper.convertDpToPixel(imageSize [0] + 20f, context);
                    int leftOver = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth - (int)ImageHelper.convertDpToPixel(imageSize [0] + 40f, context);

                    TextView whoIsIt = shell.FindViewById<TextView>(Resource.Id.textNames);
                    whoIsIt.Gravity = !isCurrentMe ? GravityFlags.Left : GravityFlags.Right;
                    whoIsIt.Text = whoAmI.FirstName + " " + whoAmI.LastName;

                    for (int m = 0; m < message.MessageStepDBList.Count; ++m)
                    {
                        if (message.MessageStepDBList [m].StepType == LOLMessageDelivery.MessageStep.StepTypes.Text)
                        {
                            TextView messageText = shell.FindViewById<TextView>(Resource.Id.textMessageBubble);

                            messageText.SetBackgroundResource(message.FromAccountID != AndroidData.CurrentUser.AccountID ? Resource.Drawable.bubblesolidleft :
                                                           Resource.Drawable.bubblesolidright);
                            int lr = (int)ImageHelper.convertDpToPixel(20f, context);
                            int tb = lr / 2;
                            messageText.SetPadding(lr, tb, lr, tb);
                            messageText.SetTextColor(Color.White);
                            messageText.SetTextSize(Android.Util.ComplexUnitType.Dip, 14f);
                            string messager = message.MessageStepDBList [m].MessageText;
                            if (messager.Length > 40)
                                messager = messager.Substring(0, 40) + "...";
                            messageText.Text = messager;
                            messageText.ContentDescription = message.MessageGuid;
                            break;
                        }
                    }

                    TextView messageDate = shell.FindViewById<TextView>(Resource.Id.textDateSent);
                    messageDate.SetTextColor(Color.Black);
                    messageDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 10f);
                    messageDate.Gravity = message.FromAccountID != AndroidData.CurrentUser.AccountID ? GravityFlags.Left : GravityFlags.Right;
                    messageDate.Text = message.MessageSent.ToShortTimeString() + ", " + message.MessageSent.ToShortDateString();

                    TextView txtMessageUnread = shell.FindViewById<TextView>(Resource.Id.txtMessageUnread);
                    txtMessageUnread.Visibility = ViewStates.Gone;

                    LinearLayout messageItems = shell.FindViewById<LinearLayout>(Resource.Id.linearLayout7);
                    messageItems = createMessageBar(messageItems, message, leftOver);

                    RunOnUiThread(delegate
                    {
                        listWrapper.AddView(shell);
                        shell = null;
                    });
                }
            }
            if (progress != null)
                RunOnUiThread(() => progress.Dismiss());
        }
Beispiel #37
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                            if(geteventsresponse.available){
                                    eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y){
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                    for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                    }
                                    for(int m=0;m<eventcards.Count;m++){
                                        if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                            App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                (Tap5050WebResponse imgresponse)=>{
                                                    if(imgresponse.available){
                                                        var array=(byte[])imgresponse.parsedobject;
                                                        var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                        try{
                                                            Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);
                                                            eventcards[flag.position].originalmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                            Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(40), TapUtil.dptodx(40), false);
                                                            eventcards[flag.position].imagemap=newbitmap;

                                                            nn_activity.RunOnUiThread(()=>{
                                                                adapter.NotifyDataSetChanged();
                                                            });
                                                        }
                                                        catch(Exception e){
                                                            Console.WriteLine (e);
                                                        }
                                                    }
                                                });
                                        }
                                    }
                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){
                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }
                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);
                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;
                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;
                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;
                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;
                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty","OK",null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number","OK",null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                            }
                                        adapter.NotifyListChange();
                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(RaffleListScreenData.AlertScreenLoadRafflesFailTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,"Ok",null,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
        private void CreateUI()
        {
            if (MessageConversations.clearView)
            {
                RunOnUiThread(() => listWrapper.RemoveAllViewsInLayout());
                MessageConversations.clearView = false;
            }
            int c = 0;
            List<int> unreadMessages = new List<int>();
            int numberInConversation = 0;
            foreach (LOLMessageConversation conversation in MessageConversations.conversationsList)
            {
                unreadMessages.Add(conversation.MessageIDs.Count - conversation.ReadMessageIDs.Count);
                int t = 0;
            }
            if (unknownUsers == null)
                unknownUsers = new List<Guid>();
            else
                unknownUsers.Clear();

            myView = null;
            LayoutInflater factory = LayoutInflater.From(this);
            List<Guid> unknownMessages = new List<Guid>();
            foreach (MessageDB latestMessage in MessageConversations.initialMessages)
            {
                UserDB whoFrom = new UserDB();
                whoFrom = dbm.GetUserWithAccountID(MessageConversations.conversationsList [c].Recipients [0].ToString());
                if (latestMessage.MessageRecipientDBList.Count != 0)
                {

                    if (whoFrom == null && latestMessage.MessageRecipientDBList [0].AccountGuid == AndroidData.CurrentUser.AccountID.ToString())
                        whoFrom = UserDB.ConvertFromUser(AndroidData.CurrentUser);
                    if (whoFrom != null)
                    {
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine("c = {0}, Recipient[0] Guid = {1}, whoFrom name = {2} {3}", c, MessageConversations.conversationsList [c].Recipients [0],
                                      whoFrom.FirstName, whoFrom.LastName);
                        #endif
                        List<UserDB> users = new List<UserDB>();
                        numberInConversation = latestMessage.MessageRecipientDBList.Count;
                        for (int i = 0; i < (numberInConversation > 3 ? 3 : numberInConversation); ++i)
                        {
                            if (latestMessage.MessageRecipientDBList [i] != null)
                            {
                                UserDB current = dbm.GetUserWithAccountID(latestMessage.MessageRecipientDBList [i].AccountGuid.ToString());
                                if (current == null && latestMessage.MessageRecipientDBList [i].AccountGuid != AndroidData.CurrentUser.AccountID.ToString())
                                    unknownUsers.Add(new Guid(latestMessage.MessageRecipientDBList [i].AccountGuid));
                                else
                                {
                                    //users.Add (current);
                                    if (current == null && latestMessage.MessageRecipientDBList [i].AccountGuid == AndroidData.CurrentUser.AccountID.ToString())
                                        users.Add(UserDB.ConvertFromUser(AndroidData.CurrentUser));
                                    else
                                        users.Add(current);
                                }
                            }
                        }

                        UserDB sender = new UserDB();
                        sender = dbm.GetUserWithAccountID(latestMessage.FromAccountGuid);
                        if (sender == null)
                            sender = UserDB.ConvertFromUser(AndroidData.CurrentUser);

                        if (numberInConversation == 1)
                            myView = factory.Inflate(Resource.Layout.lstConversation, null);
                        else
                            myView = factory.Inflate(Resource.Layout.lstConversationMulti, null);

                        int leftOver = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth - (int)ImageHelper.convertDpToPixel(imageSize [0] + 30f, context);
                        LinearLayout shell = new LinearLayout(context);

                        shell.Orientation = Orientation.Horizontal;
                        shell.SetGravity(GravityFlags.CenterVertical);
                        shell.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                        shell.SetPadding(0, 0, 0, (int)ImageHelper.convertDpToPixel(5f, context));

                        RunOnUiThread(() => shell.AddView(myView));
                        if (users.Count != 0)
                            generateUserImage(users, shell);

                        TextView whoAmI = shell.FindViewById<TextView>(Resource.Id.textNames);
                        string myName = sender.FirstName + " " + sender.LastName;
                        if (numberInConversation != 1)
                        {
                            myName += string.Format(" and {0} other{1}", numberInConversation == 2 ? "1" :
                                                     (numberInConversation - 1).ToString(), numberInConversation == 2 ? "." : "s.");
                        }
                        whoAmI.Text = myName;
                        whoAmI.SetTextSize(Android.Util.ComplexUnitType.Dip, 12f);

                        TextView txtMessage = shell.FindViewById<TextView>(Resource.Id.textMessageBubble);
                        if (latestMessage.MessageStepDBList.Count == 1 && latestMessage.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text)
                        {
                            txtMessage = messageTextBox(txtMessage, latestMessage, 0, leftOver);
                        } else
                        {
                            for (int n = 0; n < latestMessage.MessageStepDBList.Count; ++n)
                            {
                                if (latestMessage.MessageStepDBList [n].StepType == MessageStep.StepTypes.Text)
                                {
                                    txtMessage = messageTextBox(txtMessage, latestMessage, n, leftOver);
                                    break;
                                }
                            }
                        }

                        txtMessage.ContentDescription = latestMessage.MessageID.ToString();
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine("ContentDesctription = {0}, ID = {1}", txtMessage.ContentDescription, latestMessage.ID);
                        #endif
                        txtMessage.Click += textMessage_Click;

                        TextView txtDateSent = shell.FindViewById<TextView>(Resource.Id.textDateSent);
                        txtDateSent.Text = latestMessage.MessageSent.ToShortDateString();

                        TextView txtMessageUnread = shell.FindViewById<TextView>(Resource.Id.txtMessageUnread);
                        txtMessageUnread.SetTextSize(Android.Util.ComplexUnitType.Dip, 10f);
                        if (unreadMessages [c] == 0)
                            txtMessageUnread.Text = context.Resources.GetString(Resource.String.conversationUINoUnreadMessages);
                        else
                            txtMessageUnread.Text = string.Format("({0}) {1}{2}", unreadMessages [c],
                                                                   context.Resources.GetString(Resource.String.conversationUIUnreadMessages),
                                                                   unreadMessages [c] == 1 ? "." : "s.");

                        LinearLayout messageItems = shell.FindViewById<LinearLayout>(Resource.Id.linearLayout7);
                        if (latestMessage.MessageStepDBList.Count > 0)
                        {
                            createMessageBar(messageItems, latestMessage, leftOver);
                            messageItems.ContentDescription = latestMessage.MessageGuid;
                            messageItems.Click += messageBar_Click;
                        }

                        RunOnUiThread(delegate
                        {
                            listWrapper.AddView(shell);
                            shell = null;
                        });

                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine("done a loop");
                        #endif

                    }
                }
                if (c < MessageConversations.initialMessages.Count - 2)
                    c++;

            }
            //});

            if (unknownUsers.Count != 0)
            {
                Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser(unknownUsers, context);
            }
            if (progress != null)
                RunOnUiThread(() => progress.Dismiss());
        }
		public async Task Show(TopAlert alert)
		{
			await Stop ();

			this._Token = new CancellationTokenSource ();

			this._Delay = alert.Duration;

			var activity = Xamarin.Forms.Forms.Context as Android.App.Activity;
			IWindowManager windowManager = Xamarin.Forms.Forms.Context.GetSystemService(Android.App.Service.WindowService).JavaCast<IWindowManager>();
			this._Layout = (LinearLayout)activity.LayoutInflater.Inflate(Resource.Layout.AlertBox, null, false);
			this._Layout.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

			var submain = this._Layout.FindViewById<LinearLayout> (Resource.Id.linearLayout3);
			submain.SetBackgroundColor (alert.BackgroundColor.ToAndroid());

			var main = _Layout.FindViewById<LinearLayout> (Resource.Id.linearLayout1);

			var id = Xamarin.Forms.Forms.Context.Resources.GetIdentifier ("alertborder", "drawable", Xamarin.Forms.Forms.Context.PackageName);
			Android.Graphics.Drawables.GradientDrawable drawable = 
				Xamarin.Forms.Forms.Context.Resources.GetDrawable (id).JavaCast<Android.Graphics.Drawables.GradientDrawable>();


			var text = submain.FindViewById<TextView> (Resource.Id.textView1);
			text.SetTextColor (alert.TextColor.ToAndroid ());
			text.Text = alert.Text;

			if (alert.TextSize > 0) {
				text.TextSize = alert.TextSize;
			}

			drawable.SetColor (alert.BorderColor.ToAndroid ());
			drawable.SetCornerRadius (alert.BorderWidth);
			main.SetBackground (drawable);

			//activity.ActionBar.Hide ();

			var actionBarHeight = activity.ActionBar.Height;

			var intent = alert.Intent;

			var p = new WindowManagerLayoutParams (
				windowManager.DefaultDisplay.Width - intent * 2,
				(alert.AlertHeight < 0 ? 200 : (int)alert.AlertHeight),
				WindowManagerTypes.SystemAlert,
				0 | WindowManagerFlags.NotFocusable,
				Android.Graphics.Format.Translucent);

			var yOffset = alert.TopOffset;
			p.Gravity = GravityFlags.Top | GravityFlags.Left;
			p.X = intent;
			p.Y = alert.TopOffset + yOffset + (activity.ActionBar.IsShowing ? actionBarHeight : 0);
			p.Height = (alert.AlertHeight < 0 ? 200 : (int)alert.AlertHeight);
			windowManager.AddView (_Layout, p);

			this._Layout.Touch += LayoutTouched;

			Task.Run (async() => {

				await Task.Delay(alert.Duration, this._Token.Token);

				if (this._Token != null && this._Token.IsCancellationRequested == false)
				{
					if(alert.FadeOut)
					{
						Xamarin.Forms.Device.BeginInvokeOnMainThread( () => {
							// this works
							this._fadeOut = ObjectAnimator.OfFloat(_Layout, "alpha", 1f, 0f);
							this._fadeOut.SetDuration(1000);
							this._fadeOut.AnimationEnd += _fadeOut_AnimationEnd;
							this._Set = new AnimatorSet();
							this._Set.Play(_fadeOut);
							this._Set.Start();
						});
					}
					else
					{
						Stop();
					}
				}
			});
		}
        private void addMessages(LinearLayout view, int containerResourceId, IEnumerable<string> messages, int itemResourceId)
        {
            LinearLayout container = view.FindViewById<LinearLayout>(containerResourceId);

            container.RemoveAllViews();

            foreach (string message in messages)
            {
                var messageView = _context.LayoutInflater.Inflate(itemResourceId, null);
                messageView.FindViewById<TextView>(Resource.Id.MessageText).Text = message;

                messageView.LongClick += (sender, args) =>
                {
                    MessageHub.Instance.Publish(new MessageLongClickedMessage(messageView, message));
                };
                container.AddView(messageView);
            }
        }
        public CategoryViewHolder(LinearLayout container) {
			Icon = container.FindViewById<ImageView>(Resource.Id.category_icon);
			Title = container.FindViewById<TextView>(Resource.Id.category_title);
		}
Beispiel #42
0
        private void SetMoneyView(LinearLayout layout, int value)
        {
            var goldShare = value < 0 ? "-" : string.Empty;
            goldShare += MoneyHelper.ExtractGoldShare(value).ToString();
            layout.FindViewById<TextView>(Resource.Id.Gold).Text = goldShare;

            layout.FindViewById<TextView>(Resource.Id.Silver).Text = MoneyHelper.ExtractSilverShare(value).ToString();
            layout.FindViewById<TextView>(Resource.Id.Copper).Text = MoneyHelper.ExtractCopperShare(value).ToString();
        }
        /// <inheritdoc/>
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ZTnTrace.Trace(MethodBase.GetCurrentMethod());

            var view = inflater.Inflate(Resource.Layout.GearItemEditor, container, false);

            view.FindViewById<TextView>(Resource.Id.gearItemName)
                .Text = D3Context.Instance.EditingItem.Name;

            var editingItem = D3Context.Instance.EditingItem;
            editingItem.Attributes = new ItemTextAttributes { Primary = new[] { new ItemTextAttribute { Text = Application.Context.Resources.GetString(Resource.String.EditedItem) } } };

            // Attributes
            layoutAttributes = view.FindViewById<LinearLayout>(Resource.Id.layoutAttributes);
            layoutAttributes.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutAttributes.AddView(CreateRowView(attributeLabels, AttributeFields), layoutAttributes.ChildCount - 1);

            foreach (var descriptor in AttributeFields)
            {
                CreateAttributeRowView(descriptor);
            }

            // Damages
            layoutItemDamage = view.FindViewById<LinearLayout>(Resource.Id.layoutItemDamage);
            layoutItemDamage.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutItemDamage.AddView(CreateRowView(itemDamageLabels, ItemDamageFields), layoutItemDamage.ChildCount - 1);

            foreach (var descriptor in ItemDamageFields)
            {
                CreateItemDamageRowView(descriptor);
            }

            // Damage Weapons
            layoutWeaponDamage = view.FindViewById<LinearLayout>(Resource.Id.layoutWeaponDamage);
            layoutWeaponDamage.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutWeaponDamage.AddView(CreateRowView(weaponDamageLabels, WeaponDamageFields), layoutWeaponDamage.ChildCount - 1);

            foreach (var descriptor in WeaponDamageFields)
            {
                CreateWeaponDamageRowView(descriptor);
            }

            // Defense
            layoutDefense = view.FindViewById<LinearLayout>(Resource.Id.layoutDefense);
            layoutDefense.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutDefense.AddView(CreateRowView(defenseLabels, DefenseFields), layoutDefense.ChildCount - 1);

            foreach (var descriptor in DefenseFields)
            {
                CreateDefenseRowView(descriptor);
            }

            // Skills
            layoutSkillBonus = view.FindViewById<LinearLayout>(Resource.Id.layoutSkillBonus);
            layoutSkillBonus.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutSkillBonus.AddView(CreateRowView(skillBonusLabels, SkillBonusFields), layoutSkillBonus.ChildCount - 1);

            foreach (var descriptor in SkillBonusFields)
            {
                CreateSkillBonusRowView(descriptor);
            }

            // Sockets
            layoutSockets = view.FindViewById<LinearLayout>(Resource.Id.layoutSockets);
            layoutSockets.FindViewById<ImageButton>(Resource.Id.add)
                .Click += (sender, e) => layoutSockets.AddView(CreateSocketRowView(socketLabels, KnownGems.GetGemsForItem(D3Context.Instance.EditingItem)), layoutSockets.ChildCount - 1);

            var itemGems = D3Context.Instance.EditingItem.Gems;
            if (itemGems != null)
            {
                foreach (var socketedGem in itemGems)
                {
                    layoutSockets.AddView(CreateSocketRowView(socketLabels, KnownGems.GetGemsForItem(D3Context.Instance.EditingItem), socketedGem.Item), layoutSockets.ChildCount - 1);
                }
            }

            return view;
        }