android.view.animation.AnimationUtils#loadAnimation()源码实例Demo

下面列出了android.view.animation.AnimationUtils#loadAnimation() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FriendBook   文件: StartActivity.java
private void initDisPlay() {
    tvSkip = findViewById(R.id.tv_skip);
    tvSkip.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            skip();
        }
    });
    View contentView = findViewById(R.id.content_view);
    if (DisplayUtil.hasVirtualNavigationBar(this)) {
        contentView.setPadding(0, 0, 0, DisplayUtil.getNavigationBarHeight(this));
    }
    TextView tvVersionName = findViewById(R.id.tv_version_name);
    tvVersionName.setText(BuildConfig.VERSION_NAME);
    LinearLayout llWelcome = (LinearLayout) findViewById(R.id.ll_welcome);
    TextView tvDate = findViewById(R.id.tv_date);
    SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日,EEEE");
    tvDate.setText(format2.format(new Date()));
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.alpha_in);
    llWelcome.startAnimation(animation);
}
 
源代码2 项目: ToDay   文件: ToDayStateFragment.java
/**
 * Produces animation, sets text to finish
 */
@Override
public void onFinish() {
    if (activityStateFlag.equals(AppConstants.FS_NOTIFICATION_ACTIVE)) {
        mNotifyMgr.notify(
                AppConstants.FLOW_STATE_NOTIFICATION_ID,
                mNotify
                        .setContentText(
                                getString(R.string.fs_task_finish_msg)
                        )
                        .setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS)
                        .build()
        );
    }
    progressBar.setProgress(0);
    Animation fadeInAnimation = AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in);
    timeDisplay.setText(getString(R.string.fs_task_finish_msg));
    timeDisplay.setAnimation(fadeInAnimation);

    TextView notFinished = (TextView) getView().findViewById(R.id.fragment_fe_not_finished);
    notFinished.setVisibility(View.VISIBLE);
    notFinished.startAnimation(fadeInAnimation);
}
 
源代码3 项目: smartcoins-wallet   文件: ReceiveActivity.java
private void updateBlockNumberHead() {
    final Handler handler = new Handler();

    final Activity myActivity = this;

    final Runnable updateTask = new Runnable() {
        @Override
        public void run() {
            if (Application.isConnected()) {
                ivSocketConnected.setImageResource(R.drawable.icon_connecting);
                tvBlockNumberHead.setText(Application.blockHead);
                ivSocketConnected.clearAnimation();
            } else {
                ivSocketConnected.setImageResource(R.drawable.icon_disconnecting);
                Animation myFadeInAnimation = AnimationUtils.loadAnimation(myActivity.getApplicationContext(), R.anim.flash);
                ivSocketConnected.startAnimation(myFadeInAnimation);
            }
            handler.postDelayed(this, 1000);
        }
    };
    handler.postDelayed(updateTask, 1000);
}
 
源代码4 项目: android-fab-animations   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    fab = (FloatingActionButton)findViewById(R.id.fab);
    fab1 = (FloatingActionButton)findViewById(R.id.fab1);
    fab2 = (FloatingActionButton)findViewById(R.id.fab2);
    fab_open = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_open);
    fab_close = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fab_close);
    rotate_forward = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotate_forward);
    rotate_backward = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotate_backward);
    fab.setOnClickListener(this);
    fab1.setOnClickListener(this);
    fab2.setOnClickListener(this);
}
 
源代码5 项目: xDrip-Experimental   文件: AlertList.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_alert_list);
    mContext = getApplicationContext();
    listViewLow = (ListView) findViewById(R.id.listView_low);
    listViewHigh = (ListView) findViewById(R.id.listView_high);
    prefs =  PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    doMgdl = (prefs.getString("units", "mgdl").compareTo("mgdl") == 0);

    addListenerOnButton();
    FillLists();
    anim = AnimationUtils.loadAnimation(this, R.anim.fade_anim);
    listViewLow.setOnItemLongClickListener(new AlertsOnItemLongClickListener());
    listViewHigh.setOnItemLongClickListener(new AlertsOnItemLongClickListener());
}
 
源代码6 项目: SwipeBackFragment   文件: SwipeBackFragment.java
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        boolean isSupportHidden = savedInstanceState.getBoolean(SWIPEBACKFRAGMENT_STATE_SAVE_IS_HIDDEN);

        FragmentTransaction ft = getFragmentManager().beginTransaction();
        if (isSupportHidden) {
            ft.hide(this);
        } else {
            ft.show(this);
        }
        ft.commit();
    }

    mNoAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.no_anim);
    onFragmentCreate();
}
 
