Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding WeeklyWorkoutActivity. #13

Merged
merged 2 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.Modarb"
tools:targetApi="31">

<activity
android:name=".ui.workout.activites.TodayWorkoutActivity"
android:exported="false" />
<activity
android:name=".ui.onboarding.activities.WelcomeScreenActivity"
android:exported="false" />
Expand All @@ -25,7 +27,7 @@
android:name=".ui.onboarding.activities.RegisterScreenActivity"
android:exported="false" />
<activity
android:name=".ui.workout.activites.TodayWorkoutActivity"
android:name=".ui.workout.activites.MyTrainerActivity"
android:exported="false" />
<activity
android:name=".ui.home.HomeActivity"
Expand All @@ -40,10 +42,11 @@
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".ui.workout.activites.MyTrainerActivity"
android:name=".ui.workout.activites.WeeklyWorkoutActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.modarb.android.ui.workout.activites

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.modarb.android.R
import com.modarb.android.ui.workout.adapters.WorkoutAdapter
import com.modarb.android.ui.workout.models.WorkoutModel
import com.modarb.android.ui.workout.models.YourItem2

class WeeklyWorkoutActivity : AppCompatActivity() {
private lateinit var recyclerView: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_weekly_workout)


recyclerView = findViewById(R.id.recyclerView)
recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
recyclerView.visibility = View.VISIBLE

val itemList: ArrayList<WorkoutModel> = ArrayList()

val workout1 = WorkoutModel(R.drawable.chest_press, "chest press", "4 sets x 12-15 reps", "chest")
val workout2 = WorkoutModel(R.drawable.deadlift, "Deadlift", "4 sets x 10-12 reps", "full body")

itemList.add(workout1)
itemList.add(workout2)

val recyclerView: RecyclerView = findViewById(R.id.recyclerView)
val layoutManager = LinearLayoutManager(this)
recyclerView.layoutManager = layoutManager

val adapter = WorkoutAdapter(itemList)
recyclerView.adapter = adapter



val itemList2: ArrayList<YourItem2> = ArrayList()
itemList2.add(YourItem2("D1"))
itemList2.add(YourItem2("D2"))
itemList2.add(YourItem2("D3"))
itemList2.add(YourItem2("D4"))

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.modarb.android.ui.workout.adapters

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.github.vipulasri.timelineview.TimelineView
import com.modarb.android.R
import com.modarb.android.ui.workout.models.YourItem2

class TimelineWeeklyWorkoutAdapter (private val dataList: List<YourItem2>) : RecyclerView.Adapter<TimelineWeeklyWorkoutAdapter.YourViewHolder>() {

inner class YourViewHolder(itemView: View, viewType: Int) : RecyclerView.ViewHolder(itemView) {
private val timelineView: TimelineView = itemView.findViewById(R.id.timeline)
val textView: TextView = itemView.findViewById(R.id.textView)

init {
timelineView.initLine(viewType)
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): YourViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_timeline2, parent, false)
return YourViewHolder(view, viewType)
}

override fun onBindViewHolder(holder: YourViewHolder, position: Int) {
val currentItem = dataList[position]
holder.textView.text = currentItem.textView
}

override fun getItemCount() = dataList.size

override fun getItemViewType(position: Int): Int {
return TimelineView.getTimeLineViewType(position, itemCount)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.modarb.android.ui.workout.models

data class YourItem2(val textView: String)
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/grey700_shape.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/gray_700"/>
<corners android:radius="16dp" />
</shape>
183 changes: 183 additions & 0 deletions app/src/main/res/layout/activity_weekly_workout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?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"
android:background="@color/black"
tools:context=".ui.workout.activites.WeeklyWorkoutActivity">

<ImageView
android:id="@+id/imageView"
android:layout_width="28dp"
android:layout_height="37dp"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:src="@drawable/line1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:gravity="start"
android:text="@string/Week1_foundation"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="start"
android:paddingTop="2dp"
android:text="@string/Week1_description"
android:textColor="@color/white_600"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/textView"
app:layout_constraintTop_toBottomOf="@+id/textView" />


<com.github.vipulasri.timelineview.TimelineView
android:id="@+id/timeline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endLineColor="@color/primary_400"
app:lineOrientation="horizontal"
app:markerInCenter="true"
app:lineStyle="dash"
app:lineStyleDashGap="4dp"
app:lineStyleDashLength="8dp"
app:lineWidth="2dp"
app:markerPaddingBottom="16dp"
app:markerPaddingLeft="16dp"
app:markerPaddingRight="16dp"
app:markerPaddingTop="16dp"
app:markerSize="20dp"
app:startLineColor="@color/primary_400"
app:layout_constraintBottom_toTopOf="@+id/frameLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.5" />

<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="8dp"
android:background="@drawable/grey700_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView2">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginTop="24dp"
android:fontFamily="@font/montserrat"
android:gravity="center"
android:padding="8dp"
android:text="@string/sets_20"
android:textColor="@color/white_smoke"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@+id/textView3"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView5"
app:layout_constraintTop_toBottomOf="@+id/textView6" />

<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:fontFamily="@font/montserrat"
android:gravity="center"
android:padding="8dp"
android:text="@string/exercises_6"
android:textColor="@color/white_smoke"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="12dp"
android:fontFamily="@font/montserrat"
android:gravity="center"
android:padding="8dp"
android:text="@string/Duration_40_50_min"
android:textColor="@color/white_smoke"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />

<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/montserrat"
android:gravity="center"
android:padding="8dp"
tools:text="Day 1 / 4 -Full-body"
android:textColor="@color/primary_50"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4"
app:layout_constraintVertical_bias="0.041" />

<Button
android:id="@+id/startButton"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/button"
android:padding="12dp"
android:text="@string/start"
android:textSize="20sp"
android:textStyle="bold"
app:cornerRadius="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
app:layout_constraintVertical_bias="0.873" />

</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
25 changes: 25 additions & 0 deletions app/src/main/res/layout/item_timeline2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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">

<TextView
android:id="@+id/textView"
android:layout_width="80dp"
android:layout_height="28dp"
android:background="@drawable/neon_blue_shape"
android:gravity="center"
android:paddingTop="2dp"
android:textColor="@color/white_500"
android:textSize="16sp"
tools:text="Day"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
7 changes: 3 additions & 4 deletions app/src/main/res/layout/workout_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/black">
xmlns:tools="http://schemas.android.com/tools" >

<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down Expand Up @@ -55,7 +54,7 @@
android:layout_width="105dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginEnd="16dp"
android:text="@string/button"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
Loading