fix: various small fixes
This commit is contained in:
parent
4ccf6fa1c8
commit
e5ec6a6526
8 changed files with 44 additions and 21 deletions
|
@ -240,6 +240,9 @@ class SubscriptionNotificationTask : Task {
|
||||||
if (newStore.size >= 100) {
|
if (newStore.size >= 100) {
|
||||||
newStore.remove(newStore.minByOrNull { it.time })
|
newStore.remove(newStore.minByOrNull { it.time })
|
||||||
}
|
}
|
||||||
|
if (newStore.any { it.title == notification.title && it.content == notification.content}) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
newStore.add(notification)
|
newStore.add(notification)
|
||||||
PrefManager.setVal(PrefName.SubscriptionNotificationStore, newStore)
|
PrefManager.setVal(PrefName.SubscriptionNotificationStore, newStore)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.text.style.ForegroundColorSpan
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.doOnAttach
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import ani.dantotsu.MainActivity
|
import ani.dantotsu.MainActivity
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
|
@ -27,13 +28,17 @@ class CalcActivity : AppCompatActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
ThemeManager(this).applyTheme()
|
ThemeManager(this).applyTheme()
|
||||||
initActivity(this)
|
|
||||||
binding = ActivityCalcBinding.inflate(layoutInflater)
|
binding = ActivityCalcBinding.inflate(layoutInflater)
|
||||||
binding.mainContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
|
||||||
topMargin += statusBarHeight
|
|
||||||
bottomMargin = navBarHeight
|
|
||||||
}
|
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
binding.root.doOnAttach {
|
||||||
|
initActivity(this)
|
||||||
|
binding.displayContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
topMargin += statusBarHeight
|
||||||
|
}
|
||||||
|
binding.buttonContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
bottomMargin += navBarHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
code = intent.getStringExtra("code") ?: "0"
|
code = intent.getStringExtra("code") ?: "0"
|
||||||
|
|
||||||
binding.apply {
|
binding.apply {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ani.dantotsu.util.Logger
|
||||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import me.xdrop.fuzzywuzzy.FuzzySearch
|
import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
@ -147,10 +148,11 @@ abstract class BaseParser {
|
||||||
* @return Triple<Int, Int?, String> : First Int is the status code, Second Int is the response time in milliseconds, Third String is the response message.
|
* @return Triple<Int, Int?, String> : First Int is the status code, Second Int is the response time in milliseconds, Third String is the response message.
|
||||||
*/
|
*/
|
||||||
fun ping(): Triple<Int, Int?, String> {
|
fun ping(): Triple<Int, Int?, String> {
|
||||||
val client = okHttpClient
|
val client = OkHttpClient()
|
||||||
var statusCode = 0
|
var statusCode = 0
|
||||||
var responseTime: Int? = null
|
var responseTime: Int? = null
|
||||||
var responseMessage = ""
|
var responseMessage = ""
|
||||||
|
println("Pinging $name at $hostUrl")
|
||||||
try {
|
try {
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(hostUrl)
|
.url(hostUrl)
|
||||||
|
@ -158,7 +160,7 @@ abstract class BaseParser {
|
||||||
responseTime = measureTimeMillis {
|
responseTime = measureTimeMillis {
|
||||||
client.newCall(request).execute().use { response ->
|
client.newCall(request).execute().use { response ->
|
||||||
statusCode = response.code
|
statusCode = response.code
|
||||||
responseMessage = response.message
|
responseMessage = response.message.ifEmpty { "None" }
|
||||||
}
|
}
|
||||||
}.toInt()
|
}.toInt()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
@ -95,11 +95,11 @@ class ExtensionTestItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun runAnimeTest(extension: AnimeParser) {
|
private suspend fun runAnimeTest(extension: AnimeParser) {
|
||||||
|
if (testType == "ping") {
|
||||||
pingResult = extension.ping()
|
pingResult = extension.ping()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
pingResult()
|
pingResult()
|
||||||
}
|
}
|
||||||
if (testType == "ping") {
|
|
||||||
done()
|
done()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -137,11 +137,11 @@ class ExtensionTestItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun runMangaTest(extension: MangaParser) {
|
private suspend fun runMangaTest(extension: MangaParser) {
|
||||||
|
if (testType == "ping") {
|
||||||
pingResult = extension.ping()
|
pingResult = extension.ping()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
pingResult()
|
pingResult()
|
||||||
}
|
}
|
||||||
if (testType == "ping") {
|
|
||||||
done()
|
done()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,10 @@ class ExtensionTestItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun runNovelTest(extension: NovelParser) {
|
private suspend fun runNovelTest(extension: NovelParser) {
|
||||||
|
if (testType == "ping") {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
pingResult()
|
pingResult()
|
||||||
}
|
}
|
||||||
if (testType == "ping") {
|
|
||||||
done()
|
done()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class ExtensionTestItem(
|
||||||
|
|
||||||
private fun pingResult() {
|
private fun pingResult() {
|
||||||
if (::binding.isInitialized.not()) return
|
if (::binding.isInitialized.not()) return
|
||||||
if (extensionType == "novel") {
|
if (extensionType == "novel" && testType != "basic") {
|
||||||
binding.pingResultText.isVisible = true
|
binding.pingResultText.isVisible = true
|
||||||
binding.pingResultText.text = context.getString(R.string.test_not_supported)
|
binding.pingResultText.text = context.getString(R.string.test_not_supported)
|
||||||
binding.pingResultText.setCompoundDrawablesWithIntrinsicBounds(
|
binding.pingResultText.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
|
|
@ -96,6 +96,11 @@ class ExtensionTestSettingsBottomDialog : BottomSheetDialogFragment() {
|
||||||
testType = "full"
|
testType = "full"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.extensionTypeTextView.setOnLongClickListener {
|
||||||
|
binding.searchTextView.visibility = View.VISIBLE
|
||||||
|
binding.searchView.visibility = View.VISIBLE
|
||||||
|
true
|
||||||
|
}
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ class SettingsCommonActivity : AppCompatActivity() {
|
||||||
icon = R.drawable.ic_round_lock_open_24,
|
icon = R.drawable.ic_round_lock_open_24,
|
||||||
onClick = {
|
onClick = {
|
||||||
val passwordDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
val passwordDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||||
.setTitle(R.string.download_manager)
|
.setTitle(R.string.app_lock)
|
||||||
.setView(R.layout.dialog_set_password)
|
.setView(R.layout.dialog_set_password)
|
||||||
.setPositiveButton(R.string.ok) { dialog, _ ->
|
.setPositiveButton(R.string.ok) { dialog, _ ->
|
||||||
val passwordInput =
|
val passwordInput =
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
android:id="@+id/mainContainer"
|
android:id="@+id/mainContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="64dp"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
android:background="@color/bg"
|
android:background="@color/bg"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/displayContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="8dp"
|
android:layout_marginHorizontal="8dp"
|
||||||
|
@ -72,8 +73,10 @@
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/buttonContainer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
android:layout_gravity="center_horizontal|bottom"
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/extensionTypeTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical|center_horizontal"
|
android:layout_gravity="center_vertical|center_horizontal"
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/testTypeTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical|center_horizontal"
|
android:layout_gravity="center_vertical|center_horizontal"
|
||||||
|
@ -91,6 +93,7 @@
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/searchTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical|center_horizontal"
|
android:layout_gravity="center_vertical|center_horizontal"
|
||||||
|
@ -98,6 +101,7 @@
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:text="@string/test_search"
|
android:text="@string/test_search"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
|
android:visibility="gone"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
@ -116,6 +120,7 @@
|
||||||
app:boxCornerRadiusTopEnd="28dp"
|
app:boxCornerRadiusTopEnd="28dp"
|
||||||
app:boxCornerRadiusTopStart="28dp"
|
app:boxCornerRadiusTopStart="28dp"
|
||||||
app:endIconDrawable="@drawable/ic_round_search_24"
|
app:endIconDrawable="@drawable/ic_round_search_24"
|
||||||
|
android:visibility="gone"
|
||||||
app:hintAnimationEnabled="true">
|
app:hintAnimationEnabled="true">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue