Android Open Source - android-mimic-ui U I Volume Control Item






From Project

Back to project page android-mimic-ui.

License

The source code is released under:

Apache License

If you think the Android project android-mimic-ui 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

package com.mimic.ui.tableview.support;
/*  w w  w.  j  av a  2 s.  c  om*/
import android.content.Context;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

import com.mimic.ui.R;
import com.mimic.ui.tableview.UITableViewItem;

public class UIVolumeControlItem extends UITableViewItem {
  
  private SeekBar mSliderView = null;
  
  public UIVolumeControlItem(Context context, String label) {
    super(context, label);
    setStyle(STYLE_NONE);
    setupSliderViews();
  }
  
  void setupSliderViews() {
    LinearLayout volumeControlItemContentView = (LinearLayout) getInflater().inflate(
        R.layout.uivolumecontrolitem, null);
    mSliderView = (SeekBar) volumeControlItemContentView.findViewById(R.id.slider);
    getContentView().removeAllViews();
    getContentView().addView(volumeControlItemContentView);
  }
  
  public interface OnVolumeChangeListener {
    public void onVolumeChanged(UIVolumeControlItem sliderItem, int value, boolean fromUser);
  }
  
  public void setOnVolumeChangeListener(final OnVolumeChangeListener listener) {
    mSliderView.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
      
      @Override
      public void onStopTrackingTouch(SeekBar seekBar) {
      }
      
      @Override
      public void onStartTrackingTouch(SeekBar seekBar) {
      }
      
      @Override
      public void onProgressChanged(SeekBar seekBar, int progress,
          boolean fromUser) {
        listener.onVolumeChanged(UIVolumeControlItem.this, progress, fromUser);
      }
    });
  }
  
  public ProgressBar getSliderView() {
    return mSliderView;
  }
  
  public int getValue() {
    return mSliderView.getProgress();
  }
  
  public void setValue(int value) {
    mSliderView.setProgress(value);
  }
  
  @Override
  public boolean isClickable() {
    return false;
  }

  @Override
  public void setClickable(boolean clickable) {
    // do nothing
  }
}




Java Source Code List

com.mimic.ui.tableview.IListItem.java
com.mimic.ui.tableview.UITableViewActivity.java
com.mimic.ui.tableview.UITableViewItem.java
com.mimic.ui.tableview.UITableViewSection.java
com.mimic.ui.tableview.UITableView.java
com.mimic.ui.tableview.support.UIButtonItem.java
com.mimic.ui.tableview.support.UIMultiChoiceListSection.java
com.mimic.ui.tableview.support.UIProgressItem.java
com.mimic.ui.tableview.support.UISingleChoiceListSection.java
com.mimic.ui.tableview.support.UISliderItem.java
com.mimic.ui.tableview.support.UISwitchItem.java
com.mimic.ui.tableview.support.UITextInputItem.java
com.mimic.ui.tableview.support.UIVolumeControlItem.java