Esempio n. 1
0
 @Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   if (getChildCount() == 1) {
     mDragView = getChildAt(0);
   }
 }
 /** Set the Drag View after the view is inflated */
 @Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   if (mDragViewResId != -1) {
     setDragView(findViewById(mDragViewResId));
   }
 }
 public void setBrightnessMirror(BrightnessMirrorController c) {
   super.onFinishInflate();
   ToggleSlider brightnessSlider = (ToggleSlider) findViewById(R.id.brightness_slider);
   ToggleSlider mirror = (ToggleSlider) c.getMirror().findViewById(R.id.brightness_slider);
   brightnessSlider.setMirror(mirror);
   brightnessSlider.setMirrorController(c);
 }
  @Override
  protected void onFinishInflate() {
    final int childCount = getChildCount();
    if (childCount > 2) {
      throw new IllegalStateException("PtrFrameLayout only can host 2 elements");
    } else if (childCount == 2) {
      if (mHeaderId != 0 && mHeaderView == null) {
        mHeaderView = findViewById(mHeaderId);
      }
      if (mContainerId != 0 && mContent == null) {
        mContent = findViewById(mContainerId);
      }

      // not specify header or content
      if (mContent == null || mHeaderView == null) {

        View child1 = getChildAt(0);
        View child2 = getChildAt(1);
        if (child1 instanceof PtrUIHandler) {
          mHeaderView = child1;
          mContent = child2;
        } else if (child2 instanceof PtrUIHandler) {
          mHeaderView = child2;
          mContent = child1;
        } else {
          // both are not specified
          if (mContent == null && mHeaderView == null) {
            mHeaderView = child1;
            mContent = child2;
          }
          // only one is specified
          else {
            if (mHeaderView == null) {
              mHeaderView = mContent == child1 ? child2 : child1;
            } else {
              mContent = mHeaderView == child1 ? child2 : child1;
            }
          }
        }
      }
    } else if (childCount == 1) {
      mContent = getChildAt(0);
    } else {
      TextView errorView = new TextView(getContext());
      errorView.setClickable(true);
      errorView.setTextColor(0xffff6600);
      errorView.setGravity(Gravity.CENTER);
      errorView.setTextSize(20);
      errorView.setText(
          "The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?");
      mContent = errorView;
      addView(mContent);
    }
    // 检测mContent 是否是ILoadMoreView 也就是可以添加加载更多
    onContentViewFinishInflate(mContent);
    if (mHeaderView != null) {
      mHeaderView.bringToFront();
    }
    super.onFinishInflate();
  }
 @Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   bringChildToFront(mMenuButton);
   bringChildToFront(mImageToggle);
   mButtonsCount = getChildCount();
   createLabels();
 }
 protected void onFinishInflate()
 {
   super.onFinishInflate();
   this.mLogo = findViewById(2131755606);
   this.mContinueButtonFrame = findViewById(2131755630);
   this.mContinueButton = findViewById(2131755631);
   this.mSecondaryButtonFrame = findViewById(2131755632);
   this.mSecondaryButton = findViewById(2131755633);
 }
  /** Sort the views out after they have been inflated from a layout */
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    if (getChildCount() > 2) {
      throw new IllegalStateException("ParallaxScrollView can host only two direct children");
    }
    organiseViews();
  }
Esempio n. 8
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    bringChildToFront(mAddButton);
    mButtonsCount = getChildCount();

    if (mLabelsStyle != 0) {
      createLabels();
    }
  }
Esempio n. 9
0
 @Override
 protected void onFinishInflate() {
   // TODO Auto-generated method stub
   super.onFinishInflate();
   View child;
   for (int i = 0; i < getChildCount(); i++) {
     child = getChildAt(i);
     child.setFocusable(true);
     child.setClickable(true);
   }
 }
Esempio n. 10
0
 @Override
 public void onFinishInflate() {
   super.onFinishInflate();
   for (int i = 0; i < getChildCount(); i++) {
     View v = getChildAt(i);
     if (v.getId() == R.id.titleFrame) {
       mTitleBar = v;
     } else if (v.getId() == R.id.buttonDefaultNeutral) {
       mButtons[INDEX_NEUTRAL] = (MDButton) v;
     } else if (v.getId() == R.id.buttonDefaultNegative) {
       mButtons[INDEX_NEGATIVE] = (MDButton) v;
     } else if (v.getId() == R.id.buttonDefaultPositive) {
       mButtons[INDEX_POSITIVE] = (MDButton) v;
     } else {
       mContent = v;
     }
   }
 }
Esempio n. 11
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
      final View child = getChildAt(i);
      final int absGravity =
          GravityCompat.getAbsoluteGravity(
              ((LayoutParams) child.getLayoutParams()).gravity,
              ViewCompat.getLayoutDirection(child));

      if (absGravity == Gravity.NO_GRAVITY) {
        if (mContentView != null)
          throw new IllegalStateException("There is more than one content view");
        mContentView = child;
      } else if ((absGravity & Gravity.LEFT) == Gravity.LEFT) {
        if (mLeftDrawer != null)
          throw new IllegalStateException("There is more than one left menu");
        mLeftDrawer = child;
      } else if ((absGravity & Gravity.RIGHT) == Gravity.RIGHT) {
        if (mRightDrawer != null)
          throw new IllegalStateException("There is more than one right menu");
        mRightDrawer = child;
      } else {
        throw new IllegalStateException(
            "Child "
                + child
                + " at index "
                + i
                + " does not have a valid layout_gravity - must be Gravity.LEFT, "
                + "Gravity.RIGHT or Gravity.NO_GRAVITY");
      }
    }

    if (mContentView == null) throw new IllegalStateException("There is no content view");
    // Material is solid.
    // Input events cannot pass through material.
    if (mLeftDrawer != null) mLeftDrawer.setClickable(true);
    if (mRightDrawer != null) mRightDrawer.setClickable(true);

    mShadow = new ShadowView(getContext());
    addView(mShadow, 1);
  }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // 渲染完成,初始化卡片view列表
    viewList.clear();
    int num = getChildCount();
    for (int i = num - 1; i >= 0; i--) {
      View childView = getChildAt(i);
      if (childView.getId() == R.id.card_bottom_layout) {
        bottomLayout = childView;
        initBottomLayout();
      } else {
        CardItemView viewItem = (CardItemView) childView;
        viewItem.setTag(i + 1);
        viewList.add(viewItem);
      }
    }
  }
 @Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   load();
 }