Android Open Source - QuMixDroid Bound Mix Seekbar






From Project

Back to project page QuMixDroid.

License

The source code is released under:

GNU General Public License

If you think the Android project QuMixDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*******************************************************************************
 * Copyright (c) 2013 george wieggers./* w  w w  .  j  ava2  s .  c o  m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     george wieggers - initial API and implementation
 ******************************************************************************/
package org.wieggers.qu_apps.controls.bound;

import org.wieggers.qu_apps.qu16.Qu16_MixValue;
import org.wieggers.qu_apps.qu16.Qu16_MixValue.IMixValueListener;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.SeekBar;

public class BoundMixSeekbar extends SeekBar implements IMixValueListener, android.widget.SeekBar.OnSeekBarChangeListener { 

  protected Qu16_MixValue mBoundMixValue;

  public BoundMixSeekbar(Context context) {

    super(context);
    init();
  }

  public BoundMixSeekbar(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
  }
  
  public BoundMixSeekbar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    init();
  }

  private void init() {
    setMax(0x4A);
    setOnSeekBarChangeListener(this);
  }

  @Override
  public void valueChanged(final byte value) {
    this.post(new Runnable() {
      
      @Override
      public void run() {
        setProgress(value);
      }
    });    
  }

  @Override
  public void connect(Qu16_MixValue mixValue) {
    if (mBoundMixValue != null) {
      mBoundMixValue.removeListener(this);
    }
    
    final int visible;
    mBoundMixValue = mixValue;
    if (mBoundMixValue != null) {
      mBoundMixValue.addListener(this);
      setProgress(mixValue.getValue());
      visible = VISIBLE;
    } else {
      visible = INVISIBLE;
    }        

    this.post(new Runnable() {
      
      @Override
      public void run() {
        setVisibility(visible);
      }
    });
  }

  @Override
  public void onProgressChanged(SeekBar seekBar, int progress,
      boolean fromUser) {
    if (fromUser) {
      if (mBoundMixValue != null) {
        mBoundMixValue.setValue(this, (byte) progress );
      }
    }    
  }

  @Override
  public void onStartTrackingTouch(SeekBar seekBar) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void onStopTrackingTouch(SeekBar seekBar) {
    // TODO Auto-generated method stub
    
  }

}




Java Source Code List

org.wieggers.qu_apps.communication.Connected_Device.java
org.wieggers.qu_apps.controls.Fader.java
org.wieggers.qu_apps.controls.RotaryKnob.java
org.wieggers.qu_apps.controls.bound.BoundMixFader.java
org.wieggers.qu_apps.controls.bound.BoundMixRotaryKnob.java
org.wieggers.qu_apps.controls.bound.BoundMixSeekbar.java
org.wieggers.qu_apps.controls.bound.BoundMixToggleButton.java
org.wieggers.qu_apps.controls.bound.BoundMuteToggleButton.java
org.wieggers.qu_apps.qu16.Qu16_MeteringValues.java
org.wieggers.qu_apps.qu16.Qu16_Midi_Parser.java
org.wieggers.qu_apps.qu16.Qu16_MixValue.java
org.wieggers.qu_apps.qu16.Qu16_Mixer.java
org.wieggers.qu_apps.qu16.Qu16_UI.java
org.wieggers.qu_apps.qu16.midi.Qu16_GEQ_Bands.java
org.wieggers.qu_apps.qu16.midi.Qu16_Id_Parameters.java
org.wieggers.qu_apps.qu16.midi.Qu16_Input_Channels.java
org.wieggers.qu_apps.qu16.midi.Qu16_VA_Ranges.java
org.wieggers.qu_apps.qu16.midi.Qu16_VX_Buses.java
org.wieggers.qu_apps.qumixdroid.ConnectingFragment.java
org.wieggers.qu_apps.qumixdroid.LoginActivity.java
org.wieggers.qu_apps.qumixdroid.MainActivity.java
org.wieggers.qu_apps.qumixdroid.MixerFragment.java