本文整理汇总了C#中ImageView.SetBackgroundResource方法的典型用法代码示例。如果您正苦于以下问题:C# ImageView.SetBackgroundResource方法的具体用法?C# ImageView.SetBackgroundResource怎么用?C# ImageView.SetBackgroundResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView.SetBackgroundResource方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createMessageBar
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;
}
//.........这里部分代码省略.........
示例2: UpdateLinksTab
private void UpdateLinksTab (ICursor cursor)
{
ViewGroup container = mRootView.FindViewById<ViewGroup> (Resource.Id.links_container);
// Remove all views but the 'empty' view
int childCount = container.ChildCount;
if (childCount > 1) {
container.RemoveViews (1, childCount - 1);
}
LayoutInflater inflater = GetLayoutInflater (null);
bool hasLinks = false;
for (int i = 0; i < SessionsQuery.LINKS_INDICES.Length; i++) {
String url = cursor.GetString (SessionsQuery.LINKS_INDICES [i]);
if (!TextUtils.IsEmpty (url)) {
hasLinks = true;
ViewGroup linkContainer = (ViewGroup)inflater.Inflate (Resource.Layout.list_item_session_link, container, false);
linkContainer.FindViewById<TextView> (Resource.Id.link_text).SetText (SessionsQuery.LINKS_TITLES [i]);
int linkTitleIndex = i;
linkContainer.Click += (sender, e) => {
FireLinkEvent (SessionsQuery.LINKS_TITLES [linkTitleIndex]);
Intent intent = new Intent (Intent.ActionView, Android.Net.Uri.Parse (url));
intent.AddFlags (ActivityFlags.ClearWhenTaskReset);
StartActivity (intent);
};
container.AddView (linkContainer);
// Create separator
View separatorView = new ImageView (Activity);
separatorView.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
separatorView.SetBackgroundResource (Android.Resource.Drawable.DividerHorizontalBright);
container.AddView (separatorView);
}
}
container.FindViewById (Resource.Id.empty_links).Visibility = (hasLinks ? ViewStates.Gone : ViewStates.Visible);
}
示例3: createConfigPicker
private LinearLayout createConfigPicker()
{
LinearLayout holder = new LinearLayout (context);
holder.Orientation = Orientation.Horizontal;
holder.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
holder.SetBackgroundResource (Resource.Drawable.footerback);
LinearLayout level2 = new LinearLayout (context);
level2.Orientation = Orientation.Vertical;
level2.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), LinearLayout.LayoutParams.FillParent);
LinearLayout topSeekHolder = new LinearLayout (context);
topSeekHolder.Orientation = Orientation.Horizontal;
LinearLayout.LayoutParams viewParams;
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0, 0);
topSeekHolder.LayoutParameters = viewParams;
SeekBar topSeek = new SeekBar (context);
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, (int)ImageHelper.convertDpToPixel (10f, context));
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (15f, context), 0);
topSeek.LayoutParameters = viewParams;
topSeekHolder.AddView (topSeek);
LinearLayout set1 = new LinearLayout (context);
set1.Orientation = Orientation.Horizontal;
set1.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
TextView set1Text = new TextView (context);
set1Text.SetTextColor (Color.Black);
set1Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
set1Text.Gravity = GravityFlags.CenterHorizontal;
set1Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
set1Text.Text = "1";
HorizontalScrollView set1HSV = new HorizontalScrollView (context);
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
set1HSV.LayoutParameters = viewParams;
set1.AddView (set1Text);
set1.AddView (set1HSV);
LinearLayout gap1 = new LinearLayout (context);
gap1.Orientation = Orientation.Vertical;
gap1.SetBackgroundColor (Color.Brown);
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
gap1.LayoutParameters = viewParams;
set1.AddView (gap1);
LinearLayout set2 = new LinearLayout (context);
set2.Orientation = Orientation.Horizontal;
set2.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
TextView set2Text = new TextView (context);
set2Text.SetTextColor (Color.Black);
set2Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
set2Text.Gravity = GravityFlags.CenterHorizontal;
set2Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
set2Text.Text = "2";
HorizontalScrollView set2HSV = new HorizontalScrollView (context);
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
set2HSV.LayoutParameters = viewParams;
set2.AddView (set2Text);
set2.AddView (set2HSV);
LinearLayout gap2 = new LinearLayout (context);
gap2.Orientation = Orientation.Vertical;
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
gap2.LayoutParameters = viewParams;
gap2.SetBackgroundColor (Color.Brown);
set2.AddView (gap2);
LinearLayout set3 = new LinearLayout (context);
set3.Orientation = Orientation.Horizontal;
set3.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
TextView set3Text = new TextView (context);
set3Text.SetTextColor (Color.Black);
set3Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
set3Text.Gravity = GravityFlags.CenterHorizontal;
set3Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
set3Text.Text = "3";
HorizontalScrollView set3HSV = new HorizontalScrollView (context);
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
set3HSV.LayoutParameters = viewParams;
set3.AddView (set3Text);
set3.AddView (set3HSV);
LinearLayout gap3 = new LinearLayout (context);
gap3.Orientation = Orientation.Vertical;
viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
gap3.LayoutParameters = viewParams;
gap3.SetBackgroundColor (Color.Brown);
set3.AddView (gap3);
LinearLayout set4 = new LinearLayout (context);
set4.Orientation = Orientation.Horizontal;
set4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
TextView set4Text = new TextView (context);
//.........这里部分代码省略.........
示例4: CreatePreviewUI
//.........这里部分代码省略.........
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);
示例5: createUI
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);
//.........这里部分代码省略.........
示例6: OnCreate
//.........这里部分代码省略.........
imgRatingFollowUp.SetBackgroundDrawable (bgRating);
imgRatingFollowUp.Click += (sender, e) => {
if(isFeeback) {
if(dialogFeedbackReview == null){
dialogFeedbackReview = new RatingFeedbackReview(this);
}
dialogFeedbackReview.showFeedbackReview(iRatingNumber, sFeedBackContent);
} else {
if(dialogFeedback == null){
dialogFeedback = new RatingFeedbackUI(this, callId);
dialogFeedback.actionRatingDelegate = this;
}
dialogFeedback.showRatingFeedback();
}
};
imgFavoriteFollowUp.Click += (sender, e) => {
if (isFavorite) {
if(dialogFavorite == null){
dialogFavorite = new FavoriteUI(this);
dialogFavorite.actionFavoriteDelegate = this;
}
dialogFavorite.removeFavoriteRequest(specId);
} else {
if(dialogFavorite == null){
dialogFavorite = new FavoriteUI(this);
dialogFavorite.actionFavoriteDelegate = this;
}
dialogFavorite.addToFavouriteRequest(specId);
}
};
Background bgEmail = new Background (this, Resource.Drawable.ic_emailprofile, Resource.Drawable.ic_emailprofile_pressed);
imgEmailFollowUp.SetBackgroundDrawable (bgEmail);
imgEmailFollowUp.Click += (sender, e) => {
SendEmailUI dialog = new SendEmailUI(this);
dialog.actionDelegate = this;
dialog.showEmailDialog(specId);
};
Background bgWaivefee = new Background (this, Resource.Drawable.ic_waive, Resource.Drawable.ic_waive_pressed);
imgWaiveFeeFollowUp.SetBackgroundDrawable (bgWaivefee);
imgWaiveFeeFollowUp.Click += (sender, e) => {
if(dtEndWaiveFee != null && dtEndWaiveFee.AddMinutes (Constants.pTimeWaiveFee) >= Utils.getDateTimeNow (MApplication.getInstance ().timezoneName)){
if (popupConfirm == null) {
popupConfirm = new PopUpConfirm (this);
popupConfirm.actionConfirmDelegate = this;
}
popupConfirm.showConfirmDialog (GetString(Resource.String.waive_fee_title), GetString(Resource.String.waive_fee_content), "Yes", "No");
} else {
popupNotice.showNoticeDialog(GetString(Resource.String.waive_fee_expired_title), GetString(Resource.String.waive_fee_expired));
imgWaiveFeeFollowUp.Enabled = false;
imgWaiveFeeFollowUp.SetBackgroundResource(Resource.Drawable.ic_waive_disable);
imgWaiveFeeFollowUp.SetImageResource(Resource.Drawable.ic_waive_disable);
}
};
Background bgTranscribe = new Background (this, Resource.Drawable.ic_transcribe, Resource.Drawable.ic_transcribe_pressed);
imgTranscribeFollowUp.SetBackgroundDrawable (bgTranscribe);
imgTranscribeFollowUp.Click += (sender, e) => {
TranscribeRequest transcribe = new TranscribeRequest(this);
transcribe.transcribeDelegate = this;
transcribe.getTranscribe(callId, recordUrl);
};
Background bgUpphoto = new Background (this, Resource.Drawable.camera, Resource.Drawable.camera_pressed);
imgUpPhotoFollowUp.SetBackgroundDrawable (bgUpphoto);
imgUpPhotoFollowUp.Click += (sender, e) => {
if(uploadPhoto == null){
uploadPhoto = new UploadPhoto(this);
uploadPhoto.actionUploadPhotoDelegate = this;
}
uploadPhoto.selectActionUpload();
};
Background bgReplay = new Background (this, Resource.Drawable.ic_replay, Resource.Drawable.ic_replay_pressed);
imgReplayFollowUp.SetBackgroundDrawable (bgReplay);
imgReplayFollowUp.Click += (sender, e) => {
if(recordUrl != null){
if(!recordUrl.Equals("")){
Intent intent = new Intent(this, typeof(PlayAudioManager));
intent.PutExtra(constants.pPathAudioFile, recordUrl);
StartActivity(intent);
} else {
popupNotice.showNoticeDialog(GetString(Resource.String.title_notice), GetString(Resource.String.replay_not_exist_notice));
}
} else {
popupNotice.showNoticeDialog(GetString(Resource.String.title_notice), GetString(Resource.String.replay_not_exist_notice));
}
};
popupNotice = new PopupNoticeInfomation (this);
popupNotice.noticeDelegate = this;
updateCallStart (constants.durationInfo);
TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostStopCall, new TCSelector (updateCallStop));
TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostFolloUp, new TCSelector (onFollowUpAction));
TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostUploadFileSuccess, new TCSelector (onUploadFileSuccess));
TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostDeleteFileSuccess, new TCSelector (onDeleteFileSuccess));
}
示例7: AddNewUsers
private void AddNewUsers(List<User> users)
{
User user = new User();
user = users [counter];
#if DEBUG
System.Diagnostics.Debug.WriteLine("Users to add : {0}", user.FirstName + " " + user.LastName);
#endif
RunOnUiThread(delegate
{
ModalNewContact = new Dialog(this, Resource.Style.lightbox_dialog);
ModalNewContact.SetContentView(Resource.Layout.ModalNewContacts);
((Button)ModalNewContact.FindViewById(Resource.Id.btnAccept)).Click += delegate
{
if (user.Picture.Length > 0)
{
Contacts.ContactsUtil.contactFilenames.Add(user.AccountID.ToString());
System.IO.File.WriteAllBytes(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, user.AccountID.ToString()),
user.Picture);
}
DismissModalDialog();
counter++;
ContactDB contact = new ContactDB();
contact.Blocked = false;
contact.ContactAccountID = user.AccountID;
contact.OwnerAccountID = AndroidData.CurrentUser.AccountID;
contact.ContactUser = user;
contacts.Add(contact);
if (counter < users.Count)
AddNewUsers(users);
else
{
DismissModalDialog();
returnToSender();
}
};
((Button)ModalNewContact.FindViewById(Resource.Id.btnDecline)).Click += delegate
{
DismissModalDialog();
counter++;
if (counter < users.Count)
AddNewUsers(users);
else
{
DismissModalDialog();
returnToSender();
}
};
((TextView)ModalNewContact.FindViewById(Resource.Id.txtContactName)).Text = user.FirstName + " " + user.LastName;
modalImage = ((ImageView)ModalNewContact.FindViewById(Resource.Id.imgContact));
if (Contacts.ContactsUtil.contactFilenames.Contains(user.AccountID.ToString()))
{
Bitmap bm = BitmapFactory.DecodeFile(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, user.AccountID.ToString()));
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
byte[] img = ms.ToArray();
displayImage(img, modalImage);
} else
{
if (user.Picture.Length == 0)
RunOnUiThread(() => modalImage.SetBackgroundResource(Resource.Drawable.defaultuserimage));
else
{
if (user.Picture.Length == 0)
{
LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, user.AccountID, new Guid(AndroidData.ServiceAuthToken));
} else
{
Bitmap bm = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.defaultuserimage);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
byte[] img = ms.ToArray();
displayImage(img, modalImage);
}
}
}
ModalNewContact.Show();
});
}
示例8: OnCreate
//int height, oldX, oldY, X, Y;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.card_table);
group = (ViewGroup)FindViewById (Resource.Id.Main);
ivBottom = FindViewById<ImageView> (Resource.Id.ivBottom);
ivRight = FindViewById<ImageView> (Resource.Id.ivRight);
ivTop = FindViewById<ImageView> (Resource.Id.ivTop);
ivLeft = FindViewById<ImageView> (Resource.Id.ivLeft);
lp = (RelativeLayout.LayoutParams)ivBottom.LayoutParameters;
layoutParams = new RelativeLayout.LayoutParams (lp.Width, lp.Height);
image = new ImageView (this);
RunOnUiThread (() => {
image.SetBackgroundResource (Resource.Drawable.blank_small);
image.SetImageResource (Resource.Drawable.back);
//image.Click += Remove_OnTouch;
image.SetOnTouchListener (this);
image.LayoutParameters = layoutParams;
group.AddView (image);
});
MyAnimationListener.AnimationEnded += AnimationEndedHandler;
Deck deck = new Deck (0);
cards = deck.ShuffledStack;
//card = cards.Pop ();
}
示例9: createUI
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;
//.........这里部分代码省略.........
示例10: GetView
public override View GetView (int position, View convertView, ViewGroup parent)
{
// Make an ImageView to show a photo
ImageView i = new ImageView (self);
i.SetImageResource (mPhotos[position]);
i.SetAdjustViewBounds (true);
i.LayoutParameters = new AbsListView.LayoutParams (AbsListView.LayoutParams.WrapContent,
AbsListView.LayoutParams.WrapContent);
// Give it a nice background
i.SetBackgroundResource (Resource.Drawable.picture_frame);
return i;
}
示例11: createMessageBar
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))
{
//.........这里部分代码省略.........
示例12: generateMessageBarAndAnimate
private void generateMessageBarAndAnimate(string message, MessageDB msgList, UserDB contact, bool shutUp = false)
{
//RunOnUiThread (delegate {
bool rpong = false;
if (shutUp != true) {
AudioPlayer ap = new AudioPlayer (context);
Android.Content.Res.AssetManager am = this.Assets;
ap.playFromAssets (am, "incoming.mp3");
}
Guid grabGuid = Guid.Empty;
RunOnUiThread (() => messageBar.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context),
(int)ImageHelper.convertDpToPixel (10f, context)));
int leftOver = Convert.ToInt32 (wowZapp.LaffOutOut.Singleton.ScreenXWidth - (picSize + 40));
LinearLayout.LayoutParams layParams;
if (contact == null)
throw new Exception ("Contact is null in generateMessageBarAndAnimate");
ImageView profilePic = new ImageView (context);
using (layParams = new LinearLayout.LayoutParams (picSize, picSize)) {
layParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), (int)ImageHelper.convertDpToPixel (20f, context), 0, 0);
profilePic.LayoutParameters = layParams;
}
profilePic.SetBackgroundResource (Resource.Drawable.defaultuserimage);
profilePic.Tag = new Java.Lang.String ("profilepic_" + contact.AccountID);
RunOnUiThread (() => messageBar.AddView (profilePic));
if (Contacts.ContactsUtil.contactFilenames.Contains (contact.AccountGuid)) {
rpong = true;
using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, contact.AccountGuid))) {
using (MemoryStream ms = new MemoryStream ()) {
bm.Compress (Bitmap.CompressFormat.Jpeg, 80, ms);
byte[] image = ms.ToArray ();
displayImage (image, profilePic);
}
}
} else {
if (contact.Picture.Length == 0)
grabGuid = contact.AccountID;
else {
if (contact.Picture.Length > 0)
loadProfilePicture (contact, profilePic);
}
}
LinearLayout fromTVH = new LinearLayout (context);
fromTVH.Orientation = Orientation.Vertical;
fromTVH.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
float textNameSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? (int)ImageHelper.convertPixelToDp (((25 * picSize) / 100), context) : 16f;
TextView textFrom = new TextView (context);
using (layParams = new LinearLayout.LayoutParams (leftOver, (int)textNameSize)) {
layParams.SetMargins ((int)ImageHelper.convertDpToPixel (9.3f, context), (int)ImageHelper.convertPixelToDp (textNameSize - 1, context), 0, 0);
textFrom.LayoutParameters = layParams;
}
float fontSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((12 * picSize) / 100), context) : ImageHelper.convertPixelToDp (14f, context);
textFrom.SetTextSize (Android.Util.ComplexUnitType.Dip, fontSize);
textFrom.SetTextColor (Color.Black);
if (contact != null)
textFrom.Text = contact.FirstName + " " + contact.LastName;
else
textFrom.Text = "Ann Onymouse";
RunOnUiThread (() => fromTVH.AddView (textFrom));
float textMessageSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((70 * picSize) / 100), context) : ImageHelper.convertDpToPixel (39f, context);
TextView textMessage = new TextView (context);
using (layParams = new LinearLayout.LayoutParams (leftOver, (int)textMessageSize)) {
layParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10, context), 0);
textMessage.LayoutParameters = layParams;
}
float fontSize2 = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((12 * picSize) / 100), context) : ImageHelper.convertPixelToDp (16f, context);
textMessage.SetTextSize (Android.Util.ComplexUnitType.Dip, fontSize2);
textMessage.SetTextColor (Color.White);
textMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
if (!string.IsNullOrEmpty (message))
textMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft);
textMessage.Text = message != string.Empty ? message : "";
textMessage.ContentDescription = msgList.MessageGuid;
textMessage.Click += new EventHandler (textMessage_Click);
RunOnUiThread (() => fromTVH.AddView (textMessage));
//}
if (msgList != null) {
LinearLayout messageItems = new LinearLayout (context);
messageItems.Orientation = Orientation.Horizontal;
float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((35 * picSize) / 100), context) : ImageHelper.convertDpToPixel (40f, context);
using (layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) {
layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context));
messageItems.LayoutParameters = layParams;
}
messageItems.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0);
messageItems.SetGravity (GravityFlags.Left);
messageItems = createMessageBar (messageItems, msgList, leftOver);
RunOnUiThread (() => fromTVH.AddView (messageItems));
}
RunOnUiThread (() => messageBar.AddView (fromTVH));
//.........这里部分代码省略.........
示例13: OnCreate
//.........这里部分代码省略.........
layout = FindViewById<LinearLayout>(Resource.Id.imageLayout);
ib = FindViewById<ImageButton>(Resource.Id.playButton);
pb = FindViewById<ProgressBar>(Resource.Id.timerBar);
if (option == 2 || option == 5)
ib.Visibility = pb.Visibility = ViewStates.Invisible;
context = relLayout.Context;
Header.headertext = head;
Header.fontsize = 36f;
ImageHelper.fontSizeInfo(context);
header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
header.Text = Header.headertext;
ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
btnBack.Tag = 0;
ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
btnHome.Tag = 1;
btnBack.Click += delegate
{
Finish();
};
btnHome.Click += delegate
{
Intent i = new Intent(this, typeof(Main.HomeActivity));
i.AddFlags(ActivityFlags.ClearTop);
StartActivity(i);
};
btnAdd = FindViewById<Button>(Resource.Id.btnAdd);
btnSend = FindViewById<Button>(Resource.Id.btnSend);
btnAdd.Visibility = ViewStates.Invisible;
btnSend.Visibility = ViewStates.Invisible;
newSizes = new float[2];
newSizes [0] = newSizes [1] = 200f;
if (wowZapp.LaffOutOut.Singleton.resizeFonts)
{
newSizes [0] *= wowZapp.LaffOutOut.Singleton.bigger;
newSizes [1] = newSizes [0];
}
images = null;
webImages = null;
if (ComposeMessageMainUtil.contentPackID == null)
ComposeMessageMainUtil.contentPackID = new int[6];
if (btnAdd.Visibility == ViewStates.Invisible)
{
RunOnUiThread(delegate
{
ImageView preview = new ImageView(context);
preview.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
preview.SetScaleType(ImageView.ScaleType.FitXy);
switch (option)
{
case 1:
preview.SetBackgroundResource(Resource.Drawable.comix);
break;
case 2:
preview.SetBackgroundResource(Resource.Drawable.comicon);
break;
case 3:
preview.SetBackgroundResource(Resource.Drawable.audiofile);
break;
case 4:
preview.SetBackgroundResource(Resource.Drawable.video);
break;
case 5:
preview.SetBackgroundResource(Resource.Drawable.audiofile);
break;
case 6:
preview.SetBackgroundResource(Resource.Drawable.emoticon);
break;
case 7:
preview.SetBackgroundResource(Resource.Drawable.drawicon);
break;
}
preview.Click += (object sender, EventArgs e) => createNewMessage(sender, e);
if (wowZapp.LaffOutOut.Singleton.resizeFonts)
{
images = preview;
}
layout.AddView(preview);
});
}
ImageButton[] buttons = new ImageButton[2];
LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
buttons [0] = btnBack;
buttons [1] = btnHome;
ImageHelper.setupButtonsPosition(buttons, bottom, context);
cpcutil.genericIsDone = false;
btnSend.Click += (object sender, EventArgs e) => SendMessage(sender, e);
btnAdd.Click += (object sender, EventArgs e) => AddToMessages(sender, e);
}
示例14: displayNormalIcon
private void displayNormalIcon(int code)
{
ImageView preview = new ImageView(context);
newSizes [0] = newSizes [1] = 200f;
preview.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
preview.SetScaleType(ImageView.ScaleType.FitXy);
preview.Click += (object sender, EventArgs e) => createNewMessage(sender, e);
switch (code)
{
case 3:
preview.SetBackgroundResource(Resource.Drawable.audiofile);
break;
case 4:
preview.SetBackgroundResource(Resource.Drawable.video);
break;
//case 5:
// preview.SetBackgroundResource (Resource.Drawable.soundfxmsg);
break;
case 7:
preview.SetBackgroundResource(Resource.Drawable.drawicon);
break;
}
images = preview;
layout.AddView(preview);
RunOnUiThread(delegate
{
btnAdd.Visibility = ViewStates.Visible;
btnSend.Visibility = ViewStates.Visible;
});
}