Commit dfef6838 authored by fallenstardust's avatar fallenstardust

添加菜单控件按钮动画

parent b1c7a618
package cn.garymb.ygomobile.ui.home;
import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
......@@ -86,6 +89,8 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
checkForceUpdateSilent();
//ServiceDuelAssistant
startService(new Intent(this,ServiceDuelAssistant.class));
ObjectAnimator nope = shake(R.id.cube);
nope.start();
}
@Override
......@@ -369,4 +374,21 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
UpdateHelper.getInstance().autoUpdate(getPackageName(), false, intervalMillis);
}
public static ObjectAnimator animator(View view) {
int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium);
PropertyValuesHolder pvhTranslateY = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_Y,
Keyframe.ofFloat(0f, 0),
Keyframe.ofFloat(.10f, -delta),
Keyframe.ofFloat(.26f, delta),
Keyframe.ofFloat(.42f, -delta),
Keyframe.ofFloat(.58f, delta),
Keyframe.ofFloat(.74f, -delta),
Keyframe.ofFloat(.90f, delta),
Keyframe.ofFloat(1f, 0f)
);
return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateY).
setDuration(500);
}
}
......@@ -29,9 +29,10 @@
app:bmb_piecePlaceEnum="piecePlace_dot_9_1">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/cube"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
app:srcCompat="@drawable/bottom_1" />
app:srcCompat="@drawable/cube" />
</com.nightonke.boommenu.BoomMenuButton>
</FrameLayout>
\ No newline at end of file
......@@ -49,4 +49,5 @@
<dimen name="brower_arrow_height">150dp</dimen>
<dimen name="menu_text_size">6dp</dimen>
<dimen name="menu_text_top">-5dp</dimen>
<dimen name="spacing_medium">1dp</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment