Search in sources :

Example 1 with Skill

use of com.marshalchen.common.uimodule.easing.Skill in project UltimateAndroid by cymcsg.

the class EasingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.easing_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(EasingActivity.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(EasingActivity.this, 60));
                }
            }));
            set.setDuration(1200);
            set.start();
        }
    });
}
Also used : BaseEasingMethod(com.marshalchen.common.uimodule.easing.BaseEasingMethod) AnimatorSet(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Skill(com.marshalchen.common.uimodule.easing.Skill) AdapterView(android.widget.AdapterView)

Example 2 with Skill

use of com.marshalchen.common.uimodule.easing.Skill in project UltimateAndroid by cymcsg.

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.easing_item, null);
    TextView tv = (TextView) v.findViewById(R.id.list_item_text);
    tv.setText(name);
    v.setTag(o);
    return v;
}
Also used : Skill(com.marshalchen.common.uimodule.easing.Skill) BaseEasingMethod(com.marshalchen.common.uimodule.easing.BaseEasingMethod) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

View (android.view.View)2 BaseEasingMethod (com.marshalchen.common.uimodule.easing.BaseEasingMethod)2 Skill (com.marshalchen.common.uimodule.easing.Skill)2 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 AnimatorSet (com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet)1