public override Android.Views.View GetSampleContent (Android.Content.Context context)
		{
			LinearLayout layout= new LinearLayout(context);
			layout.Orientation = Orientation.Vertical;
			TextView textView= new TextView(context);
			textView.TextSize = 16;
			textView.SetPadding(10,20,0,0);
			textView.SetHeight(70);

			textView.Text ="Top Population Countries With Bubbles";
			layout.AddView(textView);
			textView.Gravity = Android.Views.GravityFlags.Top;
			maps = new SfMaps (context);
			ShapeFileLayer layer = new ShapeFileLayer ();
			layer.ShowItems = true;
			layer.Uri ="world1.shp";
			layer.DataSource = GetDataSource();
			layer.ShapeIdPath = "Country";
			layer.ShapeIdTableField = "NAME";
			layer.ShapeSettings = new ShapeSetting ();
			layer.ShapeSettings.ShapeValuePath= "ShortName";
			layer.ShapeSettings.ShapeFill = Color.ParseColor ("#A9D9F7");
			BubbleMarkerSetting marker = new BubbleMarkerSetting ()
			{  FillColor = Color.ParseColor ("#ffa500"), MinSize=15,MaxSize=25, ValuePath="Population" };
			layer.BubbleMarkerSetting = marker;
			maps.Layers.Add (layer);
			layout.AddView (maps);
			return layout;
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new FrameLayout(this);

            surface = UrhoSurface.CreateSurface(this, typeof(MySample));
            //surface.Background.SetAlpha(10);

            TextView txtView = new TextView(this);
            txtView.SetBackgroundColor(Color.Violet);
            txtView.SetWidth(10);
            txtView.SetHeight(10);

            txtView.Text = "HAHAH";
            //txtView.Text = surface.Background.ToString();
            Button btn = new Button(this);
            btn.SetBackgroundColor(Color.Transparent);
            btn.Text = "Button";
            btn.SetHeight(100);
            btn.SetWidth(100);
            btn.SetX(30);
            btn.SetY(30);
            btn.TextAlignment = TextAlignment.Center;
            mLayout.AddView(txtView);
            mLayout.AddView(btn);
            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
예제 #3
0
 private void Initialize()
 {
     var text = new TextView(Context);
     text.SetHeight(500);
     text.SetWidth(200);
     text.SetText(Resource.String.FooWidgetText);
     AddView(text);
 }
예제 #4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            TextView button = new TextView(context);
            button.SetText(chapters[position], TextView.BufferType.Normal);
            button.TextSize = 32;
            button.SetTypeface(ThisApp.Font(context, "ionbold"), Android.Graphics.TypefaceStyle.Normal);
            button.SetHeight(84);
            button.SetBackgroundResource(Resource.Drawable.metro_button_style);
            button.Gravity = GravityFlags.Center;
            //button.SetPadding(0, 0, 0, 0);
            //button.SetTextColor(Resources.System.GetColorStateList(Resource.Color.metro_button_text_style));
            //button.SetTextColor(Resources.System.GetColor(Resource.Color.metro_button_text_style));
            button.Id = position;

            button.Click += button_Click;

            return button;
        }
		public override Android.Views.View GetSampleContent (Android.Content.Context context)
		{
			Toast currentToast=new Toast(context);
			LinearLayout layout= new LinearLayout(context);
			layout.Orientation = Orientation.Vertical;
			TextView textView= new TextView(context);
			textView.TextSize = 20;
			textView.SetPadding(10,20,0,0);
			textView.SetHeight(70);

			textView.Text ="Primary Agricultural Data of USA";
			layout.AddView(textView);
			textView.Gravity = Android.Views.GravityFlags.Top;
			maps = new SfMaps (context);

			ShapeFileLayer layer = new ShapeFileLayer();
			layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => {
				JSONObject data = (JSONObject)e.P0;
				if (data != null) {
					if (currentToast != null) {
						currentToast.Cancel ();
					}
					currentToast = Toast.MakeText (context, data.Get ("Name") + "\n" + data.Get ("Type"), ToastLength.Short);
					currentToast.Show ();
				}
			};
			layer.EnableSelection = true;
			layer.Uri ="usa_state.shp";
			layer.ShapeIdTableField ="STATE_NAME";
			layer.ShapeIdPath ="Name";
			layer.DataSource = GetDataSource ();
			layer.ShapeSettings.ShapeStrokeThickess = 2;
			SetColorMapping(layer.ShapeSettings);
			layer.ShapeSettings.ShapeColorValuePath ="Type";
			maps.Layers.Add (layer);
			maps.SetY(-20);
			layout.AddView (maps);
			return layout;
		}
        private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false)
        {
            message.Reverse ();
            contact.Reverse ();
            int m = 0;
            string messager = "";
            bool dd = false;
            if (message != null && contact != null) {

                if (clear == false)
                    RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ());
                string othername = string.Empty;
                for (int i = 0; i < contact.Count; ++i) {
                    if (string.IsNullOrEmpty (nameTitle))
                        othername = contact [i].FirstName + " " + contact [i].LastName;
                    else
                        othername = nameTitle;
                    if (isMe != othername) {
                        RunOnUiThread (delegate {
                            Header.headertext = othername;
                            Header.fontsize = 36f;
                            ImageHelper.fontSizeInfo (header.Context);
                            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
                            header.Text = Header.headertext;
                        });
                        break;
                    }
                }

                if (contact.Count > 1) {
                    string toReturn = "";
                    List<UserDB> sortedList = new List<UserDB> ();
                    sortedList = contact.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);
                    RunOnUiThread (delegate {
                        using (LinearLayout btnlayout = new LinearLayout (context)) {
                            btnlayout.Orientation = Android.Widget.Orientation.Vertical;
                            btnlayout.SetGravity (GravityFlags.Center);
                            btnlayout.LayoutParameters = new ViewGroup.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);
                                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, contact); };
                                showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context));
                                showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context));
                                showAll.SetBackgroundResource (Resource.Drawable.button);
                                btnlayout.AddView (showAll);
                            }
                            listWrapper.AddView (btnlayout);
                        }
                    });
                }

                if (getGuid != null)
                    getGuid.Clear ();

                RunOnUiThread (delegate {
                    foreach (MessageDB messages in message) {
                        string name = contact [m].FirstName + " " + contact [m].LastName;

                        ImageView random = null;
                        LinearLayout layout = new LinearLayout (context);
                        layout.Orientation = Android.Widget.Orientation.Horizontal;
                        layout.SetGravity (GravityFlags.CenterVertical);
                        layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                        LinearLayout layout2 = new LinearLayout (context);
                        layout2.Orientation = Orientation.Vertical;
                        layout2.SetGravity (GravityFlags.Center);
                        if (name == isMe)
                            layout.AddView (contactUserInterface (messages, contact [m], true));
                        else
                            layout.AddView (contactUserInterface (messages, contact [m], false));

                        /*ImageView profilepic = new ImageView (context);
                        profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));

                        if (contact == null)
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                        else {
                            profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID);
                            profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                            layout.AddView (profilepic);
                            if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage)
                                getGuid.Add (contact [m].AccountID);
                            else {
                                if (contact [m].Picture.Length > 0)
                                    LoadUserImage (contact [m], profilepic);
                                else
                                    profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                            }

                            TextView name = new TextView (context);
                            name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (230f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                            name.Gravity = GravityFlags.Center;
                            name.SetTextColor (Color.White);
                            name.TextSize = 16f;

                            layout2.AddView (name);

                            if (messages.MessageStepDBList.Count == 1 && messages.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                                TextView text = new TextView (context);
                                text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                                text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                text.Gravity = GravityFlags.CenterVertical;
                                if (name == isMe)
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                else
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                text.TextSize = 16f;

                                for (int e = 0; e < messages.MessageStepDBList.Count; ++e) {
                                    if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) {
                                        messager = messages.MessageStepDBList [e].MessageText;
                                        break;
                                    }
                                }

                                if (string.IsNullOrEmpty (messager))
                                    messager = "No text message found";

                                int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                text.SetHeight (nolines);

                                text.SetTextColor (Android.Graphics.Color.Black);
                                text.Text = messager;
                                layout2.Clickable = true;
                                layout2.AddView (text);
                            } else {*/
                        LinearLayout layout3 = new LinearLayout (context);
                        layout3.Orientation = Orientation.Horizontal;
                        if (name == isMe)
                            layout3.SetGravity (GravityFlags.Right);
                        else
                            layout3.SetGravity (GravityFlags.Left);
                        layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                        layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                        layout3.SetMinimumHeight (30);
                        layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                        if (name != isMe) {
                            using (random = new ImageView (context)) {
                                random.Tag = m;
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                random.ContentDescription = messages.MessageGuid;
                                random.Click += PlayButton_Clicked;

                                layout3.AddView (random);
                            }
                        }

                        int textt = 0;
                        for (int tt = 0; tt < messages.MessageStepDBList.Count; ++tt) {
                            if (messages.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
                                textt++;
                        }

                        for (int i = 0; i < messages.MessageStepDBList.Count; ++i) {
                            switch (messages.MessageStepDBList [i].StepType) {
                            case LOLMessageDelivery.MessageStep.StepTypes.Text:
                                if (textt == 1) {
                                    TextView text = new TextView (context);
                                    text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                                    text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                    text.Gravity = GravityFlags.CenterVertical;
                                    if (name == isMe)
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                    else
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                    text.TextSize = 16f;

                                    for (int e = 0; e < messages.MessageStepDBList.Count; ++e) {
                                        if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) {
                                            messager = messages.MessageStepDBList [e].MessageText;
                                            break;
                                        }
                                    }

                                    if (string.IsNullOrEmpty (messager))
                                        messager = "No text message found";

                                    int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                    text.SetHeight (nolines);

                                    text.SetTextColor (Android.Graphics.Color.Black);
                                    text.Text = messager;
                                    layout2.Clickable = true;
                                    layout2.AddView (text);
                                } else {
                                    if (textt > 1) {
                                        using (random = new ImageView (context)) {
                                            random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                            random.SetBackgroundResource (Resource.Drawable.textmsg);
                                            layout3.AddView (random);
                                        }
                                    }
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.drawicon);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicon);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicmsgs);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.emoticonmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Polling:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.pollmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.soundfxmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Video:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.videomsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Voice:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.voicemsg);
                                    layout3.AddView (random);
                                }
                                break;
                            }
                        }
                        if (name == isMe) {
                            using (random = new ImageView (context)) {
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                random.Click += (object ss, EventArgs ee) => {
                                    random_Click (ss, ee, message); };
                                layout3.AddView (random);
                            }
                        }

                        layout2.AddView (layout3);

                        layout.AddView (layout2);

                        listWrapper.AddView (layout);
                        if (m + 1 < contact.Count)
                            m++;
                    }
                    //}

                });
                if (getGuid.Count > 0) {
                    cpUI = 0;
                    LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                    service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                    service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken));
                }
            }
        }
        private void CreatePreviewUI()
        {
            int m = 0;
            isConversation = false;
            header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader);
            Header.headertext = Application.Context.Resources.GetString (Resource.String.messageListHeaderViewTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo (header.Context);
            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            listWrapper.RemoveAllViewsInLayout ();

            Dictionary<string, MessageInfo> latestMessages = new Dictionary<string, MessageInfo> ();
            Dictionary<string, string> unreadMessageCounts = new Dictionary<string, string> ();
            string ownerAccountId = AndroidData.CurrentUser.AccountID.ToString ();
            foreach (ConversationInfo eachConversationInfo in this.conversationItems.Values) {
                MessageInfo latestMessage = eachConversationInfo.GetLatestMessage ();
                string messageCountStr = eachConversationInfo.Messages
                    .Count (s => s.Value.Message.MessageRecipientDBList.Count (t => t.AccountGuid == ownerAccountId && !t.IsRead) > 0)
                        .ToString ();
                latestMessages.Add (eachConversationInfo.ConversationID, latestMessage);
                unreadMessageCounts.Add (eachConversationInfo.ConversationID, messageCountStr);
            }

            if (getGuid != null)
                getGuid.Clear ();
            RunOnUiThread (delegate {
                foreach (KeyValuePair<string, MessageInfo> eachMessage in latestMessages) {
                    eachMessage.Value.Message.MessageRecipientDBList = eachMessage.Value.Message.MessageRecipientDBList.Where (x => x != null).ToList ();

                    string messager = string.Empty;
                    string tmpName = string.Empty;
                    ImageView random = null;
                    LinearLayout.LayoutParams randomParams = null;
                    LinearLayout layout = new LinearLayout (context);
                    LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                    layoutparams.SetMargins (0, 0, 0, (int)ImageHelper.convertDpToPixel (10f, context));
                    layout.LayoutParameters = layoutparams;
                    layout.Orientation = Android.Widget.Orientation.Horizontal;
                    layout.SetGravity (GravityFlags.Center);
                    layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context),
                                        (int)ImageHelper.convertDpToPixel (10f, context));

                    ImageView profilepic = new ImageView (context);
                    profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));

                    if (eachMessage.Key != null) {
                        UserDB who = null;
                        if (eachMessage.Value.MessageUser != null)
                            who = eachMessage.Value.MessageUser;
                        else
                            who = null;

                        if (who.AccountGuid == AndroidData.CurrentUser.AccountID.ToString ())
                            who = dbm.GetUserWithAccountID (eachMessage.Value.Message.MessageRecipientDBList [0].AccountGuid);

                        if (who == null) {
                            #if DEBUG
                            System.Diagnostics.Debug.WriteLine ("UserDB = null for {0}, bugging out", latestMessages);
                            #endif
                            m++;
                        } else {
                            profilepic.Tag = new Java.Lang.String ("profilepic_" + who.AccountID);
                            profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                            layout.AddView (profilepic);
                            if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) {
                                List<UserDB> imageList = new List<UserDB> ();
                                foreach (MessageRecipientDB human in eachMessage.Value.Message.MessageRecipientDBList) {
                                    imageList.Add (dbm.GetUserWithAccountID (human.AccountGuid));
                                }
                                RunOnUiThread (delegate {
                                    createMultipleForContact (imageList);
                                    if (multipleContact != null)
                                        profilepic.SetImageBitmap (multipleContact);
                                    else
                                        profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                                });

                            } else {

                                if (who.Picture.Length == 0 && who.HasProfileImage)
                                    getGuid.Add (who.AccountID);
                                else {
                                    if (who.Picture.Length > 0)
                                        this.LoadUserImage (who, profilepic);
                                    else
                                        profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                                }
                            }
                            LinearLayout layout2 = new LinearLayout (context);
                            layout2.Orientation = Orientation.Vertical;
                            layout2.SetGravity (GravityFlags.Left);

                            using (TextView name = new TextView (context)) {
                                name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (25f, context));
                                name.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (20f, context), 0);
                                name.Gravity = GravityFlags.Left;
                                name.SetTextColor (Color.White);
                                name.TextSize = 16f;
                                tmpName = who.FirstName + " " + who.LastName;
                                if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) {
                                    if (eachMessage.Value.Message.MessageRecipientDBList.Count == 1 || eachMessage.Value.Message.MessageRecipientDBList.Count - 1 == 1)
                                        tmpName += "   1 other";
                                    else
                                        tmpName += "   " + string.Format ("{0} others", eachMessage.Value.Message.MessageRecipientDBList.Count - 1);
                                }

                                name.Text = tmpName;
                                layout2.AddView (name);
                            }

                            if (eachMessage.Value.Message.MessageStepDBList.Count == 1 && eachMessage.Value.Message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                                using (TextView txtMessage = new TextView (context)) {
                                    using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context),
                                                                                                                 (int)ImageHelper.convertDpToPixel (60f, context))) {
                                        txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0);
                                        txtMessage.LayoutParameters = txtMessageParams;
                                    }
                                    txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                                    txtMessage.Gravity = GravityFlags.CenterVertical;

                                    if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID)
                                        txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                    else
                                        txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                    txtMessage.TextSize = 16f;

                                    for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) {
                                        if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) {
                                            messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText;
                                            break;
                                        }
                                    }

                                    if (string.IsNullOrEmpty (messager))
                                        messager = "";

                                    int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                    txtMessage.SetHeight (nolines);

                                    txtMessage.SetTextColor (Android.Graphics.Color.Black);
                                    txtMessage.Text = messager;
                                    txtMessage.ContentDescription = eachMessage.Key;
                                    txtMessage.Click += ConversationItem_Clicked;
                                    layout2.AddView (txtMessage);
                                }
                            } else {
                                int text = 0;
                                for (int tt = 0; tt < eachMessage.Value.Message.MessageStepDBList.Count; ++tt) {
                                    if (eachMessage.Value.Message.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
                                        text++;
                                }

                                LinearLayout layout3 = new LinearLayout (context);
                                LinearLayout.LayoutParams layout3params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                                layout3params.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context));
                                layout3.LayoutParameters = layout3params;
                                layout3.Orientation = Orientation.Horizontal;
                                layout3.SetGravity (GravityFlags.Left);
                                layout3.ContentDescription = eachMessage.Key;
                                layout3.Click += ConversationLayItem_Clicked;
                                layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                                layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                                layout3.SetMinimumHeight (30);
                                layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                                int end = eachMessage.Value.Message.MessageStepDBList.Count > 3 ? 3 : eachMessage.Value.Message.MessageStepDBList.Count;
                                for (int i = 0; i < end; ++i) {
                                    switch (eachMessage.Value.Message.MessageStepDBList [i].StepType) {
                                    case LOLMessageDelivery.MessageStep.StepTypes.Text:
                                        if (text == 1) {
                                            using (TextView txtMessage = new TextView (context)) {
                                                using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context),
                                                                                                                        (int)ImageHelper.convertDpToPixel (60f, context))) {
                                                    txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0);
                                                    txtMessage.LayoutParameters = txtMessageParams;
                                                }
                                                txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                                                txtMessage.Gravity = GravityFlags.CenterVertical;

                                                if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID)
                                                    txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                                else
                                                    txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                                txtMessage.TextSize = 16f;

                                                for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) {
                                                    if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) {
                                                        messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText;
                                                        break;
                                                    }
                                                }

                                                if (string.IsNullOrEmpty (messager))
                                                    messager = "No text message found";

                                                int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                                txtMessage.SetHeight (nolines);

                                                txtMessage.SetTextColor (Android.Graphics.Color.Black);
                                                txtMessage.Text = messager;
                                                txtMessage.ContentDescription = eachMessage.Key;
                                                txtMessage.Click += ConversationItem_Clicked;

                                                layout2.AddView (txtMessage);
                                            }
                                        } else {
                                            if (text > 1) {
                                                using (random = new ImageView (context)) {
                                                    using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                        randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                        random.LayoutParameters = randomParams;
                                                    }
                                                    random.ContentDescription = eachMessage.Key;
                                                    random.Click += ConversationPicItem_Clicked;
                                                    random.SetBackgroundResource (Resource.Drawable.icotext);
                                                    layout3.AddView (random);
                                                }
                                            }
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icoanimation);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icocomicons);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icocomix);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icoemoticons);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Polling:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icopolls);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icosoundfx);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Video:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icovideo);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    case LOLMessageDelivery.MessageStep.StepTypes.Voice:
                                        using (random = new ImageView (context)) {
                                            using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) {
                                                randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0);
                                                random.LayoutParameters = randomParams;
                                            }
                                            random.ContentDescription = eachMessage.Key;
                                            random.Click += ConversationPicItem_Clicked;
                                            random.SetBackgroundResource (Resource.Drawable.icovoice);
                                            layout3.AddView (random);
                                        }
                                        break;
                                    }
                                }

                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.playblack);
                                    random.ContentDescription = eachMessage.Value.Message.MessageGuid;
                                    random.Click += PlayButton_Clicked;
                                    layout3.AddView (random);
                                }
                                layout2.AddView (layout3);
                            }

                            LinearLayout layout4 = new LinearLayout (context);
                            layout4.Orientation = Orientation.Vertical;
                            layout4.SetGravity (GravityFlags.Right);

                            using (TextView noMessages = new TextView (context)) {
                                noMessages.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (20f, context));
                                noMessages.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                noMessages.SetTextColor (Color.White);
                                noMessages.TextSize = 12f;
                                noMessages.Text = unreadMessageCounts [eachMessage.Key] + " messages unread";
                                noMessages.Gravity = GravityFlags.Right;

                                layout4.AddView (noMessages);
                            }
                            layout2.AddView (layout4);

                            layout.AddView (layout2);

                            listWrapper.AddView (layout);
                            m++;
                        }
                    }
                }
            });
            if (getGuid.Count > 0) {
                cpUI = 0;
                LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken));
            }
        }
