List of usage examples for android.widget SeekBar setOnSeekBarChangeListener
public void setOnSeekBarChangeListener(OnSeekBarChangeListener l)
From source file:com.z299studio.pb.PasswordGenerator.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Application.getInstance() == null || Application.getInstance().getAccountManager() == null) { return null; }/* ww w . j a va 2 s. co m*/ View rootView = inflater.inflate(R.layout.dialog_pwd_generator, container, false); Button ok = (Button) rootView.findViewById(R.id.ok); ok.setOnClickListener(this); mPasswordView = (TextView) rootView.findViewById(R.id.text_pwd); mPasswordView.setOnClickListener(this); Button button = (Button) rootView.findViewById(R.id.cancel); button.setOnClickListener(this); button = (Button) rootView.findViewById(R.id.refresh); button.setOnClickListener(this); SeekBar sb = (SeekBar) rootView.findViewById(R.id.sb_length); tintSeekBar(sb); sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mLength = progress + 4; mLengthTitle.setText(getResources().getString(R.string.length, mLength)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); mLengthTitle = (TextView) rootView.findViewById(R.id.tv_length); mCheckBoxes = new CheckBox[4]; int ids[] = { R.id.cb_uppercase, R.id.cb_lowercase, R.id.cb_digit, R.id.cb_char }; for (int i = 0; i < mCheckBoxes.length; ++i) { mCheckBoxes[i] = (CheckBox) rootView.findViewById(ids[i]); } if (mType == AccountManager.EntryType.PIN) { mCheckBoxes[0].setChecked(false); mCheckBoxes[1].setChecked(false); mCheckBoxes[3].setChecked(false); mLength = 6; mPasswordView.setText(Application.generate(false, false, true, false, false, 6, 6)); sb.setProgress(2); mLengthTitle.setText(getResources().getString(R.string.length, 6)); } else { mPasswordView.setText(Application.generate(true, true, true, true, true, 10, 10)); sb.setProgress(6); mLength = 10; mLengthTitle.setText(getResources().getString(R.string.length, 10)); } return rootView; }
From source file:com.echo.holographlibrarysample.PieFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.fragment_piegraph, container, false); final Resources resources = getResources(); final PieGraph pg = (PieGraph) v.findViewById(R.id.piegraph); final Button animateButton = (Button) v.findViewById(R.id.animatePieButton); PieSlice slice = new PieSlice(); slice.setColor(resources.getColor(R.color.green_light)); slice.setSelectedColor(resources.getColor(R.color.transparent_orange)); slice.setValue(2);/*www . ja va 2 s . co m*/ slice.setTitle("first"); pg.addSlice(slice); slice = new PieSlice(); slice.setColor(resources.getColor(R.color.orange)); slice.setValue(3); pg.addSlice(slice); slice = new PieSlice(); slice.setColor(resources.getColor(R.color.purple)); slice.setValue(8); pg.addSlice(slice); pg.setOnSliceClickedListener(new OnSliceClickedListener() { @Override public void onClick(int index) { Toast.makeText(getActivity(), "Slice " + index + " clicked", Toast.LENGTH_SHORT).show(); } }); Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); pg.setBackgroundBitmap(b); SeekBar seekBar = (SeekBar) v.findViewById(R.id.seekBarRatio); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { pg.setInnerCircleRatio(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); seekBar = (SeekBar) v.findViewById(R.id.seekBarPadding); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { pg.setPadding(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) animateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { for (PieSlice s : pg.getSlices()) s.setGoalValue((float) Math.random() * 10); pg.setDuration(1000);//default if unspecified is 300 ms pg.setInterpolator(new AccelerateDecelerateInterpolator());//default if unspecified is linear; constant speed pg.setAnimationListener(getAnimationListener()); pg.animateToGoalValues();//animation will always overwrite. Pass true to call the onAnimationCancel Listener with onAnimationEnd } }); return v; }
From source file:eu.geopaparazzi.core.ui.dialogs.AddNoteLayoutDialogFragment.java
@Override public Dialog onCreateDialog(Bundle bundle) { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); int gridColumnCount = preferences.getInt(AddNotesActivity.PREFS_KEY_GUICOLUMNCOUNT, AddNotesActivity.DEFAULT_GUICOLUMNCOUNT); int textsizeFactor = preferences.getInt(AddNotesActivity.PREFS_KEY_GUITEXTSIZEFACTOR, AddNotesActivity.DEFAULT_GUITEXTSIZEFACTOR); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View labelDialogView = getActivity().getLayoutInflater().inflate(R.layout.fragment_dialog_addnote_layout, null);//ww w .j a v a 2 s .c o m builder.setView(labelDialogView); mSizeTextView = labelDialogView.findViewById(R.id.sizeFactorTextView); mSizeTextView.setText(String.valueOf(textsizeFactor)); SeekBar mSizeSeekBar = labelDialogView.findViewById(R.id.sizeFactorSeekBar); mSizeSeekBar.setOnSeekBarChangeListener(sizeChanged); mSizeSeekBar.setProgress(textsizeFactor); mColumnTextView = labelDialogView.findViewById(R.id.columnTextView); mColumnTextView.setText(String.valueOf(gridColumnCount)); SeekBar mColumnSeekBar = labelDialogView.findViewById(R.id.columnSeekBar); mColumnSeekBar.setOnSeekBarChangeListener(columnChanged); mColumnSeekBar.setProgress(gridColumnCount); builder.setPositiveButton(R.string.set_properties, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { SharedPreferences.Editor editor = preferences.edit(); int col = 1; try { col = Integer.parseInt(mColumnTextView.getText().toString()); } catch (Exception e) { //ignore } editor.putInt(AddNotesActivity.PREFS_KEY_GUICOLUMNCOUNT, col); int sizeFactor = 1; try { sizeFactor = Integer.parseInt(mSizeTextView.getText().toString()); } catch (Exception e) { //ignore } editor.putInt(AddNotesActivity.PREFS_KEY_GUITEXTSIZEFACTOR, sizeFactor); editor.commit(); if (layoutChangeListener != null) { layoutChangeListener.onPropertiesChanged(); } } }); builder.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); return builder.create(); // return dialog }
From source file:eu.geopaparazzi.library.core.dialogs.LabelDialogFragment.java
@Override public Dialog onCreateDialog(Bundle bundle) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View labelDialogView = getActivity().getLayoutInflater().inflate(R.layout.fragment_dialog_label, null); builder.setView(labelDialogView);/* w w w. jav a 2 s .c o m*/ CheckBox visibilityCheckBox = (CheckBox) labelDialogView.findViewById(R.id.checkVisibility); visibilityCheckBox.setChecked(mCurrentLabelObject.hasLabel); visibilityCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mCurrentLabelObject.hasLabel = isChecked; } }); mSizeTextView = (TextView) labelDialogView.findViewById(R.id.sizeTextView); mSizeTextView.setText(String.valueOf(mCurrentLabelObject.labelSize)); SeekBar mSizeSeekBar = (SeekBar) labelDialogView.findViewById(R.id.sizeSeekBar); mSizeSeekBar.setOnSeekBarChangeListener(sizeChanged); mSizeSeekBar.setProgress(mCurrentLabelObject.labelSize); List<String> labelFieldsList = mCurrentLabelObject.labelFieldsList; int index = 0; for (int i = 0; i < labelFieldsList.size(); i++) { if (labelFieldsList.get(i).equals(mCurrentLabelObject.label)) { index = i; break; } } final Spinner fieldsSpinner = (Spinner) labelDialogView.findViewById(R.id.labelFieldSpinner); ArrayAdapter<String> fieldsSpinnerAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, labelFieldsList); fieldsSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); fieldsSpinner.setAdapter(fieldsSpinnerAdapter); fieldsSpinner.setSelection(index); fieldsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Object selectedItem = fieldsSpinner.getSelectedItem(); String fieldStr = selectedItem.toString(); mCurrentLabelObject.label = fieldStr; } public void onNothingSelected(AdapterView<?> arg0) { // ignore } }); builder.setPositiveButton(R.string.set_properties, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (labelPropertiesChangeListener != null) { labelPropertiesChangeListener.onPropertiesChanged(mCurrentLabelObject); } } }); builder.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); return builder.create(); // return dialog }
From source file:com.github.jorgecastillo.FillableLoaderPage.java
private void setupFillableLoader(int pageNum) { if (pageNum == 3) { int viewSize = getResources().getDimensionPixelSize(R.dimen.fourthSampleViewSize); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(viewSize, viewSize); params.gravity = Gravity.CENTER; FillableLoaderBuilder loaderBuilder = new FillableLoaderBuilder(); fillableLoader = loaderBuilder.parentView((FrameLayout) rootView).svgPath(Paths.JOB_AND_TALENT) .layoutParams(params).originalDimensions(970, 970).strokeColor(Color.parseColor("#1c9ade")) .fillColor(Color.parseColor("#1c9ade")).strokeDrawingDuration(2000) .clippingTransform(new WavesClippingTransform()).fillDuration(10000).build(); } else if (pageNum == 6) { int viewSize = getResources().getDimensionPixelSize(R.dimen.fourthSampleViewSize); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(viewSize, viewSize); params.gravity = Gravity.CENTER; SeekBar mSeekbar = (SeekBar) rootView.findViewById(R.id.PercentageSeekBar); mSeekbar.setProgress(mPercentage); mSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { mPercentage = progress;/*from w w w .j a v a 2s . com*/ fillableLoader.setPercentage(progress); } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { } }); FillableLoaderBuilder loaderBuilder = new FillableLoaderBuilder(); fillableLoader = loaderBuilder.parentView((FrameLayout) rootView).svgPath(Paths.JOB_AND_TALENT) .layoutParams(params).percentage(mPercentage).originalDimensions(970, 970) .strokeColor(Color.parseColor("#1c9ade")).fillColor(Color.parseColor("#1c9ade")) .strokeDrawingDuration(2000).clippingTransform(new WavesClippingTransform()).fillDuration(10000) .build(); } else { fillableLoader.setSvgPath(pageNum == 0 ? Paths.INDOMINUS_REX : pageNum == 1 ? Paths.RONALDO : pageNum == 2 ? Paths.SEGA : pageNum == 4 ? Paths.COCA_COLA : Paths.GITHUB); } fillableLoader.setOnStateChangeListener(this); }
From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java
/** * Generates the initial track {@link android.widget.SeekBar}. * * @param view The view in which to setup the {@code SeekBar} for. * @return The constructed SeekBar for the track position modification. *//*from ww w. j a v a 2 s. co m*/ private static SeekBar getTrackSeekBar(final View view) { final SeekBar.OnSeekBarChangeListener seekBarTrackListener = new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) { } @Override public void onStartTrackingTouch(final SeekBar seekBar) { } @Override public void onStopTrackingTouch(final SeekBar seekBar) { MPDControl.run(MPDControl.ACTION_SEEK, seekBar.getProgress()); } }; final SeekBar seekBarTrack = (SeekBar) view.findViewById(R.id.progress_track); seekBarTrack.setOnSeekBarChangeListener(seekBarTrackListener); return seekBarTrack; }
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);/*from w w w.j a v a2 s.c o 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:de.enlightened.peris.ColorPickerDialogFragment.java
private void setupColorPicker(final View v) { final Bundle bundle = getArguments(); if (bundle != null) { if (bundle.containsKey("show_opacity")) { this.showOpacity = bundle.getBoolean("show_opacity"); }// w w w . j av a 2 s . co m } this.colorPickerColorsLayout = (LinearLayout) v.findViewById(R.id.color_picker_colors_layout); final LinearLayout opacityLayout = (LinearLayout) v.findViewById(R.id.color_picker_opacity_layout); if (this.showOpacity) { opacityLayout.setVisibility(View.VISIBLE); final SeekBar colorOpacitySeeker = (SeekBar) v.findViewById(R.id.color_opacity_seeker); colorOpacitySeeker.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override @SuppressWarnings("checkstyle:requirethis") public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) { // TODO Auto-generated method stub opacity = progress; final float opacityPercent = progress / (float) MAX_OPACITY; //Log.d(TAG ,progress + "/255 = " + opacityPercent); colorPickerColorsLayout.setAlpha(opacityPercent); } @Override public void onStartTrackingTouch(final SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(final SeekBar seekBar) { // TODO Auto-generated method stub } }); } else { opacityLayout.setVisibility(View.GONE); } final LinearLayout llPicker = (LinearLayout) v.findViewById(R.id.profileColorPicker); llPicker.setVisibility(View.VISIBLE); v.findViewById(R.id.pickColor1).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor2).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor3).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor4).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor5).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor6).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor7).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor8).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor9).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor10).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor11).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor12).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor13).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor14).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor15).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor16).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor17).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor18).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor19).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor20).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor21).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor22).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor23).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor24).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor25).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor26).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor27).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor28).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor29).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor30).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor31).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor32).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor33).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor34).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor35).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor36).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor37).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor38).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor39).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor40).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor41).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor42).setOnClickListener(this.colorSetter); }
From source file:moe.yukinoneko.gcomic.module.gallery.external.ExternalGalleryActivity.java
@Override public void init() { mDecorView = getWindow().getDecorView(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) bottomBar.getLayoutParams(); lp.setMargins(0, 0, 0, Utils.getNavigationBarHeight(this)); }/*from w w w. j a v a 2 s . com*/ galleryPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { seekBar.setProgress(position); curPage.setText(String.valueOf(position + 1)); } @Override public void onPageScrollStateChanged(int state) { } }); mPagerAdapter = new ExternalGalleryPagerAdapter(getSupportFragmentManager()); galleryPager.setAdapter(mPagerAdapter); seekBar.setKeyProgressIncrement(1); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { int progress = 0; @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { progress = i; } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { galleryPager.setCurrentItem(progress, false); } }); curPage.setText("1"); String path = FileUtlis.getPath(this, getIntent().getData()); mToolbar.setTitle(path != null ? path.substring(path.lastIndexOf("/") + 1) : "No Title"); presenter.fetchPicturesFromDisk(path); }
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 w w .ja va2 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; }