Java Code Examples for android.widget.ViewAnimator#setInAnimation()

The following examples show how to use android.widget.ViewAnimator#setInAnimation() . 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: BookActivity.java    From AnimationApiDemos with Apache License 2.0 6 votes vote down vote up
private void useCodeAnimation(ViewAnimator pages) {
	// 用代码定义一个动画
	AnimationSet slideAnimationSet = new AnimationSet(true);

	// 平移动画
	TranslateAnimation slide = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT, 1f, Animation.RELATIVE_TO_PARENT,
			0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);

	// 缩放动画
	ScaleAnimation scale = new ScaleAnimation(10, 1, 10, 1);
	// 把平移和缩放动画加入动画集合
	slideAnimationSet.addAnimation(slide);
	slideAnimationSet.addAnimation(scale);

	// 持续时间设置为1000ms
	slideAnimationSet.setDuration(1000);

	// 设置动画
	pages.setInAnimation(slideAnimationSet);
}
 
Example 2
Source File: AccountActivity.java    From UPMiss with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account);

    mTxtWhether = (TextView) findViewById(R.id.account_txt_whether);
    mTxtTitle = (TextView) findViewById(R.id.account_txt_title);
    mViewAnimator = (ViewAnimator) findViewById(R.id.account_output);
    mEditLoginEmail = (EditText) findViewById(R.id.account_edit_login_email);
    mEditLoginPassword = (EditText) findViewById(R.id.account_edit_login_password);
    mEditRegisterPasswordConfirm = (EditText) findViewById(R.id.account_edit_register_password_confirm);
    mEditRegisterPassword = (EditText) findViewById(R.id.account_edit_register_password);
    mEditRegisterEmail = (EditText) findViewById(R.id.account_edit_register_email);
    mBtnSubmit = (Button) findViewById(R.id.account_btn_submit);
    mBtnChange = (Button) findViewById(R.id.account_btn_change);
    mLoading = (Loading) findViewById(R.id.loading);

    mViewAnimator.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
            R.anim.anim_in_slide_right));
    mViewAnimator.setOutAnimation(AnimationUtils.loadAnimation(getApplicationContext(),
            R.anim.anim_out_slide_left));

    mBtnSubmit.setOnClickListener(this);
    mBtnChange.setOnClickListener(this);

    mRegisterPresenter = new AccountRegisterPresenterAccount(this);
    mAccountLoginPresenter = mRegisterPresenter;
}
 
Example 3
Source File: BaseRunnerFragment.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Creates the base view of this object.
 */
public void createView() {
    Log.i(TAG, "createView()");
    if (mProcedure == null)
        return;
    getActivity().setTitle(mProcedure.getTitle());
    View procedureView = wrapViewWithInterface(mProcedure.toView(getActivity()));

    // Now that the view is active, go to the correct page.
    if (mProcedure.getCurrentIndex() != startPage) {
        mProcedure.jumpToPage(startPage);
        updateNextPrev();
    }

    baseViews = new ViewAnimator(getActivity());
    baseViews.setBackgroundResource(android.R.drawable.alert_dark_frame);
    baseViews.setInAnimation(AnimationUtils.loadAnimation(getActivity(),
            R.anim.slide_from_right));
    baseViews
            .setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.slide_to_left));
    baseViews.addView(procedureView);

    // This should add it to baseViews, so don't add it manually.
    if (isShowCompleteConfirmation()) {
        View procedureDonePage = getActivity().getLayoutInflater().inflate(
                R.layout.procedure_runner_done, baseViews);
        ((TextView) procedureDonePage.findViewById(R.id.procedure_done_text)).setTextAppearance(
                getActivity(), android.R.style.TextAppearance_Large);
        procedureDonePage.findViewById(R.id.procedure_done_back).setOnClickListener(this);
        procedureDonePage.findViewById(R.id.procedure_done_upload).setOnClickListener(this);
    }
    if (onDonePage) {
        baseViews.setInAnimation(null);
        baseViews.setOutAnimation(null);
        baseViews.showNext();
        baseViews.setInAnimation(AnimationUtils.loadAnimation(getActivity(),
                R.anim.slide_from_right));
        baseViews.setOutAnimation(AnimationUtils.loadAnimation(getActivity(),
                R.anim.slide_to_left));
    }

    setContentView(baseViews);
    getActivity().setProgressBarVisibility(true);
    getActivity().setProgress(0);
}