예제 #8
0
		public override View GetSampleContent (Android.Content.Context con)
		{
			
			dlgAlert = new AlertDialog.Builder(con);

			dlgAlert.SetTitle("Results");
			dlgAlert.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) => 
				{
				});
			dlgAlert.SetCancelable(true);

			Title.Add ("Software");
			Title.Add ("Banking");
			Title.Add ("Media");
			Title.Add ("Medical");
			spinners = new Spinner(con);
			spinners.DropDownWidth = 500;
			spinners.SetBackgroundColor(Color.Gray);

			ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
				(con, Android.Resource.Layout.SimpleSpinnerItem, Experience);
			dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinners.Adapter = dataAdapter;

			Country.Add ("UAE");
			Country.Add ("Uruguay");
			Country.Add ("United States");
			Country.Add ("United Kingdom");
			Country.Add ("Ukraine");

			Experience.Add ("1");
			Experience.Add ("2");

			autoComplete1 = new SfAutoComplete(con);
			autoComplete2 = new SfAutoComplete(con);

			text1s = new TextView(con);
			text2s = new TextView(con);
			text3s = new TextView(con);
			text4s = new TextView(con);
			text6s = new TextView(con);

			text11 = new TextView(con);
			text22 = new TextView(con);
			text33 = new TextView(con);
			text44 = new TextView(con);
			text55 = new TextView(con);
			text66 = new TextView(con);
			text77 = new TextView(con);
			text88 = new TextView(con);

			buttons = new Button(con);
			buttons.SetWidth(ActionBar.LayoutParams.MatchParent);
			buttons.SetHeight(40);
			buttons.Text = "Search";
			buttons.SetTextColor(Color.White);
			buttons.SetBackgroundColor(Color.Gray);
			buttons.Click += (object sender, EventArgs e) => {
				GetResult();
				//dlgAlert.SetMessage(count + " Jobs Found");
				dlgAlert.SetMessage (cc + " Jobs Found");
				dlgAlert.Create ().Show ();
			};
			text11.SetHeight(10);
			text22.SetHeight(30);
			text33.SetHeight(10);
			text44.SetHeight(30);
			text55.SetHeight(10);
			text66.SetHeight(30);
			text77.SetHeight(10);
			text88.SetHeight(30);

			text1s.Text = "Job Search";
			text1s.TextSize = 30;
			text1s.Typeface = Typeface.DefaultBold;
			text2s.Text = "Country";
			text2s.TextSize = 16;
			text3s.Text = "Job Field";
			text3s.TextSize = 16;
			text4s.Text = "Experience";
			text4s.TextSize = 16;
			text6s.SetHeight(40);

			ArrayAdapter<String> adapters = new ArrayAdapter<String>(con,
				Android.Resource.Layout.SimpleListItem1, new Countrylist().Country);
			autoComplete1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
			autoComplete1.SetAutoCompleteSource(adapters);
			autoComplete1.SuggestionMode = SuggestionMode.StartsWith;
			autoComplete1.MaximumDropDownHeight = 200;
			autoComplete1.Watermark = "Enter a country name";

			ArrayAdapter<String> adapters1 = new ArrayAdapter<String>(con,
				Android.Resource.Layout.SimpleListItem1, Title);
			autoComplete2.SetAutoCompleteSource(adapters1);
			autoComplete2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);
			autoComplete2.SuggestionMode = SuggestionMode.Contains;
			autoComplete2.MaximumDropDownHeight = 200;
			autoComplete2.Watermark = "Starts with ’S’, ‘M’ or ‘B’";

			ArrayAdapter<String> adapters2 = new ArrayAdapter<String>(con,
				Android.Resource.Layout.SimpleListItem1, Experience);
			spinners.Adapter = adapters2;
			spinners.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60);

			LinearLayout linearLayout = new LinearLayout(con);
			linearLayout.SetPadding(20, 20, 20, 30);
			linearLayout.SetBackgroundColor(Color.Rgb(236, 236, 236));
			linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
			linearLayout.Orientation = Orientation.Vertical;
			linearLayout.AddView(text1s);
			linearLayout.AddView(text6s);
			linearLayout.AddView(text2s);
			linearLayout.AddView(text11);
			linearLayout.AddView(autoComplete1);
			linearLayout.AddView(text22);
			linearLayout.AddView(text3s);
			linearLayout.AddView(text33);
			linearLayout.AddView(autoComplete2);
			linearLayout.AddView(text44);
			linearLayout.AddView(text4s);
			linearLayout.AddView(text55);
			linearLayout.AddView(spinners);
			linearLayout.AddView(text66);
			linearLayout.AddView(text88);
			linearLayout.AddView(buttons);
			linearLayout.Touch+= (object sender, View.TouchEventArgs e) => {
				//if(autoComplete1.IsFocused || autoComplete2.IsFocused ){
					Rect outRect = new Rect();
					autoComplete1.GetGlobalVisibleRect(outRect);
					autoComplete2.GetGlobalVisibleRect(outRect);

					if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) {
						autoComplete1.ClearFocus();
						autoComplete2.ClearFocus();

					}
					hideSoftKeyboard((Activity)con);
				//}
			};
			return linearLayout;
		}
        private void createUI(MessageDB message, UserDB contact)
        {
            #if DEBUG
            System.Diagnostics.Debug.WriteLine ("AccoundID (MC) = {0}", AndroidData.CurrentUser.AccountID.ToString ());
            #endif
            int m = 0;
            string messager = "";
            if (message != null && contact != null) {
                RunOnUiThread (delegate {
                    ImageView random = null;
                    LinearLayout layout = new LinearLayout (context);
                    layout.Orientation = Android.Widget.Orientation.Horizontal;
                    layout.SetGravity (GravityFlags.CenterVertical);
                    layout.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                    ImageView profilepic = new ImageView (context);
                    profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (60f, context), (int)ImageHelper.convertDpToPixel (100f, context));
                    profilepic.Tag = new Java.Lang.String ("profilepic_" + m.ToString ());

                    if (contact == null)
                        profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                    else {
                        if (contact.Picture.Length > 0) {
                            //profilepic.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromStream(new MemoryStream(eachContact.ContactUser.Picture), "Profile"));
                            loadProfilePicture (contact.AccountID);
                        } else {
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                        }

                        //layout.AddView(profilepic);

                        LinearLayout layout2 = new LinearLayout (context);
                        layout2.Orientation = Orientation.Vertical;
                        layout2.SetGravity (GravityFlags.Center);

                        TextView name = new TextView (context);
                        name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                        name.Gravity = GravityFlags.Center;
                        name.SetTextColor (Color.White);
                        name.TextSize = 16f;
                        name.Text = contact.FirstName + " " + contact.LastName;

                        layout2.AddView (name);

                        TextView text = new TextView (context);
                        text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                        text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                        text.Gravity = GravityFlags.CenterVertical;
                        if (name.Text == isMe)
                            text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                        else
                            text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                        text.TextSize = 16f;

                        for (int e = 0; e < message.MessageStepDBList.Count; ++e) {
                            if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) {
                                messager = message.MessageStepDBList [e].MessageText;
                                break;
                            }
                        }

                        if (string.IsNullOrEmpty (messager))
                            messager = "No text message found";

                        int nolines = messager.Length / 27;
                        text.SetHeight ((nolines + 1) * 20);

                        text.SetTextColor (Android.Graphics.Color.Black);
                        text.Text = messager;
                        layout2.Clickable = true;
                        layout2.AddView (text);
                        if (message.MessageStepDBList.Count > 1) {
                            LinearLayout layout3 = new LinearLayout (context);
                            layout3.Orientation = Orientation.Horizontal;
                            if (name.Text == isMe)
                                layout3.SetGravity (GravityFlags.Right);
                            else
                                layout3.SetGravity (GravityFlags.Left);
                            layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                            layout3.SetMinimumHeight (30);
                            layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                            if (name.Text != isMe) {
                                random = new ImageView (context);
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                //random.Click += delegate { PlayMessage(message); };
                                layout3.AddView (random);
                            }

                            for (int i = 1; i < message.MessageStepDBList.Count; ++i) {
                                switch (message.MessageStepDBList [i].StepType) {
                                case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.drawicon);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicon);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicmsgs);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.emoticonmsg);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Polling:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.pollmsg);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.soundfxmsg);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Video:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.videomsg);
                                    layout3.AddView (random);
                                    break;
                                case LOLMessageDelivery.MessageStep.StepTypes.Voice:
                                    random = new ImageView (context);
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.voicemsg);
                                    layout3.AddView (random);
                                    break;
                                }
                            }
                            if (name.Text == isMe) {
                                random = new ImageView (context);
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                //random.Click += delegate { PlayMessage(message); };
                                layout3.AddView (random);
                            }
                            layout2.AddView (layout3);
                        }
                        if (name.Text != isMe) {
                            layout.AddView (profilepic);
                            layout.AddView (layout2);
                        } else {
                            layout.AddView (layout2);
                            layout.AddView (profilepic);
                        }

                        converse.AddView (layout);
                        m++;
                    }
                });
            }
        }
