private void UpdateButton(bool emoji) { try { if (IsShowing == emoji) { return; } IsShowing = emoji; if (emoji) { Drawable dr = AppCompatResources.GetDrawable(ActivityContext, Resource.Drawable.ic_action_keyboard); DrawableCompat.SetTint(DrawableCompat.Wrap(dr), Color.Black); EmojisViewImage.SetImageDrawable(dr); } else { Drawable dr = AppCompatResources.GetDrawable(ActivityContext, Resource.Drawable.ic_action_sentiment_satisfied_alt); DrawableCompat.SetTint(DrawableCompat.Wrap(dr), Color.Black); EmojisViewImage.SetImageDrawable(dr); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnPageChanged(AXEmojiPager emojiPager, AXEmojiBase @base, int position) { try { Drawable drawable; if (AXEmojiManager.IsAXEmojiView(@base)) { drawable = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_backspace); Utils.EnableBackspaceTouch(Footer, emojiPager.EditText); Footer.SetOnClickListener(null); } else { drawable = AppCompatResources.GetDrawable(Context, Resource.Drawable.ic_action_search); Footer.SetOnTouchListener(null); Footer.SetOnClickListener(this); } DrawableCompat.SetTint(DrawableCompat.Wrap(drawable), AXEmojiManager.EmojiViewTheme.FooterItemColor); Img.SetImageDrawable(drawable); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void InitToolbar() { try { var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { toolBar.Title = ""; toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } SearchView = FindViewById <AutoCompleteTextView>(Resource.Id.searchBox); SearchView.SetOnEditorActionListener(this); //SearchView.ClearFocus(); //Change text colors SearchView.SetHintTextColor(Color.Gray); SearchView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void InitToolbar() { try { var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { toolBar.Title = CommunitiesType switch { "Page" => GetText(Resource.String.Lbl_DeletePage), "Group" => GetText(Resource.String.Lbl_DeleteGroup), _ => GetText(Resource.String.Lbl_Delete) }; toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnLoadStickerCategory(View icon, IStickerCategory stickerCategory, bool selected) { try { var image = (ImageView)icon; if (image != null) { if (stickerCategory is ShopStickers shopStickers) { Drawable dr0 = AppCompatResources.GetDrawable(icon.Context, (int)shopStickers.CategoryData); Drawable dr = dr0.GetConstantState()?.NewDrawable(); if (selected) { DrawableCompat.SetTint(DrawableCompat.Wrap(dr), AXEmojiManager.EmojiViewTheme.SelectedColor); } else { DrawableCompat.SetTint(DrawableCompat.Wrap(dr), AXEmojiManager.EmojiViewTheme.DefaultColor); } image?.SetImageDrawable(dr); } else { Glide.With(icon).Load(Integer.ValueOf(stickerCategory.CategoryData.ToString())).Apply(RequestOptions.FitCenterTransform()).Into(image); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Methods.App.FullScreenApp(this); SetContentView(Resource.Layout.Settings_Layout); var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { toolBar.Title = GetText(Resource.String.Lbl_Message_Notifications); toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, new SettingsNotificationPrefsFragment(this))?.Commit(); AdsGoogle.Ad_Interstitial(this); LinearLayout adContainer = FindViewById <LinearLayout>(Resource.Id.bannerContainer); BannerAd = AdsFacebook.InitAdView(this, adContainer); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void setTabBG(int tab1, int tab2) { if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBeanMr1) { ViewGroup tabStrip = (ViewGroup)tabLayout.GetChildAt(0); View tabView1 = tabStrip.GetChildAt(0); View tabView2 = tabStrip.GetChildAt(1); if (tabView1 != null) { int paddingStart = tabView1.PaddingStart; int paddingTop = tabView1.PaddingTop; int paddingEnd = tabView1.PaddingEnd; int paddingBottom = tabView1.PaddingBottom; ViewCompat.SetBackground(tabView1, AppCompatResources.GetDrawable(this.Context, tab1)); ViewCompat.SetPaddingRelative(tabView1, paddingStart, paddingTop, paddingEnd, paddingBottom); } if (tabView2 != null) { int paddingStart = tabView2.PaddingStart; int paddingTop = tabView2.PaddingTop; int paddingEnd = tabView2.PaddingEnd; int paddingBottom = tabView2.PaddingBottom; ViewCompat.SetBackground(tabView2, AppCompatResources.GetDrawable(this.Context, tab2)); ViewCompat.SetPaddingRelative(tabView2, paddingStart, paddingTop, paddingEnd, paddingBottom); } } }
private void InitToolbar() { try { var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { toolBar.Title = Type switch { "MangedGroupsModel" => GetString(Resource.String.Lbl_Manage_Groups), "MangedPagesModel" => GetString(Resource.String.Lbl_Manage_Pages), "StoryModel" => GetString(Resource.String.Lbl_Story), "FollowersModel" => GetString(Resource.String.Lbl_Following), "GroupsModel" => GetString(Resource.String.Lbl_Groups), "PagesModel" => GetString(Resource.String.Lbl_Pages), "ImagesModel" => GetString(Resource.String.Lbl_Photos), _ => toolBar.Title }; toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public VehicleHistoryAdapterViewHolder(View itemView, Action <VehicleHistoryAdapterClickEventArgs> onClick, Action <VehicleHistoryAdapterClickEventArgs> mileageRequest, Action <VehicleHistoryAdapterClickEventArgs> diagnosticRequest, Action <VehicleHistoryAdapterClickEventArgs> deleteRequest) : base(itemView) { VehicleText = itemView.FindViewById <TextView>(Resource.Id.VehicleDescription); VehicleMpg = itemView.FindViewById <TextView>(Resource.Id.MileageText); VehicleVin = itemView.FindViewById <TextView>(Resource.Id.VinText); VehicleEngine = itemView.FindViewById <TextView>(Resource.Id.EngineText); MileageButton = itemView.FindViewById <ImageButton>(Resource.Id.MileageButton); DiagnosticButton = itemView.FindViewById <ImageButton>(Resource.Id.DiagnosticButton); DeleteButton = itemView.FindViewById <ImageButton>(Resource.Id.DeleteButton); OptionsLayout = itemView.FindViewById <LinearLayout>(Resource.Id.OptionsLayout); itemView.Click += (sender, e) => { itemView.Background = AppCompatResources.GetDrawable(itemView.Context, Resource.Color.background_floating_material_dark); onClick(new VehicleHistoryAdapterClickEventArgs { ViewModel = ViewModel }); }; itemView.LongClick += ItemView_LongClick; MileageButton.Click += (sender, e) => mileageRequest(new VehicleHistoryAdapterClickEventArgs { ViewModel = ViewModel }); DiagnosticButton.Click += (sender, e) => diagnosticRequest(new VehicleHistoryAdapterClickEventArgs { ViewModel = ViewModel }); DeleteButton.LongClick += (sender, e) => deleteRequest(new VehicleHistoryAdapterClickEventArgs { ViewModel = ViewModel }); }
public void SetTheImageResource(int imageResource) { try { Drawable image = AppCompatResources.GetDrawable(Context, imageResource); SetImageDrawable(image); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public DiagnosticCodeAdapterViewHolder(View itemView, Action <DiagnosticCodeAdapterClickEventArgs> clickListener) : base(itemView) { CodeText = itemView.FindViewById <TextView>(Resource.Id.CodeText); SearchButton = itemView.FindViewById <ImageButton>(Resource.Id.SearchButton); SearchButton.Click += (sender, e) => { itemView.Background = AppCompatResources.GetDrawable(itemView.Context, Resource.Color.background_floating_material_dark); clickListener(new DiagnosticCodeAdapterClickEventArgs { Code = CodeText.Text }); }; }
/// <summary> /// Simple Method to set default settings for ReactButton Constructors /// - Default Text Is Like /// - set onClick And onLongClick /// - set Default image is Dark Like /// </summary> private void ReactButtonDefaultSetting() { MReactButton.Text = MDefaultReaction.GetReactText(); //MReactButton.SetOnClickListener(this); //MReactButton.SetOnLongClickListener(this); Drawable icon; if (MReactButton.Text == ReactConstants.Like) { icon = AppCompatResources.GetDrawable(Context, MDefaultReaction.GetReactType() == ReactConstants.Default ? Resource.Drawable.icon_post_like_vector : Resource.Drawable.like); //ic_action_like if (MDefaultReaction.GetReactType() == ReactConstants.Default) { icon.SetTint(Color.ParseColor(AppSettings.SetTabDarkTheme ? "#ffffff" : "#888888")); } } else if (MReactButton.Text == ReactConstants.Love) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.love); } else if (MReactButton.Text == ReactConstants.HaHa) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.haha); } else if (MReactButton.Text == ReactConstants.Wow) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.wow); } else if (MReactButton.Text == ReactConstants.Sad) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.sad); } else if (MReactButton.Text == ReactConstants.Angry) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.angry); } else { icon = AppCompatResources.GetDrawable(Context, MDefaultReaction.GetReactIconId()); } // Drawable icon = Build.VERSION.SdkInt < BuildVersionCodes.Lollipop ? VectorDrawableCompat.Create(Context.Resources, MDefaultReaction.GetReactIconId(), Context.Theme) : AppCompatResources.GetDrawable(Context, MDefaultReaction.GetReactIconId()); //MReactButton.CompoundDrawablePadding = 20; //if (AppSettings.FlowDirectionRightToLeft) // MReactButton.SetCompoundDrawablesWithIntrinsicBounds(null, null, icon, null); //else // MReactButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); SetImageReaction(icon); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var upArrow = AppCompatResources.GetDrawable(this, Resource.Drawable.abc_ic_ab_back_material); upArrow.SetColorFilter(new Color(ContextCompat.GetColor(this, Android.Resource.Color.HoloBlueBright)), PorterDuff.Mode.SrcIn); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeAsUpIndicator(upArrow); Button b = FindViewById <Button>(Resource.Id.button); b.Click += B_Click; }
public BluetoothDeviceAdapterViewHolder(View itemView, Action <BluetoothDeviceAdapterClickEventArgs> clickListener, Action <BluetoothDeviceAdapterClickEventArgs> longClickListener) : base(itemView) { DeviceName = itemView.FindViewById <TextView>(Resource.Id.DeviceName); itemView.Click += (sender, e) => { itemView.Background = AppCompatResources.GetDrawable(itemView.Context, Resource.Color.background_floating_material_dark); clickListener(new BluetoothDeviceAdapterClickEventArgs { DeviceName = DeviceName?.Text, DeviceAddress = DeviceAddress }); }; itemView.LongClick += (sender, e) => longClickListener(new BluetoothDeviceAdapterClickEventArgs { DeviceName = DeviceName?.Text, DeviceAddress = DeviceAddress }); }
static ColorStateList MakeDefaultColorStateList(Context context) { TypedValue mTypedValue = new TypedValue(); if (context.Theme?.ResolveAttribute(R.Attribute.TextColorSecondary, mTypedValue, true) == false) { return(null); } var baseCSL = AppCompatResources.GetColorStateList(context, mTypedValue.ResourceId); var colorPrimary = (ShellView.IsDarkTheme) ? AColor.White : ShellView.DefaultBackgroundColor.ToPlatform(); int defaultColor = baseCSL.DefaultColor; var disabledcolor = baseCSL.GetColorForState(new[] { -R.Attribute.StateEnabled }, AColor.Gray); return(MakeColorStateList(colorPrimary, disabledcolor, defaultColor)); }
private void InitData() { var adapter = new UserAdapter((IMvxAndroidBindingContext)BindingContext); adapter.SetOnItemClickListener(this); _recycleView.SetLayoutManager(new LinearLayoutManager(Activity)); _recycleView.HasFixedSize = true; _recycleView.SetAdapter(adapter); var drawable = AppCompatResources.GetDrawable(Activity, Resource.Drawable.circle_drawable); if (drawable != null) { drawable.SetColorFilter(GetColor(ViewModel.StatusColor), PorterDuff.Mode.SrcAtop); _circleView.Background = drawable; } }
private void InitToolbar() { try { TopToolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (TopToolBar != null) { TopToolBar.Title = GetText(Resource.String.Lbl_SharePost); TopToolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(TopToolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void InitToolbar() { try { var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { toolBar.Title = "#" + Tag; toolBar.SetTitleTextColor(ContextCompat.GetColor(this, Resource.Color.primary)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void InitToolbar() { try { var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (toolBar != null) { switch (TypePost) { case "post_likes": toolBar.Title = GetText(Resource.String.Lbl_PostLikes); break; case "post_wonders": toolBar.Title = AppSettings.PostButton switch { PostButtonSystem.Wonder => GetText(Resource.String.Lbl_PostWonders), PostButtonSystem.DisLike => GetText(Resource.String.Lbl_PostDisLike), _ => toolBar.Title }; break; } toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor)); SetSupportActionBar(toolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color)); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public static void InitCustomFooter(Context context, AXEmojiPager emojiPager) { try { FrameLayout footer = new FrameLayout(context); Drawable drawable = AppCompatResources.GetDrawable(context, Resource.Drawable.circle); if (DarkMode) { DrawableCompat.SetTint(DrawableCompat.Wrap(drawable), Color.ParseColor("#1B242D")); } footer.Background = drawable; if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { footer.Elevation = Utils.Dp(context, 4); } var lp = new AXEmojiLayout.LayoutParams(Utils.Dp(context, 48), Utils.Dp(context, 48)) { RightMargin = Utils.Dp(context, 12), BottomMargin = Utils.Dp(context, 12) }; footer.LayoutParameters = lp; emojiPager.SetCustomFooter(footer, true); ImageView img = new ImageView(context); var lp2 = new FrameLayout.LayoutParams(Utils.Dp(context, 22), Utils.Dp(context, 22)) { Gravity = GravityFlags.Center }; footer.AddView(img, lp2); emojiPager.SetOnEmojiPageChangedListener(new MyEmojiPagerPageChanged(context, footer, img)); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
/// <summary> /// /// </summary> /// <param name="react">Reaction to update UI by take attribute from it</param> private void UpdateReactButtonByReaction(Reaction react) { try { MCurrentReaction = react; MReactButton.Text = react.GetReactText(); MReactButton.SetTextColor(Color.ParseColor(react.GetReactTextColor())); //Drawable icon = Build.VERSION.SdkInt < BuildVersionCodes.Lollipop ? VectorDrawableCompat.Create(Context.Resources, react.GetReactIconId(), Context.Theme) : AppCompatResources.GetDrawable(Context,react.GetReactIconId()); Drawable icon = AppCompatResources.GetDrawable(Context, react.GetReactIconId()); if (MReactButton.Text == ReactConstants.Like) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, react.GetReactType() == ReactConstants.Default ? Resource.Drawable.icon_post_like_vector : Resource.Drawable.emoji_like); //ic_action_like } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, react.GetReactType() == ReactConstants.Default ? Resource.Drawable.icon_post_like_vector : Resource.Drawable.like); //ic_action_like } if (react.GetReactType() == ReactConstants.Default) { icon?.SetTint(Color.ParseColor(AppSettings.SetTabDarkTheme ? "#ffffff" : "#888888")); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_like); } } else if (MReactButton.Text == ReactConstants.Love) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_love); } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.love); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_love); } } else if (MReactButton.Text == ReactConstants.HaHa) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_haha); } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.haha); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_haha); } } else if (MReactButton.Text == ReactConstants.Wow) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_wow); } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.wow); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_wow); } } else if (MReactButton.Text == ReactConstants.Sad) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_sad); } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.sad); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_sad); } } else if (MReactButton.Text == ReactConstants.Angry) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_angry); } else if (AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.angry); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.emoji_angry); } } else { icon = AppCompatResources.GetDrawable(Context, react.GetReactIconId()); if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var imgLike = PostData.View?.FindViewById <ImageView>(Resource.Id.image_like1); imgLike?.SetImageResource(Resource.Drawable.icon_post_like_vector); } } MReactButton.CompoundDrawablePadding = 20; if (AppSettings.FlowDirectionRightToLeft) { MReactButton.SetCompoundDrawablesWithIntrinsicBounds(null, null, icon, null); } else { MReactButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); } //SetImageReaction(icon); MCurrentReactState = !react.GetReactType().Equals(MDefaultReaction.GetReactType()); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void LoadPost() { try { PostObject = JsonConvert.DeserializeObject <PostDataObject>(Intent?.GetStringExtra("PostObject")); if (PostObject != null) { var readMoreOption = new StReadMoreOption.Builder() .TextLength(200, StReadMoreOption.TypeCharacter) .MoreLabel(GetText(Resource.String.Lbl_ReadMore)) .LessLabel(GetText(Resource.String.Lbl_ReadLess)) .MoreLabelColor(Color.ParseColor(AppSettings.MainColor)) .LessLabelColor(Color.ParseColor(AppSettings.MainColor)) .LabelUnderLine(true) .Build(); if (SecondReactionButton != null) { switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: case PostButtonSystem.ReactionSubShine: case PostButtonSystem.Like: MainSectionButton.WeightSum = 3; SecondReactionButton.Visibility = ViewStates.Gone; break; case PostButtonSystem.Wonder: MainSectionButton.WeightSum = 4; SecondReactionButton.Visibility = ViewStates.Visible; SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_wowonder, 0, 0, 0); SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Wonder); break; case PostButtonSystem.DisLike: MainSectionButton.WeightSum = 4; SecondReactionButton.Visibility = ViewStates.Visible; SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_dislike, 0, 0, 0); SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Dislike); break; default: MainSectionButton.WeightSum = 3; SecondReactionButton.Visibility = ViewStates.Gone; break; } } var publisher = PostObject.Publisher ?? PostObject.UserData; if (publisher != null) { if (PostObject.PostPrivacy == "4") { Username.Text = GetText(Resource.String.Lbl_Anonymous); GlideImageLoader.LoadImage(this, "user_anonymous", UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); } else { GlideImageLoader.LoadImage(this, publisher.Avatar, UserAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var postDataDecoratedContent = new WoTextDecorator().SetupStrings(PostObject, this); Username.SetText(postDataDecoratedContent, TextView.BufferType.Spannable); } if (PostExtrasLayout != null) { PostExtrasLayout.Visibility = PostObject.IsPostBoosted == "0" ? ViewStates.Gone : ViewStates.Visible; } if (string.IsNullOrEmpty(PostObject.Orginaltext)) { if (Description.Visibility != ViewStates.Gone) { Description.Visibility = ViewStates.Gone; } } else { if (Description.Visibility != ViewStates.Visible) { Description.Visibility = ViewStates.Visible; } if (!Description.Text.Contains(GetText(Resource.String.Lbl_ReadMore)) && !Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess))) { if (PostObject.RegexFilterList != null & PostObject.RegexFilterList?.Count > 0) { Description.SetAutoLinkOnClickListener(this, PostObject.RegexFilterList); } else { Description.SetAutoLinkOnClickListener(this, new Dictionary <string, string>()); } readMoreOption.AddReadMoreTo(Description, new String(PostObject.Orginaltext)); } else if (Description.Text.Contains(GetText(Resource.String.Lbl_ReadLess))) { readMoreOption.AddReadLess(Description, new String(PostObject.Orginaltext)); } else { Description.Text = PostObject.Orginaltext; } } bool success = int.TryParse(PostObject.Time, out var number); TimeText.Text = success ? Methods.Time.TimeAgo(number, false) : PostObject.Time; if (PrivacyPostIcon != null && !string.IsNullOrEmpty(PostObject.PostPrivacy) && publisher.UserId == UserDetails.UserId) { if (PostObject.PostPrivacy == "0") //Everyone { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Globe); } else if (PostObject.PostPrivacy.Contains("ifollow") || PostObject.PostPrivacy == "2") //People_i_Follow { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.User); } else if (PostObject.PostPrivacy.Contains("me") || PostObject.PostPrivacy == "1") //People_Follow_Me { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.UserFriends); } else if (PostObject.PostPrivacy == "4") //Anonymous { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeSolid, PrivacyPostIcon, FontAwesomeIcon.UserSecret); } else //No_body) { FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, PrivacyPostIcon, FontAwesomeIcon.Lock); } PrivacyPostIcon.Visibility = ViewStates.Visible; } if (CommentCount != null) { CommentCount.Text = PostObject.PostComments; } } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostObject.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); if (LikeCount != null) { LikeCount.Text = PostObject?.Reaction?.Count + " " + GetString(Resource.String.Btn_Likes); } if (PostObject.Reaction.IsReacted != null && PostObject.Reaction.IsReacted.Value) { if (!string.IsNullOrEmpty(PostObject.Reaction.Type)) { var react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Id == PostObject.Reaction.Type).Value?.Id ?? ""; switch (react) { case "1": LikeButton.SetReactionPack(ReactConstants.Like); break; case "2": LikeButton.SetReactionPack(ReactConstants.Love); break; case "3": LikeButton.SetReactionPack(ReactConstants.HaHa); break; case "4": LikeButton.SetReactionPack(ReactConstants.Wow); break; case "5": LikeButton.SetReactionPack(ReactConstants.Sad); break; case "6": LikeButton.SetReactionPack(ReactConstants.Angry); break; default: LikeButton.SetReactionPack(ReactConstants.Default); break; } } } else { LikeButton.SetReactionPack(ReactConstants.Default); } } else { if (PostObject.IsLiked != null && PostObject.IsLiked.Value) { LikeButton.SetReactionPack(ReactConstants.Like); } if (LikeCount != null) { LikeCount.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostObject.PostLikes)) + " " + GetString(Resource.String.Btn_Likes); } if (SecondReactionButton != null) { switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when PostObject.IsWondered != null && PostObject.IsWondered.Value: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Lbl_wondered); SecondReactionButton.SetTextColor(Color.ParseColor(AppSettings.MainColor)); break; } case PostButtonSystem.Wonder: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_wowonder); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Btn_Wonder); SecondReactionButton.SetTextColor(Color.ParseColor("#444444")); break; } case PostButtonSystem.DisLike when PostObject.IsWondered != null && PostObject.IsWondered.Value: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#f89823")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#f89823"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Lbl_disliked); SecondReactionButton.SetTextColor(Color.ParseColor("#f89823")); break; } case PostButtonSystem.DisLike: { Drawable unwrappedDrawable = AppCompatResources.GetDrawable(this, Resource.Drawable.ic_action_dislike); Drawable wrappedDrawable = DrawableCompat.Wrap(unwrappedDrawable); if (Build.VERSION.SdkInt <= BuildVersionCodes.Lollipop) { DrawableCompat.SetTint(wrappedDrawable, Color.ParseColor("#666666")); } else { wrappedDrawable = wrappedDrawable.Mutate(); wrappedDrawable.SetColorFilter(new PorterDuffColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcAtop)); } SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(wrappedDrawable, null, null, null); SecondReactionButton.Text = GetString(Resource.String.Btn_Dislike); SecondReactionButton.SetTextColor(Color.ParseColor("#444444")); break; } } } } if (PostObject?.GetPostComments?.Count > 0) { var db = ClassMapper.Mapper?.Map <List <CommentObjectExtra> >(PostObject.GetPostComments); MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>(db); } else { MAdapter.CommentList = new ObservableCollection <CommentObjectExtra>(); } MAdapter.NotifyDataSetChanged(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
/// <summary> /// /// </summary> /// <param name="react">Reaction to update UI by take attribute from it</param> private void UpdateReactButtonByReaction(Reaction react) { try { MCurrentReaction = react; MReactButton.Text = react.GetReactText(); MReactButton.SetTextColor(Color.ParseColor(react.GetReactTextColor())); //Drawable icon = Build.VERSION.SdkInt < BuildVersionCodes.Lollipop ? VectorDrawableCompat.Create(Context.Resources, react.GetReactIconId(), Context.Theme) : AppCompatResources.GetDrawable(Context,react.GetReactIconId()); Drawable icon; if (MReactButton.Text == ReactConstants.Like) { icon = AppCompatResources.GetDrawable(Context, react.GetReactType() == ReactConstants.Default ? Resource.Drawable.icon_post_like_vector : Resource.Drawable.like); //ic_action_like if (react.GetReactType() == ReactConstants.Default) { icon.SetTint(Color.ParseColor(AppSettings.SetTabDarkTheme ? "#ffffff" : "#888888")); } } else if (MReactButton.Text == ReactConstants.Love) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.love); } else if (MReactButton.Text == ReactConstants.HaHa) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.haha); } else if (MReactButton.Text == ReactConstants.Wow) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.wow); } else if (MReactButton.Text == ReactConstants.Sad) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.sad); } else if (MReactButton.Text == ReactConstants.Angry) { icon = AppCompatResources.GetDrawable(Context, Resource.Drawable.angry); } else { icon = AppCompatResources.GetDrawable(Context, react.GetReactIconId()); } //if (AppSettings.FlowDirectionRightToLeft) // MReactButton.SetCompoundDrawablesWithIntrinsicBounds(null, null, icon, null); //else // MReactButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); SetImageReaction(icon); //MReactButton.CompoundDrawablePadding = 10; MCurrentReactState = !react.GetReactType().Equals(MDefaultReaction.GetReactType()); } catch (Exception e) { Console.WriteLine(e); } }
private void Init(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) { try { View view = Inflate(context, Resource.Layout.RecordViewLayout, null); AddView(view); ViewGroup viewGroup = (ViewGroup)view.Parent; viewGroup.SetClipChildren(false); Arrow = view.FindViewById <ImageView>(Resource.Id.arrow); SlideToCancel = view.FindViewById <TextView>(Resource.Id.slide_to_cancel); SmallBlinkingMic = view.FindViewById <ImageView>(Resource.Id.glowing_mic); CounterTime = view.FindViewById <Chronometer>(Resource.Id.counter_tv); BasketImg = view.FindViewById <ImageView>(Resource.Id.basket_img); SlideToCancelLayout = view.FindViewById <ShimmerLayout>(Resource.Id.shimmer_layout); HideViews(true); if (attrs != null) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.RecordView, defStyleAttr, defStyleRes); int slideArrowResource = typedArray.GetResourceId(Resource.Styleable.RecordView_slide_to_cancel_arrow, -1); string slideToCancelText = typedArray.GetString(Resource.Styleable.RecordView_slide_to_cancel_text); int slideMarginRight = (int)typedArray.GetDimension(Resource.Styleable.RecordView_slide_to_cancel_margin_right, 30); Color counterTimeColor = typedArray.GetColor(Resource.Styleable.RecordView_counter_time_color, -1); Color arrowColor = typedArray.GetColor(Resource.Styleable.RecordView_slide_to_cancel_arrow_color, -1); int cancelBounds = typedArray.GetDimensionPixelSize(Resource.Styleable.RecordView_slide_to_cancel_bounds, -1); if (cancelBounds != -1) { SetCancelBounds(cancelBounds, false);//don't convert it to pixels since it's already in pixels } if (slideArrowResource != -1) { Drawable slideArrow = AppCompatResources.GetDrawable(((View)this).Context, slideArrowResource); Arrow.SetImageDrawable(slideArrow); } if (slideToCancelText != null) { SlideToCancel.Text = slideToCancelText; } if (counterTimeColor != -1) { SetCounterTimeColor(counterTimeColor); } if (arrowColor != -1) { SetSlideToCancelArrowColor(arrowColor); } SetMarginRight(slideMarginRight, true); typedArray.Recycle(); } AnimationHelper = new AnimationHelper(context, BasketImg, SmallBlinkingMic); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }