diff --git a/src/in/sahildave/gazetti/news_activities/WebsiteDetailActivity.java b/src/in/sahildave/gazetti/news_activities/WebsiteDetailActivity.java index bae49bf..8eeafed 100644 --- a/src/in/sahildave/gazetti/news_activities/WebsiteDetailActivity.java +++ b/src/in/sahildave/gazetti/news_activities/WebsiteDetailActivity.java @@ -72,6 +72,7 @@ protected void onCreate(Bundle savedInstanceState) { Bundle arguments = new Bundle(); arguments.putString("npName", getIntent().getStringExtra("npName")); arguments.putString("catName", getIntent().getStringExtra("catName")); + arguments.putInt("actionBarColor", ActionBarColorId); arguments.putString(WebsiteDetailFragment.HEADLINE_CLICKED, getIntent().getStringExtra(WebsiteDetailFragment.HEADLINE_CLICKED)); mDetailFragment.setArguments(arguments); diff --git a/src/in/sahildave/gazetti/news_activities/WebsiteDetailFragment.java b/src/in/sahildave/gazetti/news_activities/WebsiteDetailFragment.java index e5b4a68..6d030d7 100644 --- a/src/in/sahildave/gazetti/news_activities/WebsiteDetailFragment.java +++ b/src/in/sahildave/gazetti/news_activities/WebsiteDetailFragment.java @@ -2,6 +2,9 @@ import android.app.Activity; import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; @@ -50,6 +53,7 @@ public class WebsiteDetailFragment extends Fragment { private boolean bookmarked = false; private BookmarkDataSource dataSource; private Button mViewInBrowser; + private int actionBarColor = Color.DKGRAY; static interface LoadArticleCallback { void onPreExecute(View rootView); @@ -87,6 +91,7 @@ public void onCreate(Bundle savedInstanceState) { if(getArguments()!=null){ npNameString = getArguments().getString("npName"); catNameString = getArguments().getString("catName"); + actionBarColor = getArguments().getInt("actionBarColor"); if (getArguments().containsKey(HEADLINE_CLICKED)) { mArticleHeadline = getArguments().getString(HEADLINE_CLICKED); @@ -110,9 +115,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa Button mShareButton = (Button) rootView.findViewById(R.id.shareContent); mViewInBrowser = (Button) rootView.findViewById(R.id.viewInBrowser); + mShareButton.setTextColor(actionBarColor); + mViewInBrowser.setTextColor(actionBarColor); + TextView categoryName = (TextView) rootView.findViewById(R.id.category); categoryName.setText(catNameString); categoryName.setVisibility(View.VISIBLE); + categoryName.setTextColor(actionBarColor); + TextView mArticlePubDateView = (TextView) rootView.findViewById(R.id.pubDateView); + mArticlePubDateView.setTextColor(actionBarColor); if (npNameString.equals("The Hindu")) { mNewspaperTile.setImageResource(R.drawable.ic_hindu); @@ -164,6 +175,18 @@ public boolean onTouch(View v, MotionEvent event) { return rootView; } + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + setReadItLaterButtonColor(); + } + + private void setReadItLaterButtonColor() { + PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(actionBarColor, PorterDuff.Mode.SRC_ATOP); + + mReadItLater.getCompoundDrawables()[0].setColorFilter(colorFilter); + mReadItLater.setTextColor(actionBarColor); + } + private void setupReadItLaterButton() { dataSource.open(); if(dataSource.isBookmarked(mArticleURL)){ @@ -216,10 +239,12 @@ public void onClick(View v) { if (bookmarked) { dataSource.deleteBookmarkModelEntry(mArticleURL); mReadItLater.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_bookmark, 0, 0, 0); + setReadItLaterButtonColor(); bookmarked=false; } else if (!bookmarked) { dataSource.createBookmarkModelEntry(getBookmarkModelObject()); mReadItLater.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_bookmark_done, 0, 0, 0); + setReadItLaterButtonColor(); bookmarked=true; } } diff --git a/src/in/sahildave/gazetti/news_activities/WebsiteListActivity.java b/src/in/sahildave/gazetti/news_activities/WebsiteListActivity.java index 529f5fc..fb8c12d 100644 --- a/src/in/sahildave/gazetti/news_activities/WebsiteListActivity.java +++ b/src/in/sahildave/gazetti/news_activities/WebsiteListActivity.java @@ -137,6 +137,7 @@ public void onItemSelected(String headlineText, NewsAdapter newsAdapter) { Bundle arguments = new Bundle(); arguments.putString("npName", npName); arguments.putString("catName", catName); + arguments.putInt("actionBarColor", currentColor); arguments.putString(WebsiteDetailFragment.HEADLINE_CLICKED, headlineText); WebsiteDetailFragment detailFragment = new WebsiteDetailFragment(); detailFragment.setArguments(arguments);