parent
e03089ab2a
commit
d50e71bd80
@ -0,0 +1,48 @@ |
||||
package net.pokeranalytics.android.ui.adapter |
||||
|
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import androidx.recyclerview.widget.RecyclerView |
||||
import io.realm.RealmObject |
||||
import io.realm.RealmResults |
||||
import kotlinx.android.synthetic.main.row_history_session.view.* |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.model.realm.Session |
||||
import net.pokeranalytics.android.ui.view.SessionRowView |
||||
import timber.log.Timber |
||||
|
||||
class DataManagerAdapter(private var items: RealmResults<Any>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { |
||||
|
||||
companion object { |
||||
const val ROW_DATA: Int = 100 |
||||
} |
||||
|
||||
inner class RowDataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { |
||||
fun bind() { |
||||
} |
||||
} |
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { |
||||
when (viewType) { |
||||
ROW_DATA -> return RowDataViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.row_data_cell, parent, false)) |
||||
else -> throw IllegalStateException("Need to implement type $viewType in DataManager") |
||||
} |
||||
} |
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { |
||||
when (getItemViewType(position)) { |
||||
ROW_DATA -> (holder as DataManagerAdapter.RowDataViewHolder).bind() |
||||
} |
||||
} |
||||
|
||||
override fun getItemCount(): Int { |
||||
return items.size |
||||
} |
||||
|
||||
override fun getItemViewType(position: Int): Int { |
||||
return ROW_DATA |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,69 @@ |
||||
package net.pokeranalytics.android.ui.fragment |
||||
|
||||
import android.os.Bundle |
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import android.widget.Toast |
||||
import androidx.recyclerview.widget.LinearLayoutManager |
||||
import io.realm.Realm |
||||
import io.realm.RealmResults |
||||
import kotlinx.coroutines.Dispatchers |
||||
import kotlinx.coroutines.GlobalScope |
||||
import kotlinx.coroutines.delay |
||||
import kotlinx.coroutines.launch |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.ui.adapter.DataManagerAdapter |
||||
import net.pokeranalytics.android.util.PokerAnalyticsFragment |
||||
import timber.log.Timber |
||||
import java.util.* |
||||
|
||||
class DataManagerFragment : PokerAnalyticsFragment() { |
||||
|
||||
companion object { |
||||
fun newInstance(): DataManagerFragment { |
||||
val fragment = DataManagerFragment() |
||||
val bundle = Bundle() |
||||
fragment.arguments = bundle |
||||
return fragment |
||||
} |
||||
} |
||||
|
||||
private lateinit var dataManagerAdapter: DataManagerAdapter |
||||
private var realmSessions: RealmResults<Any>? = null |
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
||||
return inflater.inflate(R.layout.fragment_data_manager, container, false) |
||||
} |
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
||||
super.onViewCreated(view, savedInstanceState) |
||||
initUI() |
||||
initData() |
||||
} |
||||
|
||||
override fun onDestroyView() { |
||||
super.onDestroyView() |
||||
realmSessions?.removeAllChangeListeners() |
||||
} |
||||
|
||||
/** |
||||
* Init UI |
||||
*/ |
||||
private fun initUI() { |
||||
} |
||||
|
||||
/** |
||||
* Init data |
||||
*/ |
||||
private fun initData() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Set fragment data |
||||
*/ |
||||
fun setData(dataType: Int) { |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<fragment |
||||
android:id="@+id/dataManagerFragment" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:name="net.pokeranalytics.android.ui.fragment.DataManagerFragment" /> |
||||
|
||||
</LinearLayout> |
||||
@ -0,0 +1,21 @@ |
||||
<?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:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
tools:context=".ui.activity.DataManagementActivity"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="0dp" |
||||
android:layout_height="0dp" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" |
||||
tools:listitem="@layout/row_data_cell"/> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
Loading…
Reference in new issue