Java Code Examples for android.widget.FrameLayout#setClipChildren()

The following examples show how to use android.widget.FrameLayout#setClipChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameFragment.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	ViewGroup view = (ViewGroup) inflater.inflate(R.layout.game_fragment, container, false);
	view.setClipChildren(false);
	((ViewGroup)view.findViewById(R.id.game_board)).setClipChildren(false);
	mTime = (TextView) view.findViewById(R.id.time_bar_text);
	mTimeImage = (ImageView) view.findViewById(R.id.time_bar_image);
	FontLoader.setTypeface(Shared.context, new TextView[] {mTime}, Font.GROBOLD);
	mBoardView = BoardView.fromXml(getActivity().getApplicationContext(), view);
	FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.game_container);
	frameLayout.addView(mBoardView);
	frameLayout.setClipChildren(false);

	// build board
	buildBoard();
	Shared.eventBus.listen(FlipDownCardsEvent.TYPE, this);
	Shared.eventBus.listen(HidePairCardsEvent.TYPE, this);
	Shared.eventBus.listen(GameWonEvent.TYPE, this);
	
	return view;
}
 
Example 2
Source File: GameFragment.java    From memory-game with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	ViewGroup view = (ViewGroup) inflater.inflate(R.layout.game_fragment, container, false);
	view.setClipChildren(false);
	((ViewGroup)view.findViewById(R.id.game_board)).setClipChildren(false);
	mTime = (TextView) view.findViewById(R.id.time_bar_text);
	mTimeImage = (ImageView) view.findViewById(R.id.time_bar_image);
	FontLoader.setTypeface(Shared.context, new TextView[] {mTime}, Font.GROBOLD);
	mBoardView = BoardView.fromXml(getActivity().getApplicationContext(), view);
	FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.game_container);
	frameLayout.addView(mBoardView);
	frameLayout.setClipChildren(false);

	// build board
	buildBoard();
	Shared.eventBus.listen(FlipDownCardsEvent.TYPE, this);
	Shared.eventBus.listen(HidePairCardsEvent.TYPE, this);
	Shared.eventBus.listen(GameWonEvent.TYPE, this);
	
	return view;
}
 
Example 3
Source File: WelcomeCoordinatorLayout.java    From welcome-coordinator with Apache License 2.0 5 votes vote down vote up
private void buildMainContentView() {
    mainContentView = new FrameLayout(this.getContext());
    mainContentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT));
    mainContentView.setClipToPadding(false);
    mainContentView.setClipChildren(false);
}
 
Example 4
Source File: PullToZoomScrollViewEx.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomView_contentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 5
Source File: PullToZoomScrollViewEx.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 6
Source File: PullToZoomScrollViewEx.java    From PullZoomView with Apache License 2.0 5 votes vote down vote up
@Override
public void handleStyledAttributes(TypedArray a) {
    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    mHeaderContainer = new FrameLayout(getContext());

    if (mZoomView != null) {
        mHeaderContainer.addView(mZoomView);
    }
    if (mHeaderView != null) {
        mHeaderContainer.addView(mHeaderView);
    }
    int contentViewResId = a.getResourceId(R.styleable.PullToZoomView_contentView, 0);
    if (contentViewResId > 0) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
    }

    mRootContainer.addView(mHeaderContainer);
    if (mContentView != null) {
        mRootContainer.addView(mContentView);
    }

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    mRootView.addView(mRootContainer);
}
 
Example 7
Source File: TrashView.java    From dingo with GNU General Public License v3.0 4 votes vote down vote up
/**
 * コンストラクタ
 *
 * @param context Context
 */
