From 533636f3a117e012aef76972d05569111c85419a Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Wed, 11 Apr 2018 20:28:16 +0200 Subject: [PATCH] Link colors in cards and list items. --- .../apps/amine/bou/readerforselfoss/HomeActivity.kt | 10 ++-------- .../bou/readerforselfoss/adapters/ItemCardAdapter.kt | 4 +++- .../bou/readerforselfoss/adapters/ItemListAdapter.kt | 6 +++++- .../bou/readerforselfoss/adapters/ItemsAdapter.kt | 2 ++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index 5184394..b4ddac3 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -382,13 +382,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { Scoop.getInstance() .update(Toppings.PRIMARY.value, appColors.colorPrimary) .update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark) - /*.update(Toppings.ACCENT.value, colorAccent) - .update(Toppings.ACCENT_DARK.value, colorAccentDark) - .update(Toppings.BACKGROUND.value, colorBackground) - .update(Toppings.CARD_BACKGROUND.value, cardBackgroundColor) - .update(Toppings.TEXT_PRIMARY.value, textColorPrimary) - .update(Toppings.TEXT_SECONDARY.value, textColorSecondary) - .update(Toppings.HEADER_DRAWER_TEXT.value, materialDrawerHeaderSelectionText)*/ } private fun handleDrawer() { @@ -943,7 +936,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { internalBrowser, articleViewer, debugReadingItems, - userIdentifier + userIdentifier, + appColors ) recyclerView.addItemDecoration( diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemCardAdapter.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemCardAdapter.kt index 65f536e..5c4cc68 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemCardAdapter.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemCardAdapter.kt @@ -42,7 +42,7 @@ class ItemCardAdapter( private val internalBrowser: Boolean, private val articleViewer: Boolean, private val fullHeightCards: Boolean, - private val appColors: AppColors, + override val appColors: AppColors, override val debugReadingItems: Boolean, override val userIdentifier: String ) : ItemsAdapter() { @@ -63,6 +63,8 @@ class ItemCardAdapter( holder.mView.favButton.isLiked = itm.starred holder.mView.title.text = Html.fromHtml(itm.title) + holder.mView.title.setLinkTextColor(appColors.colorAccent) + holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText() if (!fullHeightCards) { diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemListAdapter.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemListAdapter.kt index 46f93e2..c169254 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemListAdapter.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemListAdapter.kt @@ -14,6 +14,7 @@ import apps.amine.bou.readerforselfoss.R import apps.amine.bou.readerforselfoss.api.selfoss.Item import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse +import apps.amine.bou.readerforselfoss.themes.AppColors import apps.amine.bou.readerforselfoss.utils.buildCustomTabsIntent import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper import apps.amine.bou.readerforselfoss.utils.glide.bitmapCenterCrop @@ -43,7 +44,8 @@ class ItemListAdapter( private val internalBrowser: Boolean, private val articleViewer: Boolean, override val debugReadingItems: Boolean, - override val userIdentifier: String + override val userIdentifier: String, + override val appColors: AppColors ) : ItemsAdapter() { private val generator: ColorGenerator = ColorGenerator.MATERIAL private val c: Context = app.baseContext @@ -64,6 +66,8 @@ class ItemListAdapter( holder.mView.title.text = Html.fromHtml(itm.title) + holder.mView.title.setLinkTextColor(appColors.colorAccent) + holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText() if (itm.getThumbnail(c).isEmpty()) { diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemsAdapter.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemsAdapter.kt index 585b892..0472c7b 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemsAdapter.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/adapters/ItemsAdapter.kt @@ -10,6 +10,7 @@ import apps.amine.bou.readerforselfoss.R import apps.amine.bou.readerforselfoss.api.selfoss.Item import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse +import apps.amine.bou.readerforselfoss.themes.AppColors import apps.amine.bou.readerforselfoss.utils.succeeded import com.crashlytics.android.Crashlytics import retrofit2.Call @@ -22,6 +23,7 @@ abstract class ItemsAdapter : RecyclerView.Adapte abstract val debugReadingItems: Boolean abstract val userIdentifier: String abstract val app: Activity + abstract val appColors: AppColors fun updateAllItems(newItems: ArrayList) { items = newItems