From 95a9f2f5e346a565f93314522769b729f28a084e Mon Sep 17 00:00:00 2001 From: chandrashekhar Date: Mon, 2 Nov 2015 18:02:32 +0530 Subject: [PATCH] + 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) --- .../java/org/schabi/newpipe/VideoItemListFragment.java | 10 +++++----- .../main/java/org/schabi/newpipe/VideoListAdapter.java | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java index 950c29f54..dd7ae61dc 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java @@ -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 diff --git a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java index ea69be538..c174528c6 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/VideoListAdapter.java @@ -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); }