List of usage examples for android.view.animation AlphaAnimation setRepeatCount
public void setRepeatCount(int repeatCount)
From source file:Main.java
public static AlphaAnimation fadeBackgroundAnimation() { AlphaAnimation alpha = new AlphaAnimation(0.5f, 0.2f); alpha.setRepeatCount(Animation.INFINITE); alpha.setRepeatMode(Animation.REVERSE); alpha.setDuration(1200);/*w w w . jav a 2 s .com*/ alpha.setFillAfter(true); return alpha; }
From source file:Main.java
public static void setAlphaAnimation(View v, int time, int repeatCount, int startOffset) { AlphaAnimation myAnimation_Alpha = new AlphaAnimation(0f, 1.0f); myAnimation_Alpha.setDuration(time); myAnimation_Alpha.setRepeatCount(repeatCount); myAnimation_Alpha.setStartOffset(startOffset); v.setAnimation(myAnimation_Alpha);//from w w w . j av a2 s . c o m }
From source file:Main.java
public static void SetFlickerAnimation(final TextView v, final String info, final String temp) { v.setText(info);//from w ww.j a v a 2s . c om AlphaAnimation anim = new AlphaAnimation(0, 1); anim.setDuration(4000); anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setText(info); } else { v.setText(temp); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:Main.java
public static void SetMenuAnimation(final ImageView v, final int bg1, final int bg2) { v.setImageResource(bg1);// w w w . j a v a2 s .c o m AlphaAnimation anim = new AlphaAnimation(0.8f, 1); anim.setDuration(1000); anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setInterpolator(new AccelerateInterpolator()); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setImageResource(bg1); } else { v.setImageResource(bg2); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:com.carver.paul.truesight.Ui.CounterPicker.CounterPickerFragment.java
/** * Shows the loading text and pulses it. Ensures everything else is hidden *///from www .j av a 2 s . c o m protected void startLoadingAnimation() { mLoadingText.setVisibility(View.VISIBLE); mLoadingText.setAlpha(1f); AlphaAnimation pulseAlphaAnimation = new AlphaAnimation(0.2f, 1f); pulseAlphaAnimation.setDuration(300); pulseAlphaAnimation.setRepeatCount(Animation.INFINITE); pulseAlphaAnimation.setRepeatMode(Animation.REVERSE); mLoadingText.startAnimation(pulseAlphaAnimation); }
From source file:com.actionbarsherlock.sample.styledactionbar.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // TODO handle clicking the app icon/logo return false; case R.id.menu_refresh: // switch to a progress animation item.setActionView(R.layout.indeterminate_progress_action); return true; case R.id.menu_both: // rotation animation of green fragment rotateLeftFrag();// w w w . j av a 2 s . c om case R.id.menu_text: // alpha animation of blue fragment if (IS_HONEYCOMB) { ObjectAnimatorAlpha.invoke(rightFrag.getView()); } else { AlphaAnimation alpha = new AlphaAnimation(1f, 0f); alpha.setRepeatMode(Animation.REVERSE); alpha.setRepeatCount(1); alpha.setDuration(800); rightFrag.getView().startAnimation(alpha); } return true; case R.id.menu_logo: useLogo = !useLogo; item.setChecked(useLogo); getSupportActionBar().setDisplayUseLogoEnabled(useLogo); return true; case R.id.menu_up: showHomeUp = !showHomeUp; item.setChecked(showHomeUp); getSupportActionBar().setDisplayHomeAsUpEnabled(showHomeUp); return true; case R.id.menu_nav_tabs: item.setChecked(true); showTabsNav(); return true; case R.id.menu_nav_label: item.setChecked(true); showStandardNav(); return true; case R.id.menu_nav_drop_down: item.setChecked(true); showDropDownNav(); return true; case R.id.menu_bak_none: item.setChecked(true); getSupportActionBar().setBackgroundDrawable(null); return true; case R.id.menu_bak_gradient: item.setChecked(true); getSupportActionBar() .setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.kunze.androidlocaltodo.TaskActivityFragment.java
@Override public void SwipedWhileDisabled() { AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); animation.setDuration(50);// w w w.j ava 2 s.co m animation.setRepeatCount(5); animation.setRepeatMode(Animation.REVERSE); Button revertButton = (Button) getView().findViewById(R.id.revert_button); Button acceptButton = (Button) getView().findViewById(R.id.accept_button); revertButton.startAnimation(animation); acceptButton.startAnimation(animation); }
From source file:com.pentacog.mctracker.ServerListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { RelativeLayout serverView = null;//from w w w .j a va 2 s . c o m ServerViewHolder holder = null; Server server = serverList.get(position); server.id = position; if (convertView == null) { serverView = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); holder = new ServerViewHolder((int) getItemId(position), serverView); serverView.setTag(holder); } else { serverView = (RelativeLayout) convertView; holder = (ServerViewHolder) serverView.getTag(); holder.id = (int) getItemId(position); } //set server name holder.serverTitle.setText(server.name); //set server IP String serverName = server.address.toString(); if (!serverName.startsWith("/")) { int index = serverName.lastIndexOf('/'); if (index != -1) { String tempString; tempString = serverName.substring(index + 1); serverName = serverName.substring(0, index); serverName += " " + tempString; } } else { serverName = serverName.replace("/", ""); } if (server.port != 25565) serverName += ":" + server.port; holder.serverIp.setText(serverName); //set fav icon if (server.favorite) { holder.favStar.setVisibility(View.VISIBLE); } else { holder.favStar.setVisibility(View.INVISIBLE); } if (!server.queried) { AlphaAnimation a = new AlphaAnimation(1.0f, 0.2f); a.setRepeatCount(Animation.INFINITE); a.setRepeatMode(Animation.REVERSE); a.setDuration(300); holder.statusBar.setBackgroundColor(Color.BLUE); holder.statusBar.startAnimation(a); // holder.loading.setVisibility(View.VISIBLE); holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers); holder.serverData.setText(R.string.loading); holder.playerCount.setVisibility(View.INVISIBLE); holder.ping.setVisibility(View.INVISIBLE); new ServerViewUpdater(serverView, server); } else { setupServerCell(server, holder); } return serverView; }
From source file:com.duy.pascal.ui.debug.activities.DebugActivity.java
@WorkerThread private void showPopupAt(final LineNumber lineNumber, final String msg) { mHandler.post(new Runnable() { @Override// w w w .ja v a2s . co m public void run() { if (isFinishing()) return; //get relative position of expression at edittext Point position = mCodeView.getDebugPosition(lineNumber.getLine(), lineNumber.getColumn(), Gravity.TOP); DLog.d(TAG, "generate: " + position); dismissPopup(); //create new popup PopupWindow window = new PopupWindow(DebugActivity.this); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View container = inflater.inflate(R.layout.popup_expr_result, null); container.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); int windowHeight = container.getMeasuredHeight(); int windowWidth = container.getMeasuredWidth(); window.setContentView(container); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); window.setTouchable(true); window.setSplitTouchEnabled(true); window.setOutsideTouchable(true); window.showAtLocation(mCodeView, Gravity.NO_GRAVITY, position.x - windowWidth / 3, position.y + toolbar.getHeight() - windowHeight); TextView txtResult = container.findViewById(R.id.txt_result); txtResult.setText(msg); AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.5f); alphaAnimation.setDuration(1000); alphaAnimation.setRepeatMode(Animation.REVERSE); alphaAnimation.setRepeatCount(Animation.INFINITE); txtResult.startAnimation(alphaAnimation); DebugActivity.this.mPopupWindow = window; } }); }