예제 #10
0
		public override Android.Views.View GetSampleContent (Android.Content.Context context)
		{
			Toast currentToast=new Toast(context);
			LinearLayout layout= new LinearLayout(context);
			layout.Orientation = Orientation.Vertical;
			TextView textView= new TextView(context);
			textView.TextSize = 20;
			textView.SetPadding(10,20,0,0);
			textView.SetHeight(70);

			textView.Text ="Top Population Countries";
			layout.AddView(textView);
			textView.Gravity = Android.Views.GravityFlags.Top;
			SfMaps maps = new SfMaps (context);
			ShapeFileLayer layer = new ShapeFileLayer ();
			layer.Uri= "world1.shp";

			layer.MarkerSelected += (object sender, ShapeFileLayer.MarkerSelectedEventArgs e) => {
				PopulationMarker marker= (PopulationMarker)e.P0;
				if(marker!=null)
				{
				if(currentToast!=null)
				{
					currentToast.Cancel();
				}
					currentToast= Toast.MakeText(context,marker.Name +"\n"+ marker.Population,ToastLength.Short);
				currentToast.Show();
				}


			};
			PopulationMarker usa= new PopulationMarker(context);
			usa.Latitude =38.8833;
			usa.Longitude=-77.0167;
			usa.Name= "United States";
			usa.Population ="321,174,000";
			layer.Markers.Add(usa);


			PopulationMarker brazil= new PopulationMarker(context);
			brazil.Latitude=-15.7833;
			brazil.Longitude=-47.8667;
			brazil.Name = "Brazil";
			brazil.Population= "204,436,000";
			layer.Markers.Add(brazil);


			PopulationMarker india= new PopulationMarker(context);
			india.Latitude=21.0000;
			india.Longitude=78.0000;
			india.Name= "India";
			india.Population ="1,272,470,000";
			layer.Markers.Add(india);


			PopulationMarker china= new PopulationMarker(context);
			china.Latitude=35.0000;
			china.Longitude=103.0000;
			china.Name = "China";
			china.Population = "1,370,320,000";
			layer.Markers.Add(china);



			PopulationMarker indonesia= new PopulationMarker(context);
			indonesia.Latitude=-6.1750;
			indonesia.Longitude=106.8283;
			indonesia.Name="Indonesia";
			indonesia.Population="255,461,700";
			layer.Markers.Add(indonesia);

			maps.Layers.Add (layer);
			layout.AddView (maps);
			return layout;
		}
