Search in sources :

Example 31 with OnSeekBarChangeListener

use of android.widget.SeekBar.OnSeekBarChangeListener in project android_packages_apps_Gallery2 by LineageOS.

the class BasicSlider method setUp.

@Override
public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
    container.removeAllViews();
    mEditor = editor;
    final Context context = container.getContext();
    mParameter = (ParameterInteger) parameter;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View lp = inflater.inflate(R.layout.filtershow_seekbar, container, true);
    mSeekBar = (SeekBar) lp.findViewById(R.id.primarySeekBar);
    mSeekBar.setVisibility(View.VISIBLE);
    View saveButton = lp.findViewById(R.id.slider_save);
    if (saveButton != null) {
        saveButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                FilterShowActivity activity = (FilterShowActivity) context;
                mEditor.finalApplyCalled();
                activity.leaveSeekBarPanel();
            }
        });
    }
    View cancelButton = lp.findViewById(R.id.slider_cancel);
    if (cancelButton != null) {
        cancelButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                FilterShowActivity activity = (FilterShowActivity) context;
                activity.cancelCurrentFilter();
                activity.leaveSeekBarPanel();
            }
        });
    }
    updateUI();
    mSeekBar.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) {
            if (mParameter != null) {
                mParameter.setValue(progress + mParameter.getMinimum());
                mEditor.commitLocalRepresentation();
            }
        }
    });
}
Also used : Context(android.content.Context) SeekBar(android.widget.SeekBar) LayoutInflater(android.view.LayoutInflater) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) View(android.view.View)

Example 32 with OnSeekBarChangeListener

use of android.widget.SeekBar.OnSeekBarChangeListener in project android_packages_apps_Gallery2 by LineageOS.

the class TitledSlider method setUp.

@Override
public void setUp(ViewGroup container, Parameter parameter, Editor editor) {
    container.removeAllViews();
    mEditor = editor;
    Context context = container.getContext();
    mParameter = (ParameterInteger) parameter;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mTopView = inflater.inflate(mLayoutID, container, true);
    mTopView.setVisibility(View.VISIBLE);
    mSeekBar = (SeekBar) mTopView.findViewById(R.id.controlValueSeekBar);
    mControlName = (TextView) mTopView.findViewById(R.id.controlName);
    mControlValue = (TextView) mTopView.findViewById(R.id.controlValue);
    updateUI();
    mSeekBar.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) {
            if (mParameter != null) {
                mParameter.setValue(progress + mParameter.getMinimum());
                if (mControlName != null) {
                    mControlName.setText(mParameter.getParameterName());
                }
                if (mControlValue != null) {
                    mControlValue.setText(Integer.toString(mParameter.getValue()));
                }
                mEditor.commitLocalRepresentation();
            }
        }
    });
}
Also used : Context(android.content.Context) SeekBar(android.widget.SeekBar) LayoutInflater(android.view.LayoutInflater) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener)

Example 33 with OnSeekBarChangeListener

use of android.widget.SeekBar.OnSeekBarChangeListener in project Lightning-Browser by anthonycr.

the class ReadingActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    switch(item.getItemId()) {
        case R.id.invert_item:
            mUserPreferences.setInvertColors(!mInvert);
            if (mUrl != null) {
                ReadingActivity.launch(this, mUrl);
                finish();
            }
            break;
        case R.id.text_size_item:
            View view = LayoutInflater.from(this).inflate(R.layout.dialog_seek_bar, null);
            final SeekBar bar = view.findViewById(R.id.text_size_seekbar);
            bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

                @Override
                public void onProgressChanged(SeekBar view, int size, boolean user) {
                    mBody.setTextSize(getTextSize(size));
                }

                @Override
                public void onStartTrackingTouch(SeekBar arg0) {
                }

                @Override
                public void onStopTrackingTouch(SeekBar arg0) {
                }
            });
            bar.setMax(5);
            bar.setProgress(mTextSize);
            AlertDialog.Builder builder = new AlertDialog.Builder(this).setView(view).setTitle(R.string.size).setPositiveButton(android.R.string.ok, (dialog, arg1) -> {
                mTextSize = bar.getProgress();
                mBody.setTextSize(getTextSize(mTextSize));
                mUserPreferences.setReadingTextSize(bar.getProgress());
            });
            Dialog dialog = builder.show();
            BrowserDialog.setDialogSize(this, dialog);
            break;
        default:
            finish();
            break;
    }
    return super.onOptionsItemSelected(item);
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) SeekBar(android.widget.SeekBar) AlertDialog(androidx.appcompat.app.AlertDialog) Dialog(android.app.Dialog) BrowserDialog(acr.browser.lightning.dialog.BrowserDialog) ProgressDialog(android.app.ProgressDialog) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView)

Example 34 with OnSeekBarChangeListener

use of android.widget.SeekBar.OnSeekBarChangeListener in project Android-Developers-Samples by johnjohndoe.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    /*
         * Initialize UI
         */
    // Set up main image view
    mBitmapIn = loadBitmap(R.drawable.data);
    mBitmapsOut = new Bitmap[NUM_BITMAPS];
    for (int i = 0; i < NUM_BITMAPS; ++i) {
        mBitmapsOut[i] = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(), mBitmapIn.getConfig());
    }
    mImageView = (ImageView) findViewById(R.id.imageView);
    mImageView.setImageBitmap(mBitmapsOut[mCurrentBitmap]);
    mCurrentBitmap += (mCurrentBitmap + 1) % NUM_BITMAPS;
    // Set up seekbar
    final SeekBar seekbar = (SeekBar) findViewById(R.id.seekBar1);
    seekbar.setProgress(50);
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            updateImage(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    // Setup effect selector
    RadioButton radio0 = (RadioButton) findViewById(R.id.radio0);
    radio0.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mFilterMode = MODE_BLUR;
                updateImage(seekbar.getProgress());
            }
        }
    });
    RadioButton radio1 = (RadioButton) findViewById(R.id.radio1);
    radio1.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mFilterMode = MODE_CONVOLVE;
                updateImage(seekbar.getProgress());
            }
        }
    });
    RadioButton radio2 = (RadioButton) findViewById(R.id.radio2);
    radio2.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mFilterMode = MODE_COLORMATRIX;
                updateImage(seekbar.getProgress());
            }
        }
    });
    /*
         * Create renderScript
         */
    createScript();
    /*
         * Create thumbnails
         */
    createThumbnail();
    /*
         * Invoke renderScript kernel and update imageView
         */
    mFilterMode = MODE_BLUR;
    updateImage(50);
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) SeekBar(android.widget.SeekBar) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) RadioButton(android.widget.RadioButton) CompoundButton(android.widget.CompoundButton)

Aggregations

OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)34 SeekBar (android.widget.SeekBar)33 View (android.view.View)24 TextView (android.widget.TextView)18 OnClickListener (android.view.View.OnClickListener)13 Intent (android.content.Intent)9 CompoundButton (android.widget.CompoundButton)9 ImageView (android.widget.ImageView)8 AdapterView (android.widget.AdapterView)7 Button (android.widget.Button)6 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)6 SuppressLint (android.annotation.SuppressLint)5 Paint (android.graphics.Paint)5 LayoutInflater (android.view.LayoutInflater)5 DialogInterface (android.content.DialogInterface)4 CheckBox (android.widget.CheckBox)4 AlertDialog (android.app.AlertDialog)3 Dialog (android.app.Dialog)3 ProgressDialog (android.app.ProgressDialog)3 Point (android.graphics.Point)3