TextInputLayout.java 33.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232
package android.support.design.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.DrawableContainer;
import android.os.Build.VERSION;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.annotation.StyleRes;
import android.support.annotation.VisibleForTesting;
import android.support.design.R.color;
import android.support.design.R.id;
import android.support.design.R.layout;
import android.support.design.R.string;
import android.support.design.R.styleable;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.widget.Space;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.widget.AppCompatDrawableManager;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.DrawableUtils;
import android.support.v7.widget.TintTypedArray;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateInterpolator;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import c;
import f;
import h;
import java.util.List;
import r;
import s;
import s.c;
import s.e;
import v;
import y;

public class TextInputLayout
  extends LinearLayout
{
  private Drawable A;
  private Drawable B;
  private ColorStateList C;
  private boolean D;
  private PorterDuff.Mode E;
  private boolean F;
  private ColorStateList G;
  private ColorStateList H;
  private boolean I;
  private boolean J;
  private s K;
  private boolean L;
  private boolean M;
  private boolean N;
  EditText a;
  TextView b;
  boolean c;
  boolean d;
  CheckableImageButton e;
  boolean f;
  final f g = new f(this);
  private final FrameLayout h;
  private boolean i;
  private CharSequence j;
  private Paint k;
  private final Rect l = new Rect();
  private LinearLayout m;
  private int n;
  private Typeface o;
  private boolean p;
  private int q;
  private boolean r;
  private CharSequence s;
  private TextView t;
  private int u;
  private int v;
  private int w;
  private boolean x;
  private Drawable y;
  private CharSequence z;
  
  public TextInputLayout(Context paramContext)
  {
    this(paramContext, null);
  }
  
  public TextInputLayout(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, 0);
  }
  
  public TextInputLayout(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet);
    r.a(paramContext);
    setOrientation(1);
    setWillNotDraw(false);
    setAddStatesFromChildren(true);
    this.h = new FrameLayout(paramContext);
    this.h.setAddStatesFromChildren(true);
    addView(this.h);
    this.g.a(c.b);
    f localf = this.g;
    localf.j = new AccelerateInterpolator();
    localf.b();
    this.g.b(8388659);
    if (this.g.a == 1.0F) {}
    for (boolean bool1 = true;; bool1 = false)
    {
      this.I = bool1;
      paramContext = TintTypedArray.obtainStyledAttributes(paramContext, paramAttributeSet, R.styleable.TextInputLayout, paramInt, android.support.design.R.style.Widget_Design_TextInputLayout);
      this.i = paramContext.getBoolean(R.styleable.TextInputLayout_hintEnabled, true);
      setHint(paramContext.getText(R.styleable.TextInputLayout_android_hint));
      this.J = paramContext.getBoolean(R.styleable.TextInputLayout_hintAnimationEnabled, true);
      if (paramContext.hasValue(R.styleable.TextInputLayout_android_textColorHint))
      {
        paramAttributeSet = paramContext.getColorStateList(R.styleable.TextInputLayout_android_textColorHint);
        this.H = paramAttributeSet;
        this.G = paramAttributeSet;
      }
      if (paramContext.getResourceId(R.styleable.TextInputLayout_hintTextAppearance, -1) != -1) {
        setHintTextAppearance(paramContext.getResourceId(R.styleable.TextInputLayout_hintTextAppearance, 0));
      }
      this.q = paramContext.getResourceId(R.styleable.TextInputLayout_errorTextAppearance, 0);
      bool1 = paramContext.getBoolean(R.styleable.TextInputLayout_errorEnabled, false);
      boolean bool2 = paramContext.getBoolean(R.styleable.TextInputLayout_counterEnabled, false);
      setCounterMaxLength(paramContext.getInt(R.styleable.TextInputLayout_counterMaxLength, -1));
      this.v = paramContext.getResourceId(R.styleable.TextInputLayout_counterTextAppearance, 0);
      this.w = paramContext.getResourceId(R.styleable.TextInputLayout_counterOverflowTextAppearance, 0);
      this.d = paramContext.getBoolean(R.styleable.TextInputLayout_passwordToggleEnabled, false);
      this.y = paramContext.getDrawable(R.styleable.TextInputLayout_passwordToggleDrawable);
      this.z = paramContext.getText(R.styleable.TextInputLayout_passwordToggleContentDescription);
      if (paramContext.hasValue(R.styleable.TextInputLayout_passwordToggleTint))
      {
        this.D = true;
        this.C = paramContext.getColorStateList(R.styleable.TextInputLayout_passwordToggleTint);
      }
      if (paramContext.hasValue(R.styleable.TextInputLayout_passwordToggleTintMode))
      {
        this.F = true;
        this.E = y.a(paramContext.getInt(R.styleable.TextInputLayout_passwordToggleTintMode, -1));
      }
      paramContext.recycle();
      setErrorEnabled(bool1);
      setCounterEnabled(bool2);
      f();
      if (ViewCompat.getImportantForAccessibility(this) == 0) {
        ViewCompat.setImportantForAccessibility(this, 1);
      }
      ViewCompat.setAccessibilityDelegate(this, new a());
      return;
    }
  }
  
  @VisibleForTesting
  private void a(float paramFloat)
  {
    if (this.g.a == paramFloat) {
      return;
    }
    if (this.K == null)
    {
      this.K = y.a();
      this.K.a(c.a);
      this.K.a(200L);
      this.K.a(new s.c()
      {
        public final void a(s paramAnonymouss)
        {
          TextInputLayout.this.g.a(paramAnonymouss.a.d());
        }
      });
    }
    this.K.a(this.g.a, paramFloat);
    this.K.a.a();
  }
  
  private static void a(ViewGroup paramViewGroup, boolean paramBoolean)
  {
    int i2 = paramViewGroup.getChildCount();
    int i1 = 0;
    while (i1 < i2)
    {
      View localView = paramViewGroup.getChildAt(i1);
      localView.setEnabled(paramBoolean);
      if ((localView instanceof ViewGroup)) {
        a((ViewGroup)localView, paramBoolean);
      }
      i1 += 1;
    }
  }
  
  private void a(TextView paramTextView)
  {
    if (this.m != null)
    {
      this.m.removeView(paramTextView);
      int i1 = this.n - 1;
      this.n = i1;
      if (i1 == 0) {
        this.m.setVisibility(8);
      }
    }
  }
  
  private void a(TextView paramTextView, int paramInt)
  {
    if (this.m == null)
    {
      this.m = new LinearLayout(getContext());
      this.m.setOrientation(0);
      addView(this.m, -1, -2);
      Space localSpace = new Space(getContext());
      LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(0, 0, 1.0F);
      this.m.addView(localSpace, localLayoutParams);
      if (this.a != null) {
        c();
      }
    }
    this.m.setVisibility(0);
    this.m.addView(paramTextView, paramInt);
    this.n += 1;
  }
  
  private void b()
  {
    LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams)this.h.getLayoutParams();
    if (this.i)
    {
      if (this.k == null) {
        this.k = new Paint();
      }
      this.k.setTypeface(this.g.a());
      this.k.setTextSize(this.g.e);
    }
    for (int i1 = (int)-this.k.ascent();; i1 = 0)
    {
      if (i1 != localLayoutParams.topMargin)
      {
        localLayoutParams.topMargin = i1;
        this.h.requestLayout();
      }
      return;
    }
  }
  
  private void c()
  {
    ViewCompat.setPaddingRelative(this.m, ViewCompat.getPaddingStart(this.a), 0, ViewCompat.getPaddingEnd(this.a), this.a.getPaddingBottom());
  }
  
  private void d()
  {
    if (this.a == null) {}
    Drawable localDrawable1;
    do
    {
      return;
      localDrawable1 = this.a.getBackground();
    } while (localDrawable1 == null);
    int i1 = Build.VERSION.SDK_INT;
    if ((i1 == 21) || (i1 == 22))
    {
      Drawable localDrawable2 = this.a.getBackground();
      if ((localDrawable2 != null) && (!this.L))
      {
        Drawable localDrawable3 = localDrawable2.getConstantState().newDrawable();
        if ((localDrawable2 instanceof DrawableContainer)) {
          this.L = h.a((DrawableContainer)localDrawable2, localDrawable3.getConstantState());
        }
        if (!this.L)
        {
          ViewCompat.setBackground(this.a, localDrawable3);
          this.L = true;
        }
      }
    }
    if (DrawableUtils.canSafelyMutateDrawable(localDrawable1)) {
      localDrawable1 = localDrawable1.mutate();
    }
    for (;;)
    {
      if ((this.r) && (this.b != null))
      {
        localDrawable1.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(this.b.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
        return;
      }
      if ((this.x) && (this.t != null))
      {
        localDrawable1.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(this.t.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
        return;
      }
      DrawableCompat.clearColorFilter(localDrawable1);
      this.a.refreshDrawableState();
      return;
    }
  }
  
  private void e()
  {
    if (this.a == null) {}
    Drawable[] arrayOfDrawable;
    do
    {
      do
      {
        return;
        if ((this.d) && ((a()) || (this.f))) {}
        for (int i1 = 1; i1 != 0; i1 = 0)
        {
          if (this.e == null)
          {
            this.e = ((CheckableImageButton)LayoutInflater.from(getContext()).inflate(R.layout.design_text_input_password_icon, this.h, false));
            this.e.setImageDrawable(this.y);
            this.e.setContentDescription(this.z);
            this.h.addView(this.e);
            this.e.setOnClickListener(new View.OnClickListener()
            {
              public final void onClick(View paramAnonymousView)
              {
                paramAnonymousView = TextInputLayout.this;
                int i;
                if (paramAnonymousView.d)
                {
                  i = paramAnonymousView.a.getSelectionEnd();
                  if (!paramAnonymousView.a()) {
                    break label60;
                  }
                  paramAnonymousView.a.setTransformationMethod(null);
                }
                for (paramAnonymousView.f = true;; paramAnonymousView.f = false)
                {
                  paramAnonymousView.e.setChecked(paramAnonymousView.f);
                  paramAnonymousView.a.setSelection(i);
                  return;
                  label60:
                  paramAnonymousView.a.setTransformationMethod(PasswordTransformationMethod.getInstance());
                }
              }
            });
          }
          if ((this.a != null) && (ViewCompat.getMinimumHeight(this.a) <= 0)) {
            this.a.setMinimumHeight(ViewCompat.getMinimumHeight(this.e));
          }
          this.e.setVisibility(0);
          this.e.setChecked(this.f);
          if (this.A == null) {
            this.A = new ColorDrawable();
          }
          this.A.setBounds(0, 0, this.e.getMeasuredWidth(), 1);
          arrayOfDrawable = TextViewCompat.getCompoundDrawablesRelative(this.a);
          if (arrayOfDrawable[2] != this.A) {
            this.B = arrayOfDrawable[2];
          }
          TextViewCompat.setCompoundDrawablesRelative(this.a, arrayOfDrawable[0], arrayOfDrawable[1], this.A, arrayOfDrawable[3]);
          this.e.setPadding(this.a.getPaddingLeft(), this.a.getPaddingTop(), this.a.getPaddingRight(), this.a.getPaddingBottom());
          return;
        }
        if ((this.e != null) && (this.e.getVisibility() == 0)) {
          this.e.setVisibility(8);
        }
      } while (this.A == null);
      arrayOfDrawable = TextViewCompat.getCompoundDrawablesRelative(this.a);
    } while (arrayOfDrawable[2] != this.A);
    TextViewCompat.setCompoundDrawablesRelative(this.a, arrayOfDrawable[0], arrayOfDrawable[1], this.B, arrayOfDrawable[3]);
    this.A = null;
  }
  
  private void f()
  {
    if ((this.y != null) && ((this.D) || (this.F)))
    {
      this.y = DrawableCompat.wrap(this.y).mutate();
      if (this.D) {
        DrawableCompat.setTintList(this.y, this.C);
      }
      if (this.F) {
        DrawableCompat.setTintMode(this.y, this.E);
      }
      if ((this.e != null) && (this.e.getDrawable() != this.y)) {
        this.e.setImageDrawable(this.y);
      }
    }
  }
  
  private void setEditText(EditText paramEditText)
  {
    if (this.a != null) {
      throw new IllegalArgumentException("We already have an EditText, can only have one");
    }
    if (!(paramEditText instanceof TextInputEditText)) {
      Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead.");
    }
    this.a = paramEditText;
    if (!a()) {
      this.g.a(this.a.getTypeface());
    }
    paramEditText = this.g;
    float f1 = this.a.getTextSize();
    if (paramEditText.d != f1)
    {
      paramEditText.d = f1;
      paramEditText.b();
    }
    int i1 = this.a.getGravity();
    this.g.b(i1 & 0xFFFFFF8F | 0x30);
    this.g.a(i1);
    this.a.addTextChangedListener(new TextWatcher()
    {
      public final void afterTextChanged(Editable paramAnonymousEditable)
      {
        TextInputLayout localTextInputLayout = TextInputLayout.this;
        if (!TextInputLayout.a(TextInputLayout.this)) {}
        for (boolean bool = true;; bool = false)
        {
          localTextInputLayout.a(bool);
          if (TextInputLayout.this.c) {
            TextInputLayout.this.a(paramAnonymousEditable.length());
          }
          return;
        }
      }
      
      public final void beforeTextChanged(CharSequence paramAnonymousCharSequence, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3) {}
      
      public final void onTextChanged(CharSequence paramAnonymousCharSequence, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3) {}
    });
    if (this.G == null) {
      this.G = this.a.getHintTextColors();
    }
    if ((this.i) && (TextUtils.isEmpty(this.j)))
    {
      setHint(this.a.getHint());
      this.a.setHint(null);
    }
    if (this.t != null) {
      a(this.a.getText().length());
    }
    if (this.m != null) {
      c();
    }
    e();
    a(false);
  }
  
  private void setHintInternal(CharSequence paramCharSequence)
  {
    this.j = paramCharSequence;
    this.g.a(paramCharSequence);
  }
  
  final void a(int paramInt)
  {
    boolean bool2 = this.x;
    if (this.u == -1)
    {
      this.t.setText(String.valueOf(paramInt));
      this.x = false;
      if ((this.a != null) && (bool2 != this.x))
      {
        a(false);
        d();
      }
      return;
    }
    boolean bool1;
    label66:
    TextView localTextView;
    if (paramInt > this.u)
    {
      bool1 = true;
      this.x = bool1;
      if (bool2 != this.x)
      {
        localTextView = this.t;
        if (!this.x) {
          break label150;
        }
      }
    }
    label150:
    for (int i1 = this.w;; i1 = this.v)
    {
      TextViewCompat.setTextAppearance(localTextView, i1);
      this.t.setText(getContext().getString(R.string.character_counter_pattern, new Object[] { Integer.valueOf(paramInt), Integer.valueOf(this.u) }));
      break;
      bool1 = false;
      break label66;
    }
  }
  
  final void a(boolean paramBoolean)
  {
    boolean bool = isEnabled();
    int i1;
    int i3;
    int i2;
    if ((this.a != null) && (!TextUtils.isEmpty(this.a.getText())))
    {
      i1 = 1;
      int[] arrayOfInt = getDrawableState();
      i3 = arrayOfInt.length;
      i2 = 0;
      label41:
      if (i2 >= i3) {
        break label214;
      }
      if (arrayOfInt[i2] != 16842908) {
        break label207;
      }
      i2 = 1;
      label59:
      if (TextUtils.isEmpty(getError())) {
        break label219;
      }
      i3 = 1;
      label72:
      if (this.G != null) {
        this.g.b(this.G);
      }
      if ((!bool) || (!this.x) || (this.t == null)) {
        break label225;
      }
      this.g.a(this.t.getTextColors());
      label123:
      if ((i1 == 0) && ((!isEnabled()) || ((i2 == 0) && (i3 == 0)))) {
        break label287;
      }
      if (this.I)
      {
        if ((this.K != null) && (this.K.a.b())) {
          this.K.a.e();
        }
        if ((!paramBoolean) || (!this.J)) {
          break label276;
        }
        a(1.0F);
        this.I = false;
      }
    }
    label207:
    label214:
    label219:
    label225:
    label276:
    label287:
    while (this.I) {
      for (;;)
      {
        return;
        i1 = 0;
        break;
        i2 += 1;
        break label41;
        i2 = 0;
        break label59;
        i3 = 0;
        break label72;
        if ((bool) && (i2 != 0) && (this.H != null))
        {
          this.g.a(this.H);
          break label123;
        }
        if (this.G == null) {
          break label123;
        }
        this.g.a(this.G);
        break label123;
        this.g.a(1.0F);
      }
    }
    if ((this.K != null) && (this.K.a.b())) {
      this.K.a.e();
    }
    if ((paramBoolean) && (this.J)) {
      a(0.0F);
    }
    for (;;)
    {
      this.I = true;
      return;
      this.g.a(0.0F);
    }
  }
  
  final boolean a()
  {
    return (this.a != null) && ((this.a.getTransformationMethod() instanceof PasswordTransformationMethod));
  }
  
  public void addView(View paramView, int paramInt, ViewGroup.LayoutParams paramLayoutParams)
  {
    if ((paramView instanceof EditText))
    {
      FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(paramLayoutParams);
      localLayoutParams.gravity = (localLayoutParams.gravity & 0xFFFFFF8F | 0x10);
      this.h.addView(paramView, localLayoutParams);
      this.h.setLayoutParams(paramLayoutParams);
      b();
      setEditText((EditText)paramView);
      return;
    }
    super.addView(paramView, paramInt, paramLayoutParams);
  }
  
  protected void dispatchRestoreInstanceState(SparseArray<Parcelable> paramSparseArray)
  {
    this.N = true;
    super.dispatchRestoreInstanceState(paramSparseArray);
    this.N = false;
  }
  
  public void draw(Canvas paramCanvas)
  {
    super.draw(paramCanvas);
    if (this.i) {
      this.g.a(paramCanvas);
    }
  }
  
  protected void drawableStateChanged()
  {
    boolean bool2 = true;
    if (this.M) {
      return;
    }
    this.M = true;
    super.drawableStateChanged();
    int[] arrayOfInt = getDrawableState();
    if ((ViewCompat.isLaidOut(this)) && (isEnabled()))
    {
      a(bool2);
      d();
      if (this.g == null) {
        break label84;
      }
    }
    label84:
    for (boolean bool1 = this.g.a(arrayOfInt) | false;; bool1 = false)
    {
      if (bool1) {
        invalidate();
      }
      this.M = false;
      return;
      bool2 = false;
      break;
    }
  }
  
  public int getCounterMaxLength()
  {
    return this.u;
  }
  
  @Nullable
  public EditText getEditText()
  {
    return this.a;
  }
  
  @Nullable
  public CharSequence getError()
  {
    if (this.p) {
      return this.s;
    }
    return null;
  }
  
  @Nullable
  public CharSequence getHint()
  {
    if (this.i) {
      return this.j;
    }
    return null;
  }
  
  @Nullable
  public CharSequence getPasswordVisibilityToggleContentDescription()
  {
    return this.z;
  }
  
  @Nullable
  public Drawable getPasswordVisibilityToggleDrawable()
  {
    return this.y;
  }
  
  @NonNull
  public Typeface getTypeface()
  {
    return this.o;
  }
  
  public boolean isCounterEnabled()
  {
    return this.c;
  }
  
  public boolean isErrorEnabled()
  {
    return this.p;
  }
  
  public boolean isHintAnimationEnabled()
  {
    return this.J;
  }
  
  public boolean isHintEnabled()
  {
    return this.i;
  }
  
  public boolean isPasswordVisibilityToggleEnabled()
  {
    return this.d;
  }
  
  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
    if ((this.i) && (this.a != null))
    {
      Rect localRect = this.l;
      v.a(this, this.a, localRect);
      paramInt1 = localRect.left + this.a.getCompoundPaddingLeft();
      paramInt3 = localRect.right - this.a.getCompoundPaddingRight();
      this.g.a(paramInt1, localRect.top + this.a.getCompoundPaddingTop(), paramInt3, localRect.bottom - this.a.getCompoundPaddingBottom());
      this.g.b(paramInt1, getPaddingTop(), paramInt3, paramInt4 - paramInt2 - getPaddingBottom());
      this.g.b();
    }
  }
  
  protected void onMeasure(int paramInt1, int paramInt2)
  {
    e();
    super.onMeasure(paramInt1, paramInt2);
  }
  
  protected void onRestoreInstanceState(Parcelable paramParcelable)
  {
    if (!(paramParcelable instanceof SavedState))
    {
      super.onRestoreInstanceState(paramParcelable);
      return;
    }
    paramParcelable = (SavedState)paramParcelable;
    super.onRestoreInstanceState(paramParcelable.getSuperState());
    setError(paramParcelable.a);
    requestLayout();
  }
  
  public Parcelable onSaveInstanceState()
  {
    SavedState localSavedState = new SavedState(super.onSaveInstanceState());
    if (this.r) {
      localSavedState.a = getError();
    }
    return localSavedState;
  }
  
  public void setCounterEnabled(boolean paramBoolean)
  {
    if (this.c != paramBoolean)
    {
      if (!paramBoolean) {
        break label151;
      }
      this.t = new AppCompatTextView(getContext());
      this.t.setId(R.id.textinput_counter);
      if (this.o != null) {
        this.t.setTypeface(this.o);
      }
      this.t.setMaxLines(1);
    }
    for (;;)
    {
      try
      {
        TextViewCompat.setTextAppearance(this.t, this.v);
        a(this.t, -1);
        if (this.a == null)
        {
          a(0);
          this.c = paramBoolean;
          return;
        }
      }
      catch (Exception localException)
      {
        TextViewCompat.setTextAppearance(this.t, android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Caption);
        this.t.setTextColor(ContextCompat.getColor(getContext(), R.color.design_textinput_error_color_light));
        continue;
        a(this.a.getText().length());
        continue;
      }
      label151:
      a(this.t);
      this.t = null;
    }
  }
  
  public void setCounterMaxLength(int paramInt)
  {
    if (this.u != paramInt)
    {
      if (paramInt <= 0) {
        break label39;
      }
      this.u = paramInt;
      if (this.c) {
        if (this.a != null) {
          break label47;
        }
      }
    }
    label39:
    label47:
    for (paramInt = 0;; paramInt = this.a.getText().length())
    {
      a(paramInt);
      return;
      this.u = -1;
      break;
    }
  }
  
  public void setEnabled(boolean paramBoolean)
  {
    a(this, paramBoolean);
    super.setEnabled(paramBoolean);
  }
  
  public void setError(@Nullable final CharSequence paramCharSequence)
  {
    boolean bool2 = true;
    boolean bool1;
    if ((ViewCompat.isLaidOut(this)) && (isEnabled()) && ((this.b == null) || (!TextUtils.equals(this.b.getText(), paramCharSequence))))
    {
      bool1 = true;
      this.s = paramCharSequence;
      if (!this.p)
      {
        if (!TextUtils.isEmpty(paramCharSequence)) {
          setErrorEnabled(true);
        }
      }
      else
      {
        if (TextUtils.isEmpty(paramCharSequence)) {
          break label184;
        }
        label70:
        this.r = bool2;
        ViewCompat.animate(this.b).cancel();
        if (!this.r) {
          break label200;
        }
        this.b.setText(paramCharSequence);
        this.b.setVisibility(0);
        if (!bool1) {
          break label189;
        }
        if (ViewCompat.getAlpha(this.b) == 1.0F) {
          ViewCompat.setAlpha(this.b, 0.0F);
        }
        ViewCompat.animate(this.b).alpha(1.0F).setDuration(200L).setInterpolator(c.d).setListener(new ViewPropertyAnimatorListenerAdapter()
        {
          public final void onAnimationStart(View paramAnonymousView)
          {
            paramAnonymousView.setVisibility(0);
          }
        }).start();
      }
    }
    for (;;)
    {
      d();
      a(bool1);
      return;
      bool1 = false;
      break;
      label184:
      bool2 = false;
      break label70;
      label189:
      ViewCompat.setAlpha(this.b, 1.0F);
      continue;
      label200:
      if (this.b.getVisibility() == 0) {
        if (bool1)
        {
          ViewCompat.animate(this.b).alpha(0.0F).setDuration(200L).setInterpolator(c.c).setListener(new ViewPropertyAnimatorListenerAdapter()
          {
            public final void onAnimationEnd(View paramAnonymousView)
            {
              TextInputLayout.this.b.setText(paramCharSequence);
              paramAnonymousView.setVisibility(4);
            }
          }).start();
        }
        else
        {
          this.b.setText(paramCharSequence);
          this.b.setVisibility(4);
        }
      }
    }
  }
  
  public void setErrorEnabled(boolean paramBoolean)
  {
    if (this.p != paramBoolean)
    {
      if (this.b != null) {
        ViewCompat.animate(this.b).cancel();
      }
      if (!paramBoolean) {
        break label179;
      }
      this.b = new AppCompatTextView(getContext());
      this.b.setId(R.id.textinput_error);
      if (this.o != null) {
        this.b.setTypeface(this.o);
      }
    }
    for (;;)
    {
      try
      {
        TextViewCompat.setTextAppearance(this.b, this.q);
        if (Build.VERSION.SDK_INT < 23) {
          break label204;
        }
        i1 = this.b.getTextColors().getDefaultColor();
        if (i1 != -65281) {
          break label204;
        }
        i1 = 1;
      }
      catch (Exception localException)
      {
        i1 = 1;
        continue;
      }
      if (i1 != 0)
      {
        TextViewCompat.setTextAppearance(this.b, android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Caption);
        this.b.setTextColor(ContextCompat.getColor(getContext(), R.color.design_textinput_error_color_light));
      }
      this.b.setVisibility(4);
      ViewCompat.setAccessibilityLiveRegion(this.b, 1);
      a(this.b, 0);
      this.p = paramBoolean;
      return;
      label179:
      this.r = false;
      d();
      a(this.b);
      this.b = null;
      continue;
      label204:
      int i1 = 0;
    }
  }
  
  public void setErrorTextAppearance(@StyleRes int paramInt)
  {
    this.q = paramInt;
    if (this.b != null) {
      TextViewCompat.setTextAppearance(this.b, paramInt);
    }
  }
  
  public void setHint(@Nullable CharSequence paramCharSequence)
  {
    if (this.i)
    {
      setHintInternal(paramCharSequence);
      sendAccessibilityEvent(2048);
    }
  }
  
  public void setHintAnimationEnabled(boolean paramBoolean)
  {
    this.J = paramBoolean;
  }
  
  public void setHintEnabled(boolean paramBoolean)
  {
    CharSequence localCharSequence;
    if (paramBoolean != this.i)
    {
      this.i = paramBoolean;
      localCharSequence = this.a.getHint();
      if (this.i) {
        break label73;
      }
      if ((!TextUtils.isEmpty(this.j)) && (TextUtils.isEmpty(localCharSequence))) {
        this.a.setHint(this.j);
      }
      setHintInternal(null);
    }
    for (;;)
    {
      if (this.a != null) {
        b();
      }
      return;
      label73:
      if (!TextUtils.isEmpty(localCharSequence))
      {
        if (TextUtils.isEmpty(this.j)) {
          setHint(localCharSequence);
        }
        this.a.setHint(null);
      }
    }
  }
  
  public void setHintTextAppearance(@StyleRes int paramInt)
  {
    this.g.c(paramInt);
    this.H = this.g.f;
    if (this.a != null)
    {
      a(false);
      b();
    }
  }
  
  public void setPasswordVisibilityToggleContentDescription(@StringRes int paramInt)
  {
    if (paramInt != 0) {}
    for (CharSequence localCharSequence = getResources().getText(paramInt);; localCharSequence = null)
    {
      setPasswordVisibilityToggleContentDescription(localCharSequence);
      return;
    }
  }
  
  public void setPasswordVisibilityToggleContentDescription(@Nullable CharSequence paramCharSequence)
  {
    this.z = paramCharSequence;
    if (this.e != null) {
      this.e.setContentDescription(paramCharSequence);
    }
  }
  
  public void setPasswordVisibilityToggleDrawable(@DrawableRes int paramInt)
  {
    if (paramInt != 0) {}
    for (Drawable localDrawable = AppCompatResources.getDrawable(getContext(), paramInt);; localDrawable = null)
    {
      setPasswordVisibilityToggleDrawable(localDrawable);
      return;
    }
  }
  
  public void setPasswordVisibilityToggleDrawable(@Nullable Drawable paramDrawable)
  {
    this.y = paramDrawable;
    if (this.e != null) {
      this.e.setImageDrawable(paramDrawable);
    }
  }
  
  public void setPasswordVisibilityToggleEnabled(boolean paramBoolean)
  {
    if (this.d != paramBoolean)
    {
      this.d = paramBoolean;
      if ((!paramBoolean) && (this.f) && (this.a != null)) {
        this.a.setTransformationMethod(PasswordTransformationMethod.getInstance());
      }
      this.f = false;
      e();
    }
  }
  
  public void setPasswordVisibilityToggleTintList(@Nullable ColorStateList paramColorStateList)
  {
    this.C = paramColorStateList;
    this.D = true;
    f();
  }
  
  public void setPasswordVisibilityToggleTintMode(@Nullable PorterDuff.Mode paramMode)
  {
    this.E = paramMode;
    this.F = true;
    f();
  }
  
  public void setTypeface(@Nullable Typeface paramTypeface)
  {
    if (paramTypeface != this.o)
    {
      this.o = paramTypeface;
      this.g.a(paramTypeface);
      if (this.t != null) {
        this.t.setTypeface(paramTypeface);
      }
      if (this.b != null) {
        this.b.setTypeface(paramTypeface);
      }
    }
  }
  
  static class SavedState
    extends AbsSavedState
  {
    public static final Parcelable.Creator<SavedState> CREATOR = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks() {});
    CharSequence a;
    
    SavedState(Parcel paramParcel, ClassLoader paramClassLoader)
    {
      super(paramClassLoader);
      this.a = ((CharSequence)TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(paramParcel));
    }
    
    SavedState(Parcelable paramParcelable)
    {
      super();
    }
    
    public String toString()
    {
      return "TextInputLayout.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " error=" + this.a + "}";
    }
    
    public void writeToParcel(Parcel paramParcel, int paramInt)
    {
      super.writeToParcel(paramParcel, paramInt);
      TextUtils.writeToParcel(this.a, paramParcel, paramInt);
    }
  }
  
  final class a
    extends AccessibilityDelegateCompat
  {
    a() {}
    
    public final void onInitializeAccessibilityEvent(View paramView, AccessibilityEvent paramAccessibilityEvent)
    {
      super.onInitializeAccessibilityEvent(paramView, paramAccessibilityEvent);
      paramAccessibilityEvent.setClassName(TextInputLayout.class.getSimpleName());
    }
    
    public final void onInitializeAccessibilityNodeInfo(View paramView, AccessibilityNodeInfoCompat paramAccessibilityNodeInfoCompat)
    {
      super.onInitializeAccessibilityNodeInfo(paramView, paramAccessibilityNodeInfoCompat);
      paramAccessibilityNodeInfoCompat.setClassName(TextInputLayout.class.getSimpleName());
      paramView = TextInputLayout.this.g.i;
      if (!TextUtils.isEmpty(paramView)) {
        paramAccessibilityNodeInfoCompat.setText(paramView);
      }
      if (TextInputLayout.this.a != null) {
        paramAccessibilityNodeInfoCompat.setLabelFor(TextInputLayout.this.a);
      }
      if (TextInputLayout.this.b != null) {}
      for (paramView = TextInputLayout.this.b.getText();; paramView = null)
      {
        if (!TextUtils.isEmpty(paramView))
        {
          paramAccessibilityNodeInfoCompat.setContentInvalid(true);
          paramAccessibilityNodeInfoCompat.setError(paramView);
        }
        return;
      }
    }
    
    public final void onPopulateAccessibilityEvent(View paramView, AccessibilityEvent paramAccessibilityEvent)
    {
      super.onPopulateAccessibilityEvent(paramView, paramAccessibilityEvent);
      paramView = TextInputLayout.this.g.i;
      if (!TextUtils.isEmpty(paramView)) {
        paramAccessibilityEvent.getText().add(paramView);
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/widget/TextInputLayout.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */