1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-02 15:01:01 +01:00

+ Remove deprecated method from app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java

onAttach(Activity activity) is replaced by onAttach(Context context)

+ Remove deprecated method from pp/src/main/java/org/schabi/newpipe/VideoListAdapter.java
context.getResource().getColor(resId) is replaced by ContextCompat.getColor(context,resId)
This commit is contained in:
chandrashekhar 2015-11-02 18:02:32 +05:30
parent ae7ed2d226
commit 95a9f2f5e3
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
@ -308,15 +308,15 @@ public class VideoItemListFragment extends ListFragment {
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
public void onAttach(Context context) {
super.onAttach(context);
// Activities containing this fragment must implement its callbacks.
if (!(activity instanceof Callbacks)) {
if (!(context instanceof Callbacks)) {
throw new IllegalStateException("Activity must implement fragment's callbacks.");
}
mCallbacks = (Callbacks) activity;
mCallbacks = (Callbacks) context;
}
@Override

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -99,7 +100,7 @@ public class VideoListAdapter extends BaseAdapter {
convertView = viewCreator.getViewByVideoInfoItem(convertView, parent, videoList.get(position));
if(listView.isItemChecked(position)) {
convertView.setBackgroundColor(context.getResources().getColor(R.color.primaryColorYoutube));
convertView.setBackgroundColor(ContextCompat.getColor(context,R.color.primaryColorYoutube));
} else {
convertView.setBackgroundColor(0);
}