Java Code Examples for android.widget.SeekBar#getTag()

The following examples show how to use android.widget.SeekBar#getTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
/**
 * Notification that the user has finished a touch gesture. Clients may want to use this
 * to re-enable advancing the seekbar. 
 */
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
	final Object tag = seekBar.getTag();
       if (tag instanceof StreamResources) {
           StreamResources sr = (StreamResources) tag;
           // because remote volume updates are asynchronous, AudioService might have received
           // a new remote volume value since the finger adjusted the slider. So when the
           // progress of the slider isn't being tracked anymore, adjust the slider to the last
           // "published" remote volume value, so the UI reflects the actual volume.
           if (sr.getStreamType() == STREAM_REMOTE_MUSIC) {
               seekBar.setProgress(getStreamVolume(STREAM_REMOTE_MUSIC));
           }
       }
       onUserInteraction();
}
 
Example 2
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) return;
    if (isVirtualizerSupported() && seekBar.getId() == R.id.virtualizer) {
        virtualizer.setStrength((short) progress);
        LOGI(virtualizer.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (isBassBostSupported() && seekBar.getId() == R.id.bass_boost) {
        bassBoost.setStrength((short) progress);
        LOGI(bassBoost.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (null != equalizer) {
        Object tag = seekBar.getTag();
        if (tag instanceof Short) {
            short band = (Short) tag;
            equalizer.setBandLevel(band, (short) (progress + range[0]));
            LOGI(equalizer.getClass().getSimpleName(), "setBandLevel(" + (progress + range[0]) + ')');
        }
    }
    onUserInteraction();
}
 
Example 3
Source File: VolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
/**
 * Notification that the user has finished a touch gesture. Clients may want to use this
 * to re-enable advancing the seekbar. 
 */
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
	final Object tag = seekBar.getTag();
       if (tag instanceof StreamResources) {
           StreamResources sr = (StreamResources) tag;
           // because remote volume updates are asynchronous, AudioService might have received
           // a new remote volume value since the finger adjusted the slider. So when the
           // progress of the slider isn't being tracked anymore, adjust the slider to the last
           // "published" remote volume value, so the UI reflects the actual volume.
           if (sr.getStreamType() == STREAM_REMOTE_MUSIC) {
               seekBar.setProgress(getStreamVolume(STREAM_REMOTE_MUSIC));
           }
       }
       onUserInteraction();
}
 
Example 4
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) return;
    if (isVirtualizerSupported() && seekBar.getId() == R.id.virtualizer) {
        virtualizer.setStrength((short) progress);
        LOGI(virtualizer.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (isBassBostSupported() && seekBar.getId() == R.id.bass_boost) {
        bassBoost.setStrength((short) progress);
        LOGI(bassBoost.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (null != equalizer) {
        Object tag = seekBar.getTag();
        if (tag instanceof Short) {
            short band = (Short) tag;
            equalizer.setBandLevel(band, (short) (progress + range[0]));
            LOGI(equalizer.getClass().getSimpleName(), "setBandLevel(" + (progress + range[0]) + ')');
        }
    }
    onUserInteraction();
}
 
Example 5
Source File: ParanoidVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress,
                              boolean fromUser) {
    final Object tag = seekBar.getTag();
    if (fromUser && tag instanceof StreamControl) {
        StreamControl sc = (StreamControl) tag;
        if (getStreamVolume(sc.streamType) != progress) {
            LOGI(TAG, "setStreamVolume(" + sc.streamType + ", " + progress + ')');
            setStreamVolume(sc.streamType, progress);
        }
    }
    onUserInteraction();
}
 
Example 6
Source File: ParanoidVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public void onStopTrackingTouch(SeekBar seekBar) {
    final Object tag = seekBar.getTag();
    if (tag instanceof StreamControl) {
        StreamControl sc = (StreamControl) tag;
        // because remote volume updates are asynchronous, AudioService might have received
        // a new remote volume value since the finger adjusted the slider. So when the
        // progress of the slider isn't being tracked anymore, adjust the slider to the last
        // "published" remote volume value, so the UI reflects the actual volume.
        if (sc.streamType == STREAM_REMOTE_MUSIC) {
            seekBar.setProgress(getStreamVolume(STREAM_REMOTE_MUSIC));
        }
    }
}
 
Example 7
Source File: VolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/**
 * Notification that the progress level has changed. Clients can use the fromUser parameter
 * to distinguish user-initiated changes from those that occurred programmatically.
 */
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
       LOGD("VolumePanel", "onProgressChanged(" + progress + ")");
	final Object tag = seekBar.getTag();
       if (fromUser && tag instanceof StreamResources) {
           StreamResources sr = (StreamResources) tag;
           if (getStreamVolume(sr.getStreamType()) != progress) {
               setStreamVolume(sr.getStreamType(), progress);
               mVolumeDirty = true;
           }
       }
       onUserInteraction();
}
 
Example 8
Source File: ParanoidVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress,
                              boolean fromUser) {
    final Object tag = seekBar.getTag();
    if (fromUser && tag instanceof StreamControl) {
        StreamControl sc = (StreamControl) tag;
        if (getStreamVolume(sc.streamType) != progress) {
            LOGI(TAG, "setStreamVolume(" + sc.streamType + ", " + progress + ')');
            setStreamVolume(sc.streamType, progress);
        }
    }
    onUserInteraction();
}
 
Example 9
Source File: ParanoidVolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override public void onStopTrackingTouch(SeekBar seekBar) {
    final Object tag = seekBar.getTag();
    if (tag instanceof StreamControl) {
        StreamControl sc = (StreamControl) tag;
        // because remote volume updates are asynchronous, AudioService might have received
        // a new remote volume value since the finger adjusted the slider. So when the
        // progress of the slider isn't being tracked anymore, adjust the slider to the last
        // "published" remote volume value, so the UI reflects the actual volume.
        if (sc.streamType == STREAM_REMOTE_MUSIC) {
            seekBar.setProgress(getStreamVolume(STREAM_REMOTE_MUSIC));
        }
    }
}
 
Example 10
Source File: VolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
/**
 * Notification that the progress level has changed. Clients can use the fromUser parameter
 * to distinguish user-initiated changes from those that occurred programmatically.
 */
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
       LOGD("VolumePanel", "onProgressChanged(" + progress + ")");
	final Object tag = seekBar.getTag();
       if (fromUser && tag instanceof StreamResources) {
           StreamResources sr = (StreamResources) tag;
           if (getStreamVolume(sr.getStreamType()) != progress) {
               setStreamVolume(sr.getStreamType(), progress);
               mVolumeDirty = true;
           }
       }
       onUserInteraction();
}