private void updateConnected() {
    ConnectivityManager cm = null;
    try {
      cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
    } catch (ClassCastException cce) {
      return;
    }
    if (cm == null) return;

    NetworkInfo ni = cm.getActiveNetworkInfo();

    if (ni != null && ni.isConnectedOrConnecting()) {
      // Connected
      lastTimeConnected = new Date();
      if (disconnected.getVisibility() != GONE) {
        disconnected.setVisibility(GONE);
      }
    } else {
      // Disconnected
      if (lastTimeConnected.before(
          new Date(new Date().getTime() - DISCONNECTED_WARNING_ICON_THRESHOLD))) {
        if (disconnected.getVisibility() != VISIBLE) {
          disconnected.setVisibility(VISIBLE);
        }
      }
    }
  }
 public boolean a(View paramView1, View paramView2)
 {
   if ((paramView1.getVisibility() == 0) && (paramView2.getVisibility() == 0))
   {
     Rect localRect = j;
     if (paramView1.getParent() != this)
     {
       bool = true;
       a(paramView1, bool, localRect);
       paramView1 = k;
       if (paramView2.getParent() == this) {
         break label115;
       }
     }
     label115:
     for (boolean bool = true;; bool = false)
     {
       a(paramView2, bool, paramView1);
       if ((left > right) || (top > bottom) || (right < left) || (bottom < top)) {
         break label120;
       }
       return true;
       bool = false;
       break;
     }
     label120:
     return false;
   }
   return false;
 }
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int count = getChildCount();

    int offsetX = 0;
    if (mCenterContent && count > 0) {
      // determine the max width of all the rows and center accordingly
      int maxRowX = 0;
      int minRowX = Integer.MAX_VALUE;
      for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() != GONE) {
          PagedViewCellLayout.LayoutParams lp =
              (PagedViewCellLayout.LayoutParams) child.getLayoutParams();
          minRowX = Math.min(minRowX, lp.x);
          maxRowX = Math.max(maxRowX, lp.x + lp.width);
        }
      }
      int maxRowWidth = maxRowX - minRowX;
      offsetX = (getMeasuredWidth() - maxRowWidth) / 2;
    }

    for (int i = 0; i < count; i++) {
      View child = getChildAt(i);
      if (child.getVisibility() != GONE) {
        PagedViewCellLayout.LayoutParams lp =
            (PagedViewCellLayout.LayoutParams) child.getLayoutParams();

        int childLeft = offsetX + lp.x;
        int childTop = lp.y;
        child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height);
      }
    }
  }
