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

View file

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