Search in sources :

Example 41 with SeekBar

use of android.widget.SeekBar in project platform_frameworks_base by android.

the class PresetReverbTest method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.presetreverbtest);
    mSessionText = (EditText) findViewById(R.id.sessionEdit);
    mSessionText.setOnKeyListener(mSessionKeyListener);
    mSessionText.setText(Integer.toString(sSession));
    mReleaseButton = (ToggleButton) findViewById(R.id.presetrvbReleaseButton);
    mOnOffButton = (ToggleButton) findViewById(R.id.presetrvbOnOff);
    getEffect(sSession);
    if (mPresetReverb != null) {
        mReleaseButton.setOnCheckedChangeListener(this);
        mOnOffButton.setOnCheckedChangeListener(this);
        // Presets
        SeekBar seekBar = (SeekBar) findViewById(R.id.presetrvbParam1SeekBar);
        TextView textView = (TextView) findViewById(R.id.presetrvbParam1Value);
        mParameters[0] = new PresetParam(mPresetReverb, (short) 0, (short) (sPresetNames.length - 1), seekBar, textView);
        seekBar.setOnSeekBarChangeListener(mParameters[0]);
    }
}
Also used : SeekBar(android.widget.SeekBar) TextView(android.widget.TextView)

Example 42 with SeekBar

use of android.widget.SeekBar in project platform_frameworks_base by android.

the class VirtualizerTest method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    SeekBar seekBar;
    TextView textView;
    setContentView(R.layout.virtualizertest);
    mSessionText = (EditText) findViewById(R.id.sessionEdit);
    mSessionText.setOnKeyListener(mSessionKeyListener);
    mSessionText.setText(Integer.toString(sSession));
    mReleaseButton = (ToggleButton) findViewById(R.id.virtReleaseButton);
    mOnOffButton = (ToggleButton) findViewById(R.id.virtualizerOnOff);
    getEffect(sSession);
    if (mVirtualizer != null) {
        mReleaseButton.setOnCheckedChangeListener(this);
        mOnOffButton.setOnCheckedChangeListener(this);
        textView = (TextView) findViewById(R.id.virtStrengthMin);
        textView.setText("0");
        textView = (TextView) findViewById(R.id.virtStrengthMax);
        textView.setText("1000");
        seekBar = (SeekBar) findViewById(R.id.virtStrengthSeekBar);
        textView = (TextView) findViewById(R.id.virtStrengthValue);
        mStrength = new VirtualizerParam(mVirtualizer, 0, 1000, seekBar, textView);
        seekBar.setOnSeekBarChangeListener(mStrength);
        mStrength.setEnabled(mVirtualizer.getStrengthSupported());
    }
}
Also used : SeekBar(android.widget.SeekBar) TextView(android.widget.TextView)

Example 43 with SeekBar

use of android.widget.SeekBar in project platform_frameworks_base by android.

the class GradientsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final FrameLayout layout = new FrameLayout(this);
    final ShadersView shadersView = new ShadersView(this);
    final GradientView gradientView = new GradientView(this);
    final RadialGradientView radialGradientView = new RadialGradientView(this);
    final SweepGradientView sweepGradientView = new SweepGradientView(this);
    final BitmapView bitmapView = new BitmapView(this);
    final SeekBar rotateView = new SeekBar(this);
    rotateView.setMax(360);
    rotateView.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            gradientView.setRotationY((float) progress);
            radialGradientView.setRotationX((float) progress);
            sweepGradientView.setRotationY((float) progress);
            bitmapView.setRotationX((float) progress);
        }
    });
    layout.addView(shadersView);
    layout.addView(gradientView, new FrameLayout.LayoutParams(200, 200, Gravity.CENTER));
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
    lp.setMargins(220, 0, 0, 0);
    layout.addView(radialGradientView, lp);
    lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
    lp.setMargins(440, 0, 0, 0);
    layout.addView(sweepGradientView, lp);
    lp = new FrameLayout.LayoutParams(200, 200, Gravity.CENTER);
    lp.setMargins(220, -220, 0, 0);
    layout.addView(bitmapView, lp);
    layout.addView(rotateView, new FrameLayout.LayoutParams(300, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM));
    setContentView(layout);
}
Also used : SeekBar(android.widget.SeekBar) FrameLayout(android.widget.FrameLayout) Paint(android.graphics.Paint)

Example 44 with SeekBar

use of android.widget.SeekBar in project android-topeka by googlesamples.

the class PickerQuizView method createQuizContentView.