TrashView(Context context) {
    super(context);
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mMetrics = new DisplayMetrics();
    mWindowManager.getDefaultDisplay().getMetrics(mMetrics);
    mAnimationHandler = new AnimationHandler(this);
    mIsEnabled = true;

    mParams = new WindowManager.LayoutParams();
    mParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
    mParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
    mParams.type = OVERLAY_TYPE;
    mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
            WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
    mParams.format = PixelFormat.TRANSLUCENT;
    // INFO:Windowの原点のみ左下に設定
    mParams.gravity = Gravity.LEFT | Gravity.BOTTOM;

    // 各種Viewの設定
    // TrashViewに直接貼り付けられるView(このViewを介さないと、削除Viewと背景Viewのレイアウトがなぜか崩れる)
    mRootView = new FrameLayout(context);
    mRootView.setClipChildren(false);
    // 削除アイコンのルートView
    mTrashIconRootView = new FrameLayout(context);
    mTrashIconRootView.setClipChildren(false);
    mFixedTrashIconView = new ImageView(context);
    mActionTrashIconView = new ImageView(context);
    // 背景View
    mBackgroundView = new FrameLayout(context);
    mBackgroundView.setAlpha(0.0f);
    final GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0x00000000, 0x50000000});
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        //noinspection deprecation
        mBackgroundView.setBackgroundDrawable(gradientDrawable);
    } else {
        mBackgroundView.setBackground(gradientDrawable);
    }

    // 背景Viewの貼り付け
    final LayoutParams backgroundParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (BACKGROUND_HEIGHT * mMetrics.density));
    backgroundParams.gravity = Gravity.BOTTOM;
    mRootView.addView(mBackgroundView, backgroundParams);
    // アクションアイコンの貼り付け
    final LayoutParams actionTrashIconParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    actionTrashIconParams.gravity = Gravity.CENTER;
    mTrashIconRootView.addView(mActionTrashIconView, actionTrashIconParams);
    // 固定アイコンの貼付け
    final LayoutParams fixedTrashIconParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    fixedTrashIconParams.gravity = Gravity.CENTER;
    mTrashIconRootView.addView(mFixedTrashIconView, fixedTrashIconParams);
    // 削除アイコンの貼り付け
    final LayoutParams trashIconParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    trashIconParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
    mRootView.addView(mTrashIconRootView, trashIconParams);

    // TrashViewに貼り付け
    addView(mRootView);

    // 初回描画処理用
    getViewTreeObserver().addOnPreDrawListener(this);
}
 
Example 8
Source File: NormalDokitViewManager.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
/**
 * @return rootView
 */
private FrameLayout getDokitRootContentView(final Activity activity, FrameLayout decorView) {
    FrameLayout dokitRootView = decorView.findViewById(R.id.dokit_contentview_id);
    if (dokitRootView != null) {
        return dokitRootView;
    }

    dokitRootView = new DokitFrameLayout(mContext);
    //普通模式的返回按键监听
    dokitRootView.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            //LogHelper.i(TAG, "keyCode===>" + keyCode + " " + v.getClass().getSimpleName());
            //监听返回键
            if (keyCode == KeyEvent.KEYCODE_BACK) {
                Map<String, AbsDokitView> dokitViews = getDokitViews(activity);
                if (dokitViews == null || dokitViews.size() == 0) {
                    return false;
                }
                for (AbsDokitView dokitView : dokitViews.values()) {
                    if (dokitView.shouldDealBackKey()) {
                        return dokitView.onBackPressed();
                    }
                }
                return false;
            }
            return false;
        }
    });
    dokitRootView.setClipChildren(false);
    //解决无法获取返回按键的问题
    dokitRootView.setFocusable(true);
    dokitRootView.setFocusableInTouchMode(true);
    dokitRootView.requestFocus();
    dokitRootView.setId(R.id.dokit_contentview_id);
    FrameLayout.LayoutParams dokitParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    try {
        //解决由于项目集成SwipeBackLayout而出现的dokit入口不显示
        if (BarUtils.isStatusBarVisible(activity)) {
            dokitParams.topMargin = BarUtils.getStatusBarHeight();
        }
        if (BarUtils.isSupportNavBar()) {
            if (BarUtils.isNavBarVisible(activity)) {
                dokitParams.bottomMargin = BarUtils.getNavBarHeight();
            }
        }
    } catch (Exception e) {
        //e.printStackTrace();
    }
    dokitRootView.setLayoutParams(dokitParams);
    //添加到DecorView中 为了不和用户自己往根布局中添加view干扰
    decorView.addView(dokitRootView);

    return dokitRootView;
}
 
