Skip to content

Commit

Permalink
fix: what does the fix say? 🦊
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed May 25, 2024
1 parent 37949c7 commit 7717974
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 15 deletions.
19 changes: 14 additions & 5 deletions app/src/main/java/ani/dantotsu/home/status/StatusActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import ani.dantotsu.navBarHeight
import ani.dantotsu.profile.User
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.statusBarHeight
import ani.dantotsu.toast
import ani.dantotsu.util.Logger

class StatusActivity : AppCompatActivity(), StoriesCallback {
private lateinit var activity: ArrayList<User>
Expand Down Expand Up @@ -44,10 +46,14 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {

val key = "activities"
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
val startIndex = if ( startFrom > 0) startFrom else 0
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)

if (activity.getOrNull(position) != null) {
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
val startIndex = if ( startFrom > 0) startFrom else 0
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)
} else {
Logger.log("index out of bounds for position $position of size ${activity.size}")
finish()
}

}
private fun findFirstNonMatch(watchedActivity: Set<Int>, activity: List<Activity>): Int {
Expand All @@ -58,13 +64,16 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {
}
return -1
}

override fun onPause() {
super.onPause()
binding.stories.pause()
}

override fun onResume() {
super.onResume()
binding.stories.resume()
if (hasWindowFocus())
binding.stories.resume()
}

override fun onWindowFocusChanged(hasFocus: Boolean) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
}

override fun onResume() {
navBar.selectTabAt(selected)
if (::navBar.isInitialized)
navBar.selectTabAt(selected)
super.onResume()
}

Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/ani/dantotsu/settings/ExtensionsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import uy.kohesive.injekt.injectLazy
import java.util.Locale

class ExtensionsActivity : AppCompatActivity() {
lateinit var binding: ActivityExtensionsBinding
Expand Down Expand Up @@ -173,8 +174,11 @@ class ExtensionsActivity : AppCompatActivity() {
initActivity(this)
binding.languageselect.setOnClickListener {
val languageOptions =
LanguageMapper.Companion.Language.entries.map { it.name }.toTypedArray()
val builder = AlertDialog.Builder(currContext(), R.style.MyPopup)
LanguageMapper.Companion.Language.entries.map { entry ->
entry.name.lowercase().replace("_", " ")
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.ROOT) else it.toString() }
}.toTypedArray()
val builder = AlertDialog.Builder(this, R.style.MyPopup)
val listOrder: String = PrefManager.getVal(PrefName.LangSort)
val index = LanguageMapper.Companion.Language.entries.toTypedArray()
.indexOfFirst { it.code == listOrder }
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/ani/dantotsu/settings/InstallerSteps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.core.app.NotificationCompat
import ani.dantotsu.R
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
import ani.dantotsu.snackString
import ani.dantotsu.util.Logger
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.extension.InstallStep
import uy.kohesive.injekt.Injekt
Expand All @@ -30,6 +31,7 @@ class InstallerSteps(

fun onError(error: Throwable, extra: () -> Unit) {
Injekt.get<CrashlyticsInterface>().logException(error)
Logger.log(error)
val builder = NotificationCompat.Builder(
context,
Notifications.CHANNEL_DOWNLOADER_ERROR
Expand Down
Loading

0 comments on commit 7717974

Please sign in to comment.