Search in sources :

Example 1 with SearchArrowDrawable

use of com.mypopsy.drawable.SearchArrowDrawable 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)

Example 2 with SearchArrowDrawable

use of com.mypopsy.drawable.SearchArrowDrawable in project FloatingSearchView by renaudcerrato.

the class MainActivity method updateNavigationIcon.

private void updateNavigationIcon(int itemId) {
    Context context = mSearchView.getContext();
    Drawable drawable = null;
    switch(itemId) {
        case R.id.menu_icon_search:
            drawable = new SearchArrowDrawable(context);
            break;
        case R.id.menu_icon_drawer:
            drawable = new android.support.v7.graphics.drawable.DrawerArrowDrawable(context);
            break;
        case R.id.menu_icon_custom:
            drawable = new CustomDrawable(context);
            break;
    }
    drawable = DrawableCompat.wrap(drawable);
    DrawableCompat.setTint(drawable, ViewUtils.getThemeAttrColor(context, R.attr.colorControlNormal));
    mSearchView.setIcon(drawable);
}
Also used : Context(android.content.Context) SearchArrowDrawable(com.mypopsy.drawable.SearchArrowDrawable) ToggleDrawable(com.mypopsy.drawable.ToggleDrawable) Drawable(android.graphics.drawable.Drawable) SearchArrowDrawable(com.mypopsy.drawable.SearchArrowDrawable)

Aggregations

SearchArrowDrawable (com.mypopsy.drawable.SearchArrowDrawable)2 ToggleDrawable (com.mypopsy.drawable.ToggleDrawable)2 Context (android.content.Context)1 Drawable (android.graphics.drawable.Drawable)1 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 SearchCrossDrawable (com.mypopsy.drawable.SearchCrossDrawable)1