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 Challenge page #19

Merged
merged 9 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
26 changes: 12 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.Modarb"
tools:targetApi="31">
<activity
android:name=".ui.menu.activities.ChallengeActivity"
android:exported="false" />
<activity
android:name=".ui.menu.activities.NotificationActivity"
android:exported="false" />
Expand All @@ -34,27 +37,22 @@
android:exported="false" />
<activity
android:name=".ui.menu.activities.ReminderActivity"
android:exported="false" />
<!-- <activity-->
<!-- android:name=".ui.workout.activites.ExcersiceInfoActivity"-->
<!-- android:exported="false" />-->
android:exported="false" /> <!-- <activity -->
<!-- android:name=".ui.workout.activites.ExcersiceInfoActivity" -->
<!-- android:exported="false" /> -->
<activity
android:name=".ui.home.ui.more.activities.EditProfileActivity"
android:exported="false" />
<activity
android:name=".ui.home.ui.more.activities.ProfileActivity"
android:exported="false" />
<!-- <activity-->
<!-- android:name=".ui.home.HomeActivity"-->
<!-- android:exported="false" />-->

android:exported="false" /> <!-- <activity -->
<!-- android:name=".ui.home.HomeActivity" -->
<!-- android:exported="false" /> -->
<activity
android:name=".ui.onboarding.activities.RegisterScreenActivity"
android:exported="false" />

<!-- <activity-->
<!-- android:name=".ui.home.HomeActivity"-->
<!-- android:exported="false" />-->
android:exported="false" /> <!-- <activity -->
<!-- android:name=".ui.home.HomeActivity" -->
<!-- android:exported="false" /> -->
<activity
android:name=".ui.onboarding.activities.OnBoardingSplashActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.modarb.android.ui.menu.Adapters

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.modarb.android.R
import com.modarb.android.ui.menu.models.User

class ActiveUsersAdapter(private val userList: List<User>) :
RecyclerView.Adapter<ActiveUsersAdapter.ViewHolder>() {

inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val activeUsersTextView: TextView = itemView.findViewById(R.id.activeUsersTextView)
val challengeTextView: TextView = itemView.findViewById(R.id.challengeTextView)
val activeUserView: ImageView = itemView.findViewById(R.id.activeUserView)
}

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

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val user = userList[position]
holder.activeUsersTextView.text = user.name
holder.challengeTextView.text = user.challenge
holder.activeUserView.setImageResource(user.imageResource)
}

override fun getItemCount(): Int = userList.size
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.modarb.android.ui.menu.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.modarb.android.R
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.modarb.android.ui.menu.Adapters.ActiveUsersAdapter
import com.modarb.android.ui.menu.models.User

class ChallengeActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_challenge)

val imageView = findViewById<View>(R.id.backButton)
imageView.setOnClickListener {
val intent = Intent(this, MenuActivity::class.java)
startActivity(intent)
}

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

val userList = listOf(
User("Mark", "Challenge", R.drawable.ic_ranked_user1),
User("adam", "Challenge", R.drawable.ic_ranked_user2),
User("Jala", "Challenge", R.drawable.ic_ranked_user3),
User("nardine", "Challenge", R.drawable.ic_ranked_user4)
)

val adapter = ActiveUsersAdapter(userList)
recyclerView.adapter = adapter
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ class MenuActivity : AppCompatActivity() {
cardView.setOnClickListener {
startActivity(Intent(this, ProfileActivity::class.java))
}
val cardView2 = findViewById<View>(R.id.cardView5)
val cardView2 = findViewById<View>(R.id.cardView4)
cardView2.setOnClickListener {
startActivity(Intent(this, ReminderActivity::class.java))
startActivity(Intent(this, ChallengeActivity::class.java))
}
val cardView3 = findViewById<View>(R.id.cardView6)
val cardView3 = findViewById<View>(R.id.cardView5)
cardView3.setOnClickListener {
startActivity(Intent(this, ReminderActivity::class.java))
}
val cardView4 = findViewById<View>(R.id.cardView6)
cardView4.setOnClickListener {
startActivity(Intent(this, SettingActivity::class.java))
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/modarb/android/ui/menu/models/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.modarb.android.ui.menu.models

data class User(val name: String, val challenge: String, val imageResource: Int)
39 changes: 39 additions & 0 deletions app/src/main/res/drawable/ic_post.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="31dp"
android:height="31dp"
android:viewportWidth="31"
android:viewportHeight="31">
<group>
<clip-path
android:pathData="M0,0h31v31h-31z"/>
<path
android:pathData="M30.728,2.815L28.185,0.272C28.003,0.091 27.821,0.018 27.531,0C27.295,0 27.058,0.091 26.895,0.272L24.194,2.955L24.007,6.4L28.045,6.805L30.728,4.105C30.909,3.942 31,3.705 31,3.469C31,3.233 30.909,2.997 30.728,2.815ZM23.053,10.035C22.714,9.894 22.322,9.971 22.063,10.232L16.639,15.656L14.705,16.294L15.344,14.36L20.768,8.937C21.027,8.677 21.105,8.287 20.965,7.947C20.825,7.608 20.493,7.387 20.126,7.387H0.908C0.406,7.387 0,7.793 0,8.295V30.092C0,30.594 0.406,31 0.908,31H22.705C23.207,31 23.613,30.594 23.613,30.092V10.874C23.613,10.507 23.392,10.175 23.053,10.035Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="15.5"
android:startY="31"
android:endX="15.5"
android:endY="-0"
android:type="linear">
<item android:offset="0" android:color="#FF5E34E8"/>
<item android:offset="1" android:color="#FF8561FF"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M13.568,18.576L17.419,17.305C17.546,17.268 17.674,17.196 17.764,17.087L28.045,6.806L24.194,2.955C23.061,4.089 15.056,12.094 13.914,13.236C13.805,13.327 13.732,13.454 13.696,13.581L12.406,17.432C12.315,17.759 12.388,18.122 12.642,18.358C12.881,18.623 13.277,18.693 13.568,18.576ZM17.256,23.735H6.357C5.855,23.735 5.449,24.141 5.449,24.643C5.449,25.145 5.855,25.551 6.357,25.551H17.256C17.758,25.551 18.164,25.145 18.164,24.643C18.164,24.141 17.758,23.735 17.256,23.735ZM6.357,21.918H9.99C10.492,21.918 10.898,21.512 10.898,21.01C10.898,20.508 10.492,20.102 9.99,20.102H6.357C5.855,20.102 5.449,20.508 5.449,21.01C5.449,21.512 5.855,21.918 6.357,21.918Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="16.747"
android:startY="25.551"
android:endX="16.747"
android:endY="2.955"
android:type="linear">
<item android:offset="0" android:color="#FFE9EBF8"/>
<item android:offset="1" android:color="#FFFFF2F4"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>
Binary file added app/src/main/res/drawable/ic_ranked_user1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_ranked_user2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_ranked_user3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_ranked_user4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/rounded_gradient_rectangle3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<gradient
android:angle="270"
android:startColor="#7AFF99"
android:endColor="#007AFF99"
android:type="linear" />
</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/rounded_gradient_rectangle4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<gradient
android:angle="270"
android:startColor="#E4C833"
android:endColor="#00E4C833"
android:type="linear" />
</shape>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/rounded_gradient_rectangle5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<gradient
android:angle="270"
android:startColor="#5A5A5A"
android:endColor="#005A5A5A"
android:type="linear" />
</shape>
Loading