Fix some deprecation warnings
This commit is contained in:
parent
cc582a2842
commit
0965430b64
@ -2088,7 +2088,7 @@ public class ViewPager extends ViewGroup {
|
||||
public int gravity;
|
||||
|
||||
public LayoutParams() {
|
||||
super(FILL_PARENT, FILL_PARENT);
|
||||
super(MATCH_PARENT, MATCH_PARENT);
|
||||
}
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attrs) {
|
||||
|
@ -57,7 +57,7 @@ public class TabPageIndicator extends HorizontalScrollView
|
||||
setHorizontalScrollBarEnabled(false);
|
||||
|
||||
mTabLayout = new LinearLayout(getContext());
|
||||
addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT));
|
||||
addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,7 +129,7 @@ public class TabPageIndicator extends HorizontalScrollView
|
||||
tabView.setOnClickListener(this);
|
||||
tabView.setText(text);
|
||||
|
||||
mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, LayoutParams.FILL_PARENT, 1));
|
||||
mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -186,7 +186,7 @@ public class TabPageIndicator extends HorizontalScrollView
|
||||
final int tabCount = mTabLayout.getChildCount();
|
||||
for (int i = 0; i < tabCount; i++) {
|
||||
final View child = mTabLayout.getChildAt(i);
|
||||
final boolean isSelected = (i == item);
|
||||
final boolean isSelected = i == item;
|
||||
child.setSelected(isSelected);
|
||||
if (isSelected) {
|
||||
animateToTab(item);
|
||||
|
@ -250,8 +250,8 @@ public class FullPlaybackActivity extends PlaybackActivity
|
||||
view.setClickable(true);
|
||||
view.setOnClickListener(this);
|
||||
addContentView(view,
|
||||
new ViewGroup.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
|
||||
LinearLayout.LayoutParams.FILL_PARENT));
|
||||
new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
mOverlayText = view;
|
||||
} else {
|
||||
mOverlayText.setVisibility(View.VISIBLE);
|
||||
|
@ -69,7 +69,7 @@ public class IdlePreference extends DialogPreference implements SeekBar.OnSeekBa
|
||||
protected void onPrepareDialogBuilder(Builder builder)
|
||||
{
|
||||
Context context = getContext();
|
||||
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
mValue = getPersistedInt(DEFAULT_VALUE);
|
||||
|
||||
|
@ -427,7 +427,7 @@ public class MediaAdapter
|
||||
{
|
||||
if (mSections == null) {
|
||||
if (mSortMode == 0)
|
||||
mSections = mIndexer.getSections();
|
||||
mSections = MusicAlphabetIndexer.getSections();
|
||||
else
|
||||
mSections = new String[] { " " };
|
||||
}
|
||||
|
@ -685,8 +685,23 @@ public final class PlaybackService extends Service
|
||||
/**
|
||||
* Return true if audio would play through the speaker.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean isSpeakerOn()
|
||||
{
|
||||
// Android seems very intent on making this difficult to detect. In
|
||||
// Android 1.5, this worked great with AudioManager.getRouting(),
|
||||
// which definitively answered if audio would play through the speakers.
|
||||
// Android 2.0 deprecated this method and made it no longer function.
|
||||
// So this hacky alternative was created. But with Android 4.0,
|
||||
// isWiredHeadsetOn() was deprecated, though it still works. But for
|
||||
// how much longer?
|
||||
//
|
||||
// I'd like to remove this feature so I can avoid fighting Android to
|
||||
// keep it working, but some users seem to really like it. I think the
|
||||
// best solution to this problem is for Android to have separate media
|
||||
// volumes for speaker, headphones, etc. That way the speakers can be
|
||||
// muted system-wide. There is not much I can do about that here,
|
||||
// though.
|
||||
return !mAudioManager.isWiredHeadsetOn() && !mAudioManager.isBluetoothA2dpOn() && !mAudioManager.isBluetoothScoOn();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user