源代码7 项目: Aegis   文件: EntryHolder.java
public EntryHolder(final View view) {
    super(view);

    _view = view.findViewById(R.id.rlCardEntry);

    _profileName = view.findViewById(R.id.profile_account_name);
    _profileCode = view.findViewById(R.id.profile_code);
    _profileIssuer = view.findViewById(R.id.profile_issuer);
    _profileCopied = view.findViewById(R.id.profile_copied);
    _description = view.findViewById(R.id.description);
    _profileDrawable = view.findViewById(R.id.ivTextDrawable);
    _buttonRefresh = view.findViewById(R.id.buttonRefresh);
    _selected = view.findViewById(R.id.ivSelected);
    _selectedHandler = new Handler();
    _animationHandler = new Handler();

    _progressBar = view.findViewById(R.id.progressBar);
    int primaryColorId = view.getContext().getResources().getColor(R.color.colorPrimary);
    _progressBar.getProgressDrawable().setColorFilter(primaryColorId, PorterDuff.Mode.SRC_IN);
    _view.setBackground(_view.getContext().getResources().getDrawable(R.color.card_background));

    _scaleIn = AnimationUtils.loadAnimation(view.getContext(), R.anim.item_scale_in);
    _scaleOut = AnimationUtils.loadAnimation(view.getContext(), R.anim.item_scale_out);

    _refresher = new UiRefresher(new UiRefresher.Listener() {
        @Override
        public void onRefresh() {
            if (!_hidden) {
                refreshCode();
            }
        }

        @Override
        public long getMillisTillNextRefresh() {
            return ((TotpInfo) _entry.getInfo()).getMillisTillNextRotation();
        }
    });
}
 
源代码8 项目: shortyz   文件: ShowHideOnScroll.java
private void animate(int anim) {
    if(anim != 0) {
        Animation a = AnimationUtils.loadAnimation(this.view.getContext(), anim);
        a.setAnimationListener(this);
        this.view.startAnimation(a);
        this.setIgnore(true);
    }

}
 
源代码9 项目: mollyim-android   文件: AnimatingToggle.java
public AnimatingToggle(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  this.outAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.animation_toggle_out);
  this.inAnimation  = AnimationUtils.loadAnimation(getContext(), R.anim.animation_toggle_in);
  this.outAnimation.setInterpolator(new FastOutSlowInInterpolator());
  this.inAnimation.setInterpolator(new FastOutSlowInInterpolator());
}
 
源代码10 项目: Alligator   文件: TestSmallFragment.java
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
	if (getParentFragment() != null && (getParentFragment().isDetached() || getParentFragment().isRemoving())) {
		return AnimationUtils.loadAnimation(getContext(), R.anim.stay);
	}
	return super.onCreateAnimation(transit, enter, nextAnim);
}
 
源代码11 项目: BigApp_Discuz_Android   文件: AnimUtils.java
/**
     * 开始动画
     *
     * @param context
     * @param resId
     * @param resAnimId
     */
    public static void startAnim(Context context, int resId, int resAnimId) {
//		Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
//		findViewById(R.id.xxx).startAnimation(shake);

        Animation shake = AnimationUtils.loadAnimation(context, resAnimId);
        ((Activity) context).findViewById(resId).startAnimation(shake);
    }
 
源代码12 项目: Muzesto   文件: SongsListAdapter.java
private void setAnimation(View viewToAnimate, int position) {
    // If the bound view wasn't previously displayed on screen, it's animated
    if (position > lastPosition) {
        Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_in_bottom);
        viewToAnimate.startAnimation(animation);
        lastPosition = position;
    }
}
 
源代码13 项目: Android-PreferencesManager   文件: AppAdapter.java
private void updateEmptyView() {
    if (isEmpty()) {
        if (emptyView.getVisibility() == View.GONE) {
            Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
            if (animation != null) {
                emptyView.startAnimation(animation);
            }
        }
        emptyView.setVisibility(View.VISIBLE);
    } else {
        emptyView.setVisibility(View.GONE);
    }
}
 
源代码14 项目: bcm-android   文件: TransactionAdapter.java
private void setAnimation(View viewToAnimate, int position) {
    if (position > lastPosition) {
        Animation animation = AnimationUtils.loadAnimation(context, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_bottom);
        viewToAnimate.startAnimation(animation);
        lastPosition = position;
    }
}
 
