Skip to content

Commit

Permalink
Home screen history navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
NikM3 committed Apr 24, 2023
1 parent 7d1f375 commit cd1f20f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* Created by Team Symphony on 4/24/23, 2:09 AM
* Created by Team Symphony on 4/24/23, 3:48 AM
* Copyright (c) 2023 . All rights reserved.
* Last modified 4/24/23, 2:09 AM
* Last modified 4/24/23, 3:48 AM
*/

package com.symphony.mrfit.data.adapters

import android.content.Context
import android.content.Intent
import android.os.Build
import android.view.LayoutInflater
import android.view.View
Expand All @@ -18,6 +19,7 @@ import com.symphony.mrfit.R
import com.symphony.mrfit.data.model.History
import com.symphony.mrfit.ui.Helper.humanReadableDuration
import com.symphony.mrfit.ui.Helper.humanReadableShortDate
import com.symphony.mrfit.ui.WorkoutHistoryActivity
import java.util.*

/**
Expand All @@ -39,6 +41,11 @@ class HistoryAdapter (val context: Context, val data: ArrayList<History>): Recyc
holder.historyTimestamp.text = humanReadableShortDate(data[i].date!!.toDate())
val time = humanReadableDuration(data[i].duration!!)
holder.historyDuration.text = "Exercised for $time"

holder.itemView.setOnClickListener {
val intent = Intent(context, WorkoutHistoryActivity::class.java)
context.startActivity(intent)
}
}

override fun getItemCount(): Int {
Expand Down
9 changes: 2 additions & 7 deletions app/src/main/java/com/symphony/mrfit/ui/HomeActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Created by Team Symphony on 4/24/23, 2:09 AM
* Created by Team Symphony on 4/24/23, 3:48 AM
* Copyright (c) 2023 . All rights reserved.
* Last modified 4/24/23, 1:45 AM
* Last modified 4/24/23, 3:47 AM
*/

package com.symphony.mrfit.ui
Expand Down Expand Up @@ -125,11 +125,6 @@ class HomeActivity : AppCompatActivity() {
val intent = Intent(this, RoutineSelectionActivity::class.java)
startActivity(intent)
}

historyList.setOnClickListener {
val intent = Intent(this, WorkoutHistoryActivity::class.java)
startActivity(intent)
}
}

override fun onStop() {
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Created by Team Symphony on 4/21/23, 5:08 PM
~ Created by Team Symphony on 4/24/23, 3:48 AM
~ Copyright (c) 2023 . All rights reserved.
~ Last modified 4/21/23, 4:39 PM
~ Last modified 4/24/23, 3:44 AM
-->

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
Expand Down Expand Up @@ -109,6 +109,7 @@
</LinearLayout>

<LinearLayout
android:id="@+id/homeHistoryLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
Expand Down

0 comments on commit cd1f20f

Please sign in to comment.