commit
b0babe5766
@ -0,0 +1,69 @@ |
||||
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) |
||||
} |
||||
|
||||
/** |
||||
* Set the stat data to the view |
||||
*/ |
||||
fun prepareWithStat(stat: Stat) { |
||||
|
||||
this.stat1Name.text = stat.localizedTitle(context) |
||||
this.stat2Name.text = stat.cumulativeLabelResId(context) |
||||
|
||||
//TODO: Set real data |
||||
this.title.text = "11/04/2019" |
||||
this.stat1Value.text = "$521" |
||||
this.stat2Value.text = "$15,051" |
||||
this.counter.text = "21 Sessions" |
||||
|
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
fun setData(session: Session) { |
||||
|
||||
} |
||||
|
||||
} |
||||
@ -1,7 +1,8 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
<FrameLayout |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/container" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
</FrameLayout> |
||||
@ -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="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" |
||||
tools: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" /> |
||||
|
||||
<FrameLayout |
||||
android:id="@+id/chartContainer" |
||||
android:layout_width="0dp" |
||||
android:layout_height="0dp" |
||||
android:layout_marginTop="8dp" |
||||
android:layout_marginBottom="8dp" |
||||
app:layout_constraintBottom_toTopOf="@id/chips" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@+id/legendContainer" /> |
||||
|
||||
<FrameLayout |
||||
android:id="@+id/chips" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:paddingTop="8dp" |
||||
android:paddingBottom="8dp" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
tools:layout_height="60dp"> |
||||
|
||||
<com.google.android.material.chip.ChipGroup |
||||
android:id="@+id/chipGroup" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:orientation="horizontal" |
||||
app:chipSpacingHorizontal="8dp" |
||||
app:singleSelection="true" |
||||
tools:layout_height="60dp" /> |
||||
|
||||
</FrameLayout> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -1,25 +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:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<TextView |
||||
android:id="@+id/text" |
||||
android:textColor="@color/white" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
android:layout_marginStart="8dp" |
||||
app:layout_constraintTop_toTopOf="@+id/chart" |
||||
android:layout_marginTop="8dp"/> |
||||
|
||||
<com.github.mikephil.charting.charts.LineChart |
||||
android:id="@+id/chart" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"/> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -0,0 +1,94 @@ |
||||
<?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"> |
||||
|
||||
<View |
||||
android:id="@+id/background" |
||||
android:background="@color/green_header" |
||||
android:layout_width="0dp" |
||||
android:layout_height="0dp" |
||||
app:layout_constraintBottom_toTopOf="@+id/counter" |
||||
android:layout_marginBottom="4dp" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/title" |
||||
style="@style/PokerAnalyticsTheme.TextView.LegendTitle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="16dp" |
||||
android:layout_marginEnd="16dp" |
||||
android:layout_marginTop="4dp" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" |
||||
tools:text="11/04/2019" /> |
||||
|
||||
<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="16dp" |
||||
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="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="16dp" |
||||
app:layout_constraintEnd_toStartOf="@+id/stat2Value" |
||||
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="0dp" |
||||
android:layout_marginTop="4dp" |
||||
android:layout_marginEnd="16dp" |
||||
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="16dp" |
||||
android:layout_marginStart="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="$2000000000" /> |
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/counter" |
||||
style="@style/PokerAnalyticsTheme.TextView.LegendSubtitle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="16dp" |
||||
android:layout_marginTop="8dp" |
||||
android:layout_marginBottom="8dp" |
||||
app:layout_constraintBottom_toBottomOf="parent" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@id/stat2Value" |
||||
tools:text="152 sessions" /> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
Loading…
Reference in new issue