idk some fixes or smth

This commit is contained in:
rebelonion 2024-01-23 01:23:47 -06:00
parent 9c67a7e357
commit de91f1f3fa
9 changed files with 31 additions and 15 deletions

View file

@ -15,6 +15,7 @@ import android.content.res.Configuration
import android.content.res.Resources.getSystem import android.content.res.Resources.getSystem
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.media.MediaScannerConnection import android.media.MediaScannerConnection
import android.net.ConnectivityManager import android.net.ConnectivityManager
import android.net.NetworkCapabilities.* import android.net.NetworkCapabilities.*
@ -25,6 +26,7 @@ import android.telephony.TelephonyManager
import android.text.InputFilter import android.text.InputFilter
import android.text.Spanned import android.text.Spanned
import android.util.AttributeSet import android.util.AttributeSet
import android.util.TypedValue
import android.view.* import android.view.*
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.animation.* import android.view.animation.*
@ -48,6 +50,7 @@ import ani.dantotsu.media.Media
import ani.dantotsu.parsers.ShowResponse import ani.dantotsu.parsers.ShowResponse
import ani.dantotsu.settings.UserInterfaceSettings import ani.dantotsu.settings.UserInterfaceSettings
import ani.dantotsu.subcriptions.NotificationClickReceiver import ani.dantotsu.subcriptions.NotificationClickReceiver
import ani.dantotsu.themes.ThemeManager
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.model.GlideUrl import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
@ -211,6 +214,10 @@ open class BottomSheetDialogFragment : BottomSheetDialogFragment() {
val behavior = BottomSheetBehavior.from(requireView().parent as View) val behavior = BottomSheetBehavior.from(requireView().parent as View)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_EXPANDED
} }
val typedValue = TypedValue()
val theme = requireContext().theme
theme.resolveAttribute(com.google.android.material.R.attr.colorOnSurfaceInverse, typedValue, true)
window.navigationBarColor = typedValue.data
} }
override fun show(manager: FragmentManager, tag: String?) { override fun show(manager: FragmentManager, tag: String?) {

View file

@ -213,13 +213,13 @@ class MainActivity : AppCompatActivity() {
} }
} }
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) val offlineMode = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
.getBoolean("offlineMode", false) .getBoolean("offlineMode", false)
if (!isOnline(this)) { if (!isOnline(this)) {
snackString(this@MainActivity.getString(R.string.no_internet_connection)) snackString(this@MainActivity.getString(R.string.no_internet_connection))
startActivity(Intent(this, NoInternet::class.java)) startActivity(Intent(this, NoInternet::class.java))
} else { } else {
if (offline) { if (offlineMode) {
snackString(this@MainActivity.getString(R.string.no_internet_connection)) snackString(this@MainActivity.getString(R.string.no_internet_connection))
startActivity(Intent(this, NoInternet::class.java)) startActivity(Intent(this, NoInternet::class.java))
} else { } else {

View file

@ -969,6 +969,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
exoPlayer.currentPosition, exoPlayer.currentPosition,
this this
) )
exoPlayer.seekTo(0)
val prev = episodeArr[currentEpisodeIndex] val prev = episodeArr[currentEpisodeIndex]
isTimeStampsLoaded = false isTimeStampsLoaded = false
episodeLength = 0f episodeLength = 0f
@ -1472,7 +1473,10 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
try { try {
mediaSession = MediaSession.Builder(this, exoPlayer).build() val rightNow = Calendar.getInstance()
mediaSession = MediaSession.Builder(this, exoPlayer)
.setId(rightNow.timeInMillis.toString())
.build()
} catch (e: Exception) { } catch (e: Exception) {
toast(e.toString()) toast(e.toString())
} }
@ -1556,11 +1560,13 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
if (castPlayer?.isPlaying == false) { if (castPlayer?.isPlaying == false) {
playerView.player?.pause() playerView.player?.pause()
} }
saveData( if (exoPlayer.currentPosition > 5000) {
"${media.id}_${media.anime!!.selectedEpisode}", saveData(
exoPlayer.currentPosition, "${media.id}_${media.anime!!.selectedEpisode}",
this exoPlayer.currentPosition,
) this
)
}
} }
} }

View file

@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import ani.dantotsu.BottomSheetDialogFragment import ani.dantotsu.BottomSheetDialogFragment
import ani.dantotsu.R
import ani.dantotsu.databinding.BottomSheetCustomBinding import ani.dantotsu.databinding.BottomSheetCustomBinding
open class CustomBottomDialog : BottomSheetDialogFragment() { open class CustomBottomDialog : BottomSheetDialogFragment() {
@ -55,10 +56,6 @@ open class CustomBottomDialog : BottomSheetDialogFragment() {
_binding = BottomSheetCustomBinding.inflate(inflater, container, false) _binding = BottomSheetCustomBinding.inflate(inflater, container, false)
val window = dialog?.window val window = dialog?.window
window?.statusBarColor = Color.TRANSPARENT window?.statusBarColor = Color.TRANSPARENT
val typedValue = TypedValue()
val theme = requireContext().theme
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
window?.navigationBarColor = typedValue.data
return binding.root return binding.root
} }

View file

@ -12,7 +12,7 @@
android:id="@+id/listAppBar" android:id="@+id/listAppBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSurface" android:background="?attr/colorSurfaceVariant"
android:theme="@style/Theme.Dantotsu.AppBarOverlay"> android:theme="@style/Theme.Dantotsu.AppBarOverlay">
<LinearLayout <LinearLayout

View file

@ -8,6 +8,11 @@
android:background="@drawable/card_outline" android:background="@drawable/card_outline"
app:cardCornerRadius="16dp"> app:cardCornerRadius="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurfaceVariant"/>
<LinearLayout <LinearLayout
android:id="@+id/itemEpisodeProgressCont" android:id="@+id/itemEpisodeProgressCont"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -21,6 +21,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurfaceVariant"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout

View file

@ -146,7 +146,7 @@
<item name="colorSurfaceVariant">@color/md_theme_dark_5_surfaceVariant</item> <item name="colorSurfaceVariant">@color/md_theme_dark_5_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_dark_5_onSurfaceVariant</item> <item name="colorOnSurfaceVariant">@color/md_theme_dark_5_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_dark_5_outline</item> <item name="colorOutline">@color/md_theme_dark_5_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_dark_5_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/md_theme_dark_5_surface</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_5_inverseSurface</item> <item name="colorSurfaceInverse">@color/md_theme_dark_5_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_5_inversePrimary</item> <item name="colorPrimaryInverse">@color/md_theme_dark_5_inversePrimary</item>
</style> </style>

View file

@ -223,7 +223,7 @@
<item name="colorSurfaceVariant">@color/md_theme_light_5_surfaceVariant</item> <item name="colorSurfaceVariant">@color/md_theme_light_5_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_light_5_onSurfaceVariant</item> <item name="colorOnSurfaceVariant">@color/md_theme_light_5_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_light_5_outline</item> <item name="colorOutline">@color/md_theme_light_5_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_light_5_inverseOnSurface</item> <item name="colorOnSurfaceInverse">@color/md_theme_light_5_surface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_5_inverseSurface</item> <item name="colorSurfaceInverse">@color/md_theme_light_5_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item> <item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item>
</style> </style>