Advertisement
dunc001

HTC_method

Jun 11th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 KB | None | 0 0
  1. protected void onFinishInflate()
  2. {
  3. super.onFinishInflate();
  4. this.mHandleView = findViewById(2131230766);
  5. this.notificationLayout = ((NotificationRowLayout)findViewById(2131230838));
  6. if (this.DEBUG_INTERNAL == true)
  7. Log.i("PanelView", "notificationLayout:" + this.notificationLayout);
  8. if (this.notificationLayout != null)
  9. this.notificationLayout.setLayoutTransitionsEnabled(false);
  10. loadDimens();
  11. if (DEBUG)
  12. LOG("handle view: " + this.mHandleView, new Object[0]);
  13. if (this.mHandleView != null)
  14. this.mHandleView.setOnTouchListener(new View.OnTouchListener()
  15. {
  16. public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
  17. {
  18. float f1 = paramAnonymousMotionEvent.getY();
  19. float f2 = paramAnonymousMotionEvent.getRawY();
  20. if (PanelView.DEBUG)
  21. {
  22. PanelView localPanelView2 = PanelView.this;
  23. Object[] arrayOfObject2 = new Object[4];
  24. arrayOfObject2[0] = MotionEvent.actionToString(paramAnonymousMotionEvent.getAction());
  25. arrayOfObject2[1] = Float.valueOf(f1);
  26. arrayOfObject2[2] = Float.valueOf(f2);
  27. arrayOfObject2[3] = Float.valueOf(PanelView.this.mTouchOffset);
  28. localPanelView2.LOG("handle.onTouch: a=%s y=%.1f rawY=%.1f off=%.1f", arrayOfObject2);
  29. }
  30. PanelView.this.getLocationOnScreen(PanelView.this.mAbsPos);
  31. switch (paramAnonymousMotionEvent.getAction())
  32. {
  33. case 1:
  34. case 3:
  35. PanelView.this.mFinalTouchY = f1;
  36. PanelView.access$702(PanelView.this, false);
  37. PanelView.this.mHandleView.setPressed(false);
  38. PanelView.this.postInvalidate();
  39. PanelView.this.mBar.onTrackingStopped(PanelView.this);
  40. PanelView.this.trackMovement(paramAnonymousMotionEvent);
  41. if ((paramAnonymousMotionEvent.getAction() == 1) && (PanelView.this.mStatusBarViewPressed == true))
  42. {
  43. Intent localIntent = new Intent("com.htc.intent.action.STATUS_BAR_TAP_EVENT");
  44. PanelView.this.mContext.sendBroadcast(localIntent);
  45. }
  46. PanelView.access$1402(PanelView.this, false);
  47. PanelView.FlingTracker localFlingTracker = PanelView.this.mVelocityTracker;
  48. int i = 0;
  49. float f4 = 0.0F;
  50. float f5 = 0.0F;
  51. float f6 = 0.0F;
  52. if (localFlingTracker != null)
  53. {
  54. PanelView.this.mVelocityTracker.computeCurrentVelocity(1000L);
  55. f6 = PanelView.this.mVelocityTracker.getYVelocity();
  56. if (f6 < 0.0F)
  57. i = 1;
  58. else
  59. i = 0;
  60. f5 = PanelView.this.mVelocityTracker.getXVelocity();
  61. if (f5 < 0.0F)
  62. f5 = -f5;
  63. if (f5 > PanelView.this.mFlingGestureMaxXVelocityPx)
  64. f5 = PanelView.this.mFlingGestureMaxXVelocityPx;
  65. f4 = (float)Math.hypot(f6, f5);
  66. if (f4 > PanelView.this.mFlingGestureMaxOutputVelocityPx)
  67. f4 = PanelView.this.mFlingGestureMaxOutputVelocityPx;
  68. PanelView.this.mVelocityTracker.recycle();
  69. PanelView.access$902(PanelView.this, null);
  70. }
  71. float f7 = Math.abs(PanelView.this.mFinalTouchY - PanelView.this.mInitialTouchY);
  72. if ((f7 < PanelView.this.mFlingGestureMinDistPx) || (f4 < PanelView.this.mFlingExpandMinVelocityPx))
  73. f4 = 0.0F;
  74. if (i != 0)
  75. f4 = -f4;
  76. if (PanelView.DEBUG)
  77. {
  78. PanelView localPanelView1 = PanelView.this;
  79. Object[] arrayOfObject1 = new Object[4];
  80. arrayOfObject1[0] = Float.valueOf(f7);
  81. arrayOfObject1[1] = Float.valueOf(f5);
  82. arrayOfObject1[2] = Float.valueOf(f6);
  83. arrayOfObject1[3] = Float.valueOf(f4);
  84. localPanelView1.LOG("gesture: dy=%f vel=(%f,%f) vlinear=%f", arrayOfObject1);
  85. }
  86. PanelView.this.fling(f4, true);
  87. break;
  88. case 2:
  89. float f3 = f2 - PanelView.this.mAbsPos[1] - PanelView.this.mTouchOffset;
  90. if (f3 > PanelView.this.mPeekHeight)
  91. {
  92. if ((PanelView.this.mPeekAnimator != null) && (PanelView.this.mPeekAnimator.isRunning()))
  93. PanelView.this.mPeekAnimator.cancel();
  94. PanelView.access$1202(PanelView.this, false);
  95. }
  96. if (f3 > PanelView.this.mPeekHeight / 2.0F)
  97. PanelView.access$1402(PanelView.this, false);
  98. if (!PanelView.this.mJustPeeked)
  99. {
  100. PanelView.this.setExpandedHeightInternal(f3);
  101. PanelView.this.mBar.panelExpansionChanged(PanelView.this, PanelView.this.mExpandedFraction);
  102. }
  103. PanelView.this.trackMovement(paramAnonymousMotionEvent);
  104. break;
  105. case 0:
  106. PanelView.this.disableGcForExternalAlloc(true);
  107. PanelView.access$702(PanelView.this, true);
  108. PanelView.this.mHandleView.setPressed(true);
  109. PanelView.this.postInvalidate();
  110. PanelView.this.mInitialTouchY = f1;
  111. PanelView.access$902(PanelView.this, PanelView.FlingTracker.obtain());
  112. PanelView.this.trackMovement(paramAnonymousMotionEvent);
  113. PanelView.this.mTimeAnimator.cancel();
  114. PanelView.this.mBar.onTrackingStarted(PanelView.this);
  115. PanelView.access$502(PanelView.this, f2 - PanelView.this.mAbsPos[1] - PanelView.this.getExpandedHeight());
  116. if (PanelView.this.mExpandedHeight == 0.0F)
  117. {
  118. PanelView.access$1202(PanelView.this, true);
  119. PanelView.this.runPeekAnimation();
  120. PanelView.access$1402(PanelView.this, true);
  121. }
  122. break;
  123. }
  124. return true;
  125. }
  126. });
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement