List of usage examples for android.widget SeekBar setMax
@Override public synchronized void setMax(int max)
From source file:com.esri.arcgisruntime.generateofflinemapoverrides.MainActivity.java
/** * Builds a seek bar and handles updating of the associated current seek bar text view. * * @param seekBar view to build * @param currSeekBarTextView to be updated when the seek bar progress changes * @param max max value for the seek bar * @param progress initial progress position of the seek bar * @return the built seek bar/* ww w. j a va 2s .c om*/ */ private static SeekBar buildSeekBar(SeekBar seekBar, TextView currSeekBarTextView, int max, int progress) { seekBar.setMax(max); seekBar.setProgress(progress); currSeekBarTextView.setText(String.valueOf(seekBar.getProgress())); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { currSeekBarTextView.setText(String.valueOf(progress)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); return seekBar; }
From source file:org.brandroid.openmanager.fragments.DialogHandler.java
public static AlertDialog showSeekBarDialog(final Context context, String title, int progress, int max, OnSeekBarChangeListener onSeekListener) { FrameLayout view = new FrameLayout(context); SeekBar sb = new SeekBar(context); view.addView(sb);//w w w.ja va 2 s . c o m view.setPadding(20, 20, 20, 20); sb.setOnSeekBarChangeListener(onSeekListener); sb.setProgress(progress); sb.setMax(max); return new AlertDialog.Builder(context).setTitle(title).setView(view).show(); }
From source file:fi.harism.anndblur.MainActivity.java
@Override @SuppressWarnings("deprecation") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main);/* w w w . j av a 2s. c o m*/ findViewById(R.id.button_left).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDrawerLayout.openDrawer(Gravity.LEFT); } }); findViewById(R.id.button_right).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDrawerLayout.openDrawer(Gravity.RIGHT); } }); int maxBlur = getWindowManager().getDefaultDisplay().getWidth() / 8; mFooterLayout = (BlurLinearLayout) findViewById(R.id.footer_layout); mFooterLayout.setBlurRadius(maxBlur / 2); SeekBar seekBar = (SeekBar) mFooterLayout.findViewById(R.id.seekbar_blur); seekBar.setMax(maxBlur); seekBar.setProgress(maxBlur / 2); 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) { mFooterLayout.setBlurRadius(progress + 1); } }); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setScrimColor(0x40000000); }
From source file:com.pixate.freestyle.fragment.ButtonsFragment.java
/** Set the volumn controling to seek bar */ private void setSeekBar(SeekBar seek) { AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); seek.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_RING)); seek.setProgress(m_nAlarmVolum);/* w ww . j av a 2s . co m*/ seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar arg0) { } @Override public void onStartTrackingTouch(SeekBar arg0) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean arg2) { m_nAlarmVolum = progress; AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamVolume(AudioManager.STREAM_RING, m_nAlarmVolum, AudioManager.FLAG_ALLOW_RINGER_MODES | AudioManager.FLAG_PLAY_SOUND); } }); }
From source file:uwp.cs.edu.parkingtracker.parking.ParkDialogFragment.java
/** * Called after onAttach as part of the fragment lifecycle. * * @param savedInstanceState//from w ww.j a v a2 s.c o m * @return */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder votePopup = new AlertDialog.Builder(getActivity()); votePopup.setTitle("How full is this zone?"); LinearLayout linear = new LinearLayout(getActivity()); linear.setOrientation(LinearLayout.VERTICAL); SeekBar fullnessSlider = new SeekBar(getActivity()); fullnessSlider.setMax(4); fullnessSlider.setPadding(50, 70, 50, -10); final TextView result = new TextView(getActivity()); result.setPadding(20, 10, 10, 10); result.setText("0 %"); linear.addView(fullnessSlider); linear.addView(result); votePopup.setView(linear); fullnessSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int fullness, boolean fromUser) { fullnessValue = fullness; result.setText(fullness * 25 + "%"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); votePopup.setPositiveButton("Send", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DatabaseExchange.sendVote(zID, fullnessValue * 25); dismiss(); } }); votePopup.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dismiss(); } }); return votePopup.create(); }
From source file:com.shinymayhem.radiopresets.FragmentPlayer.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (LOCAL_LOGV) log("onCreateView()", "v"); //inflate view from layout View view = inflater.inflate(R.layout.player_fragment, container, false); AudioManager audio = (AudioManager) this.getActivity().getSystemService(Context.AUDIO_SERVICE); SeekBar volumeSlider = (SeekBar) view.findViewById(R.id.volume_slider); //slider max = volume stream max volumeSlider.setMax(audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC)); //detect slider updates volumeSlider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { //update volume as slider is moved @Override/* w ww . ja va 2 s .c o m*/ public void onProgressChanged(SeekBar slider, int progress, boolean fromUser) { if (LOCAL_LOGV) log("onProgressChanged(): " + String.valueOf(progress), "v"); if (fromUser) //responding to touch slide event { mListener.setVolume(progress); } else //progress probably changed as a result of volume changing { } } @Override public void onStartTrackingTouch(SeekBar slider) { } @Override public void onStopTrackingTouch(SeekBar slider) { } }); return view; }
From source file:ca.mudar.parkcatcher.ui.fragments.NumberSeekBarFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ((ParkingApp) getActivity().getApplicationContext()).updateUiLanguage(); LayoutInflater factory = LayoutInflater.from(getActivity()); final View view = factory.inflate(R.layout.fragment_number_seekbar, null); final SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekbar_duration); final TextView vDurationValue = (TextView) view.findViewById(R.id.duration_value); seekbar.setMax(Const.DURATION_MAX - Const.DURATION_MIN); int currentDuration = mListener.getParkingDuration(); seekbar.setProgress(currentDuration - Const.DURATION_MIN); setDurationText(vDurationValue, currentDuration - Const.DURATION_MIN); seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override//w w w . j a v a 2s.com public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { setDurationText(vDurationValue, progress); } }); return new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.dialog_title_duration)) .setView(view).setPositiveButton(R.string.dialog_set, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { onDurationSet(seekbar); } }).setNegativeButton(R.string.dialog_cancel, null).create(); }
From source file:com.andryr.musicplayer.activities.EqualizerActivity.java
private void initBassBoost() { SeekBar bassBoost = (SeekBar) findViewById(R.id.bassboost_slider); bassBoost.setMax(AudioEffects.BASSBOOST_MAX_STRENGTH); bassBoost.setProgress(AudioEffects.getBassBoostStrength()); bassBoost.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override/*from ww w .j a va 2 s.co m*/ public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { AudioEffects.setBassBoostStrength((short) seekBar.getProgress()); } } }); }
From source file:com.example.levelup.core.app.example3.TipSelectorFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); SeekBar tipSelector = (SeekBar) view.findViewById(R.id.tip_selector); mTipValueView = (TextView) view.findViewById(R.id.tip_value); // The progress on the SeekBar represents the indices of valid tip values. tipSelector.setMax(ALLOWED_TIPS.length - 1); tipSelector.setOnSeekBarChangeListener(mOnSeekBarChange); mOnSeekBarChange.onProgressChanged(tipSelector, 0, false); }
From source file:com.esri.arcgisruntime.sample.hillshaderenderer.ParametersDialogFragment.java
/** * Builds a parameter dialog box with values pulled through from MainActivity. * @param savedInstanceState bundle holding previous activity's saved state * @return create parameter dialog box/*w w w . j a va 2 s .c om*/ */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); Bundle hillshadeParameters = getArguments(); if (hillshadeParameters != null) { mAltitude = hillshadeParameters.getInt("altitude"); mAzimuth = hillshadeParameters.getInt("azimuth"); mSlopeType = (SlopeType) hillshadeParameters.getSerializable("slope_type"); } AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext()); @SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.hillshade_dialog_box, null); paramDialog.setView(dialogView); paramDialog.setTitle(R.string.dialog_title); paramDialog.setNegativeButton("Cancel", (dialog, which) -> dismiss()); paramDialog.setPositiveButton("Render", (dialog, which) -> { ParametersListener activity = (ParametersListener) getActivity(); activity.returnParameters(mAltitude, mAzimuth, mSlopeType); }); mCurrAltitudeTextView = dialogView.findViewById(R.id.hillshade_curr_altitude_text); SeekBar altitudeSeekBar = dialogView.findViewById(R.id.hillshade_altitude_seek_bar); altitudeSeekBar.setMax(90); //altitude is restricted to 0 - 90 //set initial altitude value updateAltitudeSeekBar(altitudeSeekBar); altitudeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mAltitude = progress; updateAltitudeSeekBar(seekBar); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); mCurrAzimuthTextView = dialogView.findViewById(R.id.hillshade_curr_azimuth_text); SeekBar azimuthSeekBar = dialogView.findViewById(R.id.hillshade_azimuth_seek_bar); azimuthSeekBar.setMax(360); //azimuth measured in degrees 0 - 360 //set initial azimuth value updateAzimuthSeekBar(azimuthSeekBar); azimuthSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mAzimuth = progress; updateAzimuthSeekBar(seekBar); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); List<String> slopeTypeArray = new ArrayList<>(); slopeTypeArray.add("None"); //ordinals:0 slopeTypeArray.add("Degree"); //1 slopeTypeArray.add("Percent rise"); //2 slopeTypeArray.add("Scaled"); //3 ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.hillshade_spinner_text_view, slopeTypeArray); Spinner slopeTypeSpinner = dialogView.findViewById(R.id.hillshade_slope_type_spinner); slopeTypeSpinner.setAdapter(spinnerAdapter); slopeTypeSpinner.setSelection(mSlopeType.ordinal()); slopeTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mSlopeType = SlopeType.NONE; break; case 1: mSlopeType = SlopeType.DEGREE; break; case 2: mSlopeType = SlopeType.PERCENT_RISE; break; case 3: mSlopeType = SlopeType.SCALED; break; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); return paramDialog.create(); }