AppCompatSpinner.java 26.9 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
package android.support.v7.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.database.DataSetObserver;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.v4.view.TintableBackgroundView;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R.attr;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.view.menu.ShowableListMenu;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import gd;

public class AppCompatSpinner
  extends Spinner
  implements TintableBackgroundView
{
  private static final int[] d = { 16843505 };
  b a;
  int b;
  final Rect c;
  private gd e;
  private Context f;
  private ForwardingListener g;
  private SpinnerAdapter h;
  private boolean i;
  
  public AppCompatSpinner(Context paramContext)
  {
    this(paramContext, null);
  }
  
  public AppCompatSpinner(Context paramContext, int paramInt)
  {
    this(paramContext, null, R.attr.spinnerStyle, paramInt);
  }
  
  public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, paramAttributeSet, R.attr.spinnerStyle);
  }
  
  public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    this(paramContext, paramAttributeSet, paramInt, -1);
  }
  
  public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2)
  {
    this(paramContext, paramAttributeSet, paramInt1, paramInt2, null);
  }
  
  /* Error */
  public AppCompatSpinner(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2, final Resources.Theme paramTheme)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: aload_2
    //   3: iload_3
    //   4: invokespecial 65	android/widget/Spinner:<init>	(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    //   7: aload_0
    //   8: new 67	android/graphics/Rect
    //   11: dup
    //   12: invokespecial 69	android/graphics/Rect:<init>	()V
    //   15: putfield 71	android/support/v7/widget/AppCompatSpinner:c	Landroid/graphics/Rect;
    //   18: aload_1
    //   19: aload_2
    //   20: getstatic 76	android/support/v7/appcompat/R$styleable:Spinner	[I
    //   23: iload_3
    //   24: iconst_0
    //   25: invokestatic 82	android/support/v7/widget/TintTypedArray:obtainStyledAttributes	(Landroid/content/Context;Landroid/util/AttributeSet;[III)Landroid/support/v7/widget/TintTypedArray;
    //   28: astore 10
    //   30: aload_0
    //   31: new 84	gd
    //   34: dup
    //   35: aload_0
    //   36: invokespecial 87	gd:<init>	(Landroid/view/View;)V
    //   39: putfield 89	android/support/v7/widget/AppCompatSpinner:e	Lgd;
    //   42: aload 5
    //   44: ifnull +289 -> 333
    //   47: new 91	android/support/v7/view/ContextThemeWrapper
    //   50: dup
    //   51: aload_1
    //   52: aload 5
    //   54: invokespecial 94	android/support/v7/view/ContextThemeWrapper:<init>	(Landroid/content/Context;Landroid/content/res/Resources$Theme;)V
    //   57: astore 5
    //   59: aload_0
    //   60: aload 5
    //   62: putfield 96	android/support/v7/widget/AppCompatSpinner:f	Landroid/content/Context;
    //   65: aload_0
    //   66: getfield 96	android/support/v7/widget/AppCompatSpinner:f	Landroid/content/Context;
    //   69: ifnull +184 -> 253
    //   72: iload 4
    //   74: istore 7
    //   76: iload 4
    //   78: iconst_m1
    //   79: if_icmpne +71 -> 150
    //   82: getstatic 101	android/os/Build$VERSION:SDK_INT	I
    //   85: bipush 11
    //   87: if_icmplt +353 -> 440
    //   90: aload_1
    //   91: aload_2
    //   92: getstatic 41	android/support/v7/widget/AppCompatSpinner:d	[I
    //   95: iload_3
    //   96: iconst_0
    //   97: invokevirtual 106	android/content/Context:obtainStyledAttributes	(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;
    //   100: astore 8
    //   102: iload 4
    //   104: istore 6
    //   106: aload 8
    //   108: astore 5
    //   110: aload 8
    //   112: iconst_0
    //   113: invokevirtual 112	android/content/res/TypedArray:hasValue	(I)Z
    //   116: ifeq +16 -> 132
    //   119: aload 8
    //   121: astore 5
    //   123: aload 8
    //   125: iconst_0
    //   126: iconst_0
    //   127: invokevirtual 116	android/content/res/TypedArray:getInt	(II)I
    //   130: istore 6
    //   132: iload 6
    //   134: istore 7
    //   136: aload 8
    //   138: ifnull +12 -> 150
    //   141: aload 8
    //   143: invokevirtual 119	android/content/res/TypedArray:recycle	()V
    //   146: iload 6
    //   148: istore 7
    //   150: iload 7
    //   152: iconst_1
    //   153: if_icmpne +100 -> 253
    //   156: new 13	android/support/v7/widget/AppCompatSpinner$b
    //   159: dup
    //   160: aload_0
    //   161: aload_0
    //   162: getfield 96	android/support/v7/widget/AppCompatSpinner:f	Landroid/content/Context;
    //   165: aload_2
    //   166: iload_3
    //   167: invokespecial 122	android/support/v7/widget/AppCompatSpinner$b:<init>	(Landroid/support/v7/widget/AppCompatSpinner;Landroid/content/Context;Landroid/util/AttributeSet;I)V
    //   170: astore 5
    //   172: aload_0
    //   173: getfield 96	android/support/v7/widget/AppCompatSpinner:f	Landroid/content/Context;
    //   176: aload_2
    //   177: getstatic 76	android/support/v7/appcompat/R$styleable:Spinner	[I
    //   180: iload_3
    //   181: iconst_0
    //   182: invokestatic 82	android/support/v7/widget/TintTypedArray:obtainStyledAttributes	(Landroid/content/Context;Landroid/util/AttributeSet;[III)Landroid/support/v7/widget/TintTypedArray;
    //   185: astore 8
    //   187: aload_0
    //   188: aload 8
    //   190: getstatic 125	android/support/v7/appcompat/R$styleable:Spinner_android_dropDownWidth	I
    //   193: bipush -2
    //   195: invokevirtual 128	android/support/v7/widget/TintTypedArray:getLayoutDimension	(II)I
    //   198: putfield 130	android/support/v7/widget/AppCompatSpinner:b	I
    //   201: aload 5
    //   203: aload 8
    //   205: getstatic 133	android/support/v7/appcompat/R$styleable:Spinner_android_popupBackground	I
    //   208: invokevirtual 137	android/support/v7/widget/TintTypedArray:getDrawable	(I)Landroid/graphics/drawable/Drawable;
    //   211: invokevirtual 141	android/support/v7/widget/AppCompatSpinner$b:setBackgroundDrawable	(Landroid/graphics/drawable/Drawable;)V
    //   214: aload 5
    //   216: aload 10
    //   218: getstatic 144	android/support/v7/appcompat/R$styleable:Spinner_android_prompt	I
    //   221: invokevirtual 148	android/support/v7/widget/TintTypedArray:getString	(I)Ljava/lang/String;
    //   224: putfield 151	android/support/v7/widget/AppCompatSpinner$b:a	Ljava/lang/CharSequence;
    //   227: aload 8
    //   229: invokevirtual 152	android/support/v7/widget/TintTypedArray:recycle	()V
    //   232: aload_0
    //   233: aload 5
    //   235: putfield 154	android/support/v7/widget/AppCompatSpinner:a	Landroid/support/v7/widget/AppCompatSpinner$b;
    //   238: aload_0
    //   239: new 8	android/support/v7/widget/AppCompatSpinner$1
    //   242: dup
    //   243: aload_0
    //   244: aload_0
    //   245: aload 5
    //   247: invokespecial 157	android/support/v7/widget/AppCompatSpinner$1:<init>	(Landroid/support/v7/widget/AppCompatSpinner;Landroid/view/View;Landroid/support/v7/widget/AppCompatSpinner$b;)V
    //   250: putfield 159	android/support/v7/widget/AppCompatSpinner:g	Landroid/support/v7/widget/ForwardingListener;
    //   253: aload 10
    //   255: getstatic 162	android/support/v7/appcompat/R$styleable:Spinner_android_entries	I
    //   258: invokevirtual 166	android/support/v7/widget/TintTypedArray:getTextArray	(I)[Ljava/lang/CharSequence;
    //   261: astore 5
    //   263: aload 5
    //   265: ifnull +28 -> 293
    //   268: new 168	android/widget/ArrayAdapter
    //   271: dup
    //   272: aload_1
    //   273: ldc -87
    //   275: aload 5
    //   277: invokespecial 172	android/widget/ArrayAdapter:<init>	(Landroid/content/Context;I[Ljava/lang/Object;)V
    //   280: astore_1
    //   281: aload_1
    //   282: getstatic 177	android/support/v7/appcompat/R$layout:support_simple_spinner_dropdown_item	I
    //   285: invokevirtual 181	android/widget/ArrayAdapter:setDropDownViewResource	(I)V
    //   288: aload_0
    //   289: aload_1
    //   290: invokevirtual 185	android/support/v7/widget/AppCompatSpinner:setAdapter	(Landroid/widget/SpinnerAdapter;)V
    //   293: aload 10
    //   295: invokevirtual 152	android/support/v7/widget/TintTypedArray:recycle	()V
    //   298: aload_0
    //   299: iconst_1
    //   300: putfield 187	android/support/v7/widget/AppCompatSpinner:i	Z
    //   303: aload_0
    //   304: getfield 189	android/support/v7/widget/AppCompatSpinner:h	Landroid/widget/SpinnerAdapter;
    //   307: ifnull +16 -> 323
    //   310: aload_0
    //   311: aload_0
    //   312: getfield 189	android/support/v7/widget/AppCompatSpinner:h	Landroid/widget/SpinnerAdapter;
    //   315: invokevirtual 185	android/support/v7/widget/AppCompatSpinner:setAdapter	(Landroid/widget/SpinnerAdapter;)V
    //   318: aload_0
    //   319: aconst_null
    //   320: putfield 189	android/support/v7/widget/AppCompatSpinner:h	Landroid/widget/SpinnerAdapter;
    //   323: aload_0
    //   324: getfield 89	android/support/v7/widget/AppCompatSpinner:e	Lgd;
    //   327: aload_2
    //   328: iload_3
    //   329: invokevirtual 192	gd:a	(Landroid/util/AttributeSet;I)V
    //   332: return
    //   333: aload 10
    //   335: getstatic 195	android/support/v7/appcompat/R$styleable:Spinner_popupTheme	I
    //   338: iconst_0
    //   339: invokevirtual 198	android/support/v7/widget/TintTypedArray:getResourceId	(II)I
    //   342: istore 6
    //   344: iload 6
    //   346: ifeq +18 -> 364
    //   349: new 91	android/support/v7/view/ContextThemeWrapper
    //   352: dup
    //   353: aload_1
    //   354: iload 6
    //   356: invokespecial 200	android/support/v7/view/ContextThemeWrapper:<init>	(Landroid/content/Context;I)V
    //   359: astore 5
    //   361: goto -302 -> 59
    //   364: getstatic 101	android/os/Build$VERSION:SDK_INT	I
    //   367: bipush 23
    //   369: if_icmpge +9 -> 378
    //   372: aload_1
    //   373: astore 5
    //   375: goto -316 -> 59
    //   378: aconst_null
    //   379: astore 5
    //   381: goto -322 -> 59
    //   384: astore 9
    //   386: aconst_null
    //   387: astore 8
    //   389: aload 8
    //   391: astore 5
    //   393: ldc -54
    //   395: ldc -52
    //   397: aload 9
    //   399: invokestatic 209	android/util/Log:i	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   402: pop
    //   403: iload 4
    //   405: istore 7
    //   407: aload 8
    //   409: ifnull -259 -> 150
    //   412: aload 8
    //   414: invokevirtual 119	android/content/res/TypedArray:recycle	()V
    //   417: iload 4
    //   419: istore 7
    //   421: goto -271 -> 150
    //   424: astore_1
    //   425: aconst_null
    //   426: astore 5
    //   428: aload 5
    //   430: ifnull +8 -> 438
    //   433: aload 5
    //   435: invokevirtual 119	android/content/res/TypedArray:recycle	()V
    //   438: aload_1
    //   439: athrow
    //   440: iconst_1
    //   441: istore 7
    //   443: goto -293 -> 150
    //   446: astore_1
    //   447: goto -19 -> 428
    //   450: astore 9
    //   452: goto -63 -> 389
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	455	0	this	AppCompatSpinner
    //   0	455	1	paramContext	Context
    //   0	455	2	paramAttributeSet	AttributeSet
    //   0	455	3	paramInt1	int
    //   0	455	4	paramInt2	int
    //   0	455	5	paramTheme	Resources.Theme
    //   104	251	6	j	int
    //   74	368	7	k	int
    //   100	313	8	localObject	Object
    //   384	14	9	localException1	Exception
    //   450	1	9	localException2	Exception
    //   28	306	10	localTintTypedArray	TintTypedArray
    // Exception table:
    //   from	to	target	type
    //   90	102	384	java/lang/Exception
    //   90	102	424	finally
    //   110	119	446	finally
    //   123	132	446	finally
    //   393	403	446	finally
    //   110	119	450	java/lang/Exception
    //   123	132	450	java/lang/Exception
  }
  
  final int a(SpinnerAdapter paramSpinnerAdapter, Drawable paramDrawable)
  {
    if (paramSpinnerAdapter == null) {
      return 0;
    }
    int i1 = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 0);
    int i2 = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 0);
    int j = Math.max(0, getSelectedItemPosition());
    int i3 = Math.min(paramSpinnerAdapter.getCount(), j + 15);
    int k = Math.max(0, j - (15 - (i3 - j)));
    View localView = null;
    int m = 0;
    j = 0;
    if (k < i3)
    {
      int n = paramSpinnerAdapter.getItemViewType(k);
      if (n == j) {
        break label204;
      }
      localView = null;
      j = n;
    }
    label204:
    for (;;)
    {
      localView = paramSpinnerAdapter.getView(k, localView, this);
      if (localView.getLayoutParams() == null) {
        localView.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
      }
      localView.measure(i1, i2);
      m = Math.max(m, localView.getMeasuredWidth());
      k += 1;
      break;
      if (paramDrawable != null)
      {
        paramDrawable.getPadding(this.c);
        return this.c.left + this.c.right + m;
      }
      return m;
    }
  }
  
  protected void drawableStateChanged()
  {
    super.drawableStateChanged();
    if (this.e != null) {
      this.e.d();
    }
  }
  
  public int getDropDownHorizontalOffset()
  {
    if (this.a != null) {
      return this.a.getHorizontalOffset();
    }
    if (Build.VERSION.SDK_INT >= 16) {
      return super.getDropDownHorizontalOffset();
    }
    return 0;
  }
  
  public int getDropDownVerticalOffset()
  {
    if (this.a != null) {
      return this.a.getVerticalOffset();
    }
    if (Build.VERSION.SDK_INT >= 16) {
      return super.getDropDownVerticalOffset();
    }
    return 0;
  }
  
  public int getDropDownWidth()
  {
    if (this.a != null) {
      return this.b;
    }
    if (Build.VERSION.SDK_INT >= 16) {
      return super.getDropDownWidth();
    }
    return 0;
  }
  
  public Drawable getPopupBackground()
  {
    if (this.a != null) {
      return this.a.getBackground();
    }
    if (Build.VERSION.SDK_INT >= 16) {
      return super.getPopupBackground();
    }
    return null;
  }
  
  public Context getPopupContext()
  {
    if (this.a != null) {
      return this.f;
    }
    if (Build.VERSION.SDK_INT >= 23) {
      return super.getPopupContext();
    }
    return null;
  }
  
  public CharSequence getPrompt()
  {
    if (this.a != null) {
      return this.a.a;
    }
    return super.getPrompt();
  }
  
  @Nullable
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public ColorStateList getSupportBackgroundTintList()
  {
    if (this.e != null) {
      return this.e.b();
    }
    return null;
  }
  
  @Nullable
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public PorterDuff.Mode getSupportBackgroundTintMode()
  {
    if (this.e != null) {
      return this.e.c();
    }
    return null;
  }
  
  protected void onDetachedFromWindow()
  {
    super.onDetachedFromWindow();
    if ((this.a != null) && (this.a.isShowing())) {
      this.a.dismiss();
    }
  }
  
  protected void onMeasure(int paramInt1, int paramInt2)
  {
    super.onMeasure(paramInt1, paramInt2);
    if ((this.a != null) && (View.MeasureSpec.getMode(paramInt1) == Integer.MIN_VALUE)) {
      setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), a(getAdapter(), getBackground())), View.MeasureSpec.getSize(paramInt1)), getMeasuredHeight());
    }
  }
  
  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    if ((this.g != null) && (this.g.onTouch(this, paramMotionEvent))) {
      return true;
    }
    return super.onTouchEvent(paramMotionEvent);
  }
  
  public boolean performClick()
  {
    if (this.a != null)
    {
      if (!this.a.isShowing()) {
        this.a.show();
      }
      return true;
    }
    return super.performClick();
  }
  
  public void setAdapter(SpinnerAdapter paramSpinnerAdapter)
  {
    if (!this.i) {
      this.h = paramSpinnerAdapter;
    }
    do
    {
      return;
      super.setAdapter(paramSpinnerAdapter);
    } while (this.a == null);
    if (this.f == null) {}
    for (Context localContext = getContext();; localContext = this.f)
    {
      this.a.setAdapter(new a(paramSpinnerAdapter, localContext.getTheme()));
      return;
    }
  }
  
  public void setBackgroundDrawable(Drawable paramDrawable)
  {
    super.setBackgroundDrawable(paramDrawable);
    if (this.e != null) {
      this.e.a();
    }
  }
  
  public void setBackgroundResource(@DrawableRes int paramInt)
  {
    super.setBackgroundResource(paramInt);
    if (this.e != null) {
      this.e.a(paramInt);
    }
  }
  
  public void setDropDownHorizontalOffset(int paramInt)
  {
    if (this.a != null) {
      this.a.setHorizontalOffset(paramInt);
    }
    while (Build.VERSION.SDK_INT < 16) {
      return;
    }
    super.setDropDownHorizontalOffset(paramInt);
  }
  
  public void setDropDownVerticalOffset(int paramInt)
  {
    if (this.a != null) {
      this.a.setVerticalOffset(paramInt);
    }
    while (Build.VERSION.SDK_INT < 16) {
      return;
    }
    super.setDropDownVerticalOffset(paramInt);
  }
  
  public void setDropDownWidth(int paramInt)
  {
    if (this.a != null) {
      this.b = paramInt;
    }
    while (Build.VERSION.SDK_INT < 16) {
      return;
    }
    super.setDropDownWidth(paramInt);
  }
  
  public void setPopupBackgroundDrawable(Drawable paramDrawable)
  {
    if (this.a != null) {
      this.a.setBackgroundDrawable(paramDrawable);
    }
    while (Build.VERSION.SDK_INT < 16) {
      return;
    }
    super.setPopupBackgroundDrawable(paramDrawable);
  }
  
  public void setPopupBackgroundResource(@DrawableRes int paramInt)
  {
    setPopupBackgroundDrawable(AppCompatResources.getDrawable(getPopupContext(), paramInt));
  }
  
  public void setPrompt(CharSequence paramCharSequence)
  {
    if (this.a != null)
    {
      this.a.a = paramCharSequence;
      return;
    }
    super.setPrompt(paramCharSequence);
  }
  
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public void setSupportBackgroundTintList(@Nullable ColorStateList paramColorStateList)
  {
    if (this.e != null) {
      this.e.a(paramColorStateList);
    }
  }
  
  @RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
  public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode paramMode)
  {
    if (this.e != null) {
      this.e.a(paramMode);
    }
  }
  
  static final class a
    implements ListAdapter, SpinnerAdapter
  {
    private SpinnerAdapter a;
    private ListAdapter b;
    
    public a(@Nullable SpinnerAdapter paramSpinnerAdapter, @Nullable Resources.Theme paramTheme)
    {
      this.a = paramSpinnerAdapter;
      if ((paramSpinnerAdapter instanceof ListAdapter)) {
        this.b = ((ListAdapter)paramSpinnerAdapter);
      }
      if (paramTheme != null)
      {
        if ((Build.VERSION.SDK_INT < 23) || (!(paramSpinnerAdapter instanceof android.widget.ThemedSpinnerAdapter))) {
          break label66;
        }
        paramSpinnerAdapter = (android.widget.ThemedSpinnerAdapter)paramSpinnerAdapter;
        if (paramSpinnerAdapter.getDropDownViewTheme() != paramTheme) {
          paramSpinnerAdapter.setDropDownViewTheme(paramTheme);
        }
      }
      label66:
      do
      {
        do
        {
          return;
        } while (!(paramSpinnerAdapter instanceof ThemedSpinnerAdapter));
        paramSpinnerAdapter = (ThemedSpinnerAdapter)paramSpinnerAdapter;
      } while (paramSpinnerAdapter.getDropDownViewTheme() != null);
      paramSpinnerAdapter.setDropDownViewTheme(paramTheme);
    }
    
    public final boolean areAllItemsEnabled()
    {
      ListAdapter localListAdapter = this.b;
      if (localListAdapter != null) {
        return localListAdapter.areAllItemsEnabled();
      }
      return true;
    }
    
    public final int getCount()
    {
      if (this.a == null) {
        return 0;
      }
      return this.a.getCount();
    }
    
    public final View getDropDownView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      if (this.a == null) {
        return null;
      }
      return this.a.getDropDownView(paramInt, paramView, paramViewGroup);
    }
    
    public final Object getItem(int paramInt)
    {
      if (this.a == null) {
        return null;
      }
      return this.a.getItem(paramInt);
    }
    
    public final long getItemId(int paramInt)
    {
      if (this.a == null) {
        return -1L;
      }
      return this.a.getItemId(paramInt);
    }
    
    public final int getItemViewType(int paramInt)
    {
      return 0;
    }
    
    public final View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      return getDropDownView(paramInt, paramView, paramViewGroup);
    }
    
    public final int getViewTypeCount()
    {
      return 1;
    }
    
    public final boolean hasStableIds()
    {
      return (this.a != null) && (this.a.hasStableIds());
    }
    
    public final boolean isEmpty()
    {
      return getCount() == 0;
    }
    
    public final boolean isEnabled(int paramInt)
    {
      ListAdapter localListAdapter = this.b;
      if (localListAdapter != null) {
        return localListAdapter.isEnabled(paramInt);
      }
      return true;
    }
    
    public final void registerDataSetObserver(DataSetObserver paramDataSetObserver)
    {
      if (this.a != null) {
        this.a.registerDataSetObserver(paramDataSetObserver);
      }
    }
    
    public final void unregisterDataSetObserver(DataSetObserver paramDataSetObserver)
    {
      if (this.a != null) {
        this.a.unregisterDataSetObserver(paramDataSetObserver);
      }
    }
  }
  
  final class b
    extends ListPopupWindow
  {
    CharSequence a;
    ListAdapter b;
    final Rect c = new Rect();
    
    public b(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
    {
      super(paramAttributeSet, paramInt);
      setAnchorView(AppCompatSpinner.this);
      setModal(true);
      setPromptPosition(0);
      setOnItemClickListener(new AdapterView.OnItemClickListener()
      {
        public final void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
        {
          AppCompatSpinner.this.setSelection(paramAnonymousInt);
          if (AppCompatSpinner.this.getOnItemClickListener() != null) {
            AppCompatSpinner.this.performItemClick(paramAnonymousView, paramAnonymousInt, AppCompatSpinner.b.this.b.getItemId(paramAnonymousInt));
          }
          AppCompatSpinner.b.this.dismiss();
        }
      });
    }
    
    final void a()
    {
      Object localObject = getBackground();
      int i;
      int m;
      int n;
      int i1;
      int j;
      if (localObject != null)
      {
        ((Drawable)localObject).getPadding(AppCompatSpinner.this.c);
        if (ViewUtils.isLayoutRtl(AppCompatSpinner.this))
        {
          i = AppCompatSpinner.this.c.right;
          m = AppCompatSpinner.this.getPaddingLeft();
          n = AppCompatSpinner.this.getPaddingRight();
          i1 = AppCompatSpinner.this.getWidth();
          if (AppCompatSpinner.this.b != -2) {
            break label240;
          }
          j = AppCompatSpinner.this.a((SpinnerAdapter)this.b, getBackground());
          int k = AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.this.c.left - AppCompatSpinner.this.c.right;
          if (j <= k) {
            break label288;
          }
          j = k;
        }
      }
      label165:
      label240:
      label288:
      for (;;)
      {
        setContentWidth(Math.max(j, i1 - m - n));
        if (ViewUtils.isLayoutRtl(AppCompatSpinner.this)) {
          i = i1 - n - getWidth() + i;
        }
        for (;;)
        {
          setHorizontalOffset(i);
          return;
          i = -AppCompatSpinner.this.c.left;
          break;
          localObject = AppCompatSpinner.this.c;
          AppCompatSpinner.this.c.right = 0;
          ((Rect)localObject).left = 0;
          i = 0;
          break;
          if (AppCompatSpinner.this.b == -1)
          {
            setContentWidth(i1 - m - n);
            break label165;
          }
          setContentWidth(AppCompatSpinner.this.b);
          break label165;
          i += m;
        }
      }
    }
    
    public final void setAdapter(ListAdapter paramListAdapter)
    {
      super.setAdapter(paramListAdapter);
      this.b = paramListAdapter;
    }
    
    public final void show()
    {
      boolean bool = isShowing();
      a();
      setInputMethodMode(2);
      super.show();
      getListView().setChoiceMode(1);
      setSelection(AppCompatSpinner.this.getSelectedItemPosition());
      if (bool) {}
      ViewTreeObserver localViewTreeObserver;
      do
      {
        return;
        localViewTreeObserver = AppCompatSpinner.this.getViewTreeObserver();
      } while (localViewTreeObserver == null);
      final ViewTreeObserver.OnGlobalLayoutListener local2 = new ViewTreeObserver.OnGlobalLayoutListener()
      {
        public final void onGlobalLayout()
        {
          AppCompatSpinner.b localb = AppCompatSpinner.b.this;
          AppCompatSpinner localAppCompatSpinner = AppCompatSpinner.this;
          if ((ViewCompat.isAttachedToWindow(localAppCompatSpinner)) && (localAppCompatSpinner.getGlobalVisibleRect(localb.c))) {}
          for (int i = 1; i == 0; i = 0)
          {
            AppCompatSpinner.b.this.dismiss();
            return;
          }
          AppCompatSpinner.b.this.a();
          AppCompatSpinner.b.a(AppCompatSpinner.b.this);
        }
      };
      localViewTreeObserver.addOnGlobalLayoutListener(local2);
      setOnDismissListener(new PopupWindow.OnDismissListener()
      {
        public final void onDismiss()
        {
          ViewTreeObserver localViewTreeObserver = AppCompatSpinner.this.getViewTreeObserver();
          if (localViewTreeObserver != null) {
            localViewTreeObserver.removeGlobalOnLayoutListener(local2);
          }
        }
      });
    }
  }
}


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