Example 9
Source File: TrashView.java    From FloatingView with Apache License 2.0 4 votes vote down vote up
/**
 * コンストラクタ
 *
 * @param context Context
 */
TrashView(Context context) {
    super(context);
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    mMetrics = new DisplayMetrics();
    mWindowManager.getDefaultDisplay().getMetrics(mMetrics);
    mAnimationHandler = new AnimationHandler(this);
    mIsEnabled = true;

    mParams = new WindowManager.LayoutParams();
    mParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
    mParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
    mParams.type = OVERLAY_TYPE;
    mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
            WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
    mParams.format = PixelFormat.TRANSLUCENT;
    // INFO:Windowの原点のみ左下に設定
    mParams.gravity = Gravity.LEFT | Gravity.BOTTOM;

    // 各種Viewの設定
    // TrashViewに直接貼り付けられるView(このViewを介さないと、削除Viewと背景Viewのレイアウトがなぜか崩れる)
    mRootView = new FrameLayout(context);
    mRootView.setClipChildren(false);
    // 削除アイコンのルートView
    mTrashIconRootView = new FrameLayout(context);
    mTrashIconRootView.setClipChildren(false);
    mFixedTrashIconView = new ImageView(context);
    mActionTrashIconView = new ImageView(context);
    // 背景View
    mBackgroundView = new FrameLayout(context);
    mBackgroundView.setAlpha(0.0f);
    final GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0x00000000, 0x50000000});
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        //noinspection deprecation
        mBackgroundView.setBackgroundDrawable(gradientDrawable);
    } else {
        mBackgroundView.setBackground(gradientDrawable);
    }

    // 背景Viewの貼り付け
    final FrameLayout.LayoutParams backgroundParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (BACKGROUND_HEIGHT * mMetrics.density));
    backgroundParams.gravity = Gravity.BOTTOM;
    mRootView.addView(mBackgroundView, backgroundParams);
    // アクションアイコンの貼り付け
    final FrameLayout.LayoutParams actionTrashIconParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    actionTrashIconParams.gravity = Gravity.CENTER;
    mTrashIconRootView.addView(mActionTrashIconView, actionTrashIconParams);
    // 固定アイコンの貼付け
    final FrameLayout.LayoutParams fixedTrashIconParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    fixedTrashIconParams.gravity = Gravity.CENTER;
    mTrashIconRootView.addView(mFixedTrashIconView, fixedTrashIconParams);
    // 削除アイコンの貼り付け
    final FrameLayout.LayoutParams trashIconParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    trashIconParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
    mRootView.addView(mTrashIconRootView, trashIconParams);

    // TrashViewに貼り付け
    addView(mRootView);

    // 初回描画処理用
    getViewTreeObserver().addOnPreDrawListener(this);
}
 
Example 10
Source File: PullToZoomScrollView.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}
 
Example 11
Source File: SlideOutUnderneathAnimation.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void animate() {
	final ViewGroup parentView = (ViewGroup) view.getParent();
	final FrameLayout slideOutFrame = new FrameLayout(view.getContext());
	final int positionView = parentView.indexOfChild(view);
	slideOutFrame.setLayoutParams(view.getLayoutParams());
	slideOutFrame.setClipChildren(true);
	parentView.removeView(view);
	slideOutFrame.addView(view);
	parentView.addView(slideOutFrame, positionView);

	switch (direction) {
	case DIRECTION_LEFT:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
				view.getTranslationX() - view.getWidth());
		break;
	case DIRECTION_RIGHT:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
				view.getTranslationX() + view.getWidth());
		break;
	case DIRECTION_UP:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
				view.getTranslationY() - view.getHeight());
		break;
	case DIRECTION_DOWN:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
				view.getTranslationY() + view.getHeight());
		break;
	default:
		break;
	}

	AnimatorSet slideSet = new AnimatorSet();
	slideSet.play(slideAnim);
	slideSet.setInterpolator(interpolator);
	slideSet.setDuration(duration);
	slideSet.addListener(new AnimatorListenerAdapter() {

		@Override
		public void onAnimationEnd(Animator animation) {
			view.setVisibility(View.INVISIBLE);
			slideAnim.reverse();
			slideOutFrame.removeAllViews();
			parentView.removeView(slideOutFrame);
			parentView.addView(view, positionView);
			if (getListener() != null) {
				getListener().onAnimationEnd(
						SlideOutUnderneathAnimation.this);
			}
		}
	});
	slideSet.start();
}
 
