Fix problems from plugin update

Remove the fixAnimInfoLeak hack since it seems that issue was fixed in the new android plugin, and once again modify with the styles to get the dialogs to use the correct style again.

Another day another magic flag I need to fiddle with to get this busted android app working. This platform sucks so much.
This commit is contained in:
OxygenCobalt 2021-05-08 08:29:55 -06:00
parent 7c457d5773
commit 0ba1048ead
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
8 changed files with 4 additions and 60 deletions

View file

@ -56,7 +56,6 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
// Kotlin
// TODO: Move to kotlin 1.5.0 when they actually release it
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

View file

@ -19,7 +19,6 @@ import org.oxycblt.auxio.detail.DetailViewModel
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.ui.Accent
import org.oxycblt.auxio.ui.fixAnimInfoLeak
import org.oxycblt.auxio.ui.isLandscape
import org.oxycblt.auxio.ui.isTablet
import org.oxycblt.auxio.ui.toColor
@ -107,12 +106,6 @@ class MainFragment : Fragment() {
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
fixAnimInfoLeak()
}
/**
* Custom navigator code that has proper animations, unlike BottomNavigationView.setupWithNavController().
*/

View file

@ -11,7 +11,6 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.databinding.FragmentDetailBinding
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.ui.fixAnimInfoLeak
import org.oxycblt.auxio.ui.isLandscape
import org.oxycblt.auxio.ui.memberBinding
@ -41,12 +40,6 @@ abstract class DetailFragment : Fragment() {
callback.isEnabled = false
}
override fun onDestroyView() {
super.onDestroyView()
fixAnimInfoLeak()
}
/**
* Shortcut method for doing setup of the detail toolbar.
* @param menu Menu resource to use

View file

@ -17,7 +17,6 @@ import org.oxycblt.auxio.music.Artist
import org.oxycblt.auxio.music.Genre
import org.oxycblt.auxio.music.Parent
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.ui.fixAnimInfoLeak
import org.oxycblt.auxio.ui.getSpans
import org.oxycblt.auxio.ui.newMenu
@ -96,12 +95,6 @@ class LibraryFragment : Fragment() {
libraryModel.setNavigating(false)
}
override fun onDestroyView() {
super.onDestroyView()
fixAnimInfoLeak()
}
/**
* Navigate to the detail UI for a [parent].
*/

View file

@ -22,7 +22,6 @@ import org.oxycblt.auxio.music.Genre
import org.oxycblt.auxio.music.Header
import org.oxycblt.auxio.music.Song
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.ui.fixAnimInfoLeak
import org.oxycblt.auxio.ui.getSpans
import org.oxycblt.auxio.ui.newMenu
@ -127,12 +126,6 @@ class SearchFragment : Fragment() {
searchModel.setNavigating(false)
}
override fun onDestroyView() {
super.onDestroyView()
fixAnimInfoLeak()
}
/**
* Function that handles when an [item] is selected.
* Handles all datatypes that are selectable.

View file

@ -12,7 +12,6 @@ import org.oxycblt.auxio.databinding.FragmentSongsBinding
import org.oxycblt.auxio.logD
import org.oxycblt.auxio.music.MusicStore
import org.oxycblt.auxio.playback.PlaybackViewModel
import org.oxycblt.auxio.ui.fixAnimInfoLeak
import org.oxycblt.auxio.ui.getSpans
import org.oxycblt.auxio.ui.newMenu
@ -67,12 +66,6 @@ class SongsFragment : Fragment() {
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
fixAnimInfoLeak()
}
/**
* Dumb shortcut for getting the first letter in a string, while regarding certain
* semantics when it comes to articles.

View file

@ -13,7 +13,6 @@ import android.os.Looper
import android.util.DisplayMetrics
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.ImageButton
import android.widget.TextView
@ -25,7 +24,6 @@ import androidx.annotation.DrawableRes
import androidx.annotation.PluralsRes
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import org.oxycblt.auxio.R
import org.oxycblt.auxio.logE
@ -258,20 +256,3 @@ private fun isSystemBarOnBottom(activity: Activity): Boolean {
return (!canMove || width < height)
}
// --- HACKY NIGHTMARES ---
/**
* Use ***REFLECTION*** to fix a memory leak in the [Fragment] source code where the focused view
* will never be cleared. I can't believe I have to do this.
*/
fun Fragment.fixAnimInfoLeak() {
try {
Fragment::class.java.getDeclaredMethod("setFocusedView", View::class.java).apply {
isAccessible = true
invoke(this@fixAnimInfoLeak, null)
}
} catch (e: Exception) {
logE("mAnimationInfo leak fix failed.")
}
}

View file

@ -24,17 +24,16 @@
<item name="cornerRadius">0dp</item>
<!--
These magic values seem to make the dialogs use the nicer material style. Don't know why.
I have no idea why but these exact flags in this exact order give the dialogs a better
style. Please do not touch them.
-->
<item name="viewInflaterClass">
com.google.android.material.theme.MaterialComponentsViewInflater
</item>
<item name="materialAlertDialogTheme">@style/Theme.CustomDialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.MaterialComponents.Dialog.Alert</item>
<item name="materialAlertDialogTheme">@style/Theme.CustomDialog</item>
</style>
<!-- Toolbar theme -->
<style name="Toolbar.Style" parent="ThemeOverlay.MaterialComponents.ActionBar">
<item name="android:layout_width">match_parent</item>