-
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.
Merge pull request #13 from puutaro/edit/grid_view
add grid veiw implement
- Loading branch information
Showing
14 changed files
with
571 additions
and
124 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
30 changes: 29 additions & 1 deletion
30
app/src/main/java/com/puutaro/commandclick/custom_manager/PreLoadGridLayoutManager.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,4 +1,32 @@ | ||
package com.puutaro.commandclick.custom_manager | ||
|
||
class PreLoadGridLayoutManager { | ||
import android.content.Context | ||
import androidx.recyclerview.widget.GridLayoutManager | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class PreLoadGridLayoutManager( | ||
context: Context?, | ||
col: Int, | ||
reverseLayout: Boolean = false | ||
) : | ||
GridLayoutManager( | ||
context, | ||
col, | ||
LinearLayoutManager.VERTICAL, | ||
reverseLayout | ||
) { | ||
private val mDisplayHeight: Int | ||
|
||
|
||
init { | ||
mDisplayHeight = context?.resources?.displayMetrics?.heightPixels ?: 0 | ||
} | ||
override fun calculateExtraLayoutSpace( | ||
state: RecyclerView.State, | ||
extraLayoutSpace: IntArray | ||
) { | ||
extraLayoutSpace[0] = mDisplayHeight * 100 | ||
extraLayoutSpace[1] = mDisplayHeight * 100 | ||
} | ||
} |
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
Oops, something went wrong.