diff --git a/app/src/main/java/ani/dantotsu/notifications/subscription/SubscriptionNotificationTask.kt b/app/src/main/java/ani/dantotsu/notifications/subscription/SubscriptionNotificationTask.kt index efdb1bda78..6fc8fb59ab 100644 --- a/app/src/main/java/ani/dantotsu/notifications/subscription/SubscriptionNotificationTask.kt +++ b/app/src/main/java/ani/dantotsu/notifications/subscription/SubscriptionNotificationTask.kt @@ -240,6 +240,9 @@ class SubscriptionNotificationTask : Task { if (newStore.size >= 100) { newStore.remove(newStore.minByOrNull { it.time }) } + if (newStore.any { it.title == notification.title && it.content == notification.content}) { + return + } newStore.add(notification) PrefManager.setVal(PrefName.SubscriptionNotificationStore, newStore) diff --git a/app/src/main/java/ani/dantotsu/others/calc/CalcActivity.kt b/app/src/main/java/ani/dantotsu/others/calc/CalcActivity.kt index 2aa7081369..442ab39629 100644 --- a/app/src/main/java/ani/dantotsu/others/calc/CalcActivity.kt +++ b/app/src/main/java/ani/dantotsu/others/calc/CalcActivity.kt @@ -8,6 +8,7 @@ import android.text.style.ForegroundColorSpan import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import androidx.core.view.doOnAttach import androidx.core.view.updateLayoutParams import ani.dantotsu.MainActivity import ani.dantotsu.R @@ -27,13 +28,17 @@ class CalcActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) ThemeManager(this).applyTheme() - initActivity(this) binding = ActivityCalcBinding.inflate(layoutInflater) - binding.mainContainer.updateLayoutParams { - topMargin += statusBarHeight - bottomMargin = navBarHeight - } setContentView(binding.root) + binding.root.doOnAttach { + initActivity(this) + binding.displayContainer.updateLayoutParams { + topMargin += statusBarHeight + } + binding.buttonContainer.updateLayoutParams { + bottomMargin += navBarHeight + } + } code = intent.getStringExtra("code") ?: "0" binding.apply { diff --git a/app/src/main/java/ani/dantotsu/parsers/BaseParser.kt b/app/src/main/java/ani/dantotsu/parsers/BaseParser.kt index 3ddfbb09c0..abfe0f8ac0 100644 --- a/app/src/main/java/ani/dantotsu/parsers/BaseParser.kt +++ b/app/src/main/java/ani/dantotsu/parsers/BaseParser.kt @@ -11,6 +11,7 @@ import ani.dantotsu.util.Logger import eu.kanade.tachiyomi.animesource.model.SAnime import eu.kanade.tachiyomi.source.model.SManga import me.xdrop.fuzzywuzzy.FuzzySearch +import okhttp3.OkHttpClient import okhttp3.Request import java.io.Serializable import java.net.URLDecoder @@ -147,10 +148,11 @@ abstract class BaseParser { * @return Triple : First Int is the status code, Second Int is the response time in milliseconds, Third String is the response message. */ fun ping(): Triple { - val client = okHttpClient + val client = OkHttpClient() var statusCode = 0 var responseTime: Int? = null var responseMessage = "" + println("Pinging $name at $hostUrl") try { val request = Request.Builder() .url(hostUrl) @@ -158,7 +160,7 @@ abstract class BaseParser { responseTime = measureTimeMillis { client.newCall(request).execute().use { response -> statusCode = response.code - responseMessage = response.message + responseMessage = response.message.ifEmpty { "None" } } }.toInt() } catch (e: Exception) { diff --git a/app/src/main/java/ani/dantotsu/parsers/ExtensionTestItem.kt b/app/src/main/java/ani/dantotsu/parsers/ExtensionTestItem.kt index 073c466c70..e9bc4292bb 100644 --- a/app/src/main/java/ani/dantotsu/parsers/ExtensionTestItem.kt +++ b/app/src/main/java/ani/dantotsu/parsers/ExtensionTestItem.kt @@ -95,11 +95,11 @@ class ExtensionTestItem( } private suspend fun runAnimeTest(extension: AnimeParser) { - pingResult = extension.ping() - withContext(Dispatchers.Main) { - pingResult() - } if (testType == "ping") { + pingResult = extension.ping() + withContext(Dispatchers.Main) { + pingResult() + } done() return } @@ -137,11 +137,11 @@ class ExtensionTestItem( } private suspend fun runMangaTest(extension: MangaParser) { - pingResult = extension.ping() - withContext(Dispatchers.Main) { - pingResult() - } if (testType == "ping") { + pingResult = extension.ping() + withContext(Dispatchers.Main) { + pingResult() + } done() return } @@ -179,10 +179,10 @@ class ExtensionTestItem( } private suspend fun runNovelTest(extension: NovelParser) { - withContext(Dispatchers.Main) { - pingResult() - } if (testType == "ping") { + withContext(Dispatchers.Main) { + pingResult() + } done() return } @@ -219,7 +219,7 @@ class ExtensionTestItem( private fun pingResult() { if (::binding.isInitialized.not()) return - if (extensionType == "novel") { + if (extensionType == "novel" && testType != "basic") { binding.pingResultText.isVisible = true binding.pingResultText.text = context.getString(R.string.test_not_supported) binding.pingResultText.setCompoundDrawablesWithIntrinsicBounds( diff --git a/app/src/main/java/ani/dantotsu/parsers/ExtensionTestSettingsBottomDialog.kt b/app/src/main/java/ani/dantotsu/parsers/ExtensionTestSettingsBottomDialog.kt index 5bd6bb8590..e8d9cd1b2b 100644 --- a/app/src/main/java/ani/dantotsu/parsers/ExtensionTestSettingsBottomDialog.kt +++ b/app/src/main/java/ani/dantotsu/parsers/ExtensionTestSettingsBottomDialog.kt @@ -96,6 +96,11 @@ class ExtensionTestSettingsBottomDialog : BottomSheetDialogFragment() { testType = "full" } } + binding.extensionTypeTextView.setOnLongClickListener { + binding.searchTextView.visibility = View.VISIBLE + binding.searchView.visibility = View.VISIBLE + true + } setupAdapter() } diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsCommonActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsCommonActivity.kt index 0f99190f47..bd590873dc 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsCommonActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsCommonActivity.kt @@ -176,7 +176,7 @@ class SettingsCommonActivity : AppCompatActivity() { icon = R.drawable.ic_round_lock_open_24, onClick = { val passwordDialog = AlertDialog.Builder(context, R.style.MyPopup) - .setTitle(R.string.download_manager) + .setTitle(R.string.app_lock) .setView(R.layout.dialog_set_password) .setPositiveButton(R.string.ok) { dialog, _ -> val passwordInput = diff --git a/app/src/main/res/layout/activity_calc.xml b/app/src/main/res/layout/activity_calc.xml index 291fccd0a6..c82ad8f011 100644 --- a/app/src/main/res/layout/activity_calc.xml +++ b/app/src/main/res/layout/activity_calc.xml @@ -10,13 +10,14 @@ android:id="@+id/mainContainer" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="32dp" + android:layout_marginTop="64dp" android:layout_gravity="bottom|center_horizontal" android:background="@color/bg" android:orientation="vertical" tools:context=".MainActivity"> diff --git a/app/src/main/res/layout/bottom_sheet_extension_test_settings.xml b/app/src/main/res/layout/bottom_sheet_extension_test_settings.xml index 55df828e61..a897b95ff0 100644 --- a/app/src/main/res/layout/bottom_sheet_extension_test_settings.xml +++ b/app/src/main/res/layout/bottom_sheet_extension_test_settings.xml @@ -8,6 +8,7 @@ android:orientation="vertical">