Version 2.0.2 - card background now customisable, tablet layout changed

This commit is contained in:
Deniz Düzgören
2019-06-02 17:57:57 +02:00
parent abc3309acd
commit d4cef4f25d
23 changed files with 379 additions and 450 deletions
@@ -18,7 +18,9 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import java.util.*
import kotlin.collections.ArrayList
class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
class PlanFragment : Fragment(R.layout.plan) {
private lateinit var recyclerView: RecyclerView
private lateinit var mAdapter: CardAdapter
private lateinit var layoutManager: GridLayoutManager
@@ -45,10 +47,19 @@ class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
val grid = when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
val tabletSize = resources.getBoolean(R.bool.isTablet)
val grid = if (tabletSize) {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
}
}
layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager
}
@@ -68,10 +79,19 @@ class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
recyclerView = view.findViewById(R.id.linearRecycler)
recyclerView.hasFixedSize()
val grid = when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
val tabletSize = resources.getBoolean(R.bool.isTablet)
val grid = if (tabletSize) {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2
}
}
layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager