mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Fixed incorrect default position in shortcut view's recyclerview.
This commit is contained in:
parent
2b63b1d6b0
commit
eb91eb8a9d
4 changed files with 10 additions and 11 deletions
|
|
@ -24,7 +24,6 @@ class Animations () {
|
|||
fun showHome(binding: ActivityMainBinding) {
|
||||
binding.appView.slideOutToBottom()
|
||||
binding.homeView.fadeIn()
|
||||
binding.menutitle.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun showApps(binding: ActivityMainBinding) {
|
||||
|
|
@ -32,7 +31,7 @@ class Animations () {
|
|||
binding.appView.slideInFromBottom()
|
||||
}
|
||||
|
||||
fun backgroundIn(activity: Activity, binding: ActivityMainBinding, duration: Long = 100) {
|
||||
fun backgroundIn(activity: Activity, duration: Long = 100) {
|
||||
val originalColor = ContextCompat.getColor(activity, R.color.original_color)
|
||||
val newColor = ContextCompat.getColor(activity, R.color.new_color)
|
||||
|
||||
|
|
@ -48,7 +47,7 @@ class Animations () {
|
|||
backgroundColorAnimator.start()
|
||||
}
|
||||
|
||||
fun backgroundOut(activity: Activity, binding: ActivityMainBinding, duration: Long = 100) {
|
||||
fun backgroundOut(activity: Activity, duration: Long = 100) {
|
||||
val originalColor = ContextCompat.getColor(activity, R.color.new_color)
|
||||
val newColor = ContextCompat.getColor(activity, R.color.original_color)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class AppMenuLinearLayoutManager(private val activity: MainActivity) : LinearLay
|
|||
val scrollRange = super.scrollVerticallyBy(dy, recycler, state)
|
||||
val overscroll: Int = dy - scrollRange
|
||||
|
||||
if (overscroll < 0 && firstVisibleItemPosition == 0 && scrollStarted) {
|
||||
if (overscroll < 0 && firstVisibleItemPosition == 0 && scrollStarted && activity.appUpdate) {
|
||||
activity.backToHome()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
textView.setOnLongClickListener {
|
||||
adapter.menuMode = "shortcut"
|
||||
adapter.shortcutTextView = textView
|
||||
binding.menutitle.visibility = View.VISIBLE
|
||||
toAppMenu()
|
||||
|
||||
return@setOnLongClickListener true
|
||||
|
|
@ -366,9 +365,8 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
}
|
||||
|
||||
fun openAppMenuActivity() {
|
||||
//AppMenuActivity.start(this, installedApps) {
|
||||
//}
|
||||
adapter.menuMode = "app"
|
||||
binding.menutitle.visibility = View.GONE
|
||||
toAppMenu()
|
||||
}
|
||||
|
||||
|
|
@ -376,8 +374,11 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
closeKeyboard()
|
||||
searchView.setText("")
|
||||
animations.showHome(binding)
|
||||
animations.backgroundOut(this@MainActivity, binding)
|
||||
animations.backgroundOut(this@MainActivity)
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
handler.postDelayed({
|
||||
binding.menutitle.visibility = View.VISIBLE
|
||||
}, 100)
|
||||
handler.postDelayed({
|
||||
recyclerView.scrollToPosition(0)
|
||||
}, 150)
|
||||
|
|
@ -385,7 +386,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
|
||||
private fun toAppMenu() {
|
||||
animations.showApps(binding)
|
||||
animations.backgroundIn(this@MainActivity, binding)
|
||||
animations.backgroundIn(this@MainActivity)
|
||||
}
|
||||
|
||||
override fun onItemClick(appInfo: LauncherActivityInfo, userHandle: UserHandle) {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@
|
|||
android:text="@string/select_an_app"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||
android:textColor="#C1F3F3F3"
|
||||
android:textSize="36sp"
|
||||
android:visibility="gone" />
|
||||
android:textSize="36sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue