commit
973286dfa9
@ -1,79 +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 kotlinx.android.synthetic.main.row_data_cell.view.* |
||||
import kotlinx.android.synthetic.main.row_history_session.view.* |
||||
import net.pokeranalytics.android.R |
||||
|
||||
class SettingsAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() { |
||||
|
||||
companion object { |
||||
const val ROW_DATA: Int = 100 |
||||
enum class DataType { |
||||
BANKROLL { |
||||
override fun localizedName(): String { |
||||
return "Bankroll" |
||||
} |
||||
}, |
||||
GAME { |
||||
override fun localizedName(): String { |
||||
return "Game" |
||||
} |
||||
}, |
||||
LOCATION { |
||||
override fun localizedName(): String { |
||||
return "Location" |
||||
} |
||||
}, |
||||
TOURNAMENT_TYPE { |
||||
override fun localizedName(): String { |
||||
return "Tournament Type" |
||||
} |
||||
}, |
||||
TRANSACTION_TYPE { |
||||
override fun localizedName(): String { |
||||
return "Transaction" |
||||
} |
||||
}; |
||||
|
||||
abstract fun localizedName(): String |
||||
} |
||||
} |
||||
|
||||
var onClickOnData: ((position: Int, dataType: DataType) -> Unit)? = null |
||||
|
||||
inner class RowDataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { |
||||
fun bind(dataType: DataType) { |
||||
itemView.dataRow.setData(dataType.localizedName()) |
||||
itemView.dataRow.setOnClickListener { |
||||
onClickOnData?.invoke(adapterPosition, dataType) |
||||
} |
||||
} |
||||
} |
||||
|
||||
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 Settings Adapter") |
||||
} |
||||
} |
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { |
||||
when (getItemViewType(position)) { |
||||
ROW_DATA -> (holder as SettingsAdapter.RowDataViewHolder).bind(enumValues<DataType>()[position]) |
||||
} |
||||
} |
||||
|
||||
override fun getItemCount(): Int { |
||||
return enumValues<DataType>().count() |
||||
} |
||||
|
||||
override fun getItemViewType(position: Int): Int { |
||||
return ROW_DATA |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
package net.pokeranalytics.android.ui.fragment.components |
||||
|
||||
enum class BottomSheetType { |
||||
|
||||
NONE, |
||||
GAME, |
||||
BLINDS, |
||||
LOCATION, |
||||
BANKROLL, |
||||
TABLE_SIZE, |
||||
DATE |
||||
|
||||
} |
||||
@ -1,55 +0,0 @@ |
||||
package net.pokeranalytics.android.ui.view |
||||
|
||||
import android.widget.FrameLayout |
||||
import android.content.Context |
||||
import android.util.AttributeSet |
||||
import android.view.LayoutInflater |
||||
import androidx.constraintlayout.widget.ConstraintLayout |
||||
import kotlinx.android.synthetic.main.row_data_cell.view.* |
||||
import kotlinx.android.synthetic.main.row_data_content_view.view.* |
||||
import net.pokeranalytics.android.R |
||||
|
||||
|
||||
class DataRowView : FrameLayout { |
||||
|
||||
private lateinit var rowDataCell: ConstraintLayout |
||||
|
||||
/** |
||||
* Constructors |
||||
*/ |
||||
constructor(context: Context) : super(context) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { |
||||
init() |
||||
} |
||||
|
||||
/** |
||||
* Init |
||||
* |
||||
* @param attrs |
||||
*/ |
||||
private fun init() { |
||||
val layoutInflater = LayoutInflater.from(context) |
||||
rowDataCell = layoutInflater.inflate(R.layout.row_data_content_view, this, false) as ConstraintLayout |
||||
val layoutParams = FrameLayout.LayoutParams( |
||||
FrameLayout.LayoutParams.MATCH_PARENT, |
||||
FrameLayout.LayoutParams.WRAP_CONTENT |
||||
) |
||||
|
||||
addView(rowDataCell, layoutParams) |
||||
} |
||||
|
||||
/** |
||||
* Set the session data to the view |
||||
*/ |
||||
fun setData(title: String) { |
||||
rowDataCell.rowTitle.text = title |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
package net.pokeranalytics.android.util |
||||
|
||||
import android.app.DatePickerDialog |
||||
import android.app.Dialog |
||||
import android.os.Bundle |
||||
import android.widget.DatePicker |
||||
import androidx.fragment.app.DialogFragment |
||||
import java.util.* |
||||
|
||||
class DatePickerFragment : DialogFragment(), DatePickerDialog.OnDateSetListener { |
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
||||
// Use the current date as the default date in the picker |
||||
val c = Calendar.getInstance() |
||||
val year = c.get(Calendar.YEAR) |
||||
val month = c.get(Calendar.MONTH) |
||||
val day = c.get(Calendar.DAY_OF_MONTH) |
||||
|
||||
// Create a new instance of DatePickerDialog and return it |
||||
return DatePickerDialog(activity, this, year, month, day) |
||||
} |
||||
|
||||
override fun onDateSet(view: DatePicker, year: Int, month: Int, day: Int) { |
||||
// Do something with the date chosen by the user |
||||
} |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
package net.pokeranalytics.android.util |
||||
|
||||
import android.app.Dialog |
||||
import android.app.TimePickerDialog |
||||
import android.os.Bundle |
||||
import android.text.format.DateFormat |
||||
import android.widget.TimePicker |
||||
import androidx.fragment.app.DialogFragment |
||||
import java.util.* |
||||
|
||||
class TimePickerFragment : DialogFragment(), TimePickerDialog.OnTimeSetListener { |
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
||||
// Use the current time as the default values for the picker |
||||
val c = Calendar.getInstance() |
||||
val hour = c.get(Calendar.HOUR_OF_DAY) |
||||
val minute = c.get(Calendar.MINUTE) |
||||
|
||||
// Create a new instance of TimePickerDialog and return it |
||||
return TimePickerDialog(activity, this, hour, minute, DateFormat.is24HourFormat(activity)) |
||||
} |
||||
|
||||
override fun onTimeSet(view: TimePicker, hourOfDay: Int, minute: Int) { |
||||
// Do something with the time chosen by the user |
||||
} |
||||
} |
||||
@ -0,0 +1,5 @@ |
||||
<vector android:height="24dp" android:tint="#FFFFFF" |
||||
android:viewportHeight="24.0" android:viewportWidth="24.0" |
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> |
||||
</vector> |
||||
@ -0,0 +1,5 @@ |
||||
<vector android:height="24dp" android:tint="#FFFFFF" |
||||
android:viewportHeight="24.0" android:viewportWidth="24.0" |
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/> |
||||
</vector> |
||||
@ -0,0 +1,5 @@ |
||||
<vector android:height="24dp" android:tint="#FFFFFF" |
||||
android:viewportHeight="24.0" android:viewportWidth="24.0" |
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/> |
||||
</vector> |
||||
@ -0,0 +1,5 @@ |
||||
<vector android:height="24dp" android:tint="#FFFFFF" |
||||
android:viewportHeight="24.0" android:viewportWidth="24.0" |
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#FF000000" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/> |
||||
</vector> |
||||
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/bankrollRecyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="200dp" /> |
||||
|
||||
</LinearLayout> |
||||
@ -0,0 +1,59 @@ |
||||
<?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="wrap_content" |
||||
android:orientation="vertical" |
||||
tools:background="@color/gray_dark_1"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/appCompatTextView" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="16dp" |
||||
android:layout_marginTop="16dp" |
||||
android:layout_marginEnd="8dp" |
||||
android:layout_marginBottom="16dp" |
||||
android:text="Blinds" |
||||
android:textColor="@color/white" |
||||
android:textSize="16sp" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toStartOf="@+id/smallBlind" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText |
||||
android:id="@+id/smallBlind" |
||||
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="actionNext" |
||||
android:inputType="numberDecimal" |
||||
android:lines="1" |
||||
android:textColor="@color/white" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toStartOf="@+id/bigBlind" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText |
||||
android:id="@+id/bigBlind" |
||||
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" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -0,0 +1,32 @@ |
||||
<?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="wrap_content"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatButton |
||||
android:id="@+id/startDate" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="16dp" |
||||
android:layout_marginTop="16dp" |
||||
android:layout_marginBottom="16dp" |
||||
android:text="Set start date" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatButton |
||||
android:id="@+id/endDate" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:layout_marginEnd="16dp" |
||||
android:layout_marginBottom="16dp" |
||||
android:text="Set end date" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/gameTypeRecyclerView" |
||||
android:layout_width="80dp" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="200dp" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/gameNameRecyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="200dp" /> |
||||
|
||||
</LinearLayout> |
||||
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/locationRecyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="200dp" /> |
||||
|
||||
</LinearLayout> |
||||
@ -0,0 +1,13 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/locationRecyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="200dp" /> |
||||
|
||||
</LinearLayout> |
||||
@ -0,0 +1,28 @@ |
||||
<?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="wrap_content" |
||||
android:background="#222222"> |
||||
|
||||
<androidx.appcompat.widget.Toolbar |
||||
android:id="@+id/bottomSheetToolbar" |
||||
style="@style/BottomSheetToolbar" |
||||
android:layout_width="0dp" |
||||
android:layout_height="?actionBarSize" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" |
||||
tools:title="Test" /> |
||||
|
||||
<FrameLayout |
||||
android:id="@+id/bottomSheetContainer" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@+id/bottomSheetToolbar" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -1,45 +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" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/appCompatTextView" |
||||
android:layout_width="0dp" |
||||
android:layout_height="220dp" |
||||
android:background="#222222" |
||||
android:gravity="center" |
||||
android:text="Bottom sheet fragment" |
||||
android:textColor="#FFFFFF" |
||||
android:textSize="18sp" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView |
||||
android:id="@+id/close" |
||||
android:layout_width="32dp" |
||||
android:layout_height="32dp" |
||||
android:layout_marginTop="8dp" |
||||
android:layout_marginEnd="8dp" |
||||
android:background="?selectableItemBackgroundBorderless" |
||||
android:scaleType="centerInside" |
||||
android:src="@drawable/ic_close_24dp" |
||||
android:tint="@color/white" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintTop_toTopOf="@+id/appCompatTextView" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText |
||||
android:id="@+id/editText" |
||||
android:layout_width="180dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="8dp" |
||||
android:layout_marginTop="8dp" |
||||
android:layout_marginEnd="8dp" |
||||
android:textColor="@color/white" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -1,12 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<net.pokeranalytics.android.ui.view.DataRowView |
||||
android:id="@+id/dataRow" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" /> |
||||
|
||||
</FrameLayout> |
||||
@ -0,0 +1,23 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<menu 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"> |
||||
<item |
||||
android:id="@+id/actionClear" |
||||
android:orderInCategory="100" |
||||
android:title="@string/app_name" |
||||
android:icon="@drawable/ic_close_white_24dp" |
||||
app:showAsAction="always" /> |
||||
<item |
||||
android:id="@+id/actionAdd" |
||||
android:icon="@drawable/ic_add_white_24dp" |
||||
android:orderInCategory="200" |
||||
android:title="Search" |
||||
app:showAsAction="ifRoom" /> |
||||
<item |
||||
android:id="@+id/actionSave" |
||||
android:icon="@drawable/ic_check_white_24dp" |
||||
android:orderInCategory="300" |
||||
android:title="User" |
||||
app:showAsAction="ifRoom" /> |
||||
</menu> |
||||
Loading…
Reference in new issue