use of android.widget.SeekBar in project android-gpuimage by CyberAgent.
the class ActivityCamera method onCreate.
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
((SeekBar) findViewById(R.id.seekBar)).setOnSeekBarChangeListener(this);
findViewById(R.id.button_choose_filter).setOnClickListener(this);
findViewById(R.id.button_capture).setOnClickListener(this);
mGPUImage = new GPUImage(this);
mGPUImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));
mCameraHelper = new CameraHelper(this);
mCamera = new CameraLoader();
View cameraSwitchView = findViewById(R.id.img_switch_camera);
cameraSwitchView.setOnClickListener(this);
if (!mCameraHelper.hasFrontCamera() || !mCameraHelper.hasBackCamera()) {
cameraSwitchView.setVisibility(View.GONE);
}
}
use of android.widget.SeekBar in project BlurView by Dimezis.
the class MainActivity method setupBlurView.
private void setupBlurView() {
final float radius = 25f;
final float minBlurRadius = 10f;
final float step = 4f;
//set background, if your root layout doesn't have one
final Drawable windowBackground = getWindow().getDecorView().getBackground();
final BlurView.ControllerSettings topViewSettings = topBlurView.setupWith(root).windowBackground(windowBackground).blurRadius(radius);
final BlurView.ControllerSettings bottomViewSettings = bottomBlurView.setupWith(root).windowBackground(windowBackground).blurRadius(radius);
int initialProgress = (int) (radius * step);
radiusSeekBar.setProgress(initialProgress);
radiusSeekBar.setOnSeekBarChangeListener(new SeekBarListenerAdapter() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float blurRadius = progress / step;
blurRadius = Math.max(blurRadius, minBlurRadius);
topViewSettings.blurRadius(blurRadius);
bottomViewSettings.blurRadius(blurRadius);
}
});
}
use of android.widget.SeekBar in project android_packages_apps_Torch by CyanogenMod.
the class MainActivity method onCreate.
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mButtonOn = (ToggleButton) findViewById(R.id.buttonOn);
mStrobeSwitch = (Switch) findViewById(R.id.strobe_switch);
mStrobeLabel = (TextView) findViewById(R.id.strobeTimeLabel);
mSlider = (SeekBar) findViewById(R.id.slider);
mBrightSwitch = (Switch) findViewById(R.id.bright_switch);
mStrobePeriod = 100;
mTorchOn = false;
mWidgetProvider = TorchWidgetProvider.getInstance();
// Preferences
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mHasBrightSetting = getResources().getBoolean(R.bool.hasHighBrightness);
if (mHasBrightSetting) {
mBright = mPrefs.getBoolean("bright", false);
mBrightSwitch.setChecked(mBright);
mBrightSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked && mPrefs.getBoolean("bright", false)) {
mBright = true;
} else if (isChecked) {
openBrightDialog();
} else {
mBright = false;
mPrefs.edit().putBoolean("bright", false).commit();
}
}
});
} else {
// Fully hide the UI elements on Crespo since we can't use them
mBrightSwitch.setVisibility(View.GONE);
findViewById(R.id.ruler2).setVisibility(View.GONE);
}
// Set the state of the strobing section and hide as appropriate
final boolean isStrobing = mPrefs.getBoolean("strobe", false);
final LinearLayout strobeLayout = (LinearLayout) findViewById(R.id.strobeRow);
int visibility = isStrobing ? View.VISIBLE : View.GONE;
strobeLayout.setVisibility(visibility);
mStrobeSwitch.setChecked(isStrobing);
mStrobeSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int visibility = isChecked ? View.VISIBLE : View.GONE;
strobeLayout.setVisibility(visibility);
mPrefs.edit().putBoolean("strobe", isChecked).commit();
}
});
mButtonOn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(TorchSwitch.TOGGLE_FLASHLIGHT);
intent.putExtra("strobe", mStrobeSwitch.isChecked());
intent.putExtra("period", mStrobePeriod);
intent.putExtra("bright", mBright);
sendBroadcast(intent);
}
});
// Strobe frequency slider bar handling
setProgressBarVisibility(true);
updateStrobePeriod(mPrefs.getInt("strobeperiod", 100));
mSlider.setHorizontalScrollBarEnabled(true);
mSlider.setProgress(400 - mStrobePeriod);
mSlider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
updateStrobePeriod(Math.max(20, 401 - progress));
Intent intent = new Intent("net.cactii.flash2.SET_STROBE");
intent.putExtra("period", mStrobePeriod);
sendBroadcast(intent);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
// Show the about dialog, the first time the user runs the app.
if (!mPrefs.getBoolean("aboutSeen", false)) {
openAboutDialog();
mPrefs.edit().putBoolean("aboutSeen", true).commit();
}
}
use of android.widget.SeekBar in project android_packages_apps_Torch by CyanogenMod.
the class SeekBarPreference method onCreateDialogView.
@Override
protected View onCreateDialogView() {
final Context context = getContext();
LinearLayout.LayoutParams params;
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(6, 6, 6, 6);
mSplashText = new TextView(context);
if (mDialogMessage != null) {
mSplashText.setText(mDialogMessage);
}
layout.addView(mSplashText);
mValueText = new TextView(context);
mValueText.setGravity(Gravity.CENTER_HORIZONTAL);
mValueText.setTextSize(32);
params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layout.addView(mValueText, params);
mSeekBar = new SeekBar(context);
mSeekBar.setOnSeekBarChangeListener(this);
layout.addView(mSeekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
if (shouldPersist()) {
mValue = getPersistedInt(mDefault);
}
mSeekBar.setMax(mMax);
mSeekBar.setProgress(mValue);
return layout;
}
use of android.widget.SeekBar in project Gadgetbridge by Freeyourgadget.
the class VibrationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vibration);
IntentFilter filter = new IntentFilter();
filter.addAction(GBApplication.ACTION_QUIT);
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
registerReceiver(mReceiver, filter);
seekBar = (SeekBar) findViewById(R.id.vibration_seekbar);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (progress > 0) {
// 1-16
// max 255
progress = progress * 16 - 1;
}
GBApplication.deviceService().onSetConstantVibration(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
Aggregations