Search in sources :

Example 61 with SeekBar

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);
    }
}
Also used : SeekBar(android.widget.SeekBar) GPUImage(jp.co.cyberagent.android.gpuimage.GPUImage) GLSurfaceView(android.opengl.GLSurfaceView) View(android.view.View) CameraHelper(jp.co.cyberagent.android.gpuimage.sample.utils.CameraHelper)

Example 62 with SeekBar

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);
        }
    });
}
Also used : SeekBar(android.widget.SeekBar) Drawable(android.graphics.drawable.Drawable) BlurView(eightbitlab.com.blurview.BlurView)

Example 63 with SeekBar

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();
    }
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) SeekBar(android.widget.SeekBar) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) TextView(android.widget.TextView) View(android.view.View) CompoundButton(android.widget.CompoundButton) LinearLayout(android.widget.LinearLayout)

Example 64 with SeekBar

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;
}
Also used : Context(android.content.Context) SeekBar(android.widget.SeekBar) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 65 with SeekBar

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) {
        }
    });
}
Also used : IntentFilter(android.content.IntentFilter) SeekBar(android.widget.SeekBar)

Aggregations

SeekBar (android.widget.SeekBar)193 TextView (android.widget.TextView)90 View (android.view.View)64 ImageView (android.widget.ImageView)28 LinearLayout (android.widget.LinearLayout)22 FrameLayout (android.widget.FrameLayout)19 Intent (android.content.Intent)18 CompoundButton (android.widget.CompoundButton)18 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)14 Paint (android.graphics.Paint)13 AdapterView (android.widget.AdapterView)13 AlertDialog (android.support.v7.app.AlertDialog)11 Button (android.widget.Button)11 DialogInterface (android.content.DialogInterface)10 CheckBox (android.widget.CheckBox)10 ToggleButton (android.widget.ToggleButton)10 SuppressLint (android.annotation.SuppressLint)9 EditText (android.widget.EditText)9 Spinner (android.widget.Spinner)7 SharedPreferences (android.content.SharedPreferences)6