Merge "Replace deprecated APIs."

This commit is contained in:
Edwin Wong
2015-12-17 19:14:31 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 21 deletions

View File

@@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Holo.NoActionBar">
<activity android:name=".WidevineSamplePlayer"
android:label="@string/app_name"

View File

@@ -57,9 +57,8 @@ public abstract class AssetActivity extends Activity {
protected abstract boolean setUpAssetPages();
private View createView(Context ctxt) {
ImageView empty = new ImageView(this);
empty.setBackgroundDrawable(getResources().getDrawable(R.drawable.empty));
empty.setBackground(getResources().getDrawable(R.drawable.empty, context.getTheme()));
View[] clips = new View[6];
BitmapFactory.Options options = new BitmapFactory.Options();
@@ -77,12 +76,12 @@ public abstract class AssetActivity extends Activity {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.FILL_PARENT, 1);
LinearLayout.LayoutParams.MATCH_PARENT, 1);
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
LinearLayout.LayoutParams paramsMain = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.FILL_PARENT, 1);
LinearLayout.LayoutParams.MATCH_PARENT, 1);
paramsMain.gravity = Gravity.CENTER;
LinearLayout left = new LinearLayout(ctxt);
@@ -167,7 +166,8 @@ public abstract class AssetActivity extends Activity {
buttons.addView(prev, params);
buttons.addView(next, params);
body.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.background3));
body.setBackground(this.getResources().getDrawable(R.drawable.background3,
context.getTheme()));
SwipeLinearLayout main = new SwipeLinearLayout(this);
main.setNext(nextButtonListener);
@@ -186,7 +186,7 @@ public abstract class AssetActivity extends Activity {
private View createEmptyView() {
ImageView empty = new ImageView(this);
empty.setBackgroundDrawable(getResources().getDrawable(R.drawable.empty));
empty.setBackground(getResources().getDrawable(R.drawable.empty, context.getTheme()));
TextView emptyText = new TextView(this);

View File

@@ -478,19 +478,18 @@ class MediaCodecView extends SurfaceView
}
private String getSecureDecoderNameForMime(String mime) {
int n = MediaCodecList.getCodecCount();
for (int i = 0; i < n; ++i) {
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
MediaCodecInfo[] codecInfos =
new MediaCodecList(MediaCodecList.ALL_CODECS).getCodecInfos();
if (info.isEncoder()) {
for (MediaCodecInfo codecInfo : codecInfos) {
if (codecInfo.isEncoder()) {
continue;
}
String[] supportedTypes = info.getSupportedTypes();
for (int j = 0; j < supportedTypes.length; ++j) {
if (supportedTypes[j].equalsIgnoreCase(mime)) {
return info.getName() + ".secure";
String[] supportedTypes = codecInfo.getSupportedTypes();
for (int i = 0; i < supportedTypes.length; ++i) {
if (supportedTypes[i].equalsIgnoreCase(mime)) {
return codecInfo.getName() + ".secure";
}
}
}

View File

@@ -167,7 +167,8 @@ public class VideoPlayerView extends Activity {
FrameLayout.LayoutParams.MATCH_PARENT));
bgImage = new ClipImageView(this);
bgImage.setBackgroundDrawable(getResources().getDrawable(R.drawable.play_shield));
bgImage.setBackground(getResources().getDrawable(R.drawable.play_shield,
context.getTheme()));
bgImage.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -215,10 +216,10 @@ public class VideoPlayerView extends Activity {
main = new LinearLayout(this);
main.addView(playerFrame, new LinearLayout.LayoutParams((int)(width * 0.65),
LinearLayout.LayoutParams.FILL_PARENT, 1));
LinearLayout.LayoutParams.MATCH_PARENT, 1));
main.addView(sidePanel, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.FILL_PARENT, 3));
LinearLayout.LayoutParams.MATCH_PARENT, 3));
return main;
}
@@ -442,7 +443,7 @@ public class VideoPlayerView extends Activity {
});
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
params.setMargins(0, 0, 0, 5);
@@ -459,7 +460,7 @@ public class VideoPlayerView extends Activity {
buttonsRight.addView(removeButton, params);
LinearLayout.LayoutParams paramsSides = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
paramsSides.gravity = Gravity.BOTTOM;