@Override
protected View createQuizContentView() {
    initStep();
    mMin = getQuiz().getMin();
    ScrollView layout = (ScrollView) getLayoutInflater().inflate(R.layout.quiz_layout_picker, this, false);
    mCurrentSelection = (TextView) layout.findViewById(R.id.seekbar_progress);
    mCurrentSelection.setText(String.valueOf(mMin));
    mSeekBar = (SeekBar) layout.findViewById(R.id.seekbar);
    mSeekBar.setMax(getSeekBarMax());
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            setCurrentSelectionText(mMin + progress);
            allowAnswer();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }
    });
    return layout;
}
Also used : ScrollView(android.widget.ScrollView) SeekBar(android.widget.SeekBar) SuppressLint(android.annotation.SuppressLint)

Example 45 with SeekBar

use of android.widget.SeekBar in project WordPress-Android by wordpress-mobile.

the class LegacyEditorFragment method onTouch.

@Override
public boolean onTouch(View v, MotionEvent event) {
    float pos = event.getY();
    if (event.getAction() == 0)
        mLastYPos = pos;
    if (event.getAction() > 1) {
        int scrollThreshold = DisplayUtils.dpToPx(getActivity(), 2);
        if (((mLastYPos - pos) > scrollThreshold) || ((pos - mLastYPos) > scrollThreshold))
            mScrollDetected = true;
    }
    mLastYPos = pos;
    if (event.getAction() == MotionEvent.ACTION_UP) {
        ActionBar actionBar = getActionBar();
        if (actionBar != null && actionBar.isShowing()) {
            setContentEditingModeVisible(true);
            return false;
        }
    }
    if (event.getAction() == MotionEvent.ACTION_UP && !mScrollDetected) {
        Layout layout = ((TextView) v).getLayout();
        int x = (int) event.getX();
        int y = (int) event.getY();
        x += v.getScrollX();
        y += v.getScrollY();
        if (layout != null) {
            int line = layout.getLineForVertical(y);
            int charPosition = layout.getOffsetForHorizontal(line, x);
            Spannable spannable = mContentEditText.getText();
            if (spannable == null) {
                return false;
            }
            // check if image span was tapped
            WPImageSpan[] imageSpans = spannable.getSpans(charPosition, charPosition, WPImageSpan.class);
            if (imageSpans.length != 0) {
                final WPImageSpan imageSpan = imageSpans[0];
                MediaFile mediaFile = imageSpan.getMediaFile();
                if (mediaFile == null)
                    return false;
                if (!mediaFile.isVideo()) {
                    LayoutInflater factory = LayoutInflater.from(getActivity());
                    final View alertView = factory.inflate(R.layout.alert_image_options, null);
                    if (alertView == null)
                        return false;
                    final EditText imageWidthText = (EditText) alertView.findViewById(R.id.imageWidthText);
                    final EditText titleText = (EditText) alertView.findViewById(R.id.title);
                    final EditText caption = (EditText) alertView.findViewById(R.id.caption);
                    final CheckBox featuredCheckBox = (CheckBox) alertView.findViewById(R.id.featuredImage);
                    final CheckBox featuredInPostCheckBox = (CheckBox) alertView.findViewById(R.id.featuredInPost);
                    // show featured image checkboxes if supported
                    if (mFeaturedImageSupported) {
                        featuredCheckBox.setVisibility(View.VISIBLE);
                        featuredInPostCheckBox.setVisibility(View.VISIBLE);
                    }
                    featuredCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                        @Override
                        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                            if (isChecked) {
                                featuredInPostCheckBox.setVisibility(View.VISIBLE);
                            } else {
                                featuredInPostCheckBox.setVisibility(View.GONE);
                            }
                        }
                    });
                    final SeekBar seekBar = (SeekBar) alertView.findViewById(R.id.imageWidth);
                    final Spinner alignmentSpinner = (Spinner) alertView.findViewById(R.id.alignment_spinner);
                    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.alignment_array, android.R.layout.simple_spinner_item);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    alignmentSpinner.setAdapter(adapter);
                    seekBar.setProgress(mediaFile.getWidth());
                    titleText.setText(mediaFile.getTitle());
                    caption.setText(mediaFile.getCaption());
                    featuredCheckBox.setChecked(mediaFile.isFeatured());
                    if (mediaFile.isFeatured()) {
                        featuredInPostCheckBox.setVisibility(View.VISIBLE);
                    } else {
                        featuredInPostCheckBox.setVisibility(View.GONE);
                    }
                    featuredInPostCheckBox.setChecked(mediaFile.isFeaturedInPost());
                    alignmentSpinner.setSelection(mediaFile.getHorizontalAlignment(), true);
                    final int maxWidth = MediaUtils.getMaximumImageWidth(getActivity(), imageSpan.getImageSource(), mBlogSettingMaxImageWidth);
                    seekBar.setMax(maxWidth / 10);
                    imageWidthText.setText(String.format(Locale.US, "%dpx", maxWidth));
                    if (mediaFile.getWidth() != 0) {
                        seekBar.setProgress(mediaFile.getWidth() / 10);
                    }
                    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

                        @Override
                        public void onStopTrackingTouch(SeekBar seekBar) {
                        }

                        @Override
                        public void onStartTrackingTouch(SeekBar seekBar) {
                        }

                        @Override
                        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                            if (progress == 0) {
                                progress = 1;
                            }
                            imageWidthText.setText(String.format(Locale.US, "%dpx", progress * 10));
                        }
                    });
                    imageWidthText.setOnFocusChangeListener(new View.OnFocusChangeListener() {

                        @Override
                        public void onFocusChange(View v, boolean hasFocus) {
                            if (hasFocus) {
                                imageWidthText.setText("");
                            }
                        }
                    });
                    imageWidthText.setOnEditorActionListener(new TextView.OnEditorActionListener() {

                        @Override
                        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                            int width = getEditTextIntegerClamped(imageWidthText, 10, maxWidth);
                            seekBar.setProgress(width / 10);
                            imageWidthText.setSelection((String.valueOf(width).length()));
                            InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                            imm.hideSoftInputFromWindow(imageWidthText.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
                            return true;
                        }
                    });
                    showImageSettings(alertView, titleText, caption, imageWidthText, featuredCheckBox, featuredInPostCheckBox, maxWidth, alignmentSpinner, imageSpan);
                    mScrollDetected = false;
                    return true;
                }
            } else {
                mContentEditText.setMovementMethod(ArrowKeyMovementMethod.getInstance());
                int selectionStart = mContentEditText.getSelectionStart();
                if (selectionStart >= 0 && mContentEditText.getSelectionEnd() >= selectionStart)
                    mContentEditText.setSelection(selectionStart, mContentEditText.getSelectionEnd());
            }
            // get media gallery spans
            MediaGalleryImageSpan[] gallerySpans = spannable.getSpans(charPosition, charPosition, MediaGalleryImageSpan.class);
            if (gallerySpans.length > 0) {
                final MediaGalleryImageSpan gallerySpan = gallerySpans[0];
                Intent intent = new Intent(ACTION_MEDIA_GALLERY_TOUCHED);
                intent.putExtra(EXTRA_MEDIA_GALLERY, gallerySpan.getMediaGallery());
                getActivity().sendBroadcast(intent);
            }
        }
    } else if (event.getAction() == 1) {
        mScrollDetected = false;
    }
    return false;
}
Also used : Spinner(android.widget.Spinner) InputMethodManager(android.view.inputmethod.InputMethodManager) KeyEvent(android.view.KeyEvent) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) MediaFile(org.wordpress.android.util.helpers.MediaFile) WPEditText(org.wordpress.android.util.widgets.WPEditText) EditText(android.widget.EditText) SeekBar(android.widget.SeekBar) WPImageSpan(org.wordpress.android.util.helpers.WPImageSpan) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) Layout(android.text.Layout) CheckBox(android.widget.CheckBox) LayoutInflater(android.view.LayoutInflater) MediaGalleryImageSpan(org.wordpress.android.util.helpers.MediaGalleryImageSpan) Spannable(android.text.Spannable) CompoundButton(android.widget.CompoundButton)

Aggregations

SeekBar (android.widget.SeekBar)338 TextView (android.widget.TextView)159 View (android.view.View)135 Intent (android.content.Intent)45 ImageView (android.widget.ImageView)43 LinearLayout (android.widget.LinearLayout)37 CompoundButton (android.widget.CompoundButton)35 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)34 DialogInterface (android.content.DialogInterface)29 SuppressLint (android.annotation.SuppressLint)28 AdapterView (android.widget.AdapterView)28 Paint (android.graphics.Paint)22 OnClickListener (android.view.View.OnClickListener)21 Button (android.widget.Button)20 LayoutInflater (android.view.LayoutInflater)19 FrameLayout (android.widget.FrameLayout)19 SharedPreferences (android.content.SharedPreferences)18 AlertDialog (android.support.v7.app.AlertDialog)18 AlertDialog (android.app.AlertDialog)15 Bundle (android.os.Bundle)15