Removed deprecated calls to "getResources().getColor()"

# Conflicts:
#	News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderDetailFragment.java
This commit is contained in:
Christine Emrich 2015-11-24 21:25:27 +01:00
parent 554d691a89
commit 35c0a4cae4
7 changed files with 18 additions and 14 deletions

View file

@ -26,6 +26,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
@ -114,7 +115,7 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
this.mContext = mContext;
this.dbConn = dbConn;
mTextColorLightTheme = mContext.getResources().getColor(R.color.slider_listview_text_color_light_theme);
mTextColorLightTheme = ContextCompat.getColor(mContext, R.color.slider_listview_text_color_light_theme);
unreadCountFeeds = new SparseArray<>();
unreadCountFolders = new SparseArray<>();
@ -126,7 +127,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
this.listView = listView;
}
@SuppressWarnings("deprecation")
@Override
public Object getChild(int groupPosition, int childPosition) {
int parent_id = (int)getGroupId(groupPosition);

View file

@ -39,6 +39,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.widget.Toolbar;
@ -403,9 +404,8 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
if(isChromeDefaultBrowser() && mCustomTabsSupported) {
mCustomTabsSession = getSession();
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(mCustomTabsSession);
builder.setToolbarColor(getResources().getColor(R.color.colorPrimaryDarkTheme));
builder.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimaryDarkTheme));
builder.setShowTitle(true);
//builder.setCloseButtonIcon(CustomTabUiBuilder.CLOSE_BUTTON_ARROW);
builder.setStartAnimations(this, R.anim.slide_in_right, R.anim.slide_out_left);
builder.setExitAnimations(this, R.anim.slide_in_left, R.anim.slide_out_right);
builder.build().launchUrl(this, Uri.parse(link));

View file

@ -29,6 +29,7 @@ import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.ContextMenu;
@ -261,14 +262,15 @@ public class NewsDetailFragment extends Fragment {
if (progress == 100) {
mProgressbarWebView.setVisibility(ProgressBar.GONE);
//The following three lines are a workaround for websites which don't use a background colour
//The following three lines are a workaround for websites which don't use a background color
int bgColor = ContextCompat.getColor(getContext(), R.color.slider_listview_text_color_dark_theme);
NewsDetailActivity ndActivity = ((NewsDetailActivity) getActivity());
mWebView.setBackgroundColor(getResources().getColor(R.color.slider_listview_text_color_dark_theme));
ndActivity.mViewPager.setBackgroundColor(getResources().getColor(R.color.slider_listview_text_color_dark_theme));
mWebView.setBackgroundColor(bgColor);
ndActivity.mViewPager.setBackgroundColor(bgColor);
if (ThemeChooser.isDarkTheme(getActivity())) {
mWebView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
mWebView.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
}
}
}

View file

@ -361,9 +361,9 @@ public class NewsReaderDetailFragment extends Fragment {
@Override
public void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(context, attrs, savedInstanceState);
TypedArray a = context.obtainStyledAttributes(attrs,new int[]{R.attr.markasreadDrawable,R.attr.colorAccent});
TypedArray a = context.obtainStyledAttributes(attrs, new int[]{ R.attr.markasreadDrawable, R.attr.colorAccent });
markAsReadDrawable = a.getDrawable(0);
accentColor = ContextCompat.getColor(getContext(), R.color.owncloudBlueLight);
accentColor = ContextCompat.getColor(context, R.color.owncloudBlueLight);
a.recycle();
}

View file

@ -26,6 +26,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnCreateContextMenuListener;
@ -119,7 +120,7 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
View view = inflater.inflate(R.layout.fragment_newsreader_list, container, false);
if(!ThemeChooser.isDarkTheme(getActivity())) {
view.setBackgroundColor(getResources().getColor(R.color.slider_listview_background_color_light_theme));
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.slider_listview_background_color_light_theme));
}
ButterKnife.inject(this, view);
@ -130,7 +131,6 @@ public class NewsReaderListFragment extends Fragment implements OnCreateContextM
eListView.setGroupIndicator(null);
eListView.setOnChildClickListener(onChildClickListener);
//eListView.setSmoothScrollbarEnabled(true);
eListView.setClickable(true);
eListView.setAdapter(lvAdapter);

View file

@ -4,6 +4,7 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.style.ForegroundColorSpan;
@ -78,7 +79,7 @@ public class NewsListRecyclerAdapter extends RecyclerView.Adapter {
pDelayHandler = new PostDelayHandler(activity);
bodyForegroundColor = new ForegroundColorSpan(activity.getResources().getColor(android.R.color.secondary_text_dark));
bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(activity, android.R.color.secondary_text_dark));
dbConn = new DatabaseConnectionOrm(activity);
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);

View file

@ -5,6 +5,7 @@ import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.Spannable;
@ -89,7 +90,7 @@ public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickL
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(itemView.getContext());
selectedListLayout = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0"));
bodyForegroundColor = new ForegroundColorSpan(itemView.getContext().getResources().getColor(android.R.color.secondary_text_dark));
bodyForegroundColor = new ForegroundColorSpan(ContextCompat.getColor(itemView.getContext(), android.R.color.secondary_text_dark));
if(favIconHandler == null)
favIconHandler = new FavIconHandler(itemView.getContext());