示例#4
1
  public void assertMenuItemIsDisabledAndVisible(PageMenuItem pageMenuItem) {
    openAppMenu();

    if (!hasLegacyMenu()) {
      // Non-legacy devices have hierarchical menu, check for parent menu item "page".
      final View parentMenuItemView = findAppMenuItemView(MenuItem.PAGE.getString(mSolo));
      if (parentMenuItemView.isEnabled()) {
        fAssertTrue("The parent 'page' menu item is enabled", parentMenuItemView.isEnabled());
        fAssertEquals(
            "The parent 'page' menu item is visible",
            View.VISIBLE,
            parentMenuItemView.getVisibility());

        // Parent menu "page" is enabled, open page menu and check for menu item represented by
        // pageMenuItem.
        pressMenuItem(MenuItem.PAGE.getString(mSolo));

        final View pageMenuItemView = findAppMenuItemView(pageMenuItem.getString(mSolo));
        fAssertNotNull("The page menu item is not null", pageMenuItemView);
        fAssertFalse("The page menu item is not enabled", pageMenuItemView.isEnabled());
        fAssertEquals(
            "The page menu item is visible", View.VISIBLE, pageMenuItemView.getVisibility());
      } else {
        fAssertFalse("The parent 'page' menu item is not enabled", parentMenuItemView.isEnabled());
        fAssertEquals(
            "The parent 'page' menu item is visible",
            View.VISIBLE,
            parentMenuItemView.getVisibility());
      }
    } else {
      // Legacy devices (Android 2.3 and earlier) don't have the parent menu, "Page", so check
      // directly for the menu
      // item represented by pageMenuItem.
      //
      // We need to make sure the appropriate menu view is constructed
      // so open the "More" menu to additionally construct those views.
      openLegacyMoreMenu();

      final View pageMenuItemView = findAppMenuItemView(pageMenuItem.getString(mSolo));
      fAssertFalse("The page menu item is not enabled", pageMenuItemView.isEnabled());
      fAssertEquals(
          "The page menu item is visible", View.VISIBLE, pageMenuItemView.getVisibility());

      // Close the "More" menu.
      mSolo.goBack();
    }

    // Close the App Menu.
    mSolo.goBack();
  }
  public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    pw.println("NavigationBarView {");
    final Rect r = new Rect();
    final Point size = new Point();
    mDisplay.getRealSize(size);

    pw.println(
        String.format(
            "      this: "
                + PhoneStatusBar.viewInfo(this)
                + " "
                + visibilityToString(getVisibility())));

    getWindowVisibleDisplayFrame(r);
    final boolean offscreen = r.right > size.x || r.bottom > size.y;
    pw.println(
        "      window: "
            + r.toShortString()
            + " "
            + visibilityToString(getWindowVisibility())
            + (offscreen ? " OFFSCREEN!" : ""));

    pw.println(
        String.format(
            "      mCurrentView: id=%s (%dx%d) %s",
            getResourceName(mCurrentView.getId()),
            mCurrentView.getWidth(),
            mCurrentView.getHeight(),
            visibilityToString(mCurrentView.getVisibility())));

    pw.println(
        String.format(
            "      disabled=0x%08x vertical=%s hidden=%s low=%s menu=%s",
            mDisabledFlags,
            mVertical ? "true" : "false",
            mHidden ? "true" : "false",
            mLowProfile ? "true" : "false",
            mShowMenu ? "true" : "false"));

    final View back = mCurrentView.findViewWithTag("back");
    final View home = mCurrentView.findViewWithTag("home");
    final View recent = mCurrentView.findViewWithTag("recent");

    pw.println(
        "      back: "
            + PhoneStatusBar.viewInfo(back)
            + " "
            + visibilityToString(back.getVisibility()));
    pw.println(
        "      home: "
            + PhoneStatusBar.viewInfo(home)
            + " "
            + visibilityToString(home.getVisibility()));
    pw.println(
        "      rcnt: "
            + PhoneStatusBar.viewInfo(recent)
            + " "
            + visibilityToString(recent.getVisibility()));
    pw.println("    }");
  }
  // hides the headers in the list under the sticky header.
  // Makes sure the other ones are showing
  private void updateHeaderVisibilities() {
    int top = stickyHeaderTop();
    int childCount = mList.getChildCount();
    for (int i = 0; i < childCount; i++) {

      // ensure child is a wrapper view
      View child = mList.getChildAt(i);
      if (!(child instanceof WrapperView)) {
        continue;
      }

      // ensure wrapper view child has a header
      WrapperView wrapperViewChild = (WrapperView) child;
      if (!wrapperViewChild.hasHeader()) {
        continue;
      }

      // update header views visibility
      View childHeader = wrapperViewChild.mHeader;
      if (wrapperViewChild.getTop() < top) {
        if (childHeader.getVisibility() != View.INVISIBLE) {
          childHeader.setVisibility(View.INVISIBLE);
        }
      } else {
        if (childHeader.getVisibility() != View.VISIBLE) {
          childHeader.setVisibility(View.VISIBLE);
        }
      }
    }
  }
  private void updateNextPrevControls() {
    boolean showPrev = mCurrentPosition > 0;
    boolean showNext = mCurrentPosition < mAllImages.getCount() - 1;

    boolean prevIsVisible = mPrevImageView.getVisibility() == View.VISIBLE;
    boolean nextIsVisible = mNextImageView.getVisibility() == View.VISIBLE;

    if (showPrev && !prevIsVisible) {
      Animation a = mShowPrevImageViewAnimation;
      a.setDuration(500);
      mPrevImageView.startAnimation(a);
      mPrevImageView.setVisibility(View.VISIBLE);
    } else if (!showPrev && prevIsVisible) {
      Animation a = mHidePrevImageViewAnimation;
      a.setDuration(500);
      mPrevImageView.startAnimation(a);
      mPrevImageView.setVisibility(View.GONE);
    }

    if (showNext && !nextIsVisible) {
      Animation a = mShowNextImageViewAnimation;
      a.setDuration(500);
      mNextImageView.startAnimation(a);
      mNextImageView.setVisibility(View.VISIBLE);
    } else if (!showNext && nextIsVisible) {
      Animation a = mHideNextImageViewAnimation;
      a.setDuration(500);
      mNextImageView.startAnimation(a);
      mNextImageView.setVisibility(View.GONE);
    }
  }
 // hides the headers in the list under the sticky header.
 // Makes sure the other ones are showing
 private void updateHeaderVisibilities() {
   int top;
   if (mHeader != null) {
     top = mHeader.getMeasuredHeight() + (mHeaderOffset != null ? mHeaderOffset : 0);
   } else {
     top = mClippingToPadding ? mPaddingTop : 0;
   }
   int childCount = mList.getChildCount();
   for (int i = 0; i < childCount; i++) {
     View child = mList.getChildAt(i);
     if (child instanceof WrapperView) {
       WrapperView wrapperViewChild = (WrapperView) child;
       if (wrapperViewChild.hasHeader()) {
         View childHeader = wrapperViewChild.mHeader;
         if (wrapperViewChild.getTop() < top) {
           if (childHeader.getVisibility() != View.INVISIBLE) {
             childHeader.setVisibility(View.INVISIBLE);
           }
         } else {
           if (childHeader.getVisibility() != View.VISIBLE) {
             childHeader.setVisibility(View.VISIBLE);
           }
         }
       }
     }
   }
 }
示例#9
0
 private void animateFlipVertical(
     View left, View right, float positionOffset, int positionOffsetPixels) {
   if (mState != State.IDLE) {
     if (left != null) {
       manageLayer(left, true);
       mRot = 180.0f * positionOffset;
       if (mRot > 90.0f) {
         left.setVisibility(View.INVISIBLE);
       } else {
         if (left.getVisibility() == View.INVISIBLE) left.setVisibility(View.VISIBLE);
         mTrans = positionOffsetPixels;
         ViewHelper.setPivotX(left, left.getMeasuredWidth() * 0.5f);
         ViewHelper.setPivotY(left, left.getMeasuredHeight() * 0.5f);
         ViewHelper.setTranslationX(left, mTrans);
         ViewHelper.setRotationX(left, mRot);
       }
     }
     if (right != null) {
       manageLayer(right, true);
       mRot = -180.0f * (1 - positionOffset);
       if (mRot < -90.0f) {
         right.setVisibility(View.INVISIBLE);
       } else {
         if (right.getVisibility() == View.INVISIBLE) right.setVisibility(View.VISIBLE);
         mTrans = -getWidth() - getPageMargin() + positionOffsetPixels;
         ViewHelper.setPivotX(right, right.getMeasuredWidth() * 0.5f);
         ViewHelper.setPivotY(right, right.getMeasuredHeight() * 0.5f);
         ViewHelper.setTranslationX(right, mTrans);
         ViewHelper.setRotationX(right, mRot);
       }
     }
   }
 }
示例#10
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.button1:
       btn1Action();
       break;
     case R.id.simfyer_btn:
       smileyAction();
       break;
     case R.id.btn_send:
       sendMessage();
       break;
     case R.id.listview:
       if (faceView.getVisibility() == View.VISIBLE) {
         faceView.setVisibility(View.GONE);
       }
       if (menuView.getVisibility() == View.VISIBLE) {
         menuView.setVisibility(View.GONE);
       }
       break;
     case R.id.button3:
       Intent intent = new Intent();
       intent.setClass(this, CameraActivity.class);
       startActivity(intent);
       break;
   }
 }
