List of usage examples for android.view.animation AnimationSet setFillBefore
@Override public void setFillBefore(boolean fillBefore)
From source file:com.fabernovel.alertevoirie.HomeActivity.java
@Override public void onRequestcompleted(int requestCode, Object result) { try {// ww w. j a v a 2 s.co m JSONArray responses; //Log.d(Constants.PROJECT_TAG, (String) result); responses = new JSONArray((String) result); JSONObject response = responses.getJSONObject(0); final AnimationSet set = new AnimationSet(false); final float centerX = findViewById(R.id.LinearLayout02).getWidth() / 2; final float centerY = findViewById(R.id.LinearLayout02).getHeight() / 2; final Flip3dAnimation animation = new Flip3dAnimation(0, 360, centerX, centerY); animation.setDuration(500); set.setFillAfter(true); set.setFillBefore(true); animation.setInterpolator(new AccelerateInterpolator()); set.addAnimation(animation); if (requestCode == AVService.REQUEST_JSON) { if (JsonData.VALUE_REQUEST_GET_INCIDENTS_STATS.equals(response.getString(JsonData.PARAM_REQUEST))) { Last_Location.Incidents = response.getJSONObject(JsonData.PARAM_ANSWER); int resolved_incidents = response.getJSONObject(JsonData.PARAM_ANSWER) .getInt(JsonData.PARAM_RESOLVED_INCIDENTS); int ongoing_incidents = response.getJSONObject(JsonData.PARAM_ANSWER) .getInt(JsonData.PARAM_ONGOING_INCIDENTS); int updated_incidents = response.getJSONObject(JsonData.PARAM_ANSWER) .getInt(JsonData.PARAM_UPDATED_INCIDENTS); ((TextView) findViewById(R.id.Home_TextView_Solved)).setText(getResources().getQuantityString( R.plurals.home_label_solved, resolved_incidents, resolved_incidents)); ((TextView) findViewById(R.id.Home_TextView_Current)).setText(getResources() .getQuantityString(R.plurals.home_label_current, ongoing_incidents, ongoing_incidents)); ((TextView) findViewById(R.id.Home_TextView_Update)).setText(getResources() .getQuantityString(R.plurals.home_label_update, updated_incidents, updated_incidents)); } } findViewById(R.id.LinearLayout02).startAnimation(set); findViewById(R.id.LinearLayout04).startAnimation(set); findViewById(R.id.LinearLayout03).startAnimation(set); } catch (JSONException e) { Log.e(Constants.PROJECT_TAG, "JSONException", e); } catch (ClassCastException e) { Log.e(Constants.PROJECT_TAG, "Invalid result. Trying to cast " + result.getClass() + "into String", e); } finally { if (hidedialog) dismissDialog(DIALOG_PROGRESS); dialog_shown = false; } }
From source file:com.example.fragment.ScreenSlidePageFragment.java
public void startAnimation() { // SELECT LAYER ScrollView relate = (ScrollView) mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/*w ww .j a v a 2 s . co m*/ float toX = -8.0f / 100.0f;//0.0f; float fromX = 0.0f;//-8.0f / 100.0f; float toY = 0.0f; float fromY = 29.0f / 100.0f; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(2000); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.wenwen.chatuidemo.activity.NewFragment.java
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { AnimationSet _AnimationSet = new AnimationSet(true); TranslateAnimation _TranslateAnimation; if (checkedId == R.id.btn1) { _TranslateAnimation = new TranslateAnimation(mCurrentCheckedRadioLeft, getResources().getDimension(R.dimen.rdo1), 0f, 0f); _AnimationSet.addAnimation(_TranslateAnimation); _AnimationSet.setFillBefore(false); _AnimationSet.setFillAfter(true); _AnimationSet.setDuration(100);//from w w w . j a v a 2 s. co m mImageView.startAnimation(_AnimationSet); mViewPager.setCurrentItem(1); mRadioButton1.setTextColor(Color.RED); } else if (checkedId == R.id.btn2) { _TranslateAnimation = new TranslateAnimation(mCurrentCheckedRadioLeft, getResources().getDimension(R.dimen.rdo2), 0f, 0f); _AnimationSet.addAnimation(_TranslateAnimation); _AnimationSet.setFillBefore(false); _AnimationSet.setFillAfter(true); _AnimationSet.setDuration(100); mImageView.startAnimation(_AnimationSet); mViewPager.setCurrentItem(2); } else if (checkedId == R.id.btn3) { _TranslateAnimation = new TranslateAnimation(mCurrentCheckedRadioLeft, getResources().getDimension(R.dimen.rdo3), 0f, 0f); _AnimationSet.addAnimation(_TranslateAnimation); _AnimationSet.setFillBefore(false); _AnimationSet.setFillAfter(true); _AnimationSet.setDuration(100); mImageView.startAnimation(_AnimationSet); mViewPager.setCurrentItem(3); } else if (checkedId == R.id.btn4) { _TranslateAnimation = new TranslateAnimation(mCurrentCheckedRadioLeft, getResources().getDimension(R.dimen.rdo4), 0f, 0f); _AnimationSet.addAnimation(_TranslateAnimation); _AnimationSet.setFillBefore(false); _AnimationSet.setFillAfter(true); _AnimationSet.setDuration(100); mImageView.startAnimation(_AnimationSet); mViewPager.setCurrentItem(4); } mCurrentCheckedRadioLeft = getCurrentCheckedRadioLeft(); DebugLog.i("zj", "getCurrentCheckedRadioLeft=" + getCurrentCheckedRadioLeft()); DebugLog.i("zj", "getDimension=" + getResources().getDimension(R.dimen.rdo2)); mHorizontalScrollView.smoothScrollTo( (int) mCurrentCheckedRadioLeft - (int) getResources().getDimension(R.dimen.rdo2), 0); }
From source file:com.example.fragment.PrimitiveFragment.java
public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/* www.j a v a 2 s. co m*/ float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
From source file:com.example.fragment.PrimitiveFragment.java
public void move(float destX, float destY) { if (!this.mIsAlive) return;//from w w w . jav a 2 s . com if (this.mIsMoving) { return;// ADD Array } this.mDestX = Factory.getAdjustedX(destX - this.mPaddingW); this.mDestY = Factory.getAdjustedY(destY - this.mPaddingH); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate; float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); this.mIsMoving = true; this.mIsMove = true; }
From source file:com.watasan.infospider.fragment.PrimitiveFragment.java
/** SCRIPT ACTION AREA --------------------------------------------------> */ public void testAnimation(float destX, float destY) { this.mDestX = Factory.getAdjustedX(destX); this.mDestY = Factory.getAdjustedY(destY); // SELECT LAYER FrameLayout relate = (FrameLayout) mRootView.findViewById(R.id.FLBackLayer); // ScrollView relate = (ScrollView)mRootView.findViewById(R.id.content); // relate.setVisibility(View.VISIBLE); AnimationSet set = new AnimationSet(true); set.setAnimationListener(this); TranslateAnimation translate;/*from www. j a v a 2 s . co m*/ float toX = this.mDestX; float fromX = this.mSrcX; float toY = this.mDestY; float fromY = this.mSrcY; translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, fromX, Animation.RELATIVE_TO_PARENT, toX, Animation.RELATIVE_TO_PARENT, fromY, Animation.RELATIVE_TO_PARENT, toY); translate.setDuration(Constants.Animation.IPF_START); translate.setInterpolator(new AccelerateInterpolator()); set.addAnimation(translate); set.setFillBefore(true); // set.setFillBefore(false); // set.setFillAfter(false); set.setFillAfter(true); relate.startAnimation(set); }
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 va 2 s . c om 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); }