Search in sources :

Example 1 with StackBlurManager

use of com.enrique.stackblur.StackBlurManager in project android-stackblur by kikoso.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    _stackBlurManager = new StackBlurManager(getBitmapFromAsset(this, "android_platform_256.png"));
    _seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            onBlur();
        }
    });
    _toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                IMAGE_TO_ANALYZE = "image_transparency.png";
                _stackBlurManager = new StackBlurManager(getBitmapFromAsset(getApplicationContext(), IMAGE_TO_ANALYZE));
                onBlur();
            } else {
                IMAGE_TO_ANALYZE = "android_platform_256.png";
                _stackBlurManager = new StackBlurManager(getBitmapFromAsset(getApplicationContext(), IMAGE_TO_ANALYZE));
                onBlur();
            }
        }
    });
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.blur_modes, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    _typeSelectSpinner.setAdapter(adapter);
    _typeSelectSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setBlurMode(position);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
}
Also used : SeekBar(android.widget.SeekBar) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) InjectView(roboguice.inject.InjectView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) StackBlurManager(com.enrique.stackblur.StackBlurManager) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 SeekBar (android.widget.SeekBar)1 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)1 StackBlurManager (com.enrique.stackblur.StackBlurManager)1 InjectView (roboguice.inject.InjectView)1