protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); seekBar = FindViewById <DiscreteSeekBar>(Resource.Id.discrete3); seekBar.SetOnProgressChangeListener(new OnProgressChangeListener { ProgressChanged = (seekBar, value, fromUser) => { if (((float)value) / seekBar.Max <= 0.6) { seekBar.SetScrubberColor(Color.ParseColor("#CE011A")); seekBar.SetThumbColor(Color.ParseColor("#CE011A"), Color.ParseColor("#CE011A")); } if ((((float)value) / seekBar.Max > 0.6) && (((float)value) / seekBar.Max <= 0.8)) { seekBar.SetScrubberColor(Color.ParseColor("#F5A623")); seekBar.SetThumbColor(Color.ParseColor("#F5A623"), Color.ParseColor("#F5A623")); } if (((float)value) / seekBar.Max > 0.8) { seekBar.SetScrubberColor(Color.ParseColor("#007E44")); seekBar.SetThumbColor(Color.ParseColor("#007E44"), Color.ParseColor("#007E44")); } } }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); DiscreteSeekBar discreteSeekBar1 = FindViewById <DiscreteSeekBar>(Resource.Id.discrete1); discreteSeekBar1.SetNumericTransformer(new SeekBarNumericTransformer()); }
public override void OnBindViewHolder(PreferenceViewHolder holder) { base.OnBindViewHolder(holder); ISharedPreferences prefManager = PreferenceManager.GetDefaultSharedPreferences(Application.Context); DiscreteSeekBar seekbar = holder.ItemView.FindViewById <DiscreteSeekBar>(Resource.Id.seekbar); seekbar.Progress = prefManager.GetInt("volumeMultiplier", 100); seekbar.SetNumericTransformer(new PercentTransform()); seekbar.ProgressChanged += (sender, e) => { bool FromUser = e.FromUser; int Progress = e.Value; ISharedPreferences pref = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = pref.Edit(); editor.PutInt("volumeMultiplier", Progress); editor.Apply(); if (MusicPlayer.instance != null) { MusicPlayer.instance.ChangeVolume(Progress / 100f); } }; }
public void OnStopTrackingTouch(DiscreteSeekBar p0) { }
public void OnProgressChanged(DiscreteSeekBar p0, int p1, bool p2) { ProgressChanged?.Invoke(p0, p1, p2); }