This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [M] Adds Horizontal scrolling support * [M] Adds functionality to hide handle * [m] Updates sample application to have a sample for horizontal scrolling * [u] Updates libraries and gradle tools versioning
- Loading branch information
1 parent
73db556
commit 5a235f3
Showing
13 changed files
with
114 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
sample/src/main/java/com/qtalk/sample/fragments/ProgrammingLanguageFragment.kt
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
sample/src/main/java/com/qtalk/sample/fragments/ProgrammingLanguagesFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.qtalk.sample.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller | ||
import com.qtalk.sample.R | ||
import com.qtalk.sample.adapters.ProgrammingLanguagesAdapter | ||
import kotlinx.android.synthetic.main.fragment_programming_languages.view.* | ||
import kotlinx.serialization.decodeFromString | ||
import kotlinx.serialization.json.Json | ||
import java.util.Locale | ||
|
||
class ProgrammingLanguagesFragment : Fragment() { | ||
|
||
private val programmingLanguages: List<String> by lazy { | ||
Json.decodeFromString<List<String>>( | ||
requireActivity().assets.open("programming_languages.json").use { | ||
it.reader().readText() | ||
} | ||
).sortedBy { it.toLowerCase(Locale.ROOT) } | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
return inflater.inflate(R.layout.fragment_programming_languages, container, false).apply { | ||
|
||
recyclerView.layoutManager = LinearLayoutManager( | ||
context, | ||
LinearLayoutManager.HORIZONTAL, | ||
false | ||
) | ||
|
||
fab.setOnClickListener { | ||
with(fastScroller) { | ||
val tmp = handleWidth | ||
handleWidth = handleHeight | ||
handleHeight = tmp | ||
|
||
fastScrollDirection = | ||
if (fastScrollDirection == RecyclerViewFastScroller.FastScrollDirection.HORIZONTAL) { | ||
recyclerView.layoutManager = | ||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) | ||
RecyclerViewFastScroller.FastScrollDirection.VERTICAL | ||
} else { | ||
recyclerView.layoutManager = | ||
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) | ||
RecyclerViewFastScroller.FastScrollDirection.HORIZONTAL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
view.recyclerView.adapter = ProgrammingLanguagesAdapter(programmingLanguages) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters