Search in sources :

Example 36 with SeekBar

use of android.widget.SeekBar in project android_frameworks_base by AOSPA.

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 37 with SeekBar

use of android.widget.SeekBar in project android_frameworks_base by AOSPA.

the class BassBoostTest method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    SeekBar seekBar;
    TextView textView;
    setContentView(R.layout.bassboosttest);
    mSessionText = (EditText) findViewById(R.id.sessionEdit);
    mSessionText.setOnKeyListener(mSessionKeyListener);
    mSessionText.setText(Integer.toString(sSession));
    mReleaseButton = (ToggleButton) findViewById(R.id.bbReleaseButton);
    mOnOffButton = (ToggleButton) findViewById(R.id.bassboostOnOff);
    getEffect(sSession);
    if (mBassBoost != null) {
        mReleaseButton.setOnCheckedChangeListener(this);
        mOnOffButton.setOnCheckedChangeListener(this);
        textView = (TextView) findViewById(R.id.bbStrengthMin);
        textView.setText("0");
        textView = (TextView) findViewById(R.id.bbStrengthMax);
        textView.setText("1000");
        seekBar = (SeekBar) findViewById(R.id.bbStrengthSeekBar);
        textView = (TextView) findViewById(R.id.bbStrengthValue);
        mStrength = new BassBoostParam(mBassBoost, 0, 1000, seekBar, textView);
        seekBar.setOnSeekBarChangeListener(mStrength);
        mStrength.setEnabled(mBassBoost.getStrengthSupported());
    }
}
Also used : SeekBar(android.widget.SeekBar) TextView(android.widget.TextView)

Example 38 with SeekBar

use of android.widget.SeekBar in project muzei by romannurik.

the class SettingsAdvancedFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.settings_advanced_fragment, container, false);
    mBlurSeekBar = (SeekBar) rootView.findViewById(R.id.blur_amount);
    mBlurSeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_BLUR_AMOUNT, MuzeiBlurRenderer.DEFAULT_BLUR));
    mBlurSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
            if (fromUser) {
                mHandler.removeCallbacks(mUpdateBlurRunnable);
                mHandler.postDelayed(mUpdateBlurRunnable, 750);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mDimSeekBar = (SeekBar) rootView.findViewById(R.id.dim_amount);
    mDimSeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_DIM_AMOUNT, MuzeiBlurRenderer.DEFAULT_MAX_DIM));
    mDimSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
            if (fromUser) {
                mHandler.removeCallbacks(mUpdateDimRunnable);
                mHandler.postDelayed(mUpdateDimRunnable, 750);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    mGreySeekBar = (SeekBar) rootView.findViewById(R.id.grey_amount);
    mGreySeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_GREY_AMOUNT, MuzeiBlurRenderer.DEFAULT_GREY));
    mGreySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
            if (fromUser) {
                mHandler.removeCallbacks(mUpdateGreyRunnable);
                mHandler.postDelayed(mUpdateGreyRunnable, 750);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    CheckBox mNotifyNewWallpaperCheckBox = (CheckBox) rootView.findViewById(R.id.notify_new_wallpaper_checkbox);
    mNotifyNewWallpaperCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton button, boolean checked) {
            PreferenceManager.getDefaultSharedPreferences(getContext()).edit().putBoolean(NewWallpaperNotificationReceiver.PREF_ENABLED, checked).apply();
        }
    });
    mNotifyNewWallpaperCheckBox.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(NewWallpaperNotificationReceiver.PREF_ENABLED, true));
    CheckBox mBlurOnLockScreenCheckBox = (CheckBox) rootView.findViewById(R.id.blur_on_lockscreen_checkbox);
    mBlurOnLockScreenCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton button, boolean checked) {
            Prefs.getSharedPreferences(getContext()).edit().putBoolean(Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED, !checked).apply();
        }
    });
    mBlurOnLockScreenCheckBox.setChecked(!Prefs.getSharedPreferences(getContext()).getBoolean(Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED, false));
    return rootView;
}
Also used : SeekBar(android.widget.SeekBar) CheckBox(android.widget.CheckBox) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Example 39 with SeekBar

use of android.widget.SeekBar in project Shuttle by timusus.

the class EqualizerActivity method onCreate.

