Search in sources :

Example 1 with SearchCrossDrawable

use of com.mypopsy.drawable.SearchCrossDrawable in project ToggleDrawable by renaudcerrato.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContainer = (ViewGroup) findViewById(R.id.container_cardview);
    mContainer.getBackground().setAlpha(0);
    mContainer.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() != MotionEvent.ACTION_DOWN)
                return false;
            if (!isFaded)
                return false;
            toggle();
            return true;
        }
    });
    mSeekBar = ((SeekBar) findViewById(R.id.seekbar));
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            for (ToggleDrawable drawable : mToggleDrawables) drawable.setProgress(progress / (float) seekBar.getMax());
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    add(new SearchArrowDrawable(this));
    add(new SearchCrossDrawable(this));
    add(new DrawerArrowDrawable(this));
    add(new MyCustomToggleDrawable(this));
}
Also used : SearchCrossDrawable(com.mypopsy.drawable.SearchCrossDrawable) SeekBar(android.widget.SeekBar) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) MotionEvent(android.view.MotionEvent) ToggleDrawable(com.mypopsy.drawable.ToggleDrawable) SearchArrowDrawable(com.mypopsy.drawable.SearchArrowDrawable) DrawerArrowDrawable(com.mypopsy.drawable.DrawerArrowDrawable)

Aggregations

MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 SeekBar (android.widget.SeekBar)1 TextView (android.widget.TextView)1 DrawerArrowDrawable (com.mypopsy.drawable.DrawerArrowDrawable)1 SearchArrowDrawable (com.mypopsy.drawable.SearchArrowDrawable)1 SearchCrossDrawable (com.mypopsy.drawable.SearchCrossDrawable)1 ToggleDrawable (com.mypopsy.drawable.ToggleDrawable)1