源代码15 项目: a   文件: SimpleBookListDetailActivity.java
@Override
protected void bindView() {


    //设置为垂直的样式
    recycler_view_list.setLayoutManager(new LinearLayoutManager(this));
    //使用的是系统默认的分割线
    //recycler_view_list.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
    //设置适配器
    recycler_view_list.setAdapter(adapter=new SimpleBookListDetailAdapter(this));
    recycler_view_list.setNestedScrollingEnabled(false);
    //设置默认动画
    recycler_view_list.setItemAnimator(new DefaultItemAnimator());

    final Animation animation = AnimationUtils.loadAnimation(this, R.anim.alpha);
    adapter.setOnItemClickListener(new SimpleBookListDetailAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            view.startAnimation(animation);
            // Toast.makeText(mContext, position + " click",
            //        Toast.LENGTH_SHORT).show();

            RecommendBookBean recommendBookBean = adapter.getDataList().get(position);
            Intent intent = new Intent(getContext(), MyMainActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            String key = String.valueOf(System.currentTimeMillis());
            intent.putExtra("recommendBook", recommendBookBean.getTitle());

            startActivityByAnim(intent, android.R.anim.fade_in, android.R.anim.fade_out);

        }
    });
}
 
public AnimationViewBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewBehavior);
    int animationId = a.getResourceId(R.styleable.ViewBehavior_behavior_animation, 0);
    a.recycle();

    if (animationId != 0) {
        mAnimation = AnimationUtils.loadAnimation(context, animationId);
    }
}
 
源代码17 项目: JianDanRxJava   文件: JokeAdapter.java
protected void setAnimation(View viewToAnimate, int position) {
    if (position > lastPosition) {
        Animation animation = AnimationUtils.loadAnimation(viewToAnimate.getContext(), R
                .anim.item_bottom_in);
        viewToAnimate.startAnimation(animation);
        lastPosition = position;
    }
}
 
源代码18 项目: q-municate-android   文件: BaseDialogActivity.java
private void animateCanceling() {
    Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
    bucketView.startAnimation(shake);
}
 
protected PullToRefreshAttacher(Activity activity, Options options) {
	if (options == null) {
		Log.i(LOG_TAG, "Given null options so using default options.");
		options = new Options();
	}

	mRefreshableViews = new WeakHashMap<View, ViewParams>();

	// Copy necessary values from options
	mRefreshScrollDistance = options.refreshScrollDistance;
	mRefreshOnUp = options.refreshOnUp;
	mRefreshMinimizeDelay = options.refreshMinimizeDelay;
	mRefreshMinimize = options.refreshMinimize;

	// EnvironmentDelegate
	mEnvironmentDelegate = options.environmentDelegate != null ? options.environmentDelegate
			: createDefaultEnvironmentDelegate();

	// Header Transformer
	mHeaderTransformer = options.headerTransformer != null ? options.headerTransformer
			: createDefaultHeaderTransformer();

	// Create animations for use later
	mHeaderInAnimation = AnimationUtils.loadAnimation(activity,
			options.headerInAnimation);
	mHeaderOutAnimation = AnimationUtils.loadAnimation(activity,
			options.headerOutAnimation);
	if (mHeaderOutAnimation != null || mHeaderInAnimation != null) {
		final AnimationCallback callback = new AnimationCallback();
		if (mHeaderInAnimation != null)
			mHeaderInAnimation.setAnimationListener(callback);
		if (mHeaderOutAnimation != null)
			mHeaderOutAnimation.setAnimationListener(callback);
	}

	// Get touch slop for use later
	mTouchSlop = ViewConfiguration.get(activity).getScaledTouchSlop();

	// Get Window Decor View
	final ViewGroup decorView = (ViewGroup) activity.getWindow()
			.getDecorView();

	// Check to see if there is already a Attacher view installed
	if (decorView.getChildCount() == 1
			&& decorView.getChildAt(0) instanceof DecorChildLayout) {
		throw new IllegalStateException(
				"View already installed to DecorView. This shouldn't happen.");
	}

	// Create Header view and then add to Decor View
	mHeaderView = LayoutInflater.from(
			mEnvironmentDelegate.getContextForInflater(activity)).inflate(
			options.headerLayout, decorView, false);
	if (mHeaderView == null) {
		throw new IllegalArgumentException(
				"Must supply valid layout id for header.");
	}
	mHeaderView.setVisibility(View.GONE);

	// Create DecorChildLayout which will move all of the system's decor
	// view's children + the
	// Header View to itself. See DecorChildLayout for more info.
	DecorChildLayout decorContents = new DecorChildLayout(activity,
			decorView, mHeaderView);

	// Now add the DecorChildLayout to the decor view
	decorView.addView(decorContents, ViewGroup.LayoutParams.MATCH_PARENT,
			ViewGroup.LayoutParams.MATCH_PARENT);

	// Notify transformer
       mHeaderTransformer.onViewCreated(activity, mHeaderView);
       // TODO Remove the follow deprecated method call before v1.0
	mHeaderTransformer.onViewCreated(mHeaderView);
}
 
源代码20 项目: LogcatViewer   文件: StandOutWindow.java
/**
 * Return the animation to play when the window corresponding to the id is
 * shown.
 * 
 * @param id
 *            The id of the window.
 * @return The animation to play or null.
 */
public Animation getShowAnimation(int id) {
	return AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
}