Merge branch 'pr/257' into dev
This commit is contained in:
commit
1fd91b9ec6
10 changed files with 47 additions and 29 deletions
|
@ -11,7 +11,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId "ani.dantotsu"
|
||||
minSdk 23
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode((System.currentTimeMillis() / 60000).toInteger())
|
||||
versionName "2.2.0"
|
||||
|
|
|
@ -244,6 +244,7 @@ fun isOnline(context: Context): Boolean {
|
|||
val connectivityManager =
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
return tryWith {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val cap = connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)
|
||||
return@tryWith if (cap != null) {
|
||||
when {
|
||||
|
@ -259,6 +260,19 @@ fun isOnline(context: Context): Boolean {
|
|||
else -> false
|
||||
}
|
||||
} else false
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
return@tryWith connectivityManager.activeNetworkInfo?.run {
|
||||
type == ConnectivityManager.TYPE_BLUETOOTH ||
|
||||
type == ConnectivityManager.TYPE_ETHERNET ||
|
||||
type == ConnectivityManager.TYPE_MOBILE ||
|
||||
type == ConnectivityManager.TYPE_MOBILE_DUN ||
|
||||
type == ConnectivityManager.TYPE_MOBILE_HIPRI ||
|
||||
type == ConnectivityManager.TYPE_WIFI ||
|
||||
type == ConnectivityManager.TYPE_WIMAX ||
|
||||
type == ConnectivityManager.TYPE_VPN
|
||||
} ?: false
|
||||
}
|
||||
} ?: false
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
binding.root.doOnAttach {
|
||||
initActivity(this)
|
||||
window.navigationBarColor = getColor(android.R.color.transparent)
|
||||
window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent)
|
||||
selectedOption = if (fragment != null) {
|
||||
when (fragment) {
|
||||
AnimeFragment::class.java.name -> 0
|
||||
|
@ -458,7 +458,7 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
override fun onRestart() {
|
||||
super.onRestart()
|
||||
window.navigationBarColor = getColor(android.R.color.transparent)
|
||||
window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent)
|
||||
}
|
||||
|
||||
private val Int.toPx get() = TypedValue.applyDimension(
|
||||
|
|
|
@ -355,15 +355,13 @@ class AnimeDownloaderService : Service() {
|
|||
return false
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
private fun saveMediaInfo(task: AnimeDownloadTask) {
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val directory = File(
|
||||
getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
"${DownloadsManager.animeLocation}/${task.title}"
|
||||
)
|
||||
val episodeDirectory = File(directory, task.episode)
|
||||
if (!directory.exists()) directory.mkdirs()
|
||||
if (!episodeDirectory.exists()) episodeDirectory.mkdirs()
|
||||
|
||||
val file = File(directory, "media.json")
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.util.TypedValue
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ItemNovelResponseBinding
|
||||
|
@ -59,11 +60,11 @@ class NovelResponseAdapter(
|
|||
}
|
||||
if (binding.itemEpisodeFiller.text.contains("Downloading")) {
|
||||
binding.itemEpisodeFiller.setTextColor(
|
||||
fragment.requireContext().getColor(android.R.color.holo_blue_light)
|
||||
ContextCompat.getColor(fragment.requireContext(), android.R.color.holo_blue_light)
|
||||
)
|
||||
} else if (binding.itemEpisodeFiller.text.contains("Downloaded")) {
|
||||
binding.itemEpisodeFiller.setTextColor(
|
||||
fragment.requireContext().getColor(android.R.color.holo_green_light)
|
||||
ContextCompat.getColor(fragment.requireContext(), android.R.color.holo_green_light)
|
||||
)
|
||||
} else {
|
||||
binding.itemEpisodeFiller.setTextColor(color)
|
||||
|
|
|
@ -65,7 +65,7 @@ class ProfileFragment : Fragment() {
|
|||
binding.profileUserBio.setInitialScale(1)
|
||||
val styledHtml = getFullAniHTML(
|
||||
user.about ?: "",
|
||||
activity.getColor(R.color.bg_opp)
|
||||
ContextCompat.getColor(activity, R.color.bg_opp)
|
||||
)
|
||||
binding.profileUserBio.loadDataWithBaseURL(
|
||||
null,
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.os.PowerManager
|
|||
import android.util.TypedValue
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.PermissionChecker
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.graphics.alpha
|
||||
|
@ -85,7 +86,7 @@ fun Context.getThemeColor(attr: Int): Int {
|
|||
val tv = TypedValue()
|
||||
return if (this.theme.resolveAttribute(attr, tv, true)) {
|
||||
if (tv.resourceId != 0) {
|
||||
getColor(tv.resourceId)
|
||||
ContextCompat.getColor(this, tv.resourceId)
|
||||
} else {
|
||||
tv.data
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.core.app.NotificationChannelGroupCompat
|
|||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.app.NotificationManagerCompat.NotificationWithIdAndTag
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.PermissionChecker
|
||||
import androidx.core.content.getSystemService
|
||||
|
||||
|
@ -65,7 +66,7 @@ fun Context.notificationBuilder(
|
|||
block: (NotificationCompat.Builder.() -> Unit)? = null
|
||||
): NotificationCompat.Builder {
|
||||
val builder = NotificationCompat.Builder(this, channelId)
|
||||
.setColor(getColor(android.R.color.holo_blue_dark))
|
||||
.setColor(ContextCompat.getColor(this, android.R.color.holo_blue_dark))
|
||||
if (block != null) {
|
||||
builder.block()
|
||||
}
|
||||
|
|
7
app/src/main/res/values-v23/themes.xml
Normal file
7
app/src/main/res/values-v23/themes.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Dantotsu" parent="Theme.Base">
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -29,10 +29,6 @@
|
|||
</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Dantotsu" parent="Theme.Base">
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Dantotsu.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue