-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feature/item position fixes (#2) * - Resolved item position issue - Updated library version - Changed version * - Managed manual scroll scenario * - Changed item scale type
- Loading branch information
Showing
10 changed files
with
63 additions
and
71 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
2 changes: 1 addition & 1 deletion
2
autoscrollcircularpagerview/src/main/java/com/mindinventory/CenterItemCallback.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.mindinventory | ||
|
||
interface CenterItemCallback { | ||
fun onScrollFinished(middleElement: Int) | ||
fun onScrollFinished(visibleItemPosition: Int) | ||
fun onScrolled(dx: Int) | ||
} |
41 changes: 0 additions & 41 deletions
41
autoscrollcircularpagerview/src/main/java/com/mindinventory/CenterItemFinder.kt
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
autoscrollcircularpagerview/src/main/java/com/mindinventory/OnScrollListener.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,23 @@ | ||
package com.mindinventory | ||
|
||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class OnScrollListener( | ||
private val layoutManager: LinearLayoutManager, | ||
private val callback: CenterItemCallback, | ||
private val controlState: Int | ||
) : RecyclerView.OnScrollListener() { | ||
|
||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | ||
super.onScrolled(recyclerView, dx, dy) | ||
callback.onScrolled(dx) | ||
} | ||
|
||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { | ||
if (newState == controlState) { | ||
val visibleItemPosition = layoutManager.findFirstVisibleItemPosition() | ||
callback.onScrollFinished(visibleItemPosition) | ||
} | ||
} | ||
} |
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