Search in sources :

Example 1 with Skill

use of com.daimajia.easing.Skill in project AnimationEasingFunctions by daimajia.

the class EasingAdapter method getView.

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    Object o = getItem(i);
    BaseEasingMethod b = ((Skill) o).getMethod(1000);
    int start = b.getClass().getName().lastIndexOf(".") + 1;
    String name = b.getClass().getName().substring(start);
    View v = LayoutInflater.from(mContext).inflate(R.layout.item, null);
    TextView tv = (TextView) v.findViewById(R.id.list_item_text);
    tv.setText(name);
    v.setTag(o);
    return v;
}
Also used : Skill(com.daimajia.easing.Skill) BaseEasingMethod(com.daimajia.easing.BaseEasingMethod) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with Skill

use of com.daimajia.easing.Skill in project AnimationEasingFunctions by daimajia.

the class MyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    mEasingList = (ListView) findViewById(R.id.easing_list);
    mAdapter = new EasingAdapter(this);
    mEasingList.setAdapter(mAdapter);
    mTarget = findViewById(R.id.target);
    mHistory = (DrawView) findViewById(R.id.history);
    mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            mHistory.clear();
            Skill s = (Skill) view.getTag();
            AnimatorSet set = new AnimatorSet();
            mTarget.setTranslationX(0);
            mTarget.setTranslationY(0);
            set.playTogether(Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {

                @Override
                public void on(float time, float value, float start, float end, float duration) {
                    mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
                }
            }));
            set.setDuration(1200);
            set.start();
        }
    });
}
Also used : BaseEasingMethod(com.daimajia.easing.BaseEasingMethod) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Skill(com.daimajia.easing.Skill) AdapterView(android.widget.AdapterView)

Aggregations

View (android.view.View)2 BaseEasingMethod (com.daimajia.easing.BaseEasingMethod)2 Skill (com.daimajia.easing.Skill)2 AnimatorSet (android.animation.AnimatorSet)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1