Replace deprecated APIs.
The min SDK target is now 21 because of getDrawable change, so this app will not install on KitKat. Also, MediaCodecView is obsolete, so there is no need to change getInput/OutputBiffers and INFO_OUTPUT_BUFFERS_CHANGED, which requires additional refactoring effort. bug: 26185358 Change-Id: If83a5fa0eefebb4932fcd4c03162ba2dd94a755e
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<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">
|
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Holo.NoActionBar">
|
||||||
<activity android:name=".WidevineSamplePlayer"
|
<activity android:name=".WidevineSamplePlayer"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ public abstract class AssetActivity extends Activity {
|
|||||||
protected abstract boolean setUpAssetPages();
|
protected abstract boolean setUpAssetPages();
|
||||||
|
|
||||||
private View createView(Context ctxt) {
|
private View createView(Context ctxt) {
|
||||||
|
|
||||||
ImageView empty = new ImageView(this);
|
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];
|
View[] clips = new View[6];
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
@@ -77,12 +76,12 @@ public abstract class AssetActivity extends Activity {
|
|||||||
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
LinearLayout.LayoutParams.FILL_PARENT, 1);
|
LinearLayout.LayoutParams.MATCH_PARENT, 1);
|
||||||
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
||||||
|
|
||||||
LinearLayout.LayoutParams paramsMain = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams paramsMain = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
LinearLayout.LayoutParams.FILL_PARENT, 1);
|
LinearLayout.LayoutParams.MATCH_PARENT, 1);
|
||||||
paramsMain.gravity = Gravity.CENTER;
|
paramsMain.gravity = Gravity.CENTER;
|
||||||
|
|
||||||
LinearLayout left = new LinearLayout(ctxt);
|
LinearLayout left = new LinearLayout(ctxt);
|
||||||
@@ -167,7 +166,8 @@ public abstract class AssetActivity extends Activity {
|
|||||||
buttons.addView(prev, params);
|
buttons.addView(prev, params);
|
||||||
buttons.addView(next, 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);
|
SwipeLinearLayout main = new SwipeLinearLayout(this);
|
||||||
main.setNext(nextButtonListener);
|
main.setNext(nextButtonListener);
|
||||||
@@ -186,7 +186,7 @@ public abstract class AssetActivity extends Activity {
|
|||||||
|
|
||||||
private View createEmptyView() {
|
private View createEmptyView() {
|
||||||
ImageView empty = new ImageView(this);
|
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);
|
TextView emptyText = new TextView(this);
|
||||||
|
|
||||||
|
|||||||
@@ -478,19 +478,18 @@ class MediaCodecView extends SurfaceView
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getSecureDecoderNameForMime(String mime) {
|
private String getSecureDecoderNameForMime(String mime) {
|
||||||
int n = MediaCodecList.getCodecCount();
|
MediaCodecInfo[] codecInfos =
|
||||||
for (int i = 0; i < n; ++i) {
|
new MediaCodecList(MediaCodecList.ALL_CODECS).getCodecInfos();
|
||||||
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
|
|
||||||
|
|
||||||
if (info.isEncoder()) {
|
for (MediaCodecInfo codecInfo : codecInfos) {
|
||||||
|
if (codecInfo.isEncoder()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] supportedTypes = info.getSupportedTypes();
|
String[] supportedTypes = codecInfo.getSupportedTypes();
|
||||||
|
for (int i = 0; i < supportedTypes.length; ++i) {
|
||||||
for (int j = 0; j < supportedTypes.length; ++j) {
|
if (supportedTypes[i].equalsIgnoreCase(mime)) {
|
||||||
if (supportedTypes[j].equalsIgnoreCase(mime)) {
|
return codecInfo.getName() + ".secure";
|
||||||
return info.getName() + ".secure";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ public class VideoPlayerView extends Activity {
|
|||||||
FrameLayout.LayoutParams.MATCH_PARENT));
|
FrameLayout.LayoutParams.MATCH_PARENT));
|
||||||
|
|
||||||
bgImage = new ClipImageView(this);
|
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() {
|
bgImage.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -215,10 +216,10 @@ public class VideoPlayerView extends Activity {
|
|||||||
|
|
||||||
main = new LinearLayout(this);
|
main = new LinearLayout(this);
|
||||||
main.addView(playerFrame, new LinearLayout.LayoutParams((int)(width * 0.65),
|
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(
|
main.addView(sidePanel, new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
LinearLayout.LayoutParams.FILL_PARENT, 3));
|
LinearLayout.LayoutParams.MATCH_PARENT, 3));
|
||||||
|
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
@@ -442,7 +443,7 @@ public class VideoPlayerView extends Activity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.FILL_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
||||||
|
|
||||||
params.setMargins(0, 0, 0, 5);
|
params.setMargins(0, 0, 0, 5);
|
||||||
@@ -459,7 +460,7 @@ public class VideoPlayerView extends Activity {
|
|||||||
buttonsRight.addView(removeButton, params);
|
buttonsRight.addView(removeButton, params);
|
||||||
|
|
||||||
LinearLayout.LayoutParams paramsSides = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams paramsSides = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.FILL_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
LinearLayout.LayoutParams.WRAP_CONTENT, 1);
|
||||||
paramsSides.gravity = Gravity.BOTTOM;
|
paramsSides.gravity = Gravity.BOTTOM;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user