@SuppressLint("InlinedApi")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCreate(Bundle savedInstanceState) {
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    ThemeUtils.setTheme(this);
    if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        mTintManager = new SystemBarTintManager(this);
    }
    if (!ShuttleUtils.hasKitKat()) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    if (SettingsManager.getInstance().canTintNavBar()) {
        getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
    }
    super.onCreate(savedInstanceState);
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    setContentView(R.layout.activity_equalizer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ThemeUtils.themeActionBar(this);
    ThemeUtils.themeStatusBar(this, mTintManager);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getResources().getString(R.string.equalizer));
    try {
        //Query available effects
        final AudioEffect.Descriptor[] effects = AudioEffect.queryEffects();
        //Determine available/supported effects
        if (effects != null && effects.length != 0) {
            for (final AudioEffect.Descriptor effect : effects) {
                //Equalizer
                if (effect.type.equals(UUID.fromString(EFFECT_TYPE_EQUALIZER))) {
                    mEqualizerSupported = true;
                } else if (effect.type.equals(UUID.fromString(EFFECT_TYPE_BASS_BOOST))) {
                    mBassBoostSupported = true;
                } else if (effect.type.equals(UUID.fromString(EFFECT_TYPE_VIRTUALIZER))) {
                    mVirtualizerSupported = true;
                }
            }
        }
    } catch (NoClassDefFoundError ignored) {
    //The user doesn't have the AudioEffect/AudioEffect.Descriptor class. How sad.
    }
    mSpinner = (Spinner) findViewById(R.id.eqSpinner);
    mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mEqPreset = position;
            equalizerSetPreset(position);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    setupPresets();
    if (mSpinnerAdapter != null && mSpinnerAdapter.getCount() > mEqPreset) {
        mSpinner.setSelection(mEqPreset);
    }
    //Initialize the equalizer elements
    View eqContainer = findViewById(R.id.eqContainer);
    mNumberEqualizerBands = Integer.parseInt(mPrefs.getString("equalizer.number_of_bands", "5"));
    final int[] centerFreqs = getCenterFreqs();
    final int[] bandLevelRange = getBandLevelRange();
    for (int band = 0; band < mNumberEqualizerBands; band++) {
        //Unit conversion from mHz to Hz and use k prefix if necessary to display
        float centerFreqHz = centerFreqs[band] / 1000;
        String unitPrefix = "";
        if (centerFreqHz >= 1000) {
            centerFreqHz = centerFreqHz / 1000;
            unitPrefix = "k";
        }
        (eqContainer.findViewById(eqViewElementIds[band][0])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewTextElementIds[band][0])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewElementIds[band][1])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewTextElementIds[band][1])).setVisibility(View.VISIBLE);
        ((TextView) eqContainer.findViewById(eqViewElementIds[band][0])).setText(format("%.0f ", centerFreqHz) + unitPrefix + "Hz");
        mEqualizerSeekBar[band] = (SizableSeekBar) eqContainer.findViewById(eqViewElementIds[band][1]);
        ThemeUtils.themeSeekBar(this, mEqualizerSeekBar[band]);
        mEqualizerSeekBar[band].setMax((bandLevelRange[1] / 100) - (bandLevelRange[0] / 100));
        mEqualizerSeekBar[band].setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                if (fromUser) {
                    //Determine which band changed
                    int seekbarId = seekBar.getId();
                    int band = 0;
                    for (int i = 0; i < eqViewElementIds.length; i++) {
                        if (eqViewElementIds[i][1] == seekbarId) {
                            band = i;
                        }
                    }
                    if (mEqPreset != mEqCustomPresetPosition) {
                        equalizerCopyToCustom();
                        if (mSpinnerAdapter != null && mSpinnerAdapter.getCount() > mEqCustomPresetPosition) {
                            mSpinner.setSelection(mEqCustomPresetPosition);
                        }
                    } else {
                        int level = getBandLevelRange()[0] + (progress * 100);
                        equalizerBandUpdate(band, level);
                    }
                }
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
            }
        });
    }
    // Set the SeekBar listener.
    if (mBassBoostSupported) {
        final SizableSeekBar seekbar = (SizableSeekBar) findViewById(R.id.bb_strength);
        ThemeUtils.themeSeekBar(this, seekbar);
        seekbar.setMax(OpenSLESConstants.BASSBOOST_MAX_STRENGTH - OpenSLESConstants.BASSBOOST_MIN_STRENGTH);
        seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                // set parameter and state
                if (fromUser) {
                    mPrefs.edit().putBoolean("audiofx.bass.enable", true).apply();
                    mPrefs.edit().putString("audiofx.bass.strength", String.valueOf(progress)).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos was 0 when starting re-enable effect
            @Override
            public void onStartTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    mPrefs.edit().putBoolean("audiofx.bass.enable", true).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos = 0 when stopping disable effect
            @Override
            public void onStopTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    // disable
                    mPrefs.edit().putBoolean("audiofx.bass.enable", false).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }
        });
    }
    // Set the SeekBar listener.
    if (mVirtualizerSupported) {
        final SizableSeekBar seekbar = (SizableSeekBar) findViewById(R.id.virtualizer_strength);
        ThemeUtils.themeSeekBar(this, seekbar);
        seekbar.setMax(OpenSLESConstants.VIRTUALIZER_MAX_STRENGTH - OpenSLESConstants.VIRTUALIZER_MIN_STRENGTH);
        seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                // set parameter and state
                if (fromUser) {
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
                    mPrefs.edit().putString("audiofx.virtualizer.strength", String.valueOf(progress)).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos was 0 when starting re-enable effect
            @Override
            public void onStartTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos = 0 when stopping disable effect
            @Override
            public void onStopTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    // disable
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", false).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }
        });
    }
}
Also used : SizableSeekBar(com.simplecity.amp_library.ui.views.SizableSeekBar) SeekBar(android.widget.SeekBar) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) SizableSeekBar(com.simplecity.amp_library.ui.views.SizableSeekBar) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) AudioEffect(android.media.audiofx.AudioEffect) SuppressLint(android.annotation.SuppressLint) TargetApi(android.annotation.TargetApi)

