Skip to content

Commit

Permalink
charts page added (hard coded)
Browse files Browse the repository at this point in the history
Jordan Akinpelu (akinpelud) committed Jun 3, 2023
1 parent 1eaff0c commit f6e1019
Showing 22 changed files with 916 additions and 134 deletions.
4 changes: 2 additions & 2 deletions PowerOf10/.idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions PowerOf10/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions PowerOf10/app/build.gradle
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'


}
apply plugin: 'kotlin-android'

@@ -18,6 +19,7 @@ android {
vectorDrawables {
useSupportLibrary true
}
signingConfig signingConfigs.debug
}

buildTypes {
@@ -35,6 +37,7 @@ android {
}
buildFeatures {
compose true
//noinspection DataBindingWithoutKapt
dataBinding true
}
composeOptions {
@@ -50,23 +53,23 @@ android {

dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation 'com.google.android.material:material:1.8.0'
implementation('androidx.compose.material3:material3:1.1.0-beta01')
implementation('androidx.compose.material3:material3-window-size-class:1.1.0-beta01')
implementation('androidx.compose.material3:material3:1.1.0-rc01')
implementation('androidx.compose.material3:material3-window-size-class:1.1.0-rc01')
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.0'
implementation 'androidx.activity:activity-compose:1.7.1'
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'androidx.databinding:databinding-runtime:7.4.2'
implementation 'androidx.navigation:navigation-compose:2.6.0-alpha08'
implementation 'androidx.databinding:databinding-runtime:8.0.0'
implementation 'androidx.navigation:navigation-compose:2.6.0-beta01'
implementation 'com.github.ivanisidrowu.ktrssreader:android:v2.1.2'
implementation('io.coil-kt:coil-compose:2.3.0')
implementation 'com.prof18.rssparser:rssparser:3.1.3'
@@ -76,12 +79,14 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.core:core-ktx:1.10.0"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
implementation 'com.github.devscast:validable:1.2.0'
implementation "com.google.accompanist:accompanist-webview:0.30.1"
implementation 'com.github.ireward:compose-html:1.0.2'
implementation("com.himanshoe:charty:1.0.1")
implementation "com.patrykandpatrick.vico:compose:1.6.5"

}
10 changes: 4 additions & 6 deletions PowerOf10/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -11,10 +11,11 @@
android:supportsRtl="true"
android:theme="@style/Theme.PowerOf10">
<activity
android:name=".AthleteProfile"
android:name=".AnalysisTool"
android:exported="false"
android:label="@string/title_activity_athlete_profile"
android:label="@string/title_activity_analysis_tool"
android:theme="@style/Theme.PowerOf10" />

<activity
android:name=".RSSArticle"
android:exported="false"
@@ -40,10 +41,7 @@
android:exported="false"
android:label="@string/title_activity_rssfeed"
android:theme="@style/Theme.PowerOf10" />
<activity
android:name=".RSSActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat" />

<activity
android:name=".MainActivity"
android:exported="true"
233 changes: 233 additions & 0 deletions PowerOf10/app/src/main/java/com/example/powerof10/AnalysisTool.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
package com.example.powerof10

import android.graphics.Paint
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.powerof10.Components.rememberLegend
import com.example.powerof10.ui.theme.PowerOf10Theme
import com.himanshoe.charty.common.axis.AxisConfig
import com.himanshoe.charty.line.LineChart
import com.himanshoe.charty.line.model.LineData
import com.patrykandpatrick.vico.compose.axis.axisLabelComponent
import com.patrykandpatrick.vico.compose.axis.horizontal.bottomAxis
import com.patrykandpatrick.vico.compose.axis.vertical.startAxis
import com.patrykandpatrick.vico.compose.chart.Chart
import com.patrykandpatrick.vico.compose.chart.column.columnChart
import com.patrykandpatrick.vico.compose.chart.line.lineChart
import com.patrykandpatrick.vico.core.axis.AxisPosition
import com.patrykandpatrick.vico.core.axis.formatter.AxisValueFormatter
import com.patrykandpatrick.vico.core.axis.horizontal.HorizontalAxis
import com.patrykandpatrick.vico.core.chart.scale.AutoScaleUp
import com.patrykandpatrick.vico.core.chart.values.AxisValuesOverrider
import com.patrykandpatrick.vico.core.entry.FloatEntry
import com.patrykandpatrick.vico.core.entry.entryModelOf
import com.patrykandpatrick.vico.sample.showcase.rememberMarker
import org.jsoup.nodes.Element
import java.time.Month

class AnalysisTool : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
PowerOf10Theme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {

}
}
}
}
}

@Composable
fun Greeting(ldata:MutableList<LineData>) {


Column {


Text(text = "Hello !")
var colors = listOf(Color.Cyan, Color.Blue)
Box(modifier = Modifier
.fillMaxWidth()
.padding(20.dp)) {
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(100.dp),
color = colors.first(),
lineData = ldata
)
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(100.dp),
color = colors[1],
axisConfig = AxisConfig(false,false,false,false, textColor = Color.Black),
lineData = listOf(
LineData(10F, 0F),
LineData(20F, 23F),
LineData(10F, 0f),
LineData(80F, 0f),
LineData(10F, 0f),
LineData(50F, 50F),
LineData(20F, 35F),
)
)
}}

}
@Composable
fun BestVSCountryChart (datalist:MutableMap<String, MutableList<FloatEntry>>){
var axis = listOf("2023","2022","2021","2020","2019","2018")
var marker = rememberMarker()
val chartEntryModel = datalist.values.first()
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->axis[x.toInt()] }
Chart(
chart = lineChart( axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1f, round = false)),
model = entryModelOf(chartEntryModel, listOf(FloatEntry(0f,6.88f), FloatEntry(1f,6.88f),FloatEntry(2f,6.75f),FloatEntry(3f,6.68f),FloatEntry(4f,6.60f),FloatEntry(5f,6.55f))) ,
startAxis = startAxis(),
bottomAxis = bottomAxis(valueFormatter = bottomAxisValueFormatter),
marker = marker,
legend = rememberLegend(),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}
@Composable
fun BestOverSeasonChart (datalist:MutableList<Element>){
var xaxis = mutableListOf<String>()
var yaxis = mutableListOf<FloatEntry>()
for (index in 0 until datalist.size){
xaxis.add(datalist[index].child(11).text())
yaxis.add(FloatEntry(index.toFloat(),datalist[index].child(1).text().toFloat()))

}
var marker = rememberMarker()
val chartEntryModel = entryModelOf(yaxis)
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->xaxis[x.toInt()] }
Chart(
chart = lineChart( axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1f, round = false)),
model = chartEntryModel,
startAxis = startAxis(),
bottomAxis = bottomAxis(tickPosition =
HorizontalAxis.TickPosition.Center(1, 3), valueFormatter = bottomAxisValueFormatter),
marker = marker,
//legend = rememberLegend(),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}
@Composable
fun BestByVenueChart (datalist:MutableMap<String, MutableList<String>>){ //for individuals
var marker = rememberMarker()
val chartEntryModel = mutableListOf<FloatEntry>()
for (index in 0 until datalist.values.flatten().size){
chartEntryModel.add(FloatEntry(index.toFloat(),datalist.values.flatten()[index].toFloat()))// this will not work if athlete has only a dnf
}
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->datalist.keys.toList()[x.toInt()] }
Chart(
chart = columnChart( axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1.005f, round = false)),
model = entryModelOf(chartEntryModel) ,
startAxis = startAxis(),
marker = marker,
bottomAxis = bottomAxis(valueFormatter = bottomAxisValueFormatter),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}

@Composable
fun VenueByTimesChart (datalist:MutableMap<String, MutableList<String>>){//for country
var marker = rememberMarker()
val chartEntryModel = mutableListOf<FloatEntry>()
for (index in 0 until datalist.values.flatten().size){
chartEntryModel.add(FloatEntry(index.toFloat(),datalist.values.flatten()[index].toFloat()))// this will not work if athlete has only a dnf
}
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->datalist.keys.toList()[x.toInt()] }
Chart(
chart = columnChart( spacing = 60.dp, axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1.005f, round = false)),
model = entryModelOf(chartEntryModel) ,
startAxis = startAxis(),
marker = marker,
bottomAxis = bottomAxis( valueFormatter = bottomAxisValueFormatter , label = axisLabelComponent(lineCount = 4, textAlign = Paint.Align.CENTER, textSize = 14.sp)),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}

@Composable
fun FastestTimeByMonthChart (datalist:MutableMap<Month, MutableList<String>>){//for country
var marker = rememberMarker()
val chartEntryModel = mutableListOf<FloatEntry>()
for (index in 0 until datalist.values.flatten().size){
chartEntryModel.add(FloatEntry(index.toFloat(),datalist.values.flatten()[index].toFloat()))// this will not work if athlete has only a dnf
}
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->datalist.keys.toList()[x.toInt()].toString() }
Chart(
chart = columnChart( spacing = 60.dp, axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1.005f, round = false)),
model = entryModelOf(chartEntryModel) ,
startAxis = startAxis(),
marker = marker,
bottomAxis = bottomAxis( valueFormatter = bottomAxisValueFormatter , label = axisLabelComponent(lineCount = 4, textAlign = Paint.Align.CENTER, textSize = 14.sp)),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}

