parent
a7b6a08e44
commit
a1688e515a
@ -0,0 +1,66 @@ |
|||||||
|
package net.pokeranalytics.android.ui.view |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.util.AttributeSet |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.widget.FrameLayout |
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout |
||||||
|
import kotlinx.android.synthetic.main.layout_legend_default.view.* |
||||||
|
import net.pokeranalytics.android.R |
||||||
|
import net.pokeranalytics.android.calculus.Stat |
||||||
|
import net.pokeranalytics.android.model.realm.Session |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Display a row session |
||||||
|
*/ |
||||||
|
class LegendView : FrameLayout { |
||||||
|
|
||||||
|
private lateinit var legendLayout: 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 |
||||||
|
*/ |
||||||
|
private fun init() { |
||||||
|
val layoutInflater = LayoutInflater.from(context) |
||||||
|
legendLayout = layoutInflater.inflate(R.layout.layout_legend_default, this, false) as ConstraintLayout |
||||||
|
val layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT) |
||||||
|
addView(legendLayout, layoutParams) |
||||||
|
} |
||||||
|
|
||||||
|
fun prepareWithStat(stat: Stat) { |
||||||
|
|
||||||
|
this.stat1Name.text = stat.name |
||||||
|
this.stat2Name.text = stat.cumulativeLabelResId(context) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the session data to the view |
||||||
|
*/ |
||||||
|
fun setData(session: Session) { |
||||||
|
|
||||||
|
this.title.text = "" |
||||||
|
this.title.text = "" |
||||||
|
this.title.text = "" |
||||||
|
this.title.text = "" |
||||||
|
this.title.text = "" |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
<?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="match_parent"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar |
||||||
|
android:id="@+id/toolbar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="?attr/actionBarSize" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
app:title="@string/app_name" /> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/legendContainer" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@+id/toolbar"> |
||||||
|
|
||||||
|
<!--<include layout="@layout/layout_legend_default"/>--> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/chartContainer" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
app:layout_constraintBottom_toTopOf="@id/chipGroup" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@+id/legendContainer"></FrameLayout> |
||||||
|
|
||||||
|
<com.google.android.material.chip.ChipGroup |
||||||
|
android:id="@+id/chipGroup" |
||||||
|
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:singleSelection="true" |
||||||
|
tools:layout_height="60dp"> |
||||||
|
|
||||||
|
</com.google.android.material.chip.ChipGroup> |
||||||
|
|
||||||
|
<!--<com.github.mikephil.charting.charts.LineChart--> |
||||||
|
<!--android:id="@+id/chart"--> |
||||||
|
<!--android:layout_width="50dp"--> |
||||||
|
<!--android:layout_height="50dp" app:layout_constraintTop_toBottomOf="@+id/toolbar" android:layout_marginBottom="8dp"--> |
||||||
|
<!--app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp"--> |
||||||
|
<!--app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp"/>--> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
@ -1,35 +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.Toolbar |
|
||||||
android:id="@+id/toolbar" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="?attr/actionBarSize" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toTopOf="parent" |
|
||||||
app:title="@string/app_name"/> |
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView |
|
||||||
android:id="@+id/text" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
android:layout_marginStart="8dp" |
|
||||||
android:layout_marginTop="8dp" |
|
||||||
app:layout_constraintStart_toStartOf="parent" |
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"/> |
|
||||||
|
|
||||||
<com.github.mikephil.charting.charts.LineChart |
|
||||||
android:id="@+id/chart" |
|
||||||
android:layout_width="50dp" |
|
||||||
android:layout_height="50dp" app:layout_constraintTop_toBottomOf="@+id/toolbar" android:layout_marginBottom="8dp" |
|
||||||
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp" |
|
||||||
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp"/> |
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout> |
|
||||||
@ -0,0 +1,79 @@ |
|||||||
|
<?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"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/title" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsValue" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
tools:text="test" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/stat1Name" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsTitle" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
android:layout_marginTop="4dp" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/title" |
||||||
|
tools:text="NET RESULT" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/stat1Value" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsValue" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginStart="8dp" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/stat1Name" |
||||||
|
tools:text="$2000" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/stat2Name" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsTitle" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
android:layout_marginTop="4dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintHorizontal_bias="1.0" |
||||||
|
app:layout_constraintStart_toEndOf="@+id/stat1Name" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/title" |
||||||
|
tools:text="NET RESULT" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/stat2Value" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsValue" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintHorizontal_bias="1.0" |
||||||
|
app:layout_constraintStart_toEndOf="@+id/stat1Value" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/stat2Name" |
||||||
|
tools:text="$2000000000000000" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/counter" |
||||||
|
style="@style/PokerAnalyticsTheme.TextView.LegendStatsTitle" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginEnd="8dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/stat2Value" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
tools:text="152 sessions" /> |
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||||
Loading…
Reference in new issue