示例#11
0
  public void testHiddenMenuItems() throws InterruptedException {
    // Get the menu items
    MenuItem actionXmlHidden = getActivity().menuItemActionXmlHidden;
    MenuItem actionCodeHidden = getActivity().menuItemActionCodeHidden;
    MenuItem nativeXmlHidden = getActivity().menuItemNativeXmlHidden;
    MenuItem nativeCodeHidden = getActivity().menuItemNativeCodeHidden;

    // Make sure they all were created properly
    assertNotNull(actionXmlHidden);
    assertNotNull(actionCodeHidden);
    assertNotNull(nativeXmlHidden);
    assertNotNull(nativeCodeHidden);

    // Make sure the items think they're hidden
    assertFalse(actionXmlHidden.isVisible());
    assertFalse(actionCodeHidden.isVisible());
    assertFalse(nativeXmlHidden.isVisible());
    assertFalse(nativeCodeHidden.isVisible());

    // Test native items are not present
    assertFalse(getInstrumentation().invokeMenuActionSync(getActivity(), Issue0033.ID_HIDDEN, 0));
    assertFalse(getInstrumentation().invokeMenuActionSync(getActivity(), R.id.issue0033_native, 0));

    // Test action items are not present
    View codeView = findActionItem(Issue0033.TEXT_HIDDEN);
    assertNotNull(codeView);
    assertEquals(View.GONE, codeView.getVisibility());
    View xmlView = findActionItem(getActivity().getXmlHiddenText());
    assertNotNull(xmlView);
    assertEquals(View.GONE, xmlView.getVisibility());
  }
  @Override
  public void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    final boolean hasTabs = mTabContainer != null && mTabContainer.getVisibility() != GONE;

    if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
      final int containerHeight = getMeasuredHeight();
      final int tabHeight = mTabContainer.getMeasuredHeight();

      if ((mActionBarView.getDisplayOptions() & ActionBar.DISPLAY_SHOW_HOME) == 0) {
        // Not showing home, put tabs on top.
        final int count = getChildCount();
        for (int i = 0; i < count; i++) {
          final View child = getChildAt(i);

          if (child == mTabContainer) {
            continue;
          }

          if (!mActionBarView.isCollapsed()) {
            child.offsetTopAndBottom(tabHeight);
          }
        }
        mTabContainer.layout(l, 0, r, tabHeight);
      } else {
        mTabContainer.layout(l, containerHeight - tabHeight, r, containerHeight);
      }
    }

    boolean needsInvalidate = false;
    if (mIsSplit) {
      if (mSplitBackground != null) {
        mSplitBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
        needsInvalidate = true;
      }
    } else {
      if (mBackground != null) {
        mBackground.setBounds(
            mActionBarView.getLeft(),
            mActionBarView.getTop(),
            mActionBarView.getRight(),
            mActionBarView.getBottom());
        needsInvalidate = true;
      }
      if ((mIsStacked = hasTabs && mStackedBackground != null)) {
        mStackedBackground.setBounds(
            mTabContainer.getLeft(),
            mTabContainer.getTop(),
            mTabContainer.getRight(),
            mTabContainer.getBottom());
        needsInvalidate = true;
      }
    }

    if (needsInvalidate) {
      invalidate();
    }
  }
示例#13
0
  /** * 控制显示 */
  private void controlEd() {
    SystemConfig.setOperate(checkTask);

    // 根据任务状态是否显示抽屉
    if (checkStatue == null || TextUtils.isEmpty(checkStatue)) {
      if (gDrawer.getVisibility() == View.VISIBLE) {
        gDrawer.setVisibility(View.GONE);
      }
      TopManager.getInstance().getImbtnTongBu().setVisibility(View.GONE);
    } else if ("4".equals(checkStatue)) {
      if (gDrawer.getVisibility() == View.VISIBLE) {
        gDrawer.setVisibility(View.GONE);
      }
      TopManager.getInstance().getImbtnTongBu().setVisibility(View.GONE);
    } else if ("1".equals(checkStatue)) {
      if (gDrawer.getVisibility() == View.GONE) {
        gDrawer.setVisibility(View.VISIBLE);
      }

      // 任务已经受理才显示同步和提交按钮
      if (checkTask != null && 1 == checkTask.getIsaccept()) {
        TopManager.getInstance().getImbtnTongBu().setVisibility(View.VISIBLE);
      } else {
        TopManager.getInstance().getImbtnTongBu().setVisibility(View.GONE);
      }
    } else if ("2".equals(checkStatue)) {
      if (gDrawer.getVisibility() == View.VISIBLE) {
        gDrawer.setVisibility(View.GONE);
      }
      TopManager.getInstance().getImbtnTongBu().setVisibility(View.VISIBLE);
    } else {
      if (gDrawer.getVisibility() == View.VISIBLE) {
        gDrawer.setVisibility(View.GONE);
      }
      TopManager.getInstance().getImbtnTongBu().setVisibility(View.GONE);
    }
    // 判断是否接受按钮
    if (checkTask != null && 1 == checkTask.getIsaccept()) {
      SystemConfig.isOperate = true;
      drawerUtils.setAcceptBtn(false);
    }
    // 判断是否为改派申请
    if (checkTask != null && "apply".equals(checkTask.getApplycannelstatus())) {
      drawerUtils.setGaiPaiBtn(false);
      SystemConfig.isOperate = false;
    }
    // 同步和撤销按钮控制
    if ("synchroApply".equals(checkTask.getSynchrostatus())) {
      // 显示同步撤回按钮
      isTongBuCancel = true;
      TopManager.getInstance().TongBuSurveryContinue(false);
      TopManager.getInstance().getImbtnTongBu().setEnabled(true);
      SystemConfig.isOperate = false;
    } else {
      TopManager.getInstance().TongBuSurveryContinue(true);
      TopManager.getInstance().getImbtnTongBu().setEnabled(true);
      isTongBuCancel = false;
    }
  }
    public boolean isLoadViewShow() {
      if (mLoadView.getVisibility() == View.VISIBLE
          || mPrepareView.getVisibility() == View.VISIBLE) {
        return true;
      }

      return false;
    }