@Composable
fun PBsByMonthChart (datalist: MutableMap<Month, Int>){//for country
var marker = rememberMarker()
val chartEntryModel = mutableListOf<FloatEntry>()
for (index in 0 until datalist.values.size){
chartEntryModel.add(FloatEntry(index.toFloat(),datalist.values.toList()[index].toFloat()))// this will not work if athlete has only a dnf
}
val bottomAxisValueFormatter =
AxisValueFormatter<AxisPosition.Horizontal.Bottom>{ x, chartVal ->datalist.keys.toList()[x.toInt()].toString() }
Chart(
chart = columnChart( spacing = 60.dp, axisValuesOverrider = AxisValuesOverrider.adaptiveYValues(1.005f, round = true)),
model = entryModelOf(chartEntryModel) ,
startAxis = startAxis(),
marker = marker,
bottomAxis = bottomAxis( valueFormatter = bottomAxisValueFormatter , label = axisLabelComponent(lineCount = 4, textAlign = Paint.Align.CENTER, textSize = 14.sp)),
modifier = Modifier.fillMaxHeight(),
autoScaleUp = AutoScaleUp.Full,
isZoomEnabled = true
)

}
@Preview(showBackground = true, heightDp = 500)
@Composable
fun DefaultPreview() {
PowerOf10Theme {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package com.example.powerof10

import com.patrykandpatrick.vico.core.entry.FloatEntry
import com.patrykandpatrick.vico.core.entry.entryModelOf
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.time.LocalDate
import java.time.Month
import java.time.format.DateTimeFormatter

class AthleteDataCollection {
val yearly60times = entryModelOf(6.45f,6.56f,6.59f,6.53f,6.53f,6.53f)

suspend fun lifetimePerformances(): MutableMap<String, MutableList<FloatEntry>> {
var html = getHTML("profile.aspx?athleteid=525045")
var bestPerf = getBestPerformances(html)
var lineData= mutableMapOf<String,MutableList<FloatEntry> >()// Example (Key:60,Value:(6.59,6.56,6.78))
for (event in 1 until bestPerf.size){//for every event that the athlete has on their page
var performances = mutableListOf<FloatEntry>()
for(it in 0..5){//retrieves the last 5 years
if (!bestPerf.eq(event).first()?.child(it + 2)?.text()!!.replace("i","").isNullOrEmpty()){//checks if the athlete has an SB for that season
performances.add(FloatEntry(x = it.toFloat(),y=bestPerf.eq(event).first()?.child(it + 2)?.text()!!.replace("i","").replace(":","").replace("w","").substringBefore("/").toFloat()))//formats results like "6.34i" or "11.23/11.11w" to float
} else {
//performances.add(FloatEntry(0f,0f))
}

}
lineData.put(bestPerf.eq(event).first()?.child(0 )?.text()!!.replace("i",""), performances)

}

//return line

return (lineData)



}
}


suspend fun Overall60Season(): MutableList<Element> {
var html = getHTML("profile.aspx?athleteid=525045")
var data = getAllPerformances(html).first()!!.children()
var allPerformances60 = mutableListOf<Element>()//empty array for each performance
data.removeFirst()//removes headers
var dataList = data.sortedBy { SimpleDateFormat("dd MMM yy").parse(it.child(11).text()) }
for (performance in dataList){//in all performances
if (performance.firstElementChild()!!.text()=="60"){
allPerformances60.add(performance)//add to the allperformances60 array if its a 60m event
}
}

return(allPerformances60)

}


suspend fun timeByVenue(): MutableMap<String, MutableList<String>> {
var html = getHTML("profile.aspx?athleteid=21361")
var data = getAllPerformances(html).first()!!.children()
var allPerformances60 = mutableListOf<Element>()//empty array for each performance
for (performance in data){//in all performances
if (performance.firstElementChild()!!.text()=="60"){
allPerformances60.add(performance)//add to the allperformances60 array if its a 60m event
}
}
var grouped = allPerformances60.groupByTo (mutableMapOf(),{it.child(9).text() },{it.child(1).text()})
for (key in grouped.keys){
grouped[key.toString()] = mutableListOf(grouped[key.toString()]!!.min())
}

return(grouped)
}
suspend fun PbsByVenue(): MutableMap<String, MutableList<String>> {
var html = getHTML("60","All","Men","2023").getElementsByAttributeValueContaining("class", "rlr")
var grouped = html.groupByTo(mutableMapOf(),{it.child(11).text() },{it.child(1).text()})
for (key in grouped.keys){
grouped[key.toString()] = mutableListOf(grouped[key.toString()]!!.min())
}
return(grouped)

}

suspend fun FastestByMonth(): MutableMap<Month, MutableList<String>> {
var data = getHTML("60","All","Men","2023").getElementsByAttributeValueContaining("class", "rlr")

var grouped = data.groupByTo(mutableMapOf(),{ LocalDate.parse(it.child(12).text(), DateTimeFormatter.ofPattern("d MMM uu")).month },{it.child(1).text()})
for (key in grouped.keys){
grouped[key] = mutableListOf(grouped[key]!!.min())
}

return(grouped)

}
suspend fun PBsByMonth(): MutableMap<Month, Int> {
var data = getHTML("60","All","Men","2023").getElementsByAttributeValueContaining("class", "rlr")
var PBsPerformances = mutableListOf<Element>()//empty array for each performance
data.forEach{
if(it.child(5).firstElementChild()?.hasClass("rlpb") == true){
PBsPerformances.add(it)
}
}
var grouped = PBsPerformances.groupingBy { LocalDate.parse(it.child(12).text(), DateTimeFormatter.ofPattern("d MMM uu")).month }.eachCount().toMutableMap()

println(grouped.javaClass.name)

return(grouped)


}
suspend fun main(){
(PBsByMonth())

}
52 changes: 27 additions & 25 deletions PowerOf10/app/src/main/java/com/example/powerof10/AthleteProfile.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.powerof10

import DataModel
//import androidx.compose.ui.platform.LocalContext
import ExpandableListViewModel
import android.annotation.SuppressLint
import androidx.compose.animation.*
@@ -24,8 +24,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.colorResource
//import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
@@ -34,6 +32,7 @@ import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import coil.compose.AsyncImage
import com.example.powerof10.Components.NavDrawerBody
import com.example.powerof10.ui.theme.PowerOf10Theme
import com.ireward.htmlcompose.HtmlText
import kotlinx.coroutines.Dispatchers
@@ -52,7 +51,7 @@ suspend fun getHTML(profile: String): Document { //retrieves the entire HTML pag
}

}
fun getDetails(doc: Document): MutableMap<String, String> {
fun getDetails(doc: Document): MutableMap<String, String> { //gets athlete details
if (doc.getElementById("cphBody_pnlAthleteDetails")!!.child(1)!!.child(0).child(0).child(0).child(0).child(0).child(0).child(1).text() =="Yes"||doc.getElementById("cphBody_pnlAthleteDetails")!!.child(1)!!.child(0).child(0).child(0).child(0).child(0).child(0).child(1).text()=="No"){
doc.getElementById("cphBody_pnlAthleteDetails")!!.child(1)!!.child(0).child(0).child(0).child(0).child(0).child(0).remove()
}
@@ -72,10 +71,10 @@ val details = mutableMapOf<String,String>(

return details
}
fun getBestPerformances(doc: Document): Elements {
fun getBestPerformances(doc: Document): Elements {//gets their performance summary by year
var result = doc.getElementById("cphBody_divBestPerformances")!!.getElementsByTag("tr") // returns the best performances elements
for (i in 1..result.size){
if (result.eq(i).first()?.child(0)?.text().toString()=="Event"){
if (result.eq(i).first()?.child(0)?.text().toString()=="Event"){//removes the cell containing the word event
result.removeAt(i)


@@ -84,11 +83,11 @@ fun getBestPerformances(doc: Document): Elements {
}
return result
}
fun getAllPerformances(doc: Document):Elements{
fun getAllPerformances(doc: Document):Elements{//retrieves every performance
var allPerformances = Elements()
var result = doc.getElementById("cphBody_pnlPerformances")!!.getElementsByTag("tr")
var key =""
result.forEach() {
result.forEach() {//makes the each event a child of the year they belong to
if (it.attr("style")=="background-color:DarkGray;") {
allPerformances.add(it)
}
@@ -123,11 +122,10 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
var bestPerformances by remember { mutableStateOf(Elements()) }
var allPerformances by remember { mutableStateOf(Elements()) }
var isRSSLoading by remember { mutableStateOf(true) } //the state of whether the rss data has loaded yet


val itemIds by viewModel.itemIds.collectAsState()
val scope = rememberCoroutineScope()
LaunchedEffect(Unit) {

val html = getHTML(athlete)
bestPerformances = getBestPerformances(html)
allPerformances = getAllPerformances(html)
@@ -144,6 +142,7 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
picture = details["Picture"]!!
coaches = details["Coaches"]!!
isRSSLoading=false

}

//var context = LocalContext.current
@@ -166,7 +165,7 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
Image(
painter = powerOfTen,
contentDescription = "Power of Ten Logo",
modifier = Modifier,
modifier = Modifier.padding(5.dp),
contentScale = ContentScale.FillBounds
)
},
@@ -186,11 +185,7 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
)
},
drawerContent = {
NavDrawerBody(items = listOf(
MenuItems(1, "Home", Screen.HomepageRSS.route),
MenuItems(2, "Rankings", Screen.RankingPage.route),
MenuItems(3, "Athlete Search", Screen.AthleteSearch.route)
), onItemClick = { navController.navigate(route = it.route) }
NavDrawerBody(items = NavigationOptions.nav, onItemClick = { navController.navigate(route = it.route) }
)
}, content = {

@@ -200,17 +195,20 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
) {



LazyColumn(content = {
item {


//Details
Text(
text = name,
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
modifier = Modifier.padding(5.dp)
)
Row(modifier = Modifier.fillMaxWidth()) {


Row(modifier = Modifier.fillMaxWidth().padding(bottom = 10.dp)) {
Column(modifier = Modifier.padding(horizontal = 5.dp)) {
Text(
text = club,
@@ -247,16 +245,16 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod

AsyncImage(
model = "https://www.thepowerof10.info/$picture",
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.heightIn(max = 250.dp).fillMaxWidth(),
contentDescription = "profile picture",
contentScale = ContentScale.Crop
contentScale = ContentScale.FillWidth
)
}


Jsoup.parse(coaches).getElementsByTag("tr").forEach {
Jsoup.parse(coaches).getElementsByTag("tr").forEach {//displays all the coaches
Row(Modifier.padding(horizontal = 5.dp)) {
for (i in it.children()) {
for (i in it.children()) { //puts them on separate lines
Text(
text = i.text(),
fontSize = 14.sp,
@@ -276,7 +274,7 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(horizontal = 10.dp)
)
HtmlText(
HtmlText( //formatted straight from html using htmlcompose library
text = about,
fontSize = 16.sp,
modifier = Modifier.padding(
@@ -291,7 +289,7 @@ fun AthleteProfile(navController: NavController,viewModel: ExpandableListViewMod
}
item {

PerformanceSummary(
PerformanceSummary(//the expand collapse performances
bestPerformancesSize,
bestPerformances,
{ viewModel.onItemClicked(99) },
@@ -421,7 +419,11 @@ fun Performance(index:Int,performances: Elements){

}

Row(Modifier.fillMaxWidth().background(background).padding(5.dp)) {
Row(
Modifier
.fillMaxWidth()
.background(background)
.padding(5.dp)) {
Column(Modifier.fillMaxWidth(0.15f)) {
Text(text =performances.eq(index).first()!!.child(i).child(0).text())//event
Text(text = performances.eq(index).first()!!.child(i).child(1).text())//performance
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.example.powerof10.Components.NavDrawerBody
import com.example.powerof10.ui.theme.PowerOf10Theme
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -165,7 +166,7 @@ fun AthleteSearch(navController: NavController) {
Image(
painter = powerOfTen,
contentDescription = "Power of Ten Logo",
modifier = Modifier,
modifier = Modifier.padding(5.dp),
contentScale = ContentScale.FillBounds
)
},
@@ -185,11 +186,7 @@ fun AthleteSearch(navController: NavController) {
)
},
drawerContent = {
NavDrawerBody(items = listOf(
MenuItems(1, "Home",Screen.HomepageRSS.route),
MenuItems(2, "Rankings",Screen.RankingPage.route),
MenuItems(3, "Athlete Search",Screen.AthleteSearch.route)
), onItemClick = { navController.navigate(route =it.route) }
NavDrawerBody(items = NavigationOptions.nav, onItemClick = { navController.navigate(route =it.route) }
)
}, content = {

156 changes: 156 additions & 0 deletions PowerOf10/app/src/main/java/com/example/powerof10/ChartsPage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package com.example.powerof10

//import androidx.compose.ui.platform.LocalContext
import android.annotation.SuppressLint
import androidx.compose.animation.*
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.example.powerof10.Components.NavDrawerBody
import com.example.powerof10.ui.theme.PowerOf10Theme
import com.patrykandpatrick.vico.core.entry.FloatEntry
import kotlinx.coroutines.launch
import org.jsoup.nodes.Element
import java.time.Month


@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ChartsPage(navController: NavController) {
val powerOfTen = painterResource(id = R.drawable.powerof10)
val scaffoldState = rememberScaffoldState()
var isRSSLoading by remember { mutableStateOf(true) } //the state of whether the rss data has loaded yet
var ldata by remember { mutableStateOf(mutableMapOf("60" to mutableListOf<FloatEntry>())) }
val scope = rememberCoroutineScope()
var chart2data by remember { mutableStateOf(mutableListOf<Element>()) }
var chart3data by remember { mutableStateOf(mutableMapOf<String,MutableList<String>>()) }
var chart4data by remember { mutableStateOf(mutableMapOf<String,MutableList<String>>()) }
var chart5data by remember { mutableStateOf(mutableMapOf<Month,MutableList<String>>()) }
var chart6data by remember { mutableStateOf(mutableMapOf<Month, Int>()) }
LaunchedEffect(Unit) {
chart2data = Overall60Season()
chart3data = timeByVenue()
chart4data = PbsByVenue()
chart5data = FastestByMonth()
chart6data = PBsByMonth()
isRSSLoading = false
ldata = AthleteDataCollection().lifetimePerformances()
println(ldata)

}

//var context = LocalContext.current
if (isRSSLoading) {// if the RSS hasn't loaded circular progress indicator will appear
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize()
) {
CircularProgressIndicator()
}
}
if (!isRSSLoading) {// hides everything till loaded
Column {

Scaffold(
scaffoldState = scaffoldState,
topBar = {
CenterAlignedTopAppBar(modifier = Modifier.fillMaxWidth(),
title = {
Image(
painter = powerOfTen,
contentDescription = "Power of Ten Logo",
modifier = Modifier.padding(5.dp),
contentScale = ContentScale.FillBounds
)
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
Color(0xFFE5383B),
navigationIconContentColor = Color.White
),
navigationIcon = {
IconButton(onClick = { scope.launch { scaffoldState.drawerState.open() } }) {
Icon(
Icons.Filled.Menu, contentDescription = null,
tint = Color.White,
modifier = Modifier.size(48.dp)
)
}
}
)
},
drawerContent = {
NavDrawerBody(
items = NavigationOptions.nav,
onItemClick = { navController.navigate(route = it.route) }
)
},
content = {
LazyColumn(modifier =Modifier.fillMaxSize() , content = {
item{
Text(text = "Louie Hinchliffe")
Text(text = "Perf vs Country by year")
BestVSCountryChart(ldata)
Text(text = "Eugene Amo Dadzie")
Text(text = "Perf over season")
BestOverSeasonChart(chart2data)
Text(text = "Andrew Robinson")
Text(text = "Best Performance by Venue")
BestByVenueChart(chart3data)
Text(text = "Overall Men")
Text(text = "Best Performance by Venue")
VenueByTimesChart(chart4data)
Text(text = "Overall Men")
Text(text = "Best Performance by Month")
FastestTimeByMonthChart(chart5data)
Text(text = "Overall Men")
Text(text = "PBs by Month")
PBsByMonthChart(chart6data)
}


})
}
)









}

}
}


@Preview(name = "PIXEL_45")
@Composable
fun DefaultPreview8() {

val navController = rememberNavController()
PowerOf10Theme {
//AthleteProfile(navController)//, viewModel)
//ExpandableView(performances = Elements(), isExpanded = true)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.powerof10.Components

import android.graphics.Typeface
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.patrykandpatrick.vico.compose.component.shapeComponent
import com.patrykandpatrick.vico.compose.component.textComponent
import com.patrykandpatrick.vico.compose.dimensions.dimensionsOf
import com.patrykandpatrick.vico.compose.legend.verticalLegend
import com.patrykandpatrick.vico.compose.legend.verticalLegendItem
import com.patrykandpatrick.vico.compose.style.currentChartStyle
import com.patrykandpatrick.vico.core.component.shape.Shapes

var chartColors = listOf(Color.Red,Color.Yellow)
@Composable
fun rememberLegend() = verticalLegend(
items = chartColors.mapIndexed { index, chartColor ->
verticalLegendItem(
icon = shapeComponent(Shapes.pillShape, chartColor),
label = textComponent(
color = currentChartStyle.axis.axisLabelColor,
textSize = 16.sp,
typeface = Typeface.MONOSPACE,
),
labelText = " Dataset $index",
)
},
iconSize = 16.dp,
iconPadding = 0.dp,
padding = dimensionsOf(top = 0.dp),
)
118 changes: 118 additions & 0 deletions PowerOf10/app/src/main/java/com/example/powerof10/Components/Marker.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@

/*
* Copyright 2023 by Patryk Goworowski and Patrick Michalik.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.patrykandpatrick.vico.sample.showcase

import android.graphics.Typeface
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.compose.component.lineComponent
import com.patrykandpatrick.vico.compose.component.overlayingComponent
import com.patrykandpatrick.vico.compose.component.shapeComponent
import com.patrykandpatrick.vico.compose.component.textComponent
import com.patrykandpatrick.vico.compose.dimensions.dimensionsOf
import com.patrykandpatrick.vico.core.chart.insets.Insets
import com.patrykandpatrick.vico.core.chart.segment.SegmentProperties
import com.patrykandpatrick.vico.core.component.marker.MarkerComponent
import com.patrykandpatrick.vico.core.component.shape.DashedShape
import com.patrykandpatrick.vico.core.component.shape.ShapeComponent
import com.patrykandpatrick.vico.core.component.shape.Shapes
import com.patrykandpatrick.vico.core.component.shape.cornered.Corner
import com.patrykandpatrick.vico.core.component.shape.cornered.MarkerCorneredShape
import com.patrykandpatrick.vico.core.context.MeasureContext
import com.patrykandpatrick.vico.core.extension.copyColor
import com.patrykandpatrick.vico.core.marker.Marker

@Composable
internal fun rememberMarker(): Marker {
val labelBackgroundColor = MaterialTheme.colorScheme.surface
val labelBackground = remember(labelBackgroundColor) {
ShapeComponent(labelBackgroundShape, labelBackgroundColor.toArgb()).setShadow(
radius = LABEL_BACKGROUND_SHADOW_RADIUS,
dy = LABEL_BACKGROUND_SHADOW_DY,
applyElevationOverlay = true,
)
}
val label = textComponent(
background = labelBackground,
lineCount = LABEL_LINE_COUNT,
padding = labelPadding,
typeface = Typeface.MONOSPACE,
)
val indicatorInnerComponent = shapeComponent(Shapes.pillShape, MaterialTheme.colorScheme.surface)
val indicatorCenterComponent = shapeComponent(Shapes.pillShape, Color.White)
val indicatorOuterComponent = shapeComponent(Shapes.pillShape, Color.White)
val indicator = overlayingComponent(
outer = indicatorOuterComponent,
inner = overlayingComponent(
outer = indicatorCenterComponent,
inner = indicatorInnerComponent,
innerPaddingAll = indicatorInnerAndCenterComponentPaddingValue,
),
innerPaddingAll = indicatorCenterAndOuterComponentPaddingValue,
)
val guideline = lineComponent(
MaterialTheme.colorScheme.onSurface.copy(GUIDELINE_ALPHA),
guidelineThickness,
guidelineShape,
)
return remember(label, indicator, guideline) {
object : MarkerComponent(label, indicator, guideline) {
init {
indicatorSizeDp = INDICATOR_SIZE_DP
onApplyEntryColor = { entryColor ->
indicatorOuterComponent.color = entryColor.copyColor(INDICATOR_OUTER_COMPONENT_ALPHA)
with(indicatorCenterComponent) {
color = entryColor
setShadow(radius = INDICATOR_CENTER_COMPONENT_SHADOW_RADIUS, color = entryColor)
}
}
}

override fun getInsets(context: MeasureContext, outInsets: Insets, segmentProperties: SegmentProperties) =
with(context) {
outInsets.top = label.getHeight(context) + labelBackgroundShape.tickSizeDp.pixels +
LABEL_BACKGROUND_SHADOW_RADIUS.pixels * SHADOW_RADIUS_MULTIPLIER -
LABEL_BACKGROUND_SHADOW_DY.pixels
}
}
}
}

private const val LABEL_BACKGROUND_SHADOW_RADIUS = 4f
private const val LABEL_BACKGROUND_SHADOW_DY = 2f
private const val LABEL_LINE_COUNT = 1
private const val GUIDELINE_ALPHA = .2f
private const val INDICATOR_SIZE_DP = 36f
private const val INDICATOR_OUTER_COMPONENT_ALPHA = 32
private const val INDICATOR_CENTER_COMPONENT_SHADOW_RADIUS = 12f
private const val GUIDELINE_DASH_LENGTH_DP = 8f
private const val GUIDELINE_GAP_LENGTH_DP = 4f
private const val SHADOW_RADIUS_MULTIPLIER = 1.3f

private val labelBackgroundShape = MarkerCorneredShape(Corner.FullyRounded)
private val labelHorizontalPaddingValue = 8.dp
private val labelVerticalPaddingValue = 4.dp
private val labelPadding = dimensionsOf(labelHorizontalPaddingValue, labelVerticalPaddingValue)
private val indicatorInnerAndCenterComponentPaddingValue = 5.dp
private val indicatorCenterAndOuterComponentPaddingValue = 10.dp
private val guidelineThickness = 2.dp
private val guidelineShape = DashedShape(Shapes.pillShape, GUIDELINE_DASH_LENGTH_DP, GUIDELINE_GAP_LENGTH_DP)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.powerof10
package com.example.powerof10.Components

import android.os.Bundle
import androidx.activity.ComponentActivity
@@ -17,6 +17,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.powerof10.MenuItems
import com.example.powerof10.ui.theme.PowerOf10Theme

class NavDrawer : ComponentActivity() {
@@ -38,7 +39,7 @@ class NavDrawer : ComponentActivity() {


@Composable
fun NavDrawerBody(items:List<MenuItems>,onItemClick: (MenuItems)->Unit) {
fun NavDrawerBody(items:List<MenuItems>, onItemClick: (MenuItems)->Unit) {

LazyColumn(modifier = Modifier.fillMaxSize().background(Color(0xFFE5383B))){
items(items){item ->
9 changes: 3 additions & 6 deletions PowerOf10/app/src/main/java/com/example/powerof10/HomeRSS.kt
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ import androidx.lifecycle.ViewModel
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import coil.compose.AsyncImage
import com.example.powerof10.Components.NavDrawerBody
import com.example.powerof10.ui.theme.PowerOf10Theme
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers.IO
@@ -165,7 +166,7 @@ fun DisplayRssHomepage(navController: NavController) {
Image(
painter = powerOfTen,
contentDescription = "Power of Ten Logo",
modifier = Modifier,
modifier = Modifier.padding(5.dp),
contentScale = ContentScale.FillBounds
)
},
@@ -185,11 +186,7 @@ fun DisplayRssHomepage(navController: NavController) {
)
},
drawerContent = {
NavDrawerBody(items = listOf(
MenuItems(1, "Home",Screen.HomepageRSS.route),
MenuItems(2, "Rankings",Screen.RankingPage.route),
MenuItems(3, "Athlete Search",Screen.AthleteSearch.route)
), onItemClick = { navController.navigate(route =it.route) }
NavDrawerBody(items = NavigationOptions.nav, onItemClick = { navController.navigate(route =it.route) }
)
}, content = {
Column() {
159 changes: 159 additions & 0 deletions PowerOf10/app/src/main/java/com/example/powerof10/LineChartDemo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
package com.himanshoe.charty.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.MaterialTheme.colors
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.himanshoe.charty.common.axis.AxisConfig
import com.himanshoe.charty.line.LineChart
import com.himanshoe.charty.line.config.LineConfig
import com.himanshoe.charty.line.model.LineData

@Composable
fun LineChartDemo() {
var colors = listOf(Color.Cyan,Color.Blue)
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(32.dp)
) {
item {
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(300.dp),

colors = colors,
lineData = listOf(
LineData(10F, 35F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(20F, 25F),
LineData(10F, 50F),
LineData(80F, 10F),
LineData(10F, 15F),
LineData(50F, 100F),
LineData(20F, 25F),
)
)
}
item {
Text(
text = "Gradient Line Chart",
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 32.dp),
textAlign = TextAlign.Center
)
}
item {
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(300.dp),
color = colors.first(),
lineData = listOf(
LineData(10F, 35F),
LineData(20F, 25F),
LineData(10F, 50F),
LineData(80F, 10F),
LineData(10F, 15F),
LineData(50F, 100F),
LineData(20F, 25F),
)
)
}
item {
Text(
text = "Solid Line Chart",
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 32.dp),
textAlign = TextAlign.Center
)
}
item {
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(300.dp),
color = colors.first(),
lineConfig = LineConfig(hasDotMarker = false),
lineData = listOf(
LineData(10F, 35F),
LineData(20F, 25F),
LineData(10F, 50F),
LineData(80F, 10F),
LineData(10F, 15F),
LineData(50F, 100F),
LineData(20F, 25F),
)
)
}
item {
Text(
text = "Line Chart without marker",
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 32.dp),
textAlign = TextAlign.Center
)
}
item {
LineChart(
modifier = Modifier
.fillMaxWidth()
.height(300.dp),
color = colors.first(),
lineConfig = LineConfig(hasSmoothCurve = true),
lineData = listOf(
LineData(10F, 35F),
LineData(20F, 25F),
LineData(10F, 50F),
LineData(80F, 10F),
LineData(10F, 15F),
LineData(50F, 100F),
LineData(20F, 25F),
)
)
}
item {
Text(
text = "Line Chart with smooth curve",
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 32.dp),
textAlign = TextAlign.Center
)
}
}
}
Original file line number Diff line number Diff line change
@@ -32,10 +32,3 @@ class MainActivity : ComponentActivity() {



@Preview(showBackground = true, showSystemUi = true)
@Composable
fun DefaultPreview() {
PowerOf10Theme {

}
}
6 changes: 6 additions & 0 deletions PowerOf10/app/src/main/java/com/example/powerof10/NavGraph.kt
Original file line number Diff line number Diff line change
@@ -33,6 +33,12 @@ fun SetupNavGraph(

DisplayRankingPage(navController)
}
composable(
route = Screen.ChartsPage.route
) {

ChartsPage(navController)
}
composable(
route = Screen.AthleteSearch.route
) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.powerof10

object NavigationOptions{
val nav = listOf(
MenuItems(1, "Home",Screen.HomepageRSS.route),
MenuItems(2, "Rankings",Screen.RankingPage.route),
MenuItems(3, "Athlete Search",Screen.AthleteSearch.route),
MenuItems(4, "Charts",Screen.ChartsPage.route)
)
}
60 changes: 0 additions & 60 deletions PowerOf10/app/src/main/java/com/example/powerof10/RSSActivity.kt

This file was deleted.

15 changes: 5 additions & 10 deletions PowerOf10/app/src/main/java/com/example/powerof10/RankingPage.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.example.powerof10

import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.activity.ComponentActivity
@@ -27,11 +26,11 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.example.powerof10.Components.NavDrawerBody
import com.example.powerof10.ui.theme.PowerOf10Theme
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -60,7 +59,7 @@ class RankingPage : ComponentActivity() {
}


suspend fun getHTML(event: String, group: String, sex: String, year: String, area: String): Document {
suspend fun getHTML(event: String, group: String, sex: String, year: String, area: String="all regions"): Document {
val html: String
val gender = when(sex){
"Men" -> "M"
@@ -229,7 +228,7 @@ fun DisplayRankingPage(navController: NavController) {
Image(
painter = powerOfTen,
contentDescription = "Power of Ten Logo",
modifier = Modifier,
modifier = Modifier.padding(5.dp),
contentScale = ContentScale.FillBounds
)
},
@@ -249,11 +248,7 @@ fun DisplayRankingPage(navController: NavController) {
)
},
drawerContent = {
NavDrawerBody(items = listOf(
MenuItems(1, "Home",Screen.HomepageRSS.route),
MenuItems(2, "Rankings",Screen.RankingPage.route),
MenuItems(3, "Athlete Search",Screen.AthleteSearch.route)
), onItemClick = { navController.navigate(route =it.route) }
NavDrawerBody(items = NavigationOptions.nav, onItemClick = { navController.navigate(route =it.route) }
)
}, content = {
Column(modifier = Modifier.fillMaxWidth()) {
@@ -445,7 +440,7 @@ fun DisplayRankingPage(navController: NavController) {
}
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier.fillMaxWidth()
modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp)
) {
Text(text = "Rank")
Text(text = "Club")
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@ sealed class Screen(val route: String) {
object RankingPage: Screen(route = "RankingPage")
object AthleteSearch: Screen(route = "AthleteSearch")
object RSSArticle: Screen(route = "RSSArticle")
object ChartsPage: Screen(route = "ChartsPage")
}
2 changes: 2 additions & 0 deletions PowerOf10/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -9,4 +9,6 @@
<string name="title_activity_athlete_search">AthleteSearch</string>
<string name="title_activity_rssarticle">RSSArticle</string>
<string name="title_activity_athlete_profile">AthleteProfile</string>
<string name="title_activity_components">components</string>
<string name="title_activity_analysis_tool">AnalysisTool</string>
</resources>
4 changes: 2 additions & 2 deletions PowerOf10/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext.kotlin_version = '1.8.0'
ext.kotlin_version = '1.8.10'
ext {
compose_version = '1.4.0'
compose_version = '1.4.2'
navigationVersion = '2.5.3'

}

0 comments on commit f6e1019

Please sign in to comment.