List of usage examples for android.widget TextView startAnimation
public void startAnimation(Animation animation)
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/* ww w. j av a 2s . com*/ 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; } }); }
From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java
public void setSatelliteCount(int count) { ImageView imgSatelliteCount = (ImageView) rootView.findViewById(R.id.simpleview_imgSatelliteCount); TextView txtSatelliteCount = (TextView) rootView.findViewById(R.id.simpleview_txtSatelliteCount); if (count > -1) { setColor(imgSatelliteCount, IconColorIndicator.Good); AlphaAnimation fadeIn = new AlphaAnimation(0.6f, 1.0f); fadeIn.setDuration(1200);/*from w w w . ja v a 2 s. c om*/ fadeIn.setFillAfter(true); txtSatelliteCount.startAnimation(fadeIn); txtSatelliteCount.setText(String.valueOf(count)); } else { clearColor(imgSatelliteCount); txtSatelliteCount.setText(""); } }
From source file:org.secuso.privacyfriendlydicegame.MainActivity.java
public void hints(int position) { TextView hint = (TextView) findViewById(R.id.initialTextView); TextView initialText = (TextView) findViewById(R.id.initialTextTextView); TextView hint2 = (TextView) findViewById(R.id.initialTextView2); ImageView background = (ImageView) findViewById(R.id.backgroundImageView); Animation anim = new AlphaAnimation(0.0f, 1.0f); if (position == 0) { hint.setVisibility(View.VISIBLE); hint2.setVisibility(View.VISIBLE); background.setVisibility(View.VISIBLE); initialText.setVisibility(View.VISIBLE); anim.setDuration(1000);/*w w w. j av a 2 s . c o m*/ anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); hint.startAnimation(anim); hint2.startAnimation(anim); } else { hint.clearAnimation(); hint2.clearAnimation(); hint.setVisibility(View.INVISIBLE); hint2.setVisibility(View.INVISIBLE); background.setVisibility(View.INVISIBLE); initialText.setVisibility(View.INVISIBLE); } }
From source file:net.olejon.mdapp.MainActivity.java
public void onDrawerItemClick(View view) { mDrawerClosed = view.getId();/*from w w w .j a va 2 s .co m*/ if (mDrawerClosed == R.id.drawer_item_encyclopedias) { TextView brukerhandbokenTextView = (TextView) findViewById(R.id.drawer_item_brukerhandboken); TextView analyseoversiktenTextView = (TextView) findViewById(R.id.drawer_item_analyseoversikten); TextView upToDateTextView = (TextView) findViewById(R.id.drawer_item_uptodate); TextView bmjTextView = (TextView) findViewById(R.id.drawer_item_bmj); TextView encyclopediasTextView = (TextView) findViewById(R.id.drawer_item_encyclopedias); encyclopediasTextView.setVisibility(View.GONE); Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.drawer_item); brukerhandbokenTextView.startAnimation(animation); analyseoversiktenTextView.startAnimation(animation); upToDateTextView.startAnimation(animation); bmjTextView.startAnimation(animation); brukerhandbokenTextView.setVisibility(View.VISIBLE); analyseoversiktenTextView.setVisibility(View.VISIBLE); upToDateTextView.setVisibility(View.VISIBLE); bmjTextView.setVisibility(View.VISIBLE); } else { mDrawerLayout.closeDrawers(); } }
From source file:org.nla.tarotdroid.lib.ui.GameReadFragment.java
/** * Displays game index in game set and then smoothly removes the text. *///from ww w . j a v a 2 s . c o m private void smoothlyHideText() { final TextView onTop = (TextView) this.frameLayout.findViewById(R.id.txtOnTop); onTop.setText(this.game.getIndex() + "/" + this.game.getHighestGameIndex()); Animation animation1 = new AlphaAnimation(1.0f, 0.0f); animation1.setDuration(1500); //animation1 AnimationListener animation1.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { // start animation2 when animation1 ends (continue) onTop.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationStart(Animation arg0) { } }); onTop.startAnimation(animation1); }
From source file:com.example.testtab.fragment.TwitEyesPageFragment.java
public void showProgressBar(int percent) { TextView textLayer = (TextView) this.mRootView.findViewById(R.id.progress_bar); AnimationSet set = new AnimationSet(true); // ALPHA//from w ww .j a va2s . c o m AlphaAnimation alpha; switch (percent) { case 100: alpha = new AlphaAnimation(1.0f, 0.0f); break; case 0: alpha = new AlphaAnimation(0.0f, 1.0f); break; default: alpha = new AlphaAnimation(0.8f, 1.0f); } alpha.setDuration(500); TranslateAnimation translate; float toX = ((float) percent - 100.0f) / 100.0f; float fromX = toX - 0.1f; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); translate.setDuration(500); translate.setInterpolator(new BounceInterpolator()); set.addAnimation(alpha); set.addAnimation(translate); // set.setDuration(500); set.setFillBefore(true); set.setFillAfter(true); textLayer.startAnimation(set); }
From source file:kiv.janecekz.ma.ToneFragment.java
@Override public void onClick(View arg0) { TextView v = (TextView) arg0; if (v.getId() == R.id.sharp) { sharp = !sharp;/*from ww w .j a v a 2 s .c o m*/ int pos = 9; if (actualFreqView != null && !sharp) { pos = getTone(actualFreqView.getId()).getTonePos(); v.setTextColor(getView().getResources().getColor(R.color.blue)); } else if (actualFreqView != null && sharp) { // FIXME: Use only one method to get pos. pos = (getTone(actualFreqView.getId()).getTonePos() + 1) % 12; v.setTextColor(Color.RED); } else if (actualFreqView == null && sharp) { v.setTextColor(Color.RED); } else if (actualFreqView == null && !sharp) { v.setTextColor(getView().getResources().getColor(R.color.blue)); } int baseFreq = SharedPref.getBaseFreq(getActivity()); float freq = baseFreq * Tones.freqCoefs[pos]; input.setText(String.format("%.2f", freq)); pl.setFreq(freq); } else { if (actualFreqView != null) { actualFreqView.setTextColor(getView().getResources().getColor(R.color.blue)); } actualFreqView = v; // Set frequency coefficient accordingly. int freqCoefPosition = getTone(v.getId()).getTonePos(); freqCoefPosition = sharp ? (freqCoefPosition + 1) % 12 : freqCoefPosition; int baseFreq = SharedPref.getBaseFreq(getActivity()); float freq = baseFreq * Tones.freqCoefs[freqCoefPosition]; input.setText(String.format("%.2f", freq)); pl.setFreq(freq); if (!pl.isPlay()) { pl.togglePlay(); } v.setTextColor(Color.RED); } AnimationSet push = (AnimationSet) AnimationUtils.loadAnimation(v.getContext(), R.anim.push); v.startAnimation(push); }
From source file:com.koushikdutta.superuser.FragmentIntro.java
@Nullable @Override/*ww w . j av a 2 s . c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View parent = inflater.inflate(layoutResId, container, false); if (layoutResId != R.layout.fragment_intro_0) return parent; final ImageView superuser = (ImageView) parent.findViewById(R.id.superuser); final ImageView background = (ImageView) parent.findViewById(R.id.superuser_back); final TextView title = (TextView) parent.findViewById(R.id.title); final TextView desc = (TextView) parent.findViewById(R.id.tour); final Animation fadeIn, zoomIn; fadeIn = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); zoomIn = AnimationUtils.loadAnimation(getContext(), R.anim.zoom_in); fadeIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { background.startAnimation(zoomIn); background.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); zoomIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Animation fadeIn2 = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); fadeIn2.setDuration(1000); fadeIn2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { Animation fadeIn3 = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); fadeIn3.setDuration(400); fadeIn3.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { ((ActivityIntro) getActivity()).setProgressButtonEnabled(true); } @Override public void onAnimationRepeat(Animation animation) { } }); desc.startAnimation(fadeIn3); desc.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); title.startAnimation(fadeIn2); title.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); new Handler().postDelayed(new Runnable() { @Override public void run() { superuser.startAnimation(fadeIn); superuser.setVisibility(View.VISIBLE); } }, 600); return parent; }
From source file:com.numix.calculator.EventListener.java
private void deleteAnimation(View view) { final TextView colorLayout = (TextView) view.getRootView().findViewById(R.id.deleteColor); final LinearLayout displayView = (LinearLayout) view.getRootView().findViewById(R.id.displayLayout); final CalculatorDisplay calculatorDisplay = (CalculatorDisplay) view.getRootView() .findViewById(R.id.display); int finalRadius = Math.max(displayView.getWidth(), displayView.getHeight()); // create the animator for this view (the start radius is zero) Animator colorAnim;/*from w ww . ja va2s .c o m*/ colorAnim = ViewAnimationUtils.createCircularReveal(colorLayout, (int) displayView.getRight(), (int) displayView.getBottom(), 0, finalRadius); final AlphaAnimation fadeAnim = new AlphaAnimation(1.0f, 0.0f); final AlphaAnimation fadeDisplay = new AlphaAnimation(1.0f, 0.0f); fadeAnim.setDuration(250); fadeAnim.setInterpolator(new AccelerateInterpolator()); fadeAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { colorLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); fadeDisplay.setDuration(250); fadeDisplay.setInterpolator(new AccelerateInterpolator()); fadeDisplay.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mHandler.onClear(); displayView.setAlpha(1.0f); } @Override public void onAnimationRepeat(Animation animation) { } }); colorAnim.setInterpolator(new AccelerateInterpolator()); colorAnim.addListener(new android.animation.Animator.AnimatorListener() { @Override public void onAnimationStart(android.animation.Animator animation) { calculatorDisplay.startAnimation(fadeDisplay); } @Override public void onAnimationRepeat(android.animation.Animator animation) { } @Override public void onAnimationEnd(android.animation.Animator animation) { colorLayout.startAnimation(fadeAnim); } @Override public void onAnimationCancel(android.animation.Animator animation) { } }); colorLayout.setVisibility(View.VISIBLE); colorAnim.start(); }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.TimeLineActivity.java
/** * On click image view to start stop recording * /* w w w . j a va 2 s. c o m*/ * Records time SYNCHRONOUSLY * * @param v */ public void onClickSwitchAction(View v) { Drawable drwStart = getResources().getDrawable(R.drawable.play); Drawable drwStop = getResources().getDrawable(R.drawable.stop); LinearLayout lllFrag = (LinearLayout) v.getParent(); LinearLayout llTimePicker = (LinearLayout) lllFrag.findViewById(R.id.llTimePicker); LinearLayout llStatus = (LinearLayout) lllFrag.findViewById(R.id.llStatus); TextView tvRecording = (TextView) llStatus.findViewById(R.id.tvRecording); ImageView ivRecording = (ImageView) llStatus.findViewById(R.id.ivRecording); Animation anim = new AlphaAnimation(0.0f, 1.0f); Log.d(CLASSNAME, "BEFORE: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); ImageView iv = (ImageView) v; int currentStatus = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).getStatus(); if (currentStatus == ActivitySession.STATUS_STOPPED) { Log.d(CLASSNAME, "Status is STOPPED. Shift to STARTED"); iv.setImageDrawable(drwStop); llTimePicker.setVisibility(View.INVISIBLE); anim.setDuration(500); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckIn(); } else { Log.d(CLASSNAME, "Status is STARTED. Shift to STOPPED"); iv.setImageDrawable(drwStart); llTimePicker.setVisibility(View.VISIBLE); anim.setRepeatCount(0); ActivitySession as = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()); String sSubjectId = as.getId_subject(); double dLat = as.getLocation_latitude(); double dLong = as.getLocation_longitude(); long lCheckOut = new Date().getTime(); long lCheckIn = Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).doCheckOut(); // Save data into both databases DateUtils du = new DateUtils(); Log.i(CLASSNAME, "Recording activity into both databasees:" + as.getId_subject() + " / " + du.duration(lCheckIn, lCheckOut)); // TODO make some control here to make this transactional // Save in backend recordActivityBackend(sSubjectId, lCheckIn, lCheckOut, dLat, dLong, ActivityDO.ACTIVITY_RECORD_MODE_SYNCHRONOUS); // Save in local database recordActivitySQLite(sSubjectId, lCheckIn, lCheckOut, dLat, dLong); TextView tvDuration = (TextView) lllFrag.findViewById(R.id.tvDuration); tvDuration.setText( du.duration(Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sSubjectId))); Toast.makeText(getApplicationContext(), "Recorded " + du.duration(lCheckIn, lCheckOut), Toast.LENGTH_SHORT).show(); // // Update history layout // LayoutInflater inflater = LayoutInflater.from(this); LinearLayout llParent = (LinearLayout) inflater.inflate(R.layout.check_item, null); LinearLayout liContent = (LinearLayout) llParent.getChildAt(0); // ImageView ivParent = (ImageView) liContent.findViewById(R.id.imageViewStart); // ivParent.setImageResource(R.drawable.rec_50x); //TextView tvTimeStamp = (TextView) liContent.getChildAt(1); TextView tvTimeStamp = (TextView) liContent.findViewById(R.id.textViewTimeStamp); tvTimeStamp.setText(Constants.TIME_FORMAT.format(lCheckIn)); tvTimeStamp.setTag(Long.valueOf(lCheckIn)); TextView tvDurRecord = (TextView) liContent.findViewById(R.id.textViewDuration); tvDurRecord.setText(" [" + du.duration(lCheckIn, lCheckOut) + "]"); // Passing subject id as parameter tvDurRecord.setTag(sSubjectId); LinearLayout llHistory = (LinearLayout) lllFrag.findViewById(R.id.llHistory); // Set index number so that the record can be removed int iTag = (llHistory.getChildCount() - 1) / 2; llParent.setTag(iTag); llHistory.addView(inflater.inflate(R.layout.tag_divider, llHistory, false), 1); llHistory.addView(llParent, 2); } tvRecording.startAnimation(anim); ivRecording.startAnimation(anim); Log.d(CLASSNAME, "AFTER: " + Session.getSingleInstance().getActivity(mViewPager.getCurrentItem()).toString()); }