示例#15
0
 @SuppressLint("NewApi")
 public boolean isVisible() {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
     return view.getVisibility() == View.VISIBLE && view.getAlpha() >= 0;
   } else {
     return view.getVisibility() == View.VISIBLE;
   }
 }
  private void updateChildrenSize(final int widthMeasureSpec, final int heightMeasureSpec) {
    for (int i = 0; i < getChildCount(); i++) {
      final ViewConstraints viewConstraints = mViewConstraints[i];
      final View v = viewConstraints.getView();
      final LayoutParams layoutParams = (LayoutParams) v.getLayoutParams();
      final int mL = layoutParams.leftMargin,
          mR = layoutParams.rightMargin,
          mT = layoutParams.topMargin,
          mB = layoutParams.bottomMargin;
      measureChildWithMargins(v, widthMeasureSpec, 0, heightMeasureSpec, 0);

      if (!viewConstraints.isHorizontalSpring()) {
        Value childWidth;
        if (v.getVisibility() == View.GONE) {
          childWidth = mLayoutMath.variable(0);
        } else if (layoutParams.relativeWidth > 0) {
          childWidth =
              mRootConstraints
                  .innerRight
                  .subtract(mRootConstraints.innerLeft)
                  .multiply(mLayoutMath.variable(layoutParams.relativeWidth))
                  .divide(mLayoutMath.variable(RELATIVE_SIZE_DENOMINATOR));
        } else {
          childWidth = mLayoutMath.variable(v.getMeasuredWidth());
        }

        viewConstraints.leftMargin.setValue(mL);
        viewConstraints.rightMargin.setValue(mR);

        Value outerWidth = childWidth.add(mLayoutMath.variable(mL + mR)).retain();
        viewConstraints.setWidth(outerWidth);
        outerWidth.release();
      }

      if (!viewConstraints.isVerticalSpring()) {
        Value childHeight;
        if (v.getVisibility() == View.GONE) {
          childHeight = mLayoutMath.variable(0);
        } else if (layoutParams.relativeHeight > 0) {
          childHeight =
              mRootConstraints
                  .innerBottom
                  .subtract(mRootConstraints.innerTop)
                  .multiply(mLayoutMath.variable(layoutParams.relativeHeight))
                  .divide(mLayoutMath.variable(RELATIVE_SIZE_DENOMINATOR));
        } else {
          childHeight = mLayoutMath.variable(v.getMeasuredHeight());
        }

        viewConstraints.topMargin.setValue(mT);
        viewConstraints.bottomMargin.setValue(mB);

        Value outerHeight = childHeight.add(mLayoutMath.variable(mT + mB)).retain();
        viewConstraints.setHeight(outerHeight);
        outerHeight.release();
      }
    }
  }
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int width = 0;
    int height = 0;
    mMaxButtonWidth = 0;
    int maxLabelWidth = 0;

    measureChildWithMargins(mImageToggle, widthMeasureSpec, 0, heightMeasureSpec, 0);

    for (int i = 0; i < mButtonsCount; i++) {
      View child = getChildAt(i);

      if (child.getVisibility() == GONE || child == mImageToggle) continue;

      measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
      mMaxButtonWidth = Math.max(mMaxButtonWidth, child.getMeasuredWidth());
    }

    for (int i = 0; i < mButtonsCount; i++) {
      int usedWidth = 0;
      View child = getChildAt(i);

      if (child.getVisibility() == GONE || child == mImageToggle) continue;

      usedWidth += child.getMeasuredWidth();
      height += child.getMeasuredHeight();

      Label label = (Label) child.getTag(R.id.fab_label);
      if (label != null) {
        int labelOffset = (mMaxButtonWidth - child.getMeasuredWidth()) / 2;
        int labelUsedWidth =
            child.getMeasuredWidth() + label.calculateShadowWidth() + mLabelsMargin + labelOffset;
        measureChildWithMargins(label, widthMeasureSpec, labelUsedWidth, heightMeasureSpec, 0);
        usedWidth += label.getMeasuredWidth();
        maxLabelWidth = Math.max(maxLabelWidth, usedWidth + labelOffset);
      }
    }

    width =
        Math.max(mMaxButtonWidth, maxLabelWidth + mLabelsMargin)
            + getPaddingLeft()
            + getPaddingRight();

    height += mButtonSpacing * (getChildCount() - 1) + getPaddingTop() + getPaddingBottom();
    height = adjustForOvershoot(height);

    if (getLayoutParams().width == LayoutParams.MATCH_PARENT) {
      width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
    }

    if (getLayoutParams().height == LayoutParams.MATCH_PARENT) {
      height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
    }

    setMeasuredDimension(width, height);
  }
