Fixed a major app menu duplication bug (upon changing to transparent bg from another after initial app launch)

This commit is contained in:
ottoptj 2024-08-04 23:51:15 +03:00
commit 7f7a7f4286
2 changed files with 11 additions and 13 deletions

View file

@ -28,8 +28,8 @@ class Animations () {
}
fun showApps(binding: ActivityMainBinding) {
binding.homeView.fadeOut()
binding.appView.slideInFromBottom()
binding.homeView.fadeOut()
}
fun backgroundIn(activity: Activity, originalColor: Int, duration: Long = 100) {
@ -95,7 +95,7 @@ class Animations () {
.setDuration(duration)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
visibility = View.INVISIBLE
visibility = View.GONE
}
})
}
@ -122,7 +122,7 @@ class Animations () {
.setDuration(duration)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
visibility = View.INVISIBLE
visibility = View.GONE
}
})}
}

View file

@ -111,11 +111,9 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
preferences.registerOnSharedPreferenceChangeListener(this)
window.setBackgroundDrawable(
ColorDrawable(
window.decorView.setBackgroundColor(
Color.parseColor(preferences.getString("bgColor", "#00000000"))
)
)
searchView = findViewById(R.id.searchView)
@ -159,8 +157,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}
binding.homeView.setOnTouchListener { _, event ->
gestureDetector.onTouchEvent(event)
super.onTouchEvent(event)
gestureDetector.onTouchEvent(event)
true // Return true if the touch event is handled
}
@ -229,11 +227,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
}
"bgColor" -> {
window.setBackgroundDrawable(
ColorDrawable(
window.setBackgroundDrawable(ColorDrawable(Color.parseColor("#00000000")))
window.decorView.setBackgroundColor(
Color.parseColor(preferences?.getString(key, "#00000000"))
)
)
}
"textColor" -> {
@ -331,7 +328,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
@SuppressLint("NotifyDataSetChanged")
override fun onResume() {
super.onResume()
binding.homeView.visibility = View.VISIBLE
binding.appView.visibility = View.INVISIBLE
adapter?.notifyDataSetChanged()
}
@ -372,7 +370,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
startActivity(phoneIntent)
}
}
return false
return true
}
override fun onLongPress(e: MotionEvent) {