List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:com.andryr.musicplayer.MainActivity.java
private void updateTrackInfo() { View trackInfoLayout = findViewById(R.id.track_info); if (mPlaybackService != null && mPlaybackService.hasPlaylist()) { if (trackInfoLayout.getVisibility() != View.VISIBLE) { trackInfoLayout.setVisibility(View.VISIBLE); trackInfoLayout// w w w . j a v a 2 s. com .startAnimation(AnimationUtils.loadAnimation(this, R.anim.abc_grow_fade_in_from_bottom)); } String title = mPlaybackService.getSongTitle(); String artist = mPlaybackService.getArtistName(); if (title != null) { ((TextView) findViewById(R.id.song_title)).setText(title); } if (artist != null) { ((TextView) findViewById(R.id.song_artist)).setText(artist); } long albumId = mPlaybackService.getAlbumId(); final ImageView minArtworkView = (ImageView) findViewById(R.id.artwork_min); ArtworkCache.getInstance().loadBitmap(albumId, minArtworkView, mThumbSize, mThumbSize); int duration = mPlaybackService.getTrackDuration(); if (duration != -1) { mProgressBar.setMax(duration); updateProgressBar(); } } else { trackInfoLayout.setVisibility(View.GONE); } }
From source file:com.dvn.vindecoder.ui.seller.AddVehicalAndPayment.java
private void setScrollContent() { final CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById( R.id.collapsing_toolbar);/*from w ww . j av a 2s . c o m*/ AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout); final RelativeLayout img_container1 = (RelativeLayout) findViewById(R.id.img_container1); // load the animation final Animation animFadein = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fadein); // start the animation // set animation listener animFadein.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { /* if(img_container1.getVisibility() == View.VISIBLE) { img_container1.setVisibility(View.GONE); }*/ } @Override public void onAnimationRepeat(Animation animation) { } }); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { boolean isShow = false; int scrollRange = -1; @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (scrollRange == -1) { scrollRange = appBarLayout.getTotalScrollRange(); // Log.e("val","-1 choti imge ko hide kerna h"); img_container1.setVisibility(View.GONE); } if (scrollRange + verticalOffset == 0) { // collapsingToolbarLayout.setTitle("Title"); // Log.e("val","0 choti imge ko show kerna h"); img_container1.setVisibility(View.VISIBLE); img_container1.startAnimation(animFadein); isShow = true; } else if (isShow) { // collapsingToolbarLayout.setTitle(" ");//carefull there should a space between double quote otherwise it wont work //Log.e("val","Showing choti imge ko hide kerna h"); img_container1.setVisibility(View.GONE); isShow = false; } } }); }
From source file:com.app.blockydemo.ui.adapter.BrickAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (draggedBrick != null && dragTargetPosition == position) { return insertionView; }/*w w w.j a va2 s . c o m*/ listItemCount = position + 1; Object item = getItem(position); if (item instanceof ScriptBrick && (!initInsertedBrick || position != positionOfInsertedBrick)) { View scriptBrickView = ((Brick) item).getView(context, position, this); if (draggedBrick == null) { scriptBrickView.setOnClickListener(this); } return scriptBrickView; } View currentBrickView; // dirty HACK // without the footer, position can be 0, and list.get(-1) caused an Indexoutofboundsexception // no clean solution was found if (position == 0) { if (item instanceof AllowedAfterDeadEndBrick && brickList.get(position) instanceof DeadEndBrick) { currentBrickView = ((AllowedAfterDeadEndBrick) item).getNoPuzzleView(context, position, this); } else { currentBrickView = ((Brick) item).getView(context, position, this); } } else { if (item instanceof AllowedAfterDeadEndBrick && brickList.get(position - 1) instanceof DeadEndBrick) { currentBrickView = ((AllowedAfterDeadEndBrick) item).getNoPuzzleView(context, position, this); } else { currentBrickView = ((Brick) item).getView(context, position, this); } } // this one is working but causes null pointer exceptions on movement and control bricks?! // currentBrickView.setOnLongClickListener(longClickListener); // Hack!!! // if wrapper isn't used the longClick event won't be triggered ViewGroup wrapper = (ViewGroup) View.inflate(context, R.layout.brick_wrapper, null); if (currentBrickView.getParent() != null) { ((ViewGroup) currentBrickView.getParent()).removeView(currentBrickView); } wrapper.addView(currentBrickView); if (draggedBrick == null) { if ((selectMode == ListView.CHOICE_MODE_NONE)) { wrapper.setOnClickListener(this); if (!(item instanceof DeadEndBrick)) { wrapper.setOnLongClickListener(dragAndDropListView); } } } if (position == positionOfInsertedBrick && initInsertedBrick && (selectMode == ListView.CHOICE_MODE_NONE)) { initInsertedBrick = false; addingNewBrick = true; dragAndDropListView.setInsertedBrick(position); dragAndDropListView.setDraggingNewBrick(); dragAndDropListView.onLongClick(currentBrickView); return insertionView; } if (animatedBricks.contains(brickList.get(position))) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.blink); wrapper.startAnimation(animation); animatedBricks.remove(brickList.get(position)); } return wrapper; }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) { final int features = mFeatures;//getLocalFeatures(); Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out); anim.setDuration(1000);//from w w w . j a va2s .com if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 && spinnyProgressBar.getVisibility() == View.VISIBLE) { spinnyProgressBar.startAnimation(anim); spinnyProgressBar.setVisibility(View.INVISIBLE); } if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 && horizontalProgressBar.getVisibility() == View.VISIBLE) { horizontalProgressBar.startAnimation(anim); horizontalProgressBar.setVisibility(View.INVISIBLE); } }
From source file:com.brandao.tictactoe.board.BoardFragment.java
public void animateHintSquare(final int index) { final Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out); fadeOut.setAnimationListener(new AnimationListener() { @Override// ww w .j a va2s . co m public void onAnimationEnd(Animation animation) { mAnimating = false; mScreens[index].setBackgroundResource(R.drawable.transparent_image); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationStart(Animation animation) { mAnimating = true; } }); Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in); fadeIn.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mAnimating = false; mScreens[index].startAnimation(fadeOut); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationStart(Animation animation) { mAnimating = true; if (mGameState == C.STATE_PLAYER_ONE_TURN) { mScreens[index].setBackgroundResource(R.drawable.ic_green_x_android); } else { if (mGameState == C.STATE_PLAYER_TWO_TURN) { mScreens[index].setBackgroundResource(R.drawable.ic_red_o_android); } } } }); mScreens[index].startAnimation(fadeIn); }
From source file:com.huofu.RestaurantOS.ui.splash.activate.java
/** * ?/* www. java 2s .co m*/ */ public void showLoadingDialog(String text) { LayoutInflater inflater = (LayoutInflater) ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View grid = inflater.inflate(R.layout.loading_layout, null); TextView tv = (TextView) grid.findViewById(R.id.textview_loading_content); tv.setText(text); ImageView iv = (ImageView) grid.findViewById(R.id.imageview_loading_pic); iv.startAnimation(AnimationUtils.loadAnimation(ctxt, R.anim.rotate_loading)); int width = CommonUtils.getScreenWidth(ctxt); int height = CommonUtils.getScreenHeight(ctxt); if (dialog_loading == null) { dialog_loading = new PopupWindow(grid, width, height, true); } else { dialog_loading.setContentView(grid); } dialog_loading.setFocusable(true); dialog_loading.setOutsideTouchable(true); dialog_loading.setAnimationStyle(R.style.AutoDialogAnimation); dialog_loading.setBackgroundDrawable(new BitmapDrawable()); if (hasFocus) { dialog_loading.showAtLocation(rl_activate, Gravity.NO_GRAVITY, 0, 0); } }
From source file:android.support.v7.app.ActionBarImplCompatBase.java
public void doShow(boolean fromSystem) { mTopVisibilityView.clearAnimation(); if (mTopVisibilityView.getVisibility() == View.VISIBLE) { return;// w ww . j av a 2s.c o m } final boolean animate = isShowHideAnimationEnabled() || fromSystem; if (animate) { Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_in_top); mTopVisibilityView.startAnimation(anim); } mTopVisibilityView.setVisibility(View.VISIBLE); if (mSplitView != null && mSplitView.getVisibility() != View.VISIBLE) { if (animate) { Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_in_bottom); mSplitView.startAnimation(anim); } mSplitView.setVisibility(View.VISIBLE); } }
From source file:android.support.v7.app.ActionBarImplBase.java
public void doShow(boolean fromSystem) { mTopVisibilityView.clearAnimation(); if (mTopVisibilityView.getVisibility() == View.VISIBLE) { return;//from w ww. ja v a 2s.c o m } final boolean animate = isShowHideAnimationEnabled() || fromSystem; if (animate) { Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_top); mTopVisibilityView.startAnimation(anim); } mTopVisibilityView.setVisibility(View.VISIBLE); if (mSplitView != null && mSplitView.getVisibility() != View.VISIBLE) { if (animate) { Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_bottom); mSplitView.startAnimation(anim); } mSplitView.setVisibility(View.VISIBLE); } }
From source file:com.forrestguice.suntimeswidget.SuntimesActivity.java
/** * initialize view animations/*from w w w .ja v a2 s . c o m*/ * @param context a context used to access resources */ private void initAnimations(Context context) { anim_note_inPrev = AnimationUtils.loadAnimation(this, R.anim.fade_in); anim_note_inNext = AnimationUtils.loadAnimation(this, R.anim.fade_in); anim_note_outPrev = AnimationUtils.loadAnimation(this, R.anim.fade_out); anim_note_outNext = AnimationUtils.loadAnimation(this, R.anim.fade_out); //anim_note_outPrev = AnimationUtils.loadAnimation(this, R.anim.slide_out_right); //anim_note_outNext = AnimationUtils.loadAnimation(this, R.anim.slide_out_left); anim_card_inPrev = AnimationUtils.loadAnimation(this, R.anim.fade_in); anim_card_inNext = AnimationUtils.loadAnimation(this, R.anim.fade_in); anim_card_outPrev = AnimationUtils.loadAnimation(this, (isRtl ? R.anim.slide_out_left : R.anim.slide_out_right)); anim_card_outNext = AnimationUtils.loadAnimation(this, (isRtl ? R.anim.slide_out_right : R.anim.slide_out_left)); }
From source file:com.chuhan.privatecalc.fragment.os.FragmentManager.java
Animation loadAnimation(Fragment fragment, int transit, boolean enter, int transitionStyle) { Animation animObj = fragment.onCreateAnimation(transit, enter, fragment.mNextAnim); if (animObj != null) { return animObj; }/*from ww w . j av a 2 s . c om*/ if (fragment.mNextAnim != 0) { Animation anim = AnimationUtils.loadAnimation(mActivity, fragment.mNextAnim); if (anim != null) { return anim; } } if (transit == 0) { return null; } int styleIndex = transitToStyleIndex(transit, enter); if (styleIndex < 0) { return null; } switch (styleIndex) { case ANIM_STYLE_OPEN_ENTER: return makeOpenCloseAnimation(mActivity, 1.125f, 1.0f, 0, 1); case ANIM_STYLE_OPEN_EXIT: return makeOpenCloseAnimation(mActivity, 1.0f, .975f, 1, 0); case ANIM_STYLE_CLOSE_ENTER: return makeOpenCloseAnimation(mActivity, .975f, 1.0f, 0, 1); case ANIM_STYLE_CLOSE_EXIT: return makeOpenCloseAnimation(mActivity, 1.0f, 1.075f, 1, 0); case ANIM_STYLE_FADE_ENTER: return makeFadeAnimation(mActivity, 0, 1); case ANIM_STYLE_FADE_EXIT: return makeFadeAnimation(mActivity, 1, 0); } if (transitionStyle == 0 && mActivity.getWindow() != null) { transitionStyle = mActivity.getWindow().getAttributes().windowAnimations; } if (transitionStyle == 0) { return null; } //TypedArray attrs = mActivity.obtainStyledAttributes(transitionStyle, // com.android.internal.R.styleable.FragmentAnimation); //int anim = attrs.getResourceId(styleIndex, 0); //attrs.recycle(); //if (anim == 0) { // return null; //} //return AnimatorInflater.loadAnimator(mActivity, anim); return null; }