Skip to content

Commit cc55559

Browse files
authored
Add quick scroll-to-top functionality via long press on Home button (#1763)
1 parent aeba48e commit cc55559

10 files changed

Lines changed: 12 additions & 216 deletions

File tree

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 123 deletions
This file was deleted.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.idea/compiler.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/discord.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.idea/gradle.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.idea/jarRepositories.xml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.idea/studiobot.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
719719
}
720720
}
721721

722+
722723
private val pluginsLock = Mutex()
723724
private fun onAllPluginsLoaded(success: Boolean = false) {
724725
ioSafe {
@@ -1630,6 +1631,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
16301631
navController
16311632
)
16321633
}
1634+
16331635
}
16341636

16351637
binding?.navRailView?.apply {
@@ -1648,6 +1650,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
16481650
navController
16491651
)
16501652
}
1653+
16511654

16521655
fun noFocus(view: View) {
16531656
view.tag = view.context.getString(R.string.tv_no_focus_tag)
@@ -1687,6 +1690,15 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
16871690
}
16881691
}
16891692

1693+
// Home button long click functionality to scroll to top
1694+
for (view in listOf(binding?.navView, binding?.navRailView)) {
1695+
view?.findViewById<View?>(R.id.navigation_home)?.setOnLongClickListener {
1696+
val recycler = binding?.root?.findViewById<RecyclerView?>(R.id.home_master_recycler)
1697+
recycler?.smoothScrollToPosition(0)
1698+
return@setOnLongClickListener recycler != null
1699+
}
1700+
}
1701+
16901702
loadCache()
16911703
updateHasTrailers()
16921704
/*nav_view.setOnNavigationItemSelectedListener { item ->

0 commit comments

Comments
 (0)