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();
}
}
});
}
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();
}
}
});
}
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);
}
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);
}
Aggregations