private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver) { LinearLayout icons = new LinearLayout (context); icons.Orientation = Orientation.Horizontal; icons.SetGravity (GravityFlags.Left); icons.SetVerticalGravity (GravityFlags.CenterVertical); icons.SetMinimumHeight (30); icons.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); if (message.MessageStepDBList.Count == 0) { ImageView random1 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, leftOver - (int)ImageHelper.convertDpToPixel (30f, context), 0); random1.LayoutParameters = lp; } random1.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random1.SetBackgroundResource (Resource.Drawable.playblack); random1.ContentDescription = message.MessageGuid; random1.Click += delegate { Messages.MessageReceived m = new Messages.MessageReceived (message, context); }; RunOnUiThread (() => icons.AddView (random1)); } else { int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count; int iconSize = (int)ImageHelper.convertDpToPixel (34f, context); int toEnd = leftOver - (2 * iconSize) - (end * iconSize); for (int i = 0; i < end; ++i) { switch (message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: ImageView random2 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random2.LayoutParameters = lp; } random2.SetBackgroundResource (Resource.Drawable.textmsg); random2.ContentDescription = message.MessageID.ToString (); random2.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random2)); break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: ImageView random3 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random3.LayoutParameters = lp; } random3.SetBackgroundResource (Resource.Drawable.drawicon); random3.ContentDescription = message.MessageID.ToString (); random3.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random3)); break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: ImageView random4 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random4.LayoutParameters = lp; } random4.SetBackgroundResource (Resource.Drawable.comicon); random4.ContentDescription = message.MessageID.ToString (); random4.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random4)); break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: ImageView random5 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random5.LayoutParameters = lp; } random5.SetBackgroundResource (Resource.Drawable.comix); random5.ContentDescription = message.MessageID.ToString (); random5.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random5)); break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: ImageView random6 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random6.LayoutParameters = lp; } random6.SetBackgroundResource (Resource.Drawable.emoticon); random6.ContentDescription = message.MessageID.ToString (); random6.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random6)); break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: ImageView random7 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random7.LayoutParameters = lp; } random7.SetBackgroundResource (Resource.Drawable.polls); random7.ContentDescription = message.MessageID.ToString (); random7.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random7)); break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: ImageView random8 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random8.LayoutParameters = lp; } random8.SetBackgroundResource (Resource.Drawable.audiofile); random8.ContentDescription = message.MessageID.ToString (); random8.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random8)); break; case LOLMessageDelivery.MessageStep.StepTypes.Video: ImageView random9 = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); random9.LayoutParameters = lp; } random9.SetBackgroundResource (Resource.Drawable.camera); random9.ContentDescription = message.MessageID.ToString (); random9.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (random9)); break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: ImageView randomA = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (1f, context), 0); randomA.LayoutParameters = lp; } randomA.SetBackgroundResource (Resource.Drawable.microphone); randomA.ContentDescription = message.MessageID.ToString (); randomA.Click += new EventHandler (imgMessage_Click); RunOnUiThread (() => icons.AddView (randomA)); break; } } ImageView randomp = new ImageView (context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins (toEnd, 0, 0, 0); randomp.LayoutParameters = lp; } randomp.SetBackgroundResource (Resource.Drawable.playblack); randomp.ContentDescription = message.MessageID.ToString (); randomp.Click += new EventHandler (random_Click); RunOnUiThread (() => icons.AddView (randomp)); } RunOnUiThread (() => mBar.AddView (icons)); return mBar; }
private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver) { RunOnUiThread(delegate { LinearLayout icons = new LinearLayout(context); ImageView random = null; icons.Orientation = Orientation.Horizontal; icons.SetGravity(GravityFlags.Left); icons.SetVerticalGravity(GravityFlags.CenterVertical); icons.SetMinimumHeight(30); int topPos = 0; if (wowZapp.LaffOutOut.Singleton.resizeFonts) topPos = 0; icons.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0); if (message.MessageStepDBList.Count == 0) { using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, leftOver - (int)ImageHelper.convertDpToPixel(30f, context), 0); random.LayoutParameters = lp; } random.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(30f, context), (int)ImageHelper.convertDpToPixel(30f, context)); random.SetBackgroundResource(Resource.Drawable.playblack); random.ContentDescription = message.MessageGuid; random.Click += delegate { Messages.MessageReceived m = new Messages.MessageReceived(message, context); }; icons.AddView(random); } } else { int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count; int iconSize = (int)ImageHelper.convertDpToPixel(34f, context); int toEnd = leftOver - (2 * iconSize) - (end * iconSize); for (int i = 0; i < end; ++i) { switch (message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.textmsg); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.drawicon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.comicon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.comix); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.emoticon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.polls); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.audiofile); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.camera); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.microphone); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; } } using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(toEnd, 0, 0, 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.playblack); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(random_Click); icons.AddView(random); } } mBar.AddView(icons); }); return mBar; }