chore: cleanup pt 3

This commit is contained in:
aayush262 2024-04-30 00:26:30 +05:30
parent ea48809d07
commit 0a0da65f7c
26 changed files with 99 additions and 243 deletions

View file

@ -3,7 +3,6 @@ package ani.dantotsu.home
import android.content.Intent
import android.os.Handler
import android.os.Looper
import android.util.TypedValue
import android.view.HapticFeedbackConstants
import android.view.LayoutInflater
import android.view.View
@ -24,6 +23,7 @@ import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.currContext
import ani.dantotsu.databinding.ItemAnimePageBinding
import ani.dantotsu.databinding.LayoutTrendingBinding
import ani.dantotsu.getThemeColor
import ani.dantotsu.loadImage
import ani.dantotsu.media.CalendarActivity
import ani.dantotsu.media.GenreActivity
@ -67,10 +67,7 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
val materialCardView =
holder.itemView.findViewById<MaterialCardView>(R.id.userAvatarContainer)
materialCardView.setCardBackgroundColor(semiTransparentColor)
val typedValue = TypedValue()
currContext()?.theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
val color = typedValue.data
val color = binding.root.context.getThemeColor(android.R.attr.windowBackground)
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000)

View file

@ -3,7 +3,6 @@ package ani.dantotsu.home
import android.content.Intent
import android.os.Handler
import android.os.Looper
import android.util.TypedValue
import android.view.HapticFeedbackConstants
import android.view.LayoutInflater
import android.view.View
@ -21,9 +20,9 @@ import androidx.viewpager2.widget.ViewPager2
import ani.dantotsu.MediaPageTransformer
import ani.dantotsu.R
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.currContext
import ani.dantotsu.databinding.ItemMangaPageBinding
import ani.dantotsu.databinding.LayoutTrendingBinding
import ani.dantotsu.getThemeColor
import ani.dantotsu.loadImage
import ani.dantotsu.media.GenreActivity
import ani.dantotsu.media.MediaAdaptor
@ -66,10 +65,7 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
val materialCardView =
holder.itemView.findViewById<MaterialCardView>(R.id.userAvatarContainer)
materialCardView.setCardBackgroundColor(semiTransparentColor)
val typedValue = TypedValue()
currContext()?.theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
val color = typedValue.data
val color = binding.root.context.getThemeColor(android.R.attr.windowBackground)
textInputLayout.boxBackgroundColor = (color and 0x00FFFFFF) or 0x28000000
materialCardView.setCardBackgroundColor((color and 0x00FFFFFF) or 0x28000000)

View file

@ -7,8 +7,8 @@ import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.util.AttributeSet
import android.util.TypedValue
import android.view.View
import ani.dantotsu.getThemeColor
class CircleView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
private var parts: Int = 3
@ -30,12 +30,11 @@ class CircleView(context: Context, attrs: AttributeSet?) : View(context, attrs)
val totalGapAngle = gapAngle * (parts)
val totalAngle = 360f - totalGapAngle
val typedValue = TypedValue()
context.theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue, true)
val primaryColor = typedValue.data
val typedValue1 = TypedValue()
context.theme.resolveAttribute(com.google.android.material.R.attr.colorOnPrimary, typedValue1, true)
val secondColor = typedValue1.data
val primaryColor = context.getThemeColor(com.google.android.material.R.attr.colorPrimary)
val secondColor = context.getThemeColor(com.google.android.material.R.attr.colorOnPrimary)
fun setColor(int: Int) {
paint.color = if (int < booleanList.size && booleanList[int]) {
Color.GRAY
@ -46,7 +45,6 @@ class CircleView(context: Context, attrs: AttributeSet?) : View(context, attrs)
}
if (parts == 1) {
// Draw a single arc covering the entire circle
path.addArc(
centerX - radius,
centerY - radius,

View file

@ -7,16 +7,11 @@ import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.util.AttributeSet
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.content.ContextCompat
@ -27,6 +22,7 @@ import ani.dantotsu.buildMarkwon
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.api.Activity
import ani.dantotsu.databinding.FragmentStatusBinding
import ani.dantotsu.getThemeColor
import ani.dantotsu.home.status.listener.StoriesCallback
import ani.dantotsu.loadImage
import ani.dantotsu.media.MediaDetailsActivity
@ -70,12 +66,9 @@ constructor(
val inflater: LayoutInflater = LayoutInflater.from(context)
binding = FragmentStatusBinding.inflate(inflater, this, false)
addView(binding.root)
val typedValue = TypedValue()
val typedValue1 = TypedValue()
context.theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue, true)
context.theme.resolveAttribute(com.google.android.material.R.attr.colorOnPrimary, typedValue1, true)
primaryColor = typedValue.data
onPrimaryColor = typedValue1.data
primaryColor = context.getThemeColor(com.google.android.material.R.attr.colorPrimary)
onPrimaryColor = context.getThemeColor(com.google.android.material.R.attr.colorOnPrimary)
if (context is StoriesCallback)
storiesListener = context as StoriesCallback

View file

@ -1,5 +1,6 @@
package ani.dantotsu.home.status
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup