Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            DiscreteSeekBar discreteSeekBar1 = FindViewById <DiscreteSeekBar>(Resource.Id.discrete1);

            discreteSeekBar1.SetNumericTransformer(new SeekBarNumericTransformer());
        }
Exemple #2
0
    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);
            }
        };
    }