示例#18
0
 private void smileyAction() {
   if (faceView.getVisibility() == View.VISIBLE) {
     faceView.setVisibility(View.GONE);
   }
   if (menuView.getVisibility() == View.GONE) {
     menuView.setVisibility(View.VISIBLE);
   } else {
     menuView.setVisibility(View.GONE);
   }
 }
    @Override
    public void executeAnim(final View target, final int animType) {
      if (ExpandableStickyListHeadersListView.ANIMATION_EXPAND == animType
          && target.getVisibility() == View.VISIBLE) {
        return;
      }
      if (ExpandableStickyListHeadersListView.ANIMATION_COLLAPSE == animType
          && target.getVisibility() != View.VISIBLE) {
        return;
      }
      if (mOriginalViewHeightPool.get(target) == null) {
        mOriginalViewHeightPool.put(target, target.getHeight());
      }
      final int viewHeight = mOriginalViewHeightPool.get(target);
      float animStartY =
          animType == ExpandableStickyListHeadersListView.ANIMATION_EXPAND ? 0f : viewHeight;
      float animEndY =
          animType == ExpandableStickyListHeadersListView.ANIMATION_EXPAND ? viewHeight : 0f;
      final ViewGroup.LayoutParams lp = target.getLayoutParams();
      ValueAnimator animator = ValueAnimator.ofFloat(animStartY, animEndY);
      animator.setDuration(200);
      target.setVisibility(View.VISIBLE);
      animator.addListener(
          new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {}

            @Override
            public void onAnimationEnd(Animator animator) {
              if (animType == ExpandableStickyListHeadersListView.ANIMATION_EXPAND) {
                target.setVisibility(View.VISIBLE);
              } else {
                target.setVisibility(View.GONE);
              }
              target.getLayoutParams().height = viewHeight;
            }

            @Override
            public void onAnimationCancel(Animator animator) {}

            @Override
            public void onAnimationRepeat(Animator animator) {}
          });
      animator.addUpdateListener(
          new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
              lp.height = ((Float) valueAnimator.getAnimatedValue()).intValue();
              target.setLayoutParams(lp);
              target.requestLayout();
            }
          });
      animator.start();
    }
示例#20
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {

    if (menuView != null && menuView.getVisibility() == View.VISIBLE) {
      menuView.setVisibility(View.GONE);
    }
    if (faceView != null && faceView.getVisibility() == View.VISIBLE) {
      faceView.setVisibility(View.GONE);
    }

    return super.onTouchEvent(event);
  }
示例#21
0
 // react to buttons's on clicks below
 private void btn1Action() {
   if (menuView.getVisibility() == View.VISIBLE) {
     menuView.setVisibility(View.GONE);
   }
   if (faceView.getVisibility() == View.GONE) {
     if (pa == null) {
       initPaper();
       Init_Point();
     }
     faceView.setVisibility(View.VISIBLE);
   }
 }
 public void testEmptyCourseListClick() {
   ListView listView = (ListView) solo.getView(R.id.courses_list);
   View emptyview = listView.getEmptyView();
   assertEquals("EmptyView shoudl not be visible", View.GONE, emptyview.getVisibility());
   deleteAllCourses();
   assertEquals(0, listView.getCount());
   assertEquals("Empty view should be visible", View.VISIBLE, emptyview.getVisibility());
   solo.clickOnView(emptyview);
   solo.assertCurrentActivity(
       "Current activity shoudl Be the AddCourse Activity", AddCourseActivity.class);
   solo.goBack();
 }
