merge conflict fix

dev_raz_wip
Razmig Sarkissian 7 years ago
commit 0e8e564981
  1. 4
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 6
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/DynamicRowInterface.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/RowViewType.kt
  4. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/NewSessionFragment.kt
  5. 23
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/BottomSheetEditTextFragment.kt
  6. 1
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/BottomSheetFragment.kt
  7. 29
      app/src/main/res/layout/bottom_sheet_edit_text.xml
  8. 44
      app/src/main/res/layout/row_title_value.xml
  9. 1
      app/src/main/res/values/strings.xml

@ -143,6 +143,7 @@ open class Session : RealmObject(), SessionInterface, DynamicRowDelegate, Displa
SessionRow.LOCATION -> location?.title ?: "--"
SessionRow.BANKROLL -> bankroll?.title ?: "--"
SessionRow.DATE -> if (timeFrame != null) timeFrame?.startDate.toString() else "--"
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--"
else -> "--"
}
}
@ -173,6 +174,9 @@ open class Session : RealmObject(), SessionInterface, DynamicRowDelegate, Displa
data.add(BottomSheetData(cgSmallBlind, "Small blind", InputType.TYPE_CLASS_NUMBER))
data.add(BottomSheetData(cgBigBlind, "Big blind", InputType.TYPE_CLASS_NUMBER))
}
SessionRow.COMMENT -> {
data.add(BottomSheetData(comment, "Comment", InputType.TYPE_CLASS_TEXT))
}
}
return data

@ -38,7 +38,8 @@ enum class SessionRow(val resId: Int) : DynamicRowInterface {
BLINDS(R.string.blinds),
LOCATION(R.string.location),
BANKROLL(R.string.bankroll),
DATE(R.string.date);
DATE(R.string.date),
COMMENT(R.string.comment);
override fun localizedTitle(context: Context): String {
return context.getString(this.resId)
@ -47,7 +48,7 @@ enum class SessionRow(val resId: Int) : DynamicRowInterface {
override val viewType: Int
get() {
return when (this) {
BLINDS, GAME, DATE, BANKROLL, LOCATION -> RowViewType.TITLE_VALUE.ordinal
BLINDS, GAME, DATE, BANKROLL, LOCATION, COMMENT -> RowViewType.TITLE_VALUE.ordinal
}
}
@ -59,6 +60,7 @@ enum class SessionRow(val resId: Int) : DynamicRowInterface {
LOCATION -> BottomSheetType.LIST
BANKROLL -> BottomSheetType.LIST
DATE -> BottomSheetType.DATE
COMMENT -> BottomSheetType.EDIT_TEXT
}
}

@ -47,7 +47,7 @@ enum class RowViewType {
return when (this) {
TITLE_VALUE -> TitleValueViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_session,
R.layout.row_title_value,
parent,
false
)

@ -57,6 +57,7 @@ class NewSessionFragment : PokerAnalyticsFragment(), DynamicRowCallback, BottomS
currentSession.cgSmallBlind = null
currentSession.cgBigBlind = null
}
SessionRow.COMMENT -> currentSession.comment = ""
}
sessionAdapter.notifyItemChanged(SessionRow.values().indexOf(row))
}
@ -74,6 +75,7 @@ class NewSessionFragment : PokerAnalyticsFragment(), DynamicRowCallback, BottomS
currentSession.cgSmallBlind = (value[0] as String? ?: "0").toDouble()
currentSession.cgBigBlind = (value[1] as String? ?: "0").toDouble()
}
SessionRow.COMMENT -> if (value is String) currentSession.comment = value
}
sessionAdapter.notifyItemChanged(SessionRow.values().indexOf(row))
}

@ -1,8 +1,10 @@
package net.pokeranalytics.android.ui.fragment.components
import android.os.Bundle
import android.text.InputType
import android.view.LayoutInflater
import android.view.View
import android.view.inputmethod.EditorInfo
import kotlinx.android.synthetic.main.bottom_sheet_edit_text.*
import kotlinx.android.synthetic.main.fragment_bottom_sheet.view.*
import net.pokeranalytics.android.R
@ -25,7 +27,6 @@ class BottomSheetEditTextFragment : BottomSheetFragment() {
* Init data
*/
private fun initData() {
val data = getData()
}
/**
@ -33,8 +34,28 @@ class BottomSheetEditTextFragment : BottomSheetFragment() {
*/
private fun initUI() {
setAddButtonVisible(false)
LayoutInflater.from(requireContext()).inflate(R.layout.bottom_sheet_edit_text, view?.bottomSheetContainer, true)
val data = getData()
if (data.size == 1) {
editText1.hint = data[0].hint
editText1.setText((data[0].defaultValue ?: "").toString())
editText1.inputType = data[0].inputType ?: InputType.TYPE_CLASS_TEXT
editText1.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
val value = editText1.text.toString()
bottomSheetDelegate.setValue(value, row)
dismiss()
true
} else {
false
}
}
}
}
}

@ -48,6 +48,7 @@ open class BottomSheetFragment : BottomSheetDialogFragment() {
BottomSheetType.DATE -> BottomSheetDateFragment()
BottomSheetType.LIST -> BottomSheetListFragment()
BottomSheetType.DOUBLE_LIST -> BottomSheetDoubleListFragment()
BottomSheetType.EDIT_TEXT -> BottomSheetEditTextFragment()
BottomSheetType.DOUBLE_EDIT_TEXT -> BottomSheetDoubleEditTextFragment()
else -> BottomSheetFragment()
}

@ -7,37 +7,20 @@
android:orientation="vertical"
tools:background="@color/gray_darker">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/editText1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/editText1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Blinds" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/editText1"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:gravity="end|center_vertical"
android:imeOptions="actionDone"
android:inputType="numberDecimal"
android:lines="1"
android:textColor="@color/white"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:hint="Test" />
tools:text="10" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,44 @@
<?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="wrap_content"
android:background="?selectableItemBackground"
android:padding="16dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/value"
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:ellipsize="end"
android:gravity="end"
android:maxLines="1"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent"
tools:text="Value" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -13,6 +13,7 @@
<string name="session">Session</string>
<string name="tournament_type">Tournament Type</string>
<string name="transaction_type">Transaction Type</string>
<string name="comment">Comment</string>
<string name="name">Name</string>
<string name="live">Live</string>

Loading…
Cancel
Save