예제 #11
0
        TextView GetItem(ColumnPosition columnPosition)
        {
            TextView textView = new TextView (Activity);
            textView.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
            textView.SetHeight (48);
            //			textView.

            switch (columnPosition) {
            case ColumnPosition.cpFirst:
                textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 24, LeftMargin = 24 };
                break;
            case ColumnPosition.cpMiddle:
                textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = 56 };
                break;
            case ColumnPosition.cpLast:
                textView.LayoutParameters = new TableRow.LayoutParams () { LeftMargin = 24 };
                break;
            default:
                break;
            }
            return textView;
        }
예제 #12
0
        TextView GetItem(ColumnPosition columnPosition)
        {
            TextView textView = new TextView (this);
            textView.SetTextAppearance (this, Resource.Style.rowTextForPharmacy);
            textView.SetHeight (ToDIP(48));

            switch (columnPosition) {
            case ColumnPosition.cpFirst:
                textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24), LeftMargin = ToDIP(24) };
                break;
            case ColumnPosition.cpMiddle:
                textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(56) };
                break;
            case ColumnPosition.cpLast:
                textView.LayoutParameters = new TableRow.LayoutParams () { RightMargin = ToDIP(24) };
                break;
            default:
                break;
            }
            return textView;
        }
예제 #13
0
 private TextView messageTextBox(TextView txtMessage, MessageDB message, int position, int leftOver)
 {
     if (position < message.MessageStepDBList.Count)
     {
         if (string.IsNullOrEmpty(message.MessageStepDBList [position].MessageText))
             txtMessage.Text = "";
         else
             txtMessage.Text = message.MessageStepDBList [position].MessageText;
     }
     int nolines = (int)(ImageHelper.convertDpToPixel((txtMessage.Text.Length / 27f) * 12f, context));
     txtMessage.SetHeight(nolines);
     txtMessage.SetTextColor(Android.Graphics.Color.Black);
     return txtMessage;
 }
		public override View GetSampleContent (Context con)
		{
			
			LinearLayout linearLayout = new LinearLayout(con);
			linearLayout.SetPadding(20, 20, 20, 30);
			linearLayout.SetBackgroundColor(Color.Rgb(236, 235, 242));
			linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
			linearLayout.Orientation = Android.Widget.Orientation.Vertical;


			TextView textView3 = new TextView(con);
			textView3.TextSize=20;
			textView3.Text=" "+"Departure";
			textView3.SetTextColor (Color.Black);

			range = new SfRangeSlider(con);
			range.Minimum= 0;
			range.Maximum=12;
			range.TickFrequency=2;
			range.ShowValueLabel=showlabel;
			range.StepFrequency=6;
			range.DirectionReversed=false;
			range.ValuePlacement=valueplacement;
			range.RangeEnd=12;
			range.RangeStart=0;
			range.TickPlacement=tickplacement;
			range.ShowRange=showlabel;
			range.SnapsTo=snapsto;

			range.Orientation=Com.Syncfusion.Sfrangeslider.Orientation.Horizontal;


			range.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150);

			LinearLayout depstack =new LinearLayout (con);
			depstack.Orientation = Android.Widget.Orientation.Horizontal;
			depstack.AddView (textView3);
			TextView textView4 = new TextView(con);
			textView4.TextSize=13;
			textView4.Text="  "+"(in Hours)";
			textView4.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent);
			textView4.SetTextColor (Color.ParseColor("#939394"));
			textView4.Gravity = GravityFlags.Center;
			depstack.AddView (textView4);

			TextView textView7 = new TextView(con);
			textView7.SetHeight (50);
			linearLayout.AddView (textView7);
			linearLayout.AddView (depstack);
			TextView textView10 = new TextView(con);
			TextView textView12 = new TextView(con);
			linearLayout.AddView (textView12);
			linearLayout.AddView (textView10);

			linearLayout.AddView(range);

			textView10.TextSize=13;
			val3 = "12";
			val4 = Math.Round (range.RangeEnd).ToString ();
			textView10.SetTextColor (Color.ParseColor ("#939394"));
			textView10.Text = "  "+"Time:  "+val3 +"AM " +" - "+ val4 +" PM";
			textView10.Gravity = GravityFlags.Left;
			range.RangeChanged += (object sender, SfRangeSlider.RangeChangedEventArgs e) => {
				String pmstr2="AM",pmstr1 = "AM";
				if(Math.Round(e.P1).ToString() =="0" ) {
					val3 = "12";
					pmstr1 = "AM";
				}
				else
					val3 =  Convert.ToString(Math.Round(e.P1));

				if (e.P2 <= 12)
					val4 = Convert.ToString(Math.Round(e.P2));


				if(Math.Round(e.P2).ToString()=="12")
					pmstr2 = "PM";


				if(Math.Round(e.P2).ToString()=="12")
					pmstr2 = "PM";
				if(Convert.ToString(Math.Round(e.P1)).Equals(Convert.ToString(Math.Round(e.P2)))){
					if(Math.Round(e.P1).ToString() =="0" )
						textView10.Text="  "+"Time: "+val3 +" "+ pmstr1;
					else if(Math.Round(e.P2).ToString()=="12")
						textView10.Text="  "+"Time: "+val4 +" "+ pmstr2;
					else
						textView10.Text="  "+"Time: "+val3 +" "+ pmstr1;
				}
				else
					textView10.Text="  "+"Time: " +val3+" "+ pmstr1 + " - "+ val4+" " + pmstr2;
			};


			TextView textView6 = new TextView(con);
			textView6.SetHeight (70);
			linearLayout.AddView (textView6);
			TextView textView2 = new TextView(con);
			textView2.TextSize=20;
			textView2.Text=" "+"Arrival";
			textView2.SetTextColor (Color.Black);
			//linearLayout.AddView(textView2);


			range2 = new SfRangeSlider(con);
			range2.Minimum= 0;
			range2.Maximum=12;
			range2.TickFrequency=2;
			range2.ShowValueLabel=showlabel;
			range2.StepFrequency=6;
			range2.DirectionReversed=false;
			range2.ValuePlacement=valueplacement;
			range2.RangeEnd=12;
			range2.RangeStart=0;
			range2.TickPlacement=tickplacement;
			range2.ShowRange=showlabel;
			range2.SnapsTo=snapsto;
			range2.Orientation = Com.Syncfusion.Sfrangeslider.Orientation.Horizontal;
			range2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150);
			TextView textView5 = new TextView(con);
			textView5.TextSize=13;
			textView5.Text="  "+"(in Hours)";
			textView5.Gravity = GravityFlags.Center;
			textView5.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent);
			textView5.SetTextColor (Color.ParseColor("#939394"));
			TextView textView8 = new TextView(con);
			textView8.SetHeight (50);
			LinearLayout arrivestack =new LinearLayout (con);
			arrivestack.Orientation = Android.Widget.Orientation.Horizontal;
			arrivestack.AddView (textView2);

			arrivestack.AddView (textView5);
			linearLayout.AddView (textView8);
			linearLayout.AddView (arrivestack);
			TextView textView13 = new TextView(con);
			linearLayout.AddView (textView13);
			TextView textView9 = new TextView(con);
			linearLayout.AddView (textView9);
			linearLayout.AddView(range2);

			textView9.TextSize=13;
			textView9.SetTextColor (Color.ParseColor ("#939394"));
			val1 = "12";
			val2 = Math.Round (range2.RangeEnd).ToString ();
			textView9.Text = "  "+"Time:  "+val1 +"AM " +" - "+ val2 +" PM";
			textView9.Gravity = GravityFlags.Left;
			range2.RangeChanged += (object sender, SfRangeSlider.RangeChangedEventArgs e) => {
				String pmstr2="AM",pmstr1 = "AM";
				if(Math.Round(e.P1).ToString() =="0" ) {
					val1 = "12";
					pmstr1 = "AM";
				}
				else
					val1 =  Convert.ToString(Math.Round(e.P1));

				if (e.P2 <= 12)
					val2 = Convert.ToString(Math.Round(e.P2));





				if(Math.Round(e.P2).ToString()=="12")
					pmstr2 = "PM";
				if(Convert.ToString(Math.Round(e.P1)).Equals(Convert.ToString(Math.Round(e.P2)))){
					if(Math.Round(e.P1).ToString() =="0" )
						textView9.Text="  "+"Time: "+val1 +" "+ pmstr1;
					else if(Math.Round(e.P2).ToString()=="12")
						textView9.Text="  "+"Time: "+val2 +" "+ pmstr2;
					else
						textView9.Text="  "+"Time: "+val1 +" "+ pmstr1;
				}
				else
					textView9.Text="  "+"Time: " +val1+" "+ pmstr1 + " - "+ val2+" " + pmstr2;
			};

			return linearLayout;
		}
		public override View GetPropertyWindowLayout (Android.Content.Context context)
		{
			int width = context.Resources.DisplayMetrics.WidthPixels / 2;


			propertylayout = new LinearLayout (context);
			propertylayout.Orientation = droid.Vertical;

			LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams (
				width * 2, 5);

			layoutParams.SetMargins (0, 5, 0, 0);

			TextView textView1 = new TextView (context);
			textView1.Text = "  " + "TICK PLACEMENT";
			textView1.TextSize = 15;
			textView1.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
			textView1.SetTextColor (Color.White);
			textView1.Gravity = GravityFlags.Left;
			TextView textview2 = new TextView (context);
			textview2.SetHeight (14);
			propertylayout.AddView (textview2);
			tickSpinner = new Spinner (context);
			tickSpinner.SetPadding (0, 0, 0, 0);
			propertylayout.AddView (textView1);			
			SeparatorView separate = new SeparatorView (context, width * 2);
			separate.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5);
			propertylayout.AddView (separate, layoutParams);
			TextView textview8 = new TextView (context);
			textview8.SetHeight (20);
			propertylayout.AddView (textview8);
			propertylayout.AddView (tickSpinner);
			TextView textview3 = new TextView (context);
			propertylayout.AddView (textview3);
			List<String> list = new List<String> ();

			list.Add ("BottomRight");
			list.Add ("TopLeft");
			list.Add ("Outside");
			list.Add ("Inline");
			list.Add ("None");


			dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list);
			dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			tickSpinner.Adapter = dataAdapter;

			tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem (e.Position);
				if (selectedItem.Equals ("BottomRight")) {
					tickplacement = TickPlacement.BottomRight;

				} else if (selectedItem.Equals ("TopLeft")) {
					tickplacement = TickPlacement.TopLeft;

				} else if (selectedItem.Equals ("Inline")) {
					tickplacement = TickPlacement.Inline;

				} else if (selectedItem.Equals ("Outside")) {
					tickplacement = TickPlacement.Outside;

				} else if (selectedItem.Equals ("None")) {
					tickplacement = TickPlacement.None;

				}
			};


			TextView textView3 = new TextView (context);
			textView3.Text = "  " + "LABEL PLACEMENT";
			textView3.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
			textView3.Gravity = GravityFlags.Left;
			textView3.TextSize = 15;
			textView3.SetTextColor (Color.White);
			List<String> labelList = new List<String> ();
			labelList.Add ("BottomRight");
			labelList.Add ("TopLeft");

			labelSpinner = new Spinner (context);

			labelSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				String selectedItem = dataAdapter.GetItem (e.Position);
				if (selectedItem.Equals ("TopLeft")) {
					valueplacement = ValuePlacement.TopLeft;

				} else if (selectedItem.Equals ("BottomRight")) {
					valueplacement = ValuePlacement.BottomRight;


				}
			};



			labelAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, labelList);
			labelAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

			labelSpinner.Adapter = labelAdapter;
			labelSpinner.SetPadding (0, 0, 0, 0);

			LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams (width * 2, 7);

			layoutParams2.SetMargins (0, 5, 0, 0);
			propertylayout.AddView (textView3);

			SeparatorView separate2 = new SeparatorView (context, width * 2);
			separate2.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 7);

			propertylayout.AddView (separate2, layoutParams2);
			TextView textview9 = new TextView (context);
			textview9.SetHeight (20);
			propertylayout.AddView (textview9);
			propertylayout.AddView (labelSpinner);
			propertylayout.SetPadding (15, 0, 15, 0);
			TextView textview7 = new TextView (context);
			textview7.SetHeight (20);
			propertylayout.AddView (textview7);

			TextView textView6 = new TextView (context);
			textView6.Text = "  " + "Show Label";
			textView6.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
			textView6.Gravity = GravityFlags.Center;
			textView6.TextSize = 16;

			Switch checkBox = new Switch (context);
			checkBox.Checked = true;
			checkBox.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				if (e.IsChecked)
					showlabel = true;
				else
					showlabel = false;
			};

			LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams (
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams3.SetMargins (0, 10, 0, 0);

			LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams (
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams4.SetMargins (0, 10, 0, 0);

			stackView3 = new LinearLayout (context);
			stackView3.AddView (textView6, layoutParams4);



			stackView3.AddView (checkBox, layoutParams3);
			stackView3.Orientation = droid.Horizontal;
			propertylayout.AddView (stackView3);
			SeparatorView separate3 = new SeparatorView (context, width * 2);
			separate3.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5);
			LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams (
				width * 2, 5);

			layoutParams7.SetMargins (0, 30, 0, 0);
			propertylayout.AddView (separate3, layoutParams7);

			TextView textView7 = new TextView (context);
			textView7.Text = "  "+"SnapsToTicks";
			textView7.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal);
			textView7.Gravity = GravityFlags.Center;
			textView7.TextSize = 16;

			Switch checkBox2 = new Switch (context);
			checkBox2.Checked = false;
			checkBox2.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				if (e.IsChecked)
					snapsto = SnapsTo.Ticks;
				else
					snapsto = SnapsTo.None;
			};

			LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams (
				ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
			layoutParams5.SetMargins (0, 20, 0, 0);

			LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams (
				ViewGroup.LayoutParams.WrapContent, 55);
			layoutParams6.SetMargins (0, 20, 0, 0);

			stackView4 = new LinearLayout (context);
			stackView4.AddView (textView7, layoutParams6);



			stackView4.AddView (checkBox2, layoutParams5);
			stackView4.Orientation = droid.Horizontal;
			propertylayout.AddView (stackView4);
			SeparatorView separate4 = new SeparatorView (context, width * 2);
			separate4.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5);
			LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams (
				width * 2, 5);

			layoutParams8.SetMargins (0, 30, 0, 0);
			propertylayout.AddView (separate4, layoutParams8);
			return propertylayout;
		}
        private LinearLayout contactUserInterface(MessageDB message, UserDB contact, bool direction)
        {
            LinearLayout layout = new LinearLayout (context);
            layout.Orientation = Android.Widget.Orientation.Horizontal;
            layout.SetGravity (GravityFlags.CenterVertical);
            string messager = "";
            layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
            ImageView profilepic = new ImageView (context);
            if (!direction) {
                profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));

                if (contact == null)
                    profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                else {
                    profilepic.Tag = new Java.Lang.String ("profilepic_" + contact.AccountID);
                    profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                    layout.AddView (profilepic);
                    if (contact.Picture.Length == 0 && contact.HasProfileImage)
                        getGuid.Add (contact.AccountID);
                    else {
                        if (contact.Picture.Length > 0)
                            LoadUserImage (contact, profilepic);
                        else
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                    }

                    LinearLayout layout2 = new LinearLayout (context);
                    layout2.Orientation = Orientation.Vertical;
                    layout2.SetGravity (GravityFlags.Center);

                    if (message.MessageStepDBList.Count == 1 && message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                        TextView text = new TextView (context);
                        text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                        text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                        text.Gravity = GravityFlags.CenterVertical;
                        text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                        text.TextSize = 16f;

                        for (int e = 0; e < message.MessageStepDBList.Count; ++e) {
                            if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) {
                                messager = message.MessageStepDBList [e].MessageText;
                                break;
                            }
                        }

                        if (string.IsNullOrEmpty (messager))
                            messager = "No text message found";

                        int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                        text.SetHeight (nolines);

                        text.SetTextColor (Android.Graphics.Color.Black);
                        text.Text = messager;
                        layout2.Clickable = true;
                        layout2.AddView (text);
                    }
                    layout.AddView (layout2);
                }
            } else {
                LinearLayout layout2 = new LinearLayout (context);
                layout2.Orientation = Orientation.Vertical;
                layout2.SetGravity (GravityFlags.Center);

                if (message.MessageStepDBList.Count == 1 && message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                    TextView text = new TextView (context);
                    text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                    text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                    text.Gravity = GravityFlags.CenterVertical;
                    text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
                    text.TextSize = 16f;

                    for (int e = 0; e < message.MessageStepDBList.Count; ++e) {
                        if (!string.IsNullOrEmpty (message.MessageStepDBList [e].MessageText)) {
                            messager = message.MessageStepDBList [e].MessageText;
                            break;
                        }
                    }

                    if (string.IsNullOrEmpty (messager))
                        messager = "No text message found";

                    int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                    text.SetHeight (nolines);

                    text.SetTextColor (Android.Graphics.Color.Black);
                    text.Text = messager;
                    layout2.Clickable = true;
                    layout2.AddView (text);
                }
                profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));
                layout.AddView (layout2);
                if (contact == null)
                    profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                else {
                    profilepic.Tag = new Java.Lang.String ("profilepic_" + contact.AccountID);
                    profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                    layout.AddView (profilepic);
                    if (contact.Picture.Length == 0 && contact.HasProfileImage)
                        getGuid.Add (contact.AccountID);
                    else {
                        if (contact.Picture.Length > 0)
                            LoadUserImage (contact, profilepic);
                        else
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                    }
                }
            }
            return layout;
        }
        private TextView messageTextBox(MessageDB message, int position, int leftOver)
        {
            TextView txtMessage = new TextView (context);
            using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams (leftOver,
                                                                                        (int)ImageHelper.convertDpToPixel (60f, context))) {
                txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0);
                txtMessage.LayoutParameters = txtMessageParams;
            }
            txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context),
                                   (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context));
            txtMessage.Gravity = GravityFlags.CenterVertical;
            txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
            txtMessage.TextSize = 16f;

            if (position < message.MessageStepDBList.Count) {
                if (string.IsNullOrEmpty (message.MessageStepDBList [position].MessageText))
                    txtMessage.Text = "";
                else
                    txtMessage.Text = message.MessageStepDBList [position].MessageText;
            }
            int nolines = (int)(ImageHelper.convertDpToPixel ((txtMessage.Text.Length / 27f) * 12f, context));
            txtMessage.SetHeight (nolines);
            txtMessage.SetTextColor (Android.Graphics.Color.Black);
            return txtMessage;
        }