示例#23
0
 void showProgress(boolean show) {
   if (show) {
     if (mProgressLay.getVisibility() != View.VISIBLE) {
       mProgressLay.setVisibility(View.VISIBLE);
       mEmpty.setVisibility(View.GONE);
     }
   } else {
     if (mProgressLay.getVisibility() == View.VISIBLE) {
       mProgressLay.setVisibility(View.GONE);
     }
   }
 }
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int w = Math.max(MeasureSpec.getSize(widthMeasureSpec), getSuggestedMinimumWidth());
    int wMode = MeasureSpec.getMode(widthMeasureSpec);
    int h = Math.max(MeasureSpec.getSize(heightMeasureSpec), getSuggestedMinimumHeight());
    int hMode = MeasureSpec.getMode(heightMeasureSpec);

    int maxWidth = 0;
    int maxHeight = 0;

    for (int i = 0; i < getChildCount(); i++) {
      View child = getChildAt(i);
      if (child.getVisibility() != View.GONE) {
        constrainChild(child, w, wMode, h, hMode);
      }

      int childWidth = child.getMeasuredWidth();
      int childHeight = child.getMeasuredHeight();
      if (child.getVisibility() != View.GONE) {
        childWidth += getViewWidthPadding(child);
        childHeight += getViewHeightPadding(child);
      }

      maxWidth = Math.max(maxWidth, childWidth);
      if (vertical) {
        LayoutParams p = (LayoutParams) child.getLayoutParams();
        maxHeight += childHeight;
        if (p.optionTop != NOT_SET) {
          maxHeight += p.optionTop;
        }
      } else {
        maxHeight = Math.max(maxHeight, childHeight);
      }
    }

    // account for padding
    maxWidth += getPaddingLeft() + getPaddingRight();
    maxHeight += getPaddingTop() + getPaddingBottom();

    // Account for border
    // int padding = Math.round(borderHelper.calculatePadding());
    // maxWidth += padding;
    // maxHeight += padding;

    // check minimums
    maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
    maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());

    int measuredWidth = getMeasuredWidth(maxWidth, widthMeasureSpec);
    int measuredHeight = getMeasuredHeight(maxHeight, heightMeasureSpec);
    setMeasuredDimension(measuredWidth, measuredHeight);
  }
示例#25
0
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int count = getChildCount();

    int maxWidth = 0;
    int maxHeight = 0;

    measureChildren(widthMeasureSpec, heightMeasureSpec);

    // scale에 따른 사이즈를 다시 계산함.
    for (int i = 0; i < count; i++) {
      View child = getChildAt(i);
      if (child.getVisibility() != View.GONE) {
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        int widthPadding = getPaddingLeft() + getPaddingRight();
        int heightPadding = getPaddingTop() + getPaddingBottom();
        int childWidth = child.getMeasuredWidth();
        int childHeight = child.getMeasuredHeight();
        if (lp.isScalable) {
          childWidth = (int) (childWidth * lp.fScale * mScaleFactor);
          childHeight = (int) (childHeight * lp.fScale * mScaleFactor);
        }
        int childWidthMeasureSpec =
            this.getChildMeasureSpec(widthMeasureSpec, widthPadding, childWidth);
        int childHeightMeasureSpec =
            this.getChildMeasureSpec(heightMeasureSpec, heightPadding, childHeight);
        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
      }
    }

    for (int i = 0; i < count; i++) {
      View child = getChildAt(i);
      if (child.getVisibility() != View.GONE) {
        int right, bottom;
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        right = (int) (lp.x * mScaleFactor) + child.getMeasuredWidth();
        bottom = (int) (lp.y * mScaleFactor) + child.getMeasuredHeight();

        maxWidth = Math.max(maxWidth, right);
        maxHeight = Math.max(maxHeight, bottom);
      }
    }

    maxWidth += getPaddingLeft() + getPaddingRight();
    maxHeight += getPaddingTop() + getPaddingBottom();

    maxWidth = Math.max(maxWidth, this.getSuggestedMinimumWidth());
    maxHeight = Math.max(maxHeight, this.getSuggestedMinimumHeight());

    setMeasuredDimension(
        resolveSize(maxWidth, widthMeasureSpec), resolveSize(maxHeight, heightMeasureSpec));
  }
