-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
237 additions
and
186 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
22 changes: 22 additions & 0 deletions
22
demo/src/main/java/com/github/chantsune/swipetoaction/demo/base/BaseListFragment.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,22 @@ | ||
package com.github.chantsune.swipetoaction.demo.base | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.github.chantsune.swipetoaction.demo.databinding.FragmentListBinding | ||
|
||
open class BaseListFragment : Fragment() { | ||
|
||
protected lateinit var binding: FragmentListBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentListBinding.inflate(inflater, container, false) | ||
return binding.root | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
demo/src/main/java/com/github/chantsune/swipetoaction/demo/grid/GridLayoutFragment.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,33 @@ | ||
package com.github.chantsune.swipetoaction.demo.grid | ||
|
||
import android.os.Bundle | ||
import androidx.lifecycle.ViewModelProvider | ||
import androidx.lifecycle.get | ||
import androidx.recyclerview.widget.GridLayoutManager | ||
import com.github.chantsune.swipetoaction.demo.base.BaseListFragment | ||
import com.github.chantsune.swipetoaction.demo.simple.RecyclerAdapter | ||
|
||
class GridLayoutFragment : BaseListFragment() { | ||
|
||
private lateinit var viewModel: GridLayoutViewModel | ||
|
||
override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
super.onActivityCreated(savedInstanceState) | ||
viewModel = ViewModelProvider(this).get() | ||
binding.recyclerView.apply { | ||
adapter = RecyclerAdapter() | ||
layoutManager = GridLayoutManager(requireContext(), 2).apply { | ||
spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { | ||
override fun getSpanSize(position: Int): Int { | ||
return if (position in 0..3) { | ||
2 | ||
} else { | ||
1 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
demo/src/main/java/com/github/chantsune/swipetoaction/demo/grid/GridLayoutViewModel.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,7 @@ | ||
package com.github.chantsune.swipetoaction.demo.grid | ||
|
||
import androidx.lifecycle.ViewModel | ||
|
||
class GridLayoutViewModel : ViewModel() { | ||
// TODO: Implement the ViewModel | ||
} |
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
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.