List of usage examples for android.animation ObjectAnimator ofFloat
public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> xProperty, Property<T, Float> yProperty, Path path)
Path
using two properties. From source file:com.google.android.apps.muzei.settings.SettingsActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); setContentView(R.layout.settings_activity); if (getIntent() != null && getIntent().getCategories() != null && getIntent().getCategories().contains(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)) { mStartSection = START_SECTION_ADVANCED; }// w ww. ja va 2 s. c om // Set up UI widgets setupAppBar(); ((DrawInsetsFrameLayout) findViewById(R.id.draw_insets_frame_layout)) .setOnInsetsCallback(new DrawInsetsFrameLayout.OnInsetsCallback() { @Override public void onInsetsChanged(Rect insets) { View container = findViewById(R.id.container); ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) container .getLayoutParams(); lp.leftMargin = insets.left; lp.topMargin = insets.top; lp.rightMargin = insets.right; lp.bottomMargin = insets.bottom; container.setLayoutParams(lp); } }); if (mBackgroundAnimator != null) { mBackgroundAnimator.cancel(); } mBackgroundAnimator = ObjectAnimator.ofFloat(this, "backgroundOpacity", 0, 1); mBackgroundAnimator.setDuration(1000); mBackgroundAnimator.start(); }
From source file:android.support.transition.FadePort.java
/** * Utility method to handle creating and running the Animator. *//*from ww w . j a v a2 s. c om*/ private Animator createAnimation(View view, float startAlpha, float endAlpha, AnimatorListenerAdapter listener) { if (startAlpha == endAlpha) { // run listener if we're noop'ing the animation, to get the end-state results now if (listener != null) { listener.onAnimationEnd(null); } return null; } final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", startAlpha, endAlpha); if (DBG) { Log.d(LOG_TAG, "Created animator " + anim); } if (listener != null) { anim.addListener(listener); } return anim; }
From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java
private void startBoringAnimation() { scanLine.setVisibility(View.VISIBLE); // Create animators for y axe if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { int yMax = 0; yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight(); yMax = (int) (yMax * 0.9);// 174; ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax); oay.setRepeatCount(Animation.INFINITE); oay.setDuration(ANIM_DURATION);// w w w . j av a 2 s .co m oay.setRepeatMode(Animation.REVERSE); oay.setInterpolator(new LinearInterpolator()); oay.start(); //for draw points near scanline markFakeFeaturePoint.setObjectAnimator(oay); } //scanAnimation. }
From source file:com.b44t.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_MessengerProj); super.onCreate(savedInstanceState); Theme.loadRecources(this); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); } else {//from www . j a v a2s . co m setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Intro7Headline, R.string.Intro6Headline, R.string.Intro5Headline, R.string.Intro4Headline, R.string.Intro3Headline, R.string.Intro2Headline, R.string.Intro1Headline }; messages = new int[] { R.string.Intro7Message, R.string.Intro6Message, R.string.Intro5Message, R.string.Intro4Message, R.string.Intro3Message, R.string.Intro2Message, R.string.Intro1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Intro1Headline, R.string.Intro2Headline, R.string.Intro3Headline, R.string.Intro4Headline, R.string.Intro5Headline, R.string.Intro6Headline, R.string.Intro7Headline }; messages = new int[] { R.string.Intro1Message, R.string.Intro2Message, R.string.Intro3Message, R.string.Intro4Message, R.string.Intro5Message, R.string.Intro6Message, R.string.Intro7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging) .toUpperCase(Locale.getDefault())); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)) .setDuration(200)); animator.addState(new int[] {}, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)) .setDuration(200)); startMessagingButton.setStateListAnimator(animator); } topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); justCreated = true; }
From source file:im.actor.sdk.view.emoji.keyboard.emoji.EmojiKeyboard.java
@Override protected View createView() { final View emojiPagerView = LayoutInflater.from(activity).inflate(R.layout.emoji_smiles_pager, null); final ViewPager emojiPager = (ViewPager) emojiPagerView.findViewById(R.id.emoji_pager); final PagerSlidingTabStrip emojiPagerIndicator = (PagerSlidingTabStrip) emojiPagerView .findViewById(R.id.emoji_pager_indicator); View backspace = emojiPagerView.findViewById(R.id.backspace); final View backToSmiles = emojiPagerView.findViewById(R.id.back_to_smiles); final View indicatorContainer = emojiPagerView.findViewById(R.id.indicator_container); stickerIndicatorContainer = emojiPagerView.findViewById(R.id.sticker_indicator_container); stickerSwitchContainer = emojiPagerView.findViewById(R.id.sticker_switch_container); emojiPagerIndicator.setTabBackground(R.drawable.clickable_background); emojiPagerIndicator.setIndicatorColorResource(R.color.primary); emojiPagerIndicator.setIndicatorHeight(Screen.dp(2)); emojiPagerIndicator.setDividerColor(0x00000000); emojiPagerIndicator.setUnderlineHeight(0); emojiPagerIndicator.setTabLayoutParams(new LinearLayout.LayoutParams(Screen.dp(48), Screen.dp(48))); backspace.setOnTouchListener(new RepeatListener(500, 100, new OnClickListener() { @Override//from w w w .ja va2s. c o m public void onClick(View v) { onBackspaceClick(v); } })); mEmojisAdapter = new SmilePagerAdapter(this); mEmojisAdapter.setTabs(emojiPagerIndicator); emojiPager.setAdapter(mEmojisAdapter); emojiPagerIndicator.setViewPager(emojiPager); backToSmiles.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { emojiPager.setCurrentItem(3, false); ObjectAnimator oa = ObjectAnimator.ofFloat(indicatorContainer, "translationX", 0, 0); oa.setDuration(0); oa.start(); if (stickerIndicatorContainer.getVisibility() == View.INVISIBLE) { stickerIndicatorContainer.setVisibility(View.VISIBLE); } ObjectAnimator oas = ObjectAnimator.ofFloat(stickerIndicatorContainer, "translationX", Screen.getWidth(), Screen.getWidth()); oas.setDuration(0); oas.start(); emojiPager.setCurrentItem(1, true); } }); final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) stickerIndicatorContainer.getLayoutParams(); emojiPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 4) { ObjectAnimator oa = ObjectAnimator.ofFloat(indicatorContainer, "translationX", indicatorContainer.getX(), -positionOffsetPixels); oa.setDuration(0); oa.start(); if (stickerIndicatorContainer.getVisibility() == View.INVISIBLE) { stickerIndicatorContainer.setVisibility(View.VISIBLE); } ObjectAnimator oas = ObjectAnimator.ofFloat(stickerIndicatorContainer, "translationX", stickerIndicatorContainer.getX() + Screen.getWidth(), -positionOffsetPixels + Screen.getWidth()); oas.setDuration(0); oas.start(); } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); //emojiPagerIndicator.setLayoutParams(new RelativeLayout.LayoutParams(Screen.dp(58 * mEmojisAdapter.getCount()), Screen.dp(48))); // emojiPager.postDelayed(new Runnable() { // @Override // public void run() { // emojiPager.setAlpha(0f); // emojiPagerIndicator.setAlpha(0f); // animateView(emojiPager); // animateView(emojiPagerIndicator); // emojiPager.setAdapter(mEmojisAdapter); // emojiPagerIndicator.setViewPager(emojiPager); // } // }, BINDING_DELAY); if (SmilesPack.getRecent().size() == 0) { emojiPager.setCurrentItem(1); } return emojiPagerView; }
From source file:com.microsoft.azure.engagement.ProductDiscountActivity.java
/** * Method that updates the ui screen with the new product price * * @param fromRemoveButton Is true if the removeDiscountButton was clicked on *///from w w w . j a v a 2s. c o m private final void updatePriceLayout(boolean fromRemoveButton) { if (fromRemoveButton == false) { final double finalPrice = priceValue * (100 - discountRateInPercent) / 100; prizeDiscountTextView.setText(getPrice(finalPrice)); discountTextView.setText( getString(R.string.product_discount, discountRateInPercent, getString(R.string.percent_sign))); } // Start the animation ProductDiscountActivity.performAnimation(prizeDiscountTextView, discountApplied ? ObjectAnimator.ofFloat(prizeDiscountTextView, "alpha", 0f, 1f) : ObjectAnimator.ofFloat(prizeDiscountTextView, "alpha", 1f, 0f), discountApplied); ProductDiscountActivity.performAnimation(discountTextView, discountApplied ? ObjectAnimator.ofFloat(discountTextView, "alpha", 0f, 1f) : ObjectAnimator.ofFloat(discountTextView, "alpha", 1f, 0f), discountApplied); applyDiscountButton.setVisibility(discountApplied ? View.GONE : View.VISIBLE); removeDiscountButton.setVisibility(discountApplied ? View.VISIBLE : View.GONE); addOrRemoveStrikeTextView(prizeTextView, discountApplied); }
From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java
private void startBoringAnimation() { scanLine.setVisibility(View.VISIBLE); // Create animators for y axe if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { int yMax = 0; yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight(); yMax = (int) (yMax * 0.9);// 174; ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax); oay.setRepeatCount(Animation.INFINITE); oay.setDuration(ANIM_DURATION);// w w w . ja va 2 s .c o m oay.setRepeatMode(ValueAnimator.REVERSE); oay.setInterpolator(new LinearInterpolator()); oay.start(); //for draw points near ir_scanline markFakeFeaturePoint.setObjectAnimator(oay); } //scanAnimation. }
From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java
private AnimatorSet getEnterAnimtor(final View target) { ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f); ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f); AnimatorSet enter = new AnimatorSet(); enter.setDuration(500);//from w ww . j av a 2 s .co m enter.setInterpolator(new LinearInterpolator()); enter.playTogether(alpha, scaleX, scaleY); enter.setTarget(target); return enter; }
From source file:com.ae.apps.tripmeter.fragments.expenses.TripDetailsFragment.java
private void initViews(View inflatedView) { mExpenseManager = ExpenseManager.newInstance(getContext()); mTrip = mExpenseManager.getTripByTripId(String.valueOf(mTripId)); // Update the trip with the ContactVos from member ids mTrip.getMembers().addAll(mExpenseManager.getContactsFromIds(mTrip.getMemberIds())); TextView tripName = (TextView) inflatedView.findViewById(R.id.txtTripName); mTripTotalExpenses = (TextView) inflatedView.findViewById(R.id.txtTripTotalAmount); mTripMembersContainer = (LinearLayout) inflatedView.findViewById(R.id.tripMembersContainer); addTripMembersToContainer();/* w ww.java 2 s.c om*/ tripName.setText(mTrip.getName()); updateTripTotalExpenses(); FloatingActionButton floatingActionButton = (FloatingActionButton) inflatedView.findViewById(R.id.fab); floatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showAddExpenseDialog(); } }); final ImageButton btnShowHideExpenseMembers = (ImageButton) inflatedView .findViewById(R.id.btnShowHideExpenseMembers); btnShowHideExpenseMembers.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ObjectAnimator btnAnimation; if (isMembersContainerDisplayed) { mTripMembersContainer.setVisibility(View.GONE); isMembersContainerDisplayed = false; btnAnimation = ObjectAnimator.ofFloat(btnShowHideExpenseMembers, "rotation", 180, 0); } else { mTripMembersContainer.setVisibility(View.VISIBLE); isMembersContainerDisplayed = true; btnAnimation = ObjectAnimator.ofFloat(btnShowHideExpenseMembers, "rotation", 0, 180); } btnAnimation.setDuration(200).start(); } }); mViewPager = (ViewPager) inflatedView.findViewById(R.id.viewpager); setUpViewPager(); TabLayout mTabLayout = (TabLayout) inflatedView.findViewById(R.id.tabs); mTabLayout.setupWithViewPager(mViewPager); // Bundle args = new Bundle(); // args.putString(AppConstants.KEY_TRIP_ID, mTripId); // Fragment fragment = TripExpenseFragment.newInstance(args); // FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); // transaction.replace(R.id.frag, fragment).commit(); }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void startRevealAnimation() { View disappearingView = getMainView(); ObjectAnimator fabAnimator = getFABAnimator(); ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(disappearingView, "alpha", 1, 0); AnimatorSet set = new AnimatorSet(); set.play(fabAnimator).with(alphaAnimator); setupAnimationParams(set);/*from w ww .j av a 2 s.c o m*/ set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); fab.setVisibility(GONE); prepareForReveal(); expandCircle(); } }); set.start(); }