예제 #18
0
        private void RefreshTableContent2()
        {
            if (pfPharmacyTable != null) {
                int childCount = pfPharmacyTable.ChildCount;

                // Remove all rows except the first one
                if (childCount > 1) {
                    pfPharmacyTable.RemoveViews(1, childCount - 1);
                }

                pharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (pfSearchEdit.Text, 20);

                foreach (var pharmacy in pharmacies) {
                    string src = pfSearchEdit.Text;
                    string srcWithCap = UppercaseFirst(pfSearchEdit.Text);
                    string rpl = "";

                    TableRow row = new TableRow (Activity);

                    row.SetBackgroundResource(Resource.Drawable.bottomline);

                    //View view = layoutInflater.Inflate (Resource.Layout.LeftDrawerItem, null, false);//TextView id = new TextView (this.Activity);
                    TextView id = new TextView (Activity);
                    //					id.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
                    //					id.SetTextAppearance(Activity, Resource.Style.rowTextForPharmacy);
                    //					id.SetPadding(24, 0, 24, 0);
                    //					TableRow.LayoutParams p =
                    //					p.RightMargin = 24;
                    //					p.LeftMargin = 24;
                    id.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 24, LeftMargin = 24};
                    id.SetBackgroundResource(Resource.Drawable.bottomline);
                    id.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    id.SetHeight (48);
                    id.Gravity = GravityFlags.Center;
                    id.Text = pharmacy.id.ToString ();
                    row.AddView (id);

                    //					CheckBox chk = new CheckBox (Activity);
                    //					chk.SetPadding(24, 16, 24, 16);
                    //					row.AddView (chk);

                    TextView fullName = new TextView (Activity);
                    //					fullName.SetTextAppearance (Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
                    //					fullName.SetPadding(0, 0, 56, 0);
                    //					TableRow.LayoutParams fullNameP = new TableRow.LayoutParams();
                    //					fullNameP.RightMargin = 56;
                    fullName.LayoutParameters = new TableRow.LayoutParams() {RightMargin = 56};
                    //					fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    //					fullName.SetBackgroundResource(Resource.Drawable.bottomline);
                    fullName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    fullName.SetHeight (48);
                    fullName.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        fullName.Text = pharmacy.fullName;
                    } else {
                        rpl = pharmacy.fullName.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        fullName.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (fullName);

                    TextView shortName = new TextView (Activity);
                    //					shortName.SetPadding(0, 0, 56, 0);0
                    //					shortName.SetBackgroundResource(Resource.Drawable.bottomline);
                    shortName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    shortName.SetHeight (48);
                    shortName.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        shortName.Text = pharmacy.shortName;
                    } else {
                        rpl = pharmacy.shortName.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        shortName.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (shortName);

                    TextView officialName = new TextView (Activity);
                    //					officialName.SetPadding(0, 0, 56, 0);
                    //					officialName.SetBackgroundResource(Resource.Drawable.bottomline);
                    officialName.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    officialName.SetHeight (48);
                    officialName.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        officialName.Text = pharmacy.officialName;
                    } else {
                        rpl = pharmacy.officialName.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        officialName.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (officialName);

                    TextView address = new TextView (Activity);
                    //					address.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
                    //					address.SetPadding(0, 0, 56, 0);
                    //					address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    //					address.SetBackgroundResource(Resource.Drawable.bottomline);
                    address.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    address.SetHeight (48);
                    address.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        address.Text = pharmacy.address;
                    } else {
                        rpl = pharmacy.address.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        address.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (address);

                    TextView subway = new TextView (Activity);
                    //					subway.SetPadding(0, 0, 56, 0);
                    //					subway.SetBackgroundResource(Resource.Drawable.bottomline);
                    subway.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    subway.SetHeight (48);
                    subway.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        subway.Text = pharmacy.subway;
                    } else {
                        rpl = pharmacy.subway.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        subway.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (subway);

                    TextView phone = new TextView (Activity);
                    //					phone.SetPadding(0, 0, 56, 0);
                    //					phone.SetBackgroundResource(Resource.Drawable.bottomline);
                    phone.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    phone.SetHeight (48);
                    phone.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        phone.Text = pharmacy.phone;
                    } else {
                        rpl = pharmacy.phone.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        phone.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (phone);

                    TextView email = new TextView (Activity);
                    //					email.SetPadding(0, 0, 56, 0);
                    //					email.SetBackgroundResource(Resource.Drawable.bottomline);
                    email.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
                    email.SetHeight (48);
                    email.Gravity = GravityFlags.CenterVertical;
                    if (string.IsNullOrEmpty (src)) {
                        email.Text = pharmacy.email;
                    } else {
                        rpl = pharmacy.email.Replace (src, @"<font color='red'>" + src + @"</font>");
                        rpl = rpl.Replace (srcWithCap, @"<font color='red'>" + srcWithCap + @"</font>");
                        email.TextFormatted = Html.FromHtml (rpl);
                    }
                    row.AddView (email);

                    //					Button delete = new Button (this.Activity);
                    //					delete.SetTextAppearance (this.Activity, global::Android.Resource.Style.TextAppearanceLarge); //?android:attr/textAppearanceLarge
                    //					delete.SetPadding(0, 16, 24, 16);
                    //					delete.Text = @"Del";
                    //					delete.Id = pharmacy.id;
                    //					delete.Click += PharmacyDelete_Click;
                    //
                    //					row.AddView (delete);

                    pfPharmacyTable.AddView(row);
                }

            }
        }