Example 12
Source File: PullToZoomScrollView.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}
 
Example 13
Source File: SlideOutUnderneathAnimation.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
public void animate() {
	final ViewGroup parentView = (ViewGroup) view.getParent();
	final FrameLayout slideOutFrame = new FrameLayout(view.getContext());
	final int positionView = parentView.indexOfChild(view);
	slideOutFrame.setLayoutParams(view.getLayoutParams());
	slideOutFrame.setClipChildren(true);
	parentView.removeView(view);
	slideOutFrame.addView(view);
	parentView.addView(slideOutFrame, positionView);

	switch (direction) {
	case DIRECTION_LEFT:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
				view.getTranslationX() - view.getWidth());
		break;
	case DIRECTION_RIGHT:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
				view.getTranslationX() + view.getWidth());
		break;
	case DIRECTION_UP:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
				view.getTranslationY() - view.getHeight());
		break;
	case DIRECTION_DOWN:
		slideAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
				view.getTranslationY() + view.getHeight());
		break;
	default:
		break;
	}

	AnimatorSet slideSet = new AnimatorSet();
	slideSet.play(slideAnim);
	slideSet.setInterpolator(interpolator);
	slideSet.setDuration(duration);
	slideSet.addListener(new AnimatorListenerAdapter() {

		@Override
		public void onAnimationEnd(Animator animation) {
			view.setVisibility(View.INVISIBLE);
			slideAnim.reverse();
			slideOutFrame.removeAllViews();
			parentView.removeView(slideOutFrame);
			parentView.addView(view, positionView);
			if (getListener() != null) {
				getListener().onAnimationEnd(
						SlideOutUnderneathAnimation.this);
			}
		}
	});
	slideSet.start();
}
 
Example 14
Source File: PullToZoomScrollView.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void init(AttributeSet attrs) {
    mHeaderContainer = new FrameLayout(getContext());
    mZoomContainer = new FrameLayout(getContext());
    mContentContainer = new FrameLayout(getContext());

    mRootContainer = new LinearLayout(getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);

    if (attrs != null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
        //初始化状态View
        TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PullToZoomScrollView);

        int zoomViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollZoomView, 0);
        if (zoomViewResId > 0) {
            mZoomView = mLayoutInflater.inflate(zoomViewResId, null, false);
            mZoomContainer.addView(mZoomView);
            mHeaderContainer.addView(mZoomContainer);
        }

        int headViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollHeadView, 0);
        if (headViewResId > 0) {
            mHeadView = mLayoutInflater.inflate(headViewResId, null, false);
            mHeaderContainer.addView(mHeadView);
        }
        int contentViewResId = a.getResourceId(R.styleable.PullToZoomScrollView_scrollContentView, 0);
        if (contentViewResId > 0) {
            mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
            mContentContainer.addView(mContentView);
        }

        a.recycle();
    }

    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    ((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    mScreenHeight = localDisplayMetrics.heightPixels;
    mZoomWidth = localDisplayMetrics.widthPixels;
    mScalingRunnable = new ScalingRunnable();

    mRootContainer.addView(mHeaderContainer);
    mRootContainer.addView(mContentContainer);

    mRootContainer.setClipChildren(false);
    mHeaderContainer.setClipChildren(false);

    addView(mRootContainer);
}