| 35 | import cc.ioctl.tmoe.ui.wrapper.component.Switch; |
| 36 | |
| 37 | @SuppressLint("RtlHardcoded") |
| 38 | public class TextCheckCell extends FrameLayout { |
| 39 | |
| 40 | private boolean isAnimatingToThumbInsteadOfTouch; |
| 41 | |
| 42 | private TextView textView; |
| 43 | private TextView valueTextView; |
| 44 | private Switch checkBox; |
| 45 | private boolean needDivider; |
| 46 | private boolean isMultiline; |
| 47 | private int height = 50; |
| 48 | private int animatedColorBackground; |
| 49 | private float animationProgress; |
| 50 | private Paint animationPaint; |
| 51 | private float lastTouchX; |
| 52 | private ObjectAnimator animator; |
| 53 | private boolean drawCheckRipple; |
| 54 | private boolean drawVerticalSwitchDividerLine = false; |
| 55 | |
| 56 | public static final Property<TextCheckCell, Float> ANIMATION_PROGRESS = new AnimationProperties.FloatProperty<TextCheckCell>("animationProgress") { |
| 57 | @Override |
| 58 | public void setValue(TextCheckCell object, float value) { |
| 59 | object.setAnimationProgress(value); |
| 60 | object.invalidate(); |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public Float get(TextCheckCell object) { |
| 65 | return object.animationProgress; |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | public TextCheckCell(Context context) { |
| 70 | this(context, 21); |
| 71 | } |
| 72 | |
| 73 | public TextCheckCell(Context context, int padding) { |
| 74 | this(context, padding, false); |
| 75 | } |
| 76 | |
| 77 | public TextCheckCell(Context context, int padding, boolean dialog) { |
| 78 | super(context); |
| 79 | |
| 80 | textView = new TextView(context); |
| 81 | textView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogTextBlack : Theme.key_windowBackgroundWhiteBlackText)); |
| 82 | textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); |
| 83 | textView.setLines(1); |
| 84 | textView.setMaxLines(1); |
| 85 | textView.setSingleLine(true); |
| 86 | textView.setGravity((LocaleController.isRTL() ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); |
| 87 | textView.setEllipsize(TextUtils.TruncateAt.END); |
| 88 | addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL() ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL() ? 70 : padding, 0, LocaleController.isRTL() ? padding : 70, 0)); |
| 89 | |
| 90 | valueTextView = new TextView(context); |
| 91 | valueTextView.setTextColor(Theme.getColor(dialog ? Theme.key_dialogIcon : Theme.key_windowBackgroundWhiteGrayText2)); |
| 92 | valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); |
| 93 | valueTextView.setGravity(LocaleController.isRTL() ? Gravity.RIGHT : Gravity.LEFT); |
| 94 | valueTextView.setLines(1); |
no outgoing calls
no test coverage detected