# Conflicts: # app/src/main/java/net/pokeranalytics/android/model/realm/Bankroll.kt # app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt # app/src/main/java/net/pokeranalytics/android/model/realm/Location.kt # app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt # app/src/main/java/net/pokeranalytics/android/model/realm/TournamentFeature.kt # app/src/main/java/net/pokeranalytics/android/model/realm/TransactionType.kt # app/src/main/java/net/pokeranalytics/android/ui/adapter/components/DynamicRowInterface.kt # app/src/main/java/net/pokeranalytics/android/ui/adapter/components/LiveDataAdapter.kt # app/src/main/java/net/pokeranalytics/android/ui/fragment/EditableDataFragment.kt # app/src/main/java/net/pokeranalytics/android/ui/fragment/SessionFragment.kt # app/src/main/java/net/pokeranalytics/android/ui/fragment/components/DateTimePickerManager.ktdev_raz_wip
commit
8393877318
@ -1,53 +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 net.pokeranalytics.android.R |
|
||||||
import net.pokeranalytics.android.model.realm.Session |
|
||||||
import timber.log.Timber |
|
||||||
|
|
||||||
class NewSessionAdapter(private var session: Session) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { |
|
||||||
|
|
||||||
companion object { |
|
||||||
const val ROW_SESSION: Int = 100 |
|
||||||
} |
|
||||||
|
|
||||||
//var onClickOnSession: ((position: Int) -> Unit)? = null |
|
||||||
|
|
||||||
inner class RowSessionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { |
|
||||||
fun bind() { |
|
||||||
Timber.d("Bind session") |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { |
|
||||||
when (viewType) { |
|
||||||
ROW_SESSION -> return RowSessionViewHolder( |
|
||||||
LayoutInflater.from(parent.context).inflate( |
|
||||||
R.layout.row_history_session, |
|
||||||
parent, |
|
||||||
false |
|
||||||
) |
|
||||||
) |
|
||||||
else -> throw IllegalStateException("Need to implement type $viewType in NewSessionAdapter") |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { |
|
||||||
when (getItemViewType(position)) { |
|
||||||
ROW_SESSION -> (holder as NewSessionAdapter.RowSessionViewHolder).bind() |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override fun getItemCount(): Int { |
|
||||||
return 2 |
|
||||||
} |
|
||||||
|
|
||||||
override fun getItemViewType(position: Int): Int { |
|
||||||
return ROW_SESSION |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
@ -1,140 +0,0 @@ |
|||||||
package net.pokeranalytics.android.ui.adapter.components |
|
||||||
|
|
||||||
import android.content.Context |
|
||||||
import net.pokeranalytics.android.R |
|
||||||
import net.pokeranalytics.android.model.DataList |
|
||||||
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType |
|
||||||
|
|
||||||
|
|
||||||
interface DynamicRowInterface { |
|
||||||
fun localizedTitle(context: Context): String |
|
||||||
val viewType: Int |
|
||||||
get() { |
|
||||||
return 0 |
|
||||||
} |
|
||||||
|
|
||||||
val bottomSheetType: BottomSheetType |
|
||||||
get() { |
|
||||||
return BottomSheetType.NONE |
|
||||||
} |
|
||||||
|
|
||||||
val relatedDataList: DataList? |
|
||||||
get() { |
|
||||||
return null |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
class SectionRow(stringRes: Int) : DynamicRowInterface { |
|
||||||
|
|
||||||
var stringRes: Int = stringRes |
|
||||||
|
|
||||||
override fun localizedTitle(context: Context): String { |
|
||||||
return context.getString(this.stringRes) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
enum class SessionRow(val resId: Int) : DynamicRowInterface { |
|
||||||
GAME(R.string.game), |
|
||||||
BLINDS(R.string.blinds), |
|
||||||
LOCATION(R.string.location), |
|
||||||
BANKROLL(R.string.bankroll), |
|
||||||
START_DATE(R.string.start_date), |
|
||||||
END_DATE(R.string.end_date), |
|
||||||
COMMENT(R.string.comment); |
|
||||||
|
|
||||||
override fun localizedTitle(context: Context): String { |
|
||||||
return context.getString(this.resId) |
|
||||||
} |
|
||||||
|
|
||||||
override val viewType: Int |
|
||||||
get() { |
|
||||||
return when (this) { |
|
||||||
BLINDS, GAME, BANKROLL, LOCATION, COMMENT -> RowViewType.TITLE_VALUE.ordinal |
|
||||||
START_DATE, END_DATE -> RowViewType.TITLE_VALUE_ACTION.ordinal |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override val bottomSheetType: BottomSheetType |
|
||||||
get() { |
|
||||||
return when (this) { |
|
||||||
BLINDS -> BottomSheetType.DOUBLE_EDIT_TEXT |
|
||||||
GAME -> BottomSheetType.LIST |
|
||||||
LOCATION -> BottomSheetType.LIST |
|
||||||
BANKROLL -> BottomSheetType.LIST |
|
||||||
COMMENT -> BottomSheetType.EDIT_TEXT |
|
||||||
else -> BottomSheetType.NONE |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
enum class SimpleRow(val resId: Int) : DynamicRowInterface { |
|
||||||
NAME(R.string.name); |
|
||||||
override fun localizedTitle(context: Context): String { |
|
||||||
return context.getString(this.resId) |
|
||||||
} |
|
||||||
override val viewType: Int = RowViewType.TITLE_VALUE.ordinal |
|
||||||
override val bottomSheetType: BottomSheetType = BottomSheetType.EDIT_TEXT |
|
||||||
} |
|
||||||
|
|
||||||
enum class BankrollRow(val resId: Int) : DynamicRowInterface { |
|
||||||
LIVE(R.string.live), |
|
||||||
CURRENCY(R.string.currency); |
|
||||||
|
|
||||||
override fun localizedTitle(context: Context): String { |
|
||||||
return context.getString(this.resId) |
|
||||||
} |
|
||||||
|
|
||||||
override val viewType: Int |
|
||||||
get() { |
|
||||||
return when (this) { |
|
||||||
LIVE, CURRENCY -> RowViewType.TITLE_VALUE.ordinal |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
override val bottomSheetType: BottomSheetType |
|
||||||
get() { |
|
||||||
return when (this) { |
|
||||||
LIVE -> BottomSheetType.NONE |
|
||||||
CURRENCY -> BottomSheetType.LIST |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
enum class GameRow(val resId: Int) : DynamicRowInterface { |
|
||||||
} |
|
||||||
|
|
||||||
enum class LocationRow(val resId: Int) : DynamicRowInterface { |
|
||||||
} |
|
||||||
|
|
||||||
enum class TransactionTypeRow(val resId: Int) : DynamicRowInterface { |
|
||||||
} |
|
||||||
|
|
||||||
enum class TournamentFeatureRow(val resId: Int) : DynamicRowInterface { |
|
||||||
} |
|
||||||
|
|
||||||
enum class SettingRow(val resId: Int) : DynamicRowInterface { |
|
||||||
BANKROLL(R.string.bankroll), |
|
||||||
GAME(R.string.game), |
|
||||||
LOCATION(R.string.location), |
|
||||||
TOURNAMENT_TYPE(R.string.tournament_type), |
|
||||||
TRANSACTION_TYPE(R.string.transaction_type); |
|
||||||
|
|
||||||
override fun localizedTitle(context: Context): String { |
|
||||||
return context.getString(this.resId) |
|
||||||
} |
|
||||||
|
|
||||||
override val viewType: Int = RowViewType.TITLE.ordinal |
|
||||||
|
|
||||||
override val relatedDataList : DataList? |
|
||||||
get() { |
|
||||||
return when (this) { |
|
||||||
BANKROLL -> DataList.BANKROLL |
|
||||||
GAME -> DataList.GAME |
|
||||||
LOCATION -> DataList.LOCATION |
|
||||||
TOURNAMENT_TYPE -> DataList.TOURNAMENT_TYPE |
|
||||||
TRANSACTION_TYPE-> DataList.TRANSACTION_TYPE |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,7 +0,0 @@ |
|||||||
package net.pokeranalytics.android.ui.fragment.components |
|
||||||
|
|
||||||
open class DynamicListFragment : PokerAnalyticsFragment() { |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package net.pokeranalytics.android.ui.view |
||||||
|
|
||||||
|
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetData |
||||||
|
|
||||||
|
interface RowEditable { |
||||||
|
fun getBottomSheetData(row: RowRepresentable): ArrayList<BottomSheetData> |
||||||
|
fun updateValue(value: Any?, row: RowRepresentable) |
||||||
|
} |
||||||
@ -0,0 +1,158 @@ |
|||||||
|
package net.pokeranalytics.android.ui.view |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import net.pokeranalytics.android.R |
||||||
|
import net.pokeranalytics.android.model.LiveData |
||||||
|
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType |
||||||
|
|
||||||
|
|
||||||
|
interface RowRepresentable { |
||||||
|
fun localizedTitle(context: Context): String { |
||||||
|
this.resId?.let { |
||||||
|
return context.getString(it) |
||||||
|
} |
||||||
|
return "LOCALISATION NOT FOUND" |
||||||
|
} |
||||||
|
|
||||||
|
val resId: Int? |
||||||
|
get() { |
||||||
|
return null |
||||||
|
} |
||||||
|
|
||||||
|
val viewType: Int |
||||||
|
get() { |
||||||
|
return 0 |
||||||
|
} |
||||||
|
|
||||||
|
val bottomSheetType: BottomSheetType |
||||||
|
get() { |
||||||
|
return BottomSheetType.NONE |
||||||
|
} |
||||||
|
|
||||||
|
val relatedResultsRepresentable: LiveData? |
||||||
|
get() { |
||||||
|
return null |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
enum class SessionRow : RowRepresentable { |
||||||
|
GAME, |
||||||
|
BLINDS, |
||||||
|
LOCATION, |
||||||
|
BANKROLL, |
||||||
|
START_DATE, |
||||||
|
END_DATE, |
||||||
|
COMMENT; |
||||||
|
|
||||||
|
override val resId: Int? |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
BLINDS -> R.string.blinds |
||||||
|
GAME -> R.string.game |
||||||
|
LOCATION -> R.string.location |
||||||
|
BANKROLL -> R.string.bankroll |
||||||
|
COMMENT -> R.string.comment |
||||||
|
START_DATE -> R.string.start_date |
||||||
|
END_DATE -> R.string.end_date |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override val viewType: Int |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
BLINDS, GAME, BANKROLL, LOCATION, COMMENT -> RowViewType.TITLE_VALUE.ordinal |
||||||
|
START_DATE, END_DATE -> RowViewType.TITLE_VALUE_ACTION.ordinal |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override val bottomSheetType: BottomSheetType |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
BLINDS -> BottomSheetType.DOUBLE_EDIT_TEXT |
||||||
|
GAME -> BottomSheetType.LIST |
||||||
|
LOCATION -> BottomSheetType.LIST |
||||||
|
BANKROLL -> BottomSheetType.LIST |
||||||
|
COMMENT -> BottomSheetType.EDIT_TEXT |
||||||
|
else -> BottomSheetType.NONE |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
enum class SimpleRow : RowRepresentable { |
||||||
|
NAME; |
||||||
|
override val resId: Int? = R.string.name |
||||||
|
override val viewType: Int = RowViewType.TITLE_VALUE.ordinal |
||||||
|
override val bottomSheetType: BottomSheetType = BottomSheetType.EDIT_TEXT |
||||||
|
} |
||||||
|
|
||||||
|
enum class BankrollRow : RowRepresentable { |
||||||
|
LIVE, |
||||||
|
CURRENCY; |
||||||
|
|
||||||
|
override val resId: Int? |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
LIVE -> R.string.live |
||||||
|
CURRENCY -> R.string.currency |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override val viewType: Int |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
LIVE, CURRENCY -> RowViewType.TITLE_VALUE.ordinal |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override val bottomSheetType: BottomSheetType |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
LIVE -> BottomSheetType.NONE |
||||||
|
CURRENCY -> BottomSheetType.LIST |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
enum class GameRow : RowRepresentable { |
||||||
|
} |
||||||
|
|
||||||
|
enum class LocationRow : RowRepresentable { |
||||||
|
} |
||||||
|
|
||||||
|
enum class TransactionTypeRow : RowRepresentable { |
||||||
|
} |
||||||
|
|
||||||
|
enum class TournamentFeatureRow : RowRepresentable { |
||||||
|
} |
||||||
|
|
||||||
|
enum class SettingRow: RowRepresentable { |
||||||
|
BANKROLL, |
||||||
|
GAME, |
||||||
|
LOCATION, |
||||||
|
TOURNAMENT_TYPE, |
||||||
|
TRANSACTION_TYPE; |
||||||
|
|
||||||
|
override val resId: Int? |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
BANKROLL -> R.string.bankroll |
||||||
|
GAME -> R.string.game |
||||||
|
LOCATION -> R.string.location |
||||||
|
TOURNAMENT_TYPE -> R.string.tournament_type |
||||||
|
TRANSACTION_TYPE -> R.string.transaction_type |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override val viewType: Int = RowViewType.TITLE.ordinal |
||||||
|
|
||||||
|
override val relatedResultsRepresentable : LiveData? |
||||||
|
get() { |
||||||
|
return when (this) { |
||||||
|
BANKROLL -> LiveData.BANKROLL |
||||||
|
GAME -> LiveData.GAME |
||||||
|
LOCATION -> LiveData.LOCATION |
||||||
|
TOURNAMENT_TYPE -> LiveData.TOURNAMENT_TYPE |
||||||
|
TRANSACTION_TYPE -> LiveData.TRANSACTION_TYPE |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,23 +1,18 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
<androidx.constraintlayout.widget.ConstraintLayout |
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
xmlns:tools="http://schemas.android.com/tools" |
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
android:id="@+id/container" |
xmlns:tools="http://schemas.android.com/tools" |
||||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||||
android:layout_height="match_parent" |
android:layout_height="match_parent"> |
||||||
tools:context=".ui.activity.HomeActivity"> |
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView |
<androidx.recyclerview.widget.RecyclerView |
||||||
android:id="@+id/title" |
android:id="@+id/recyclerView" |
||||||
android:layout_width="wrap_content" |
android:layout_width="0dp" |
||||||
android:layout_height="wrap_content" |
android:layout_height="0dp" |
||||||
android:layout_marginStart="8dp" |
app:layout_constraintBottom_toBottomOf="parent" |
||||||
android:layout_marginEnd="8dp" |
app:layout_constraintEnd_toEndOf="parent" |
||||||
android:text="Stats" |
app:layout_constraintStart_toStartOf="parent" |
||||||
android:textSize="48sp" |
app:layout_constraintTop_toTopOf="parent" /> |
||||||
app:layout_constraintBottom_toBottomOf="parent" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toTopOf="parent" /> |
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout> |
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
Loading…
Reference in new issue