示例#1
0
 @Override
 public void onResume() {
   super.onResume();
   if (mShouldSelectAllInput && mSearchUi.getVisibility() == View.VISIBLE) {
     handler.sendEmptyMessageDelayed(UiHandler.MSG_SHOW_SEARCH, ACTION_DURATION_FOR_RESUME);
   }
   mShouldSelectAllInput = false;
 }
 private void scheduleClickLocked() {
   unscheduleClickLocked();
   mPostClickScheduled = true;
   mUiHandler.sendEmptyMessageDelayed(UiHandler.MSG_CLICK, DOUBLE_TAP_TIMEOUT);
 }
 private void scheduleHideTapHighlightLocked() {
   unscheduleHideTapHighlightLocked();
   mPostHideTapHighlightScheduled = true;
   mUiHandler.sendEmptyMessageDelayed(UiHandler.MSG_HIDE_TAP_HIGHLIGHT, PRESSED_STATE_DURATION);
 }
 private void scheduleShowTapHighlightLocked() {
   unscheduleShowTapHighlightLocked();
   mPostShowTapHighlightScheduled = true;
   mUiHandler.sendEmptyMessageDelayed(UiHandler.MSG_SHOW_TAP_HIGHLIGHT, TAP_TIMEOUT);
 }
 private void scheduleLongPressLocked() {
   unscheduleLongPressLocked();
   mPostLongPressScheduled = true;
   mUiHandler.sendEmptyMessageDelayed(UiHandler.MSG_LONG_PRESS, LONG_PRESS_TIMEOUT);
 }
示例#6
0
 public void showSearchUi(boolean show) {
   View titleBar = ((BaseActivity) getActivity()).getTitleBarContainer();
   View tabs = ((MainActivity) getActivity()).tabs;
   if (show) {
     if (mFakeTopBmp == null) {
       int w = 0,
           h = 0,
           titleBmpH = 0,
           tabsBmpH =
               (int) ShopApp.getContext().getResources().getDimension(R.dimen.tabs_visible_height);
       titleBar.setDrawingCacheEnabled(true);
       tabs.setDrawingCacheEnabled(true);
       Bitmap titleBmp = titleBar.getDrawingCache();
       Bitmap tabsBmp = tabs.getDrawingCache();
       if (titleBmp != null) {
         w = titleBmp.getWidth();
         mTitleHeight = titleBmpH = titleBmp.getHeight();
         h += titleBmpH;
       }
       if (tabsBmp != null) {
         if (w == 0) {
           w = tabsBmp.getWidth();
         }
         h += tabsBmpH;
       }
       mFakeTopBmp = Bitmap.createBitmap(w, h, Config.ARGB_8888);
       Canvas canvas = new Canvas(mFakeTopBmp);
       Paint paint = new Paint();
       if (titleBmp != null) {
         canvas.drawBitmap(titleBmp, 0, 0, paint);
         titleBmp.recycle();
       }
       titleBar.setDrawingCacheEnabled(false);
       if (tabsBmp != null) {
         paint.setColor(
             ShopApp.getContext().getResources().getColor(R.color.fake_search_background));
         canvas.drawRect(0, titleBmpH, w, titleBmpH + tabsBmpH, paint);
         canvas.drawBitmap(tabsBmp, 0, titleBmpH, paint);
         tabsBmp.recycle();
       }
       tabs.setDrawingCacheEnabled(false);
     }
     mCategoryListAdapter.showCoverView(true);
     mFakeBg.setVisibility(View.VISIBLE);
     mFakeBg.setLayoutParams(new LayoutParams(mFakeTopBmp.getWidth(), mFakeTopBmp.getHeight()));
     mFakeBg.setBackgroundDrawable(new BitmapDrawable(mFakeTopBmp));
     mTopView.setLayoutParams(
         new AbsListView.LayoutParams(mFakeTopBmp.getWidth(), mFakeTopBmp.getHeight()));
     mTopViewContent.setBackgroundColor(
         ShopApp.getContext().getResources().getColor(R.color.transparent));
     titleBar.setVisibility(View.GONE);
     tabs.setVisibility(View.GONE);
     int scrollDis =
         mTitleHeight
             + mFakeSearchView.getTop()
             + (int)
                 ShopApp.getContext()
                     .getResources()
                     .getDimension(R.dimen.fake_search_scroll_up_diff);
     mListView.smoothScrollBy(scrollDis, ANIMATION_DURATION);
     handler.sendEmptyMessageDelayed(UiHandler.MSG_SHOW_SEARCH, ACTION_DURATION);
     loadHint();
   } else {
     mInput.setText("");
     Utils.SoftInput.hide(getActivity(), mInput.getWindowToken());
     mSearchUi.setVisibility(View.GONE);
     int scrollDis =
         -mFakeTopBmp.getHeight()
             + (int)
                 ShopApp.getContext()
                     .getResources()
                     .getDimension(R.dimen.fake_search_scroll_down_diff);
     mListView.smoothScrollBy(scrollDis, ANIMATION_DURATION);
     handler.sendEmptyMessageDelayed(UiHandler.MSG_HIDE_SEARCH, ACTION_DURATION);
   }
 }