Fixes #37 : Reports header issue + cleanup
parent
56a10395cc
commit
5c683eb369
@ -1,95 +0,0 @@ |
|||||||
package net.pokeranalytics.android.ui.fragment |
|
||||||
|
|
||||||
import android.os.Bundle |
|
||||||
import android.view.LayoutInflater |
|
||||||
import android.view.View |
|
||||||
import android.view.ViewGroup |
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager |
|
||||||
import kotlinx.android.synthetic.main.fragment_more.* |
|
||||||
import net.pokeranalytics.android.R |
|
||||||
import net.pokeranalytics.android.ui.modules.bankroll.BankrollActivity |
|
||||||
import net.pokeranalytics.android.ui.activity.SettingsActivity |
|
||||||
import net.pokeranalytics.android.ui.activity.Top10Activity |
|
||||||
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter |
|
||||||
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
||||||
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
||||||
import net.pokeranalytics.android.ui.fragment.components.BaseFragment |
|
||||||
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
||||||
import net.pokeranalytics.android.ui.view.rowrepresentable.MoreTabRow |
|
||||||
|
|
||||||
class MoreFragment : BaseFragment(), StaticRowRepresentableDataSource, RowRepresentableDelegate { |
|
||||||
|
|
||||||
companion object { |
|
||||||
|
|
||||||
/** |
|
||||||
* Create new instance |
|
||||||
*/ |
|
||||||
fun newInstance(): MoreFragment { |
|
||||||
val fragment = MoreFragment() |
|
||||||
val bundle = Bundle() |
|
||||||
fragment.arguments = bundle |
|
||||||
return fragment |
|
||||||
} |
|
||||||
|
|
||||||
val rowRepresentation: List<RowRepresentable> by lazy { |
|
||||||
val rows = ArrayList<RowRepresentable>() |
|
||||||
rows.addAll(MoreTabRow.values()) |
|
||||||
rows |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private lateinit var moreAdapter: RowRepresentableAdapter |
|
||||||
|
|
||||||
|
|
||||||
// Life Cycle |
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
||||||
return inflater.inflate(R.layout.fragment_more, container, false) |
|
||||||
} |
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
||||||
super.onViewCreated(view, savedInstanceState) |
|
||||||
initData() |
|
||||||
initUI() |
|
||||||
} |
|
||||||
|
|
||||||
// Rows |
|
||||||
override fun adapterRows(): List<RowRepresentable>? { |
|
||||||
return rowRepresentation |
|
||||||
} |
|
||||||
|
|
||||||
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { |
|
||||||
super.onRowSelected(position, row, tag) |
|
||||||
when(row) { |
|
||||||
MoreTabRow.BANKROLL -> BankrollActivity.newInstance(requireContext()) |
|
||||||
MoreTabRow.TOP_10 -> Top10Activity.newInstance(requireContext()) |
|
||||||
MoreTabRow.SETTINGS -> SettingsActivity.newInstance(requireContext()) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Business |
|
||||||
|
|
||||||
/** |
|
||||||
* Init data |
|
||||||
*/ |
|
||||||
private fun initData() { |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Init UI |
|
||||||
*/ |
|
||||||
private fun initUI() { |
|
||||||
|
|
||||||
moreAdapter = RowRepresentableAdapter(this, this) |
|
||||||
|
|
||||||
val viewManager = LinearLayoutManager(requireContext()) |
|
||||||
|
|
||||||
recyclerView.apply { |
|
||||||
setHasFixedSize(true) |
|
||||||
layoutManager = viewManager |
|
||||||
adapter = moreAdapter |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,37 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|
||||||
xmlns:tools="http://schemas.android.com/tools" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent"> |
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout |
|
||||||
android:id="@+id/appBar" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:theme="@style/PokerAnalyticsTheme.Toolbar.Session" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toTopOf="parent"> |
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar |
|
||||||
android:id="@+id/toolbar" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="?attr/actionBarSize" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toTopOf="parent" |
|
||||||
app:title="@string/more" /> |
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout> |
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView |
|
||||||
android:id="@+id/recyclerView" |
|
||||||
android:layout_width="0dp" |
|
||||||
android:layout_height="0dp" |
|
||||||
app:layout_constraintBottom_toBottomOf="parent" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/appBar" /> |
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout> |
|
||||||
Loading…
Reference in new issue