parent
f5aa689b50
commit
9a68a39908
@ -1,45 +0,0 @@ |
|||||||
package net.pokeranalytics.android.ui.activity |
|
||||||
|
|
||||||
import android.content.Context |
|
||||||
import android.content.Intent |
|
||||||
import android.os.Bundle |
|
||||||
import kotlinx.android.synthetic.main.activity_data_manager.* |
|
||||||
import net.pokeranalytics.android.R |
|
||||||
import net.pokeranalytics.android.ui.fragment.DataManagerFragment |
|
||||||
import net.pokeranalytics.android.util.PokerAnalyticsActivity |
|
||||||
|
|
||||||
class DataManagementActivity: PokerAnalyticsActivity() { |
|
||||||
|
|
||||||
companion object { |
|
||||||
fun newInstance(context: Context, dataType: Int) { |
|
||||||
val intent = Intent(context, DataManagementActivity::class.java) |
|
||||||
intent.putExtra("dataType", dataType) |
|
||||||
context.startActivity(intent) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) { |
|
||||||
super.onCreate(savedInstanceState) |
|
||||||
setContentView(R.layout.activity_data_manager) |
|
||||||
|
|
||||||
initUI() |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Init UI |
|
||||||
*/ |
|
||||||
private fun initUI() { |
|
||||||
|
|
||||||
val dataType = intent.getIntExtra("dataType", 0) |
|
||||||
val fragment = dataManagerFragment as DataManagerFragment |
|
||||||
fragment.setData(dataType) |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Init data |
|
||||||
*/ |
|
||||||
private fun initData() { |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,48 +0,0 @@ |
|||||||
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 |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
@ -1,69 +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 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) { |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,13 +0,0 @@ |
|||||||
<?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> |
|
||||||
@ -1,21 +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: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