示例#26
0
 @Override
 public void onScrollChanged(boolean isAtTheEnd) {
   if (isAtTheEnd) {
     if (mLikeView.getVisibility() == View.GONE) {
       mLikeView.setVisibility(View.VISIBLE);
       mLikeView.startAnimation(this.fadeIn);
     }
   } else {
     if (mLikeView.getVisibility() == View.VISIBLE) {
       mLikeView.startAnimation(this.fadeOut);
     }
   }
 }
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     if (mBottomInput.getVisibility() == View.VISIBLE) {
       // 在输入模式下按返回键,退出输入模式
       hideInput();
       return true;
     } else if (mInputTextOnly.getVisibility() == View.VISIBLE) {
       switchTestOnlyMode();
       return true;
     }
   }
   return super.onKeyDown(keyCode, event);
 }
示例#28
0
 public void onLayout(boolean changed, int l, int t, int r, int b) {
   super.onLayout(changed, l, t, r, b);
   View tabContainer = this.mTabContainer;
   boolean hasTabs = (tabContainer == null || tabContainer.getVisibility() == 8) ? false : true;
   if (!(tabContainer == null || tabContainer.getVisibility() == 8)) {
     int containerHeight = getMeasuredHeight();
     FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) tabContainer.getLayoutParams();
     tabContainer.layout(
         l,
         (containerHeight - tabContainer.getMeasuredHeight()) - lp.bottomMargin,
         r,
         containerHeight - lp.bottomMargin);
   }
   boolean needsInvalidate = false;
   if (!this.mIsSplit) {
     if (this.mBackground != null) {
       if (this.mActionBarView.getVisibility() == 0) {
         this.mBackground.setBounds(
             this.mActionBarView.getLeft(),
             this.mActionBarView.getTop(),
             this.mActionBarView.getRight(),
             this.mActionBarView.getBottom());
       } else if (this.mContextView == null || this.mContextView.getVisibility() != 0) {
         this.mBackground.setBounds(0, 0, 0, 0);
       } else {
         this.mBackground.setBounds(
             this.mContextView.getLeft(),
             this.mContextView.getTop(),
             this.mContextView.getRight(),
             this.mContextView.getBottom());
       }
       needsInvalidate = true;
     }
     this.mIsStacked = hasTabs;
     if (hasTabs && this.mStackedBackground != null) {
       this.mStackedBackground.setBounds(
           tabContainer.getLeft(),
           tabContainer.getTop(),
           tabContainer.getRight(),
           tabContainer.getBottom());
       needsInvalidate = true;
     }
   } else if (this.mSplitBackground != null) {
     this.mSplitBackground.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
     needsInvalidate = true;
   }
   if (needsInvalidate) {
     invalidate();
   }
 }
  @UiThread
  void verifyValid() {
    try {
      if (!isAdded()) {
        return;
      }
      ((SoliciteActivity) getActivity()).enableNextButton(valid);
      if (!valid && error.getVisibility() != View.VISIBLE) {
        AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
        anim.setDuration(1000);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setAnimationListener(
            new Animation.AnimationListener() {
              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                error.setVisibility(View.VISIBLE);
              }

              @Override
              public void onAnimationRepeat(Animation animation) {}
            });
        error.startAnimation(anim);
      } else if (valid && error.getVisibility() != View.GONE) {
        AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
        anim.setDuration(1000);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setAnimationListener(
            new Animation.AnimationListener() {
              @Override
              public void onAnimationStart(Animation animation) {}

              @Override
              public void onAnimationEnd(Animation animation) {
                error.setVisibility(View.GONE);
              }

              @Override
              public void onAnimationRepeat(Animation animation) {}
            });
        error.startAnimation(anim);
      }
    } catch (Exception e) {
      Log.e("ZUP", e.getMessage(), e);
      Crashlytics.logException(e);
    }
  }
 public void showEmpty(boolean show, View emptyView) {
   Animation anim =
       AnimationUtils.loadAnimation(
           getActivity(), show ? android.R.anim.fade_in : android.R.anim.fade_out);
   if (show
       && (emptyView.getVisibility() == View.GONE
           || emptyView.getVisibility() == View.INVISIBLE)) {
     emptyView.setAnimation(anim);
     emptyView.setVisibility(View.VISIBLE);
     if (adapter != null) adapter.changeDataSet(null);
   } else if (!show && emptyView.getVisibility() == View.VISIBLE) {
     emptyView.setAnimation(anim);
     emptyView.setVisibility(View.GONE);
   }
 }