本文整理汇总了Java中android.support.v4.media.VolumeProviderCompat类的典型用法代码示例。如果您正苦于以下问题:Java VolumeProviderCompat类的具体用法?Java VolumeProviderCompat怎么用?Java VolumeProviderCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VolumeProviderCompat类属于android.support.v4.media包,在下文中一共展示了VolumeProviderCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVolumeAttributes
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public ParcelableVolumeInfo getVolumeAttributes() {
int volumeType;
int stream;
int controlType;
int max;
int current;
synchronized (MediaSessionImplBase.this.mLock) {
volumeType = MediaSessionImplBase.this.mVolumeType;
stream = MediaSessionImplBase.this.mLocalStream;
VolumeProviderCompat vp = MediaSessionImplBase.this.mVolumeProvider;
if (volumeType == 2) {
controlType = vp.getVolumeControl();
max = vp.getMaxVolume();
current = vp.getCurrentVolume();
} else {
controlType = 2;
max = MediaSessionImplBase.this.mAudioManager.getStreamMaxVolume(stream);
current = MediaSessionImplBase.this.mAudioManager.getStreamVolume(stream);
}
}
return new ParcelableVolumeInfo(volumeType, stream, controlType, max, current);
}
示例2: updatePlaybackInfoFromSelectedRoute
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
private void updatePlaybackInfoFromSelectedRoute() {
if (mSelectedRoute != null) {
mPlaybackInfo.volume = mSelectedRoute.getVolume();
mPlaybackInfo.volumeMax = mSelectedRoute.getVolumeMax();
mPlaybackInfo.volumeHandling = mSelectedRoute.getVolumeHandling();
mPlaybackInfo.playbackStream = mSelectedRoute.getPlaybackStream();
mPlaybackInfo.playbackType = mSelectedRoute.getPlaybackType();
final int count = mRemoteControlClients.size();
for (int i = 0; i < count; i++) {
RemoteControlClientRecord record = mRemoteControlClients.get(i);
record.updatePlaybackInfo();
}
if (mMediaSession != null) {
int controlType = VolumeProviderCompat.VOLUME_CONTROL_FIXED;
if (mPlaybackInfo.volumeHandling
== RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
controlType = VolumeProviderCompat.VOLUME_CONTROL_ABSOLUTE;
}
mMediaSession.configureVolume(controlType, mPlaybackInfo.volumeMax,
mPlaybackInfo.volume);
}
}
}
示例3: setPlaybackToRemote
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void setPlaybackToRemote(VolumeProviderCompat volumeProvider) {
if (volumeProvider == null) {
throw new IllegalArgumentException("volumeProvider may not be null");
}
if (this.mVolumeProvider != null) {
this.mVolumeProvider.setCallback(null);
}
this.mVolumeType = 2;
this.mVolumeProvider = volumeProvider;
sendVolumeInfoChanged(new ParcelableVolumeInfo(this.mVolumeType, this.mLocalStream, this.mVolumeProvider.getVolumeControl(), this.mVolumeProvider.getMaxVolume(), this.mVolumeProvider.getCurrentVolume()));
volumeProvider.setCallback(this.mVolumeCallback);
}
示例4: getTypedValue
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
/**
* 获取单个自定义属性的TypedValue
* @param context 上下文
* @param attrRes attrid
* @return {@link TypedValue}
*/
public static TypedValue getTypedValue(@NonNull Context context, @VolumeProviderCompat.ControlType int attrRes)
{
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attrRes, typedValue, true);
return typedValue;
}
示例5: getBoolean
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
/**
* 获取boolean类型值
* @param context 上下文
* @param attrRes attrid
* @return boolean类型值
*/
public static boolean getBoolean(@NonNull Context context, @VolumeProviderCompat.ControlType int attrRes)
{
if("true".equals(getTypedValue(context,attrRes).coerceToString()))
{
return true;
}
return false;
}
示例6: setPlaybackToRemote
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void setPlaybackToRemote(VolumeProviderCompat volumeprovidercompat)
{
if (volumeprovidercompat == null)
{
throw new IllegalArgumentException("volumeProvider may not be null");
}
if (mVolumeProvider != null)
{
mVolumeProvider.setCallback(null);
}
mVolumeType = 2;
mVolumeProvider = volumeprovidercompat;
sendVolumeInfoChanged(new ParcelableVolumeInfo(mVolumeType, mLocalStream, mVolumeProvider.getVolumeControl(), mVolumeProvider.getMaxVolume(), mVolumeProvider.getCurrentVolume()));
volumeprovidercompat.setCallback(mVolumeCallback);
}
示例7: onVolumeChanged
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void onVolumeChanged(VolumeProviderCompat volumeprovidercompat)
{
if (mVolumeProvider != volumeprovidercompat)
{
return;
} else
{
volumeprovidercompat = new ParcelableVolumeInfo(mVolumeType, mLocalStream, volumeprovidercompat.getVolumeControl(), volumeprovidercompat.getMaxVolume(), volumeprovidercompat.getCurrentVolume());
sendVolumeInfoChanged(volumeprovidercompat);
return;
}
}
示例8: onLoad
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
@Override
protected void onLoad(Bundle savedInstanceState) {
super.onLoad(savedInstanceState);
controller.getCurrentRenderer(new Action1<ComponentName>() {
@Override
public void call(ComponentName componentName) {
final List<RendererInfo> infos = loader.getPluginInfos();
for (RendererInfo info : infos) {
if (componentName == null) {
//local is null
info.setActive(info.getComponentName() == null);
} else {
info.setActive(componentName.equals(info.getComponentName()));
}
}
if (hasView()) {
getView().getAdapter().replaceAll(infos);
}
}
});
PlaybackInfoCompat playbackInfo = controller.getPlaybackInfo();
if (playbackInfo == null || playbackInfo.getPlaybackType() !=
MediaControllerCompat.PlaybackInfo.PLAYBACK_TYPE_REMOTE ||
playbackInfo.getVolumeControl() != VolumeProviderCompat.VOLUME_CONTROL_ABSOLUTE) {
getView().mVolumeControl.setVisibility(View.GONE);
} else {
getView().mVolumeSeekbar.setMax(playbackInfo.getMaxVolume());
getView().mVolumeSeekbar.setProgress(playbackInfo.getCurrentVolume());
getView().mVolumeSeekbar.setOnSeekBarChangeListener(this);
}
}
示例9: onVolumeChanged
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void onVolumeChanged(VolumeProviderCompat volumeProvider) {
if (MediaSessionImplBase.this.mVolumeProvider == volumeProvider) {
MediaSessionImplBase.this.sendVolumeInfoChanged(new ParcelableVolumeInfo(MediaSessionImplBase.this.mVolumeType, MediaSessionImplBase.this.mLocalStream, volumeProvider.getVolumeControl(), volumeProvider.getMaxVolume(), volumeProvider.getCurrentVolume()));
}
}
示例10: isChangeable
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public boolean isChangeable() {
return getVolumeControl() != VolumeProviderCompat.VOLUME_CONTROL_FIXED;
}
示例11: CustomVolumeProvider
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public CustomVolumeProvider() {
super(VolumeProviderCompat.VOLUME_CONTROL_ABSOLUTE, 100, 50);
inactive = checkInactivity();
}
示例12: setPlaybackToRemote
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void setPlaybackToRemote(VolumeProviderCompat volumeprovidercompat)
{
MediaSessionCompatApi21.setPlaybackToRemote(mSessionObj, volumeprovidercompat.getVolumeProvider());
}
示例13: setPlaybackToRemote
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
@Override
public void setPlaybackToRemote(VolumeProviderCompat volumeProvider) {
}
示例14: getVolumeProvider
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
@Override
public VolumeProviderCompat getVolumeProvider() {
return null;
}
示例15: setPlaybackToRemote
import android.support.v4.media.VolumeProviderCompat; //导入依赖的package包/类
public void setPlaybackToRemote(VolumeProviderCompat volumeProviderCompat) {
mProxy.setPlaybackToRemote(volumeProviderCompat);
}