Just some quality of life garbage (#304)

* fix: statistics widget min sizes

* fix: offset for split TextView values

Due to format and color changes, the text is split between two separate items and this space avoids multiple insertions in code

* feat: extension launch from notice

* fix: wait for the UI to post stuff to it
This commit is contained in:
TwistedUmbrellaX 2024-03-29 18:11:37 -04:00 committed by GitHub
parent 92be9bf626
commit c29147a681
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 22 deletions

View file

@ -15,6 +15,7 @@ import android.os.Looper
import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import android.view.View.OnClickListener
import android.view.ViewGroup
import android.view.animation.AnticipateInterpolator
import android.widget.TextView
@ -54,6 +55,7 @@ import ani.dantotsu.others.CustomBottomDialog
import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.activity.FeedActivity
import ani.dantotsu.profile.activity.NotificationActivity
import ani.dantotsu.settings.ExtensionsActivity
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefManager.asLiveBool
import ani.dantotsu.settings.saving.PrefName
@ -228,17 +230,6 @@ class MainActivity : AppCompatActivity() {
}
}
val preferences: SourcePreferences = Injekt.get()
if (preferences.animeExtensionUpdatesCount()
.get() > 0 || preferences.mangaExtensionUpdatesCount().get() > 0
) {
Toast.makeText(
this,
"You have extension updates available!",
Toast.LENGTH_LONG
).show()
}
binding.root.isMotionEventSplittingEnabled = false
lifecycleScope.launch {
@ -282,6 +273,16 @@ class MainActivity : AppCompatActivity() {
binding.root.doOnAttach {
initActivity(this)
val preferences: SourcePreferences = Injekt.get()
if (preferences.animeExtensionUpdatesCount()
.get() > 0 || preferences.mangaExtensionUpdatesCount().get() > 0
) {
snackString(R.string.extension_updates_available)
?.setDuration(Snackbar.LENGTH_LONG)
?.setAction(R.string.review) {
startActivity(Intent(this, ExtensionsActivity::class.java))
}
}
window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent)
selectedOption = if (fragment != null) {
when (fragment) {
@ -482,7 +483,7 @@ class MainActivity : AppCompatActivity() {
dialogView.findViewById<TextInputEditText>(R.id.userAgentTextBox)?.hint = "Password"
val subtitleTextView = dialogView.findViewById<TextView>(R.id.subtitle)
subtitleTextView?.visibility = View.VISIBLE
subtitleTextView?.text = "Enter your password to decrypt the file"
subtitleTextView?.text = getString(R.string.enter_password_to_decrypt_file)
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle("Enter Password")

View file

@ -15,7 +15,7 @@ class ExtensionUpdateNotifier(private val context: Context) {
Notifications.CHANNEL_EXTENSIONS_UPDATE,
) {
setContentTitle(
"Extension updates available"
context.getString(R.string.extension_updates_available)
)
val extNames = names.joinToString(", ")
setContentText(extNames)

View file

@ -49,9 +49,9 @@
<string name="popular_manga">Popular Manga</string>
<string name="username">Username</string>
<string name="chapters_read">Chapters Read</string>
<string name="chapters_read">Chapters Read </string>
<string name="chapters_read_n">Chapters\nRead</string>
<string name="episodes_watched">Episodes Watched</string>
<string name="episodes_watched">Episodes Watched </string>
<string name="episodes_watched_n">Episodes\nWatched</string>
<string name="continue_reading">Continue Reading</string>
<string name="continue_watching">Continue Watching</string>
@ -175,6 +175,7 @@
<string name="offline_mode">Offline Mode</string>
<string name="settings">Settings</string>
<string name="extensions">Extensions</string>
<string name="extension_updates_available">Extension updates available</string>
<string name="player_settings">Player Settings</string>
<string name="recentlyListOnly">Only show my content in \"Recently Updated\"</string>
<string name="download_manager_select">Download Manager</string>
@ -418,6 +419,7 @@
<string name="extension_installed">Extension installed</string>
<string name="error_message">Error: %1$s</string>
<string name="install_step">Step: %1$s</string>
<string name="review">Review</string>
<string name="jobless_message">DAMN! YOU TRULY ARE JOBLESS\nYOU REACHED THE END</string>
<string name="file_manager_not_found">Couldn\'t find any File Manager to open SD card</string>

View file

@ -3,10 +3,10 @@
android:description="@string/profile_stats_widget"
android:initialKeyguardLayout="@layout/statistics_widget"
android:initialLayout="@layout/statistics_widget"
android:targetCellWidth="3"
android:targetCellWidth="2"
android:targetCellHeight="2"
android:minResizeWidth="180dp"
android:minResizeHeight="110dp"
android:minResizeWidth="130dp"
android:minResizeHeight="220dp"
android:previewImage="@drawable/statistics_widget_preview"
android:previewLayout="@layout/statistics_widget"
android:resizeMode="horizontal|vertical"

View file

@ -3,10 +3,10 @@
android:description="@string/profile_stats_widget"
android:initialKeyguardLayout="@layout/statistics_widget"
android:initialLayout="@layout/statistics_widget"
android:minWidth="180dp"
android:minHeight="110dp"
android:minResizeWidth="180dp"
android:minResizeHeight="110dp"
android:minWidth="130dp"
android:minHeight="220dp"
android:minResizeWidth="130dp"
android:minResizeHeight="220dp"
android:previewImage="@drawable/statistics_widget_preview"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="86400000"