Beispiel #1
0
        public EditImageDialog(Activity context, CellControllerImage controller)
        {
            this.context    = context;
            this.controller = controller;

            mainView = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical
            };
            LayoutTransition lt = new LayoutTransition();

            lt.EnableTransitionType(LayoutTransitionType.Appearing);
            lt.EnableTransitionType(LayoutTransitionType.Changing);
            mainView.LayoutTransition = lt;

            imageView = new ImageView(context);
            mainView.AddView(imageView);

            controller.HookView(this);
        }
            public void Run()
            {
                try
                {
                    int textLengthNew = Option.TextLength;

                    if (Option.TextLengthType == TypeLine)
                    {
                        if (TextView.Layout.LineCount <= Option.TextLength)
                        {
                            TextView.SetText(Text, TextView.BufferType.Spannable);
                            return;
                        }

                        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams)TextView.LayoutParameters;

                        string subString = Text.ToString().Substring(TextView.Layout.GetLineStart(0), TextView.Layout.GetLineEnd(Option.TextLength - 1));
                        textLengthNew = subString.Length - (Option.MoreLabel.Length + 4 + lp.RightMargin / 6);
                    }

                    SpannableStringBuilder spendableStringBuilder = new SpannableStringBuilder(Text.SubSequence(0, textLengthNew));
                    spendableStringBuilder.Append(" ...");
                    spendableStringBuilder.Append(Option.MoreLabel);

                    SpannableString ss             = SpannableString.ValueOf(spendableStringBuilder);
                    ClickableSpan   rclickableSpan = new StRclickableSpan(Option, TextView, Text, StTools.StTypeText.ReadMore);

                    ss.SetSpan(rclickableSpan, ss.Length() - Option.MoreLabel.Length, ss.Length(), SpanTypes.ExclusiveExclusive);

                    switch (Build.VERSION.SdkInt)
                    {
                    case >= BuildVersionCodes.JellyBean when Option.ExpandAnimation:
                    {
                        LayoutTransition layoutTransition = new LayoutTransition();
                        layoutTransition.EnableTransitionType(LayoutTransitionType.Changing);
                        ((ViewGroup)TextView?.Parent).LayoutTransition = layoutTransition;
                        break;
                    }
                    }
                    //TextView.SetTextFuture(PrecomputedTextCompat.GetTextFuture(ss, TextViewCompat.GetTextMetricsParams(TextView), null));
                    TextView.SetText(ss, TextView.BufferType.Spannable);
                    TextView.MovementMethod = LinkMovementMethod.Instance;
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }
            }