Compare commits
No commits in common. "7d6e24f1fd2ff979087a0f66a7d6b11a93adf1d9" and "29d99fca177113499b804d1ae862a028dd9a13cb" have entirely different histories.
7d6e24f1fd
...
29d99fca17
@ -31,7 +31,9 @@ class SourcesActivity : AppCompatActivity() {
|
||||
|
||||
val scoop = Scoop.getInstance()
|
||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar)
|
||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySourcesBinding.inflate(layoutInflater)
|
||||
@ -39,6 +41,10 @@ class SourcesActivity : AppCompatActivity() {
|
||||
|
||||
setContentView(view)
|
||||
|
||||
val scoop = Scoop.getInstance()
|
||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar)
|
||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView.ScaleType
|
||||
import androidx.core.content.ContextCompat
|
||||
import apps.amine.bou.readerforselfoss.R
|
||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||
@ -60,6 +61,10 @@ class ItemCardAdapter(
|
||||
|
||||
binding.favButton.isSelected = itm.starred
|
||||
binding.title.text = itm.getTitleDecoded()
|
||||
binding.title.setTextColor(ContextCompat.getColor(
|
||||
c,
|
||||
appColors.textColor
|
||||
))
|
||||
|
||||
binding.title.setOnTouchListener(LinkOnTouchListener())
|
||||
|
||||
@ -67,6 +72,11 @@ class ItemCardAdapter(
|
||||
|
||||
binding.sourceTitleAndDate.text = itm.sourceAndDateText()
|
||||
|
||||
binding.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
||||
c,
|
||||
appColors.textColor
|
||||
))
|
||||
|
||||
if (!fullHeightCards) {
|
||||
binding.itemImage.maxHeight = imageMaxHeight
|
||||
binding.itemImage.scaleType = ScaleType.CENTER_CROP
|
||||
@ -102,6 +112,7 @@ class ItemCardAdapter(
|
||||
|
||||
inner class ViewHolder(val binding: CardItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
init {
|
||||
binding.root.setCardBackgroundColor(appColors.cardBackgroundColor)
|
||||
handleClickListeners()
|
||||
handleCustomTabActions()
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.content.Context
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import apps.amine.bou.readerforselfoss.api.selfoss.Item
|
||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||
import apps.amine.bou.readerforselfoss.databinding.ListItemBinding
|
||||
@ -48,14 +49,25 @@ class ItemListAdapter(
|
||||
with(holder) {
|
||||
val itm = items[position]
|
||||
|
||||
|
||||
binding.title.text = itm.getTitleDecoded()
|
||||
|
||||
binding.title.setTextColor(ContextCompat.getColor(
|
||||
c,
|
||||
appColors.textColor
|
||||
))
|
||||
|
||||
binding.title.setOnTouchListener(LinkOnTouchListener())
|
||||
|
||||
binding.title.setLinkTextColor(appColors.colorAccent)
|
||||
|
||||
binding.sourceTitleAndDate.text = itm.sourceAndDateText()
|
||||
|
||||
binding.sourceTitleAndDate.setTextColor(ContextCompat.getColor(
|
||||
c,
|
||||
appColors.textColor
|
||||
))
|
||||
|
||||
if (itm.getThumbnail(c).isEmpty()) {
|
||||
|
||||
if (itm.getIcon(c).isEmpty()) {
|
||||
|
@ -392,12 +392,24 @@ class ArticleFragment : Fragment() {
|
||||
binding.webcontent.visibility = View.VISIBLE
|
||||
val (textColor, backgroundColor) = if (appColors.isDarkTheme) {
|
||||
if (context != null) {
|
||||
binding.webcontent.setBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.dark_webview
|
||||
)
|
||||
)
|
||||
Pair(ContextCompat.getColor(requireContext(), R.color.dark_webview_text), ContextCompat.getColor(requireContext(), R.color.dark_webview))
|
||||
} else {
|
||||
Pair(null, null)
|
||||
}
|
||||
} else {
|
||||
if (context != null) {
|
||||
binding.webcontent.setBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.light_webview
|
||||
)
|
||||
)
|
||||
Pair(ContextCompat.getColor(requireContext(), R.color.light_webview_text), ContextCompat.getColor(requireContext(), R.color.light_webview))
|
||||
} else {
|
||||
Pair(null, null)
|
||||
|
@ -13,10 +13,7 @@ import androidx.core.widget.addTextChangedListener
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import apps.amine.bou.readerforselfoss.R
|
||||
import apps.amine.bou.readerforselfoss.databinding.ActivitySettingsBinding
|
||||
import apps.amine.bou.readerforselfoss.themes.Toppings
|
||||
import apps.amine.bou.readerforselfoss.utils.Config
|
||||
import com.ftinc.scoop.Scoop
|
||||
import java.lang.NumberFormatException
|
||||
|
||||
private const val TITLE_TAG = "settingsActivityTitle"
|
||||
@ -29,13 +26,7 @@ class SettingsActivity : AppCompatActivity(),
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("dark_theme", false)) {
|
||||
setTheme(R.style.NoBarDark)
|
||||
}
|
||||
val binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||
|
||||
val scoop = Scoop.getInstance()
|
||||
scoop.bind(this, Toppings.PRIMARY.value, binding.toolbar)
|
||||
scoop.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
|
||||
|
||||
setContentView(binding.root)
|
||||
setContentView(R.layout.activity_settings)
|
||||
if (savedInstanceState == null) {
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
@ -50,7 +41,7 @@ class SettingsActivity : AppCompatActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
setSupportActionBar(findViewById(R.id.toolbar))
|
||||
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
@ -1,9 +1,14 @@
|
||||
package apps.amine.bou.readerforselfoss.themes
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.annotation.ColorInt
|
||||
import android.content.Context
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import android.util.TypedValue
|
||||
import apps.amine.bou.readerforselfoss.R
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
|
||||
class AppColors(a: Activity) {
|
||||
|
||||
@ -11,6 +16,7 @@ class AppColors(a: Activity) {
|
||||
@ColorInt val colorPrimaryDark: Int
|
||||
@ColorInt val colorAccent: Int
|
||||
@ColorInt val colorAccentDark: Int
|
||||
@ColorInt val cardBackgroundColor: Int
|
||||
@ColorInt val colorBackground: Int
|
||||
@ColorInt val textColor: Int
|
||||
val isDarkTheme: Boolean
|
||||
@ -57,5 +63,14 @@ class AppColors(a: Activity) {
|
||||
} else {
|
||||
R.color.grey_900
|
||||
}
|
||||
|
||||
val wrapper = Context::class.java
|
||||
val method = wrapper!!.getMethod("getThemeResId")
|
||||
method.isAccessible = true
|
||||
|
||||
val typedCardBackground = TypedValue()
|
||||
a.theme.resolveAttribute(R.attr.cardBackgroundColor, typedCardBackground, true)
|
||||
|
||||
cardBackgroundColor = typedCardBackground.data
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
card_view:cardElevation="2dp"
|
||||
card_view:cardUseCompatPadding="true"
|
||||
card_view:layout_constraintBottom_toBottomOf="parent"
|
||||
app:cardBackgroundColor="?cardBackgroundColor">
|
||||
card_view:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -66,7 +65,6 @@
|
||||
android:gravity="start"
|
||||
android:textAlignment="viewStart"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toRightOf="@+id/sourceImage"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@ -81,7 +79,6 @@
|
||||
android:gravity="start"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||
tools:text="Google Actualité Il y a 5h" />
|
||||
|
@ -33,7 +33,7 @@
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@ -65,7 +65,6 @@
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:paddingBottom="48dp"
|
||||
android:background="?android:colorBackground"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
@ -12,8 +12,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="21dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginLeft="8dp" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
@ -30,14 +29,11 @@
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/itemImage"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Titre"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="16dp" />
|
||||
tools:text="Titre" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sourceTitleAndDate"
|
||||
@ -50,13 +46,10 @@
|
||||
android:maxLines="1"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/itemImage"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Google Actualité Il y a 5h"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="16dp" />
|
||||
tools:text="Google Actualité Il y a 5h" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user