Example 40 with SeekBar

use of android.widget.SeekBar in project Shuttle by timusus.

the class VideoCastControllerActivity method loadAndSetupViews.

private void loadAndSetupViews() {
    mPauseDrawable = getResources().getDrawable(R.drawable.ic_pause_circle_white_80dp);
    mPlayDrawable = getResources().getDrawable(R.drawable.ic_play_circle_white_80dp);
    mStopDrawable = getResources().getDrawable(R.drawable.ic_stop_circle_white_80dp);
    mPageView = findViewById(R.id.pageview);
    mPlayPause = (ImageButton) findViewById(R.id.play_pause_toggle);
    mLiveText = (TextView) findViewById(R.id.live_text);
    mStart = (TextView) findViewById(R.id.start_text);
    mEnd = (TextView) findViewById(R.id.end_text);
    mSeekbar = (SeekBar) findViewById(R.id.seekbar);
    mLine2 = (TextView) findViewById(R.id.textview2);
    mLoading = (ProgressBar) findViewById(R.id.progressbar1);
    mControllers = findViewById(R.id.controllers);
    mClosedCaptionIcon = (ImageButton) findViewById(R.id.cc);
    mSkipNext = (ImageButton) findViewById(R.id.next);
    mSkipPrevious = (ImageButton) findViewById(R.id.previous);
    mPlaybackControls = findViewById(R.id.playback_controls);
    ((MiniController) findViewById(R.id.miniController1)).setCurrentVisibility(false);
    setClosedCaptionState(CC_DISABLED);
    mPlayPause.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                mListener.onPlayPauseClicked(v);
            } catch (TransientNetworkDisconnectionException e) {
                LOGE(TAG, "Failed to toggle playback due to temporary network issue", e);
                Utils.showToast(VideoCastControllerActivity.this, R.string.ccl_failed_no_connection_trans);
            } catch (NoConnectionException e) {
                LOGE(TAG, "Failed to toggle playback due to network issues", e);
                Utils.showToast(VideoCastControllerActivity.this, R.string.ccl_failed_no_connection);
            } catch (Exception e) {
                LOGE(TAG, "Failed to toggle playback due to other issues", e);
                Utils.showToast(VideoCastControllerActivity.this, R.string.ccl_failed_perform_action);
            }
        }
    });
    mSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            try {
                if (mListener != null) {
                    mListener.onStopTrackingTouch(seekBar);
                }
            } catch (Exception e) {
                LOGE(TAG, "Failed to complete seek", e);
                finish();
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            try {
                if (mListener != null) {
                    mListener.onStartTrackingTouch(seekBar);
                }
            } catch (Exception e) {
                LOGE(TAG, "Failed to start seek", e);
                finish();
            }
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mStart.setText(Utils.formatMillis(progress));
            try {
                if (mListener != null) {
                    mListener.onProgressChanged(seekBar, progress, fromUser);
                }
            } catch (Exception e) {
                LOGE(TAG, "Failed to set the progress result", e);
            }
        }
    });
    mClosedCaptionIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                showTracksChooserDialog();
            } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                LOGE(TAG, "Failed to get the media", e);
            }
        }
    });
    mSkipNext.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                mListener.onSkipNextClicked(v);
            } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                LOGE(TAG, "Failed to move to the next item in the queue", e);
            }
        }
    });
    mSkipPrevious.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                mListener.onSkipPreviousClicked(v);
            } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
                LOGE(TAG, "Failed to move to the previous item in the queue", e);
            }
        }
    });
}
Also used : SeekBar(android.widget.SeekBar) NoConnectionException(com.google.android.libraries.cast.companionlibrary.cast.exceptions.NoConnectionException) MiniController(com.google.android.libraries.cast.companionlibrary.widgets.MiniController) OnClickListener(android.view.View.OnClickListener) TransientNetworkDisconnectionException(com.google.android.libraries.cast.companionlibrary.cast.exceptions.TransientNetworkDisconnectionException) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) TransientNetworkDisconnectionException(com.google.android.libraries.cast.companionlibrary.cast.exceptions.TransientNetworkDisconnectionException) NoConnectionException(com.google.android.libraries.cast.companionlibrary.cast.exceptions.NoConnectionException)

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