mirror of
https://github.com/a-mayb3/KanbanCloneAndroid.git
synced 2026-03-21 18:15:38 +01:00
Started working on adding details and project management
This commit is contained in:
parent
110f356d78
commit
d1c02510d1
3 changed files with 124 additions and 12 deletions
|
|
@ -1,14 +1,17 @@
|
||||||
package com.campusaula.edbole.kanban_clone_android.ui
|
package com.campusaula.edbole.kanban_clone_android.ui
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.health.connect.datatypes.units.Percentage
|
import android.health.connect.datatypes.units.Percentage
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.widget.Button
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.campusaula.edbole.kanban_clone_android.R
|
import com.campusaula.edbole.kanban_clone_android.R
|
||||||
import com.campusaula.edbole.kanban_clone_android.kanban.Project
|
import com.campusaula.edbole.kanban_clone_android.kanban.Project
|
||||||
import com.campusaula.edbole.kanban_clone_android.kanban.Task
|
import com.campusaula.edbole.kanban_clone_android.kanban.Task
|
||||||
|
|
@ -22,10 +25,17 @@ class ProjectDetailActivity : AppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var api: ApiService
|
private lateinit var api: ApiService
|
||||||
|
|
||||||
|
private lateinit var returnActionButton: FloatingActionButton
|
||||||
|
private lateinit var addTaskButton: Button
|
||||||
|
private lateinit var addCollaboratorButton: Button
|
||||||
|
|
||||||
|
private lateinit var collaboratorListRecycler: RecyclerView
|
||||||
|
// private lateinit var collaboratorListAdapter: CollaboratorListAdapter
|
||||||
|
|
||||||
private lateinit var projectTitleText : TextView
|
private lateinit var projectTitleText : TextView
|
||||||
private lateinit var projectDescriptionText : TextView
|
private lateinit var projectDescriptionText : TextView
|
||||||
private lateinit var completedPercentageText: TextView
|
private lateinit var completedPercentageText: TextView
|
||||||
private lateinit var returnActionButton: FloatingActionButton
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
@ -36,14 +46,36 @@ class ProjectDetailActivity : AppCompatActivity() {
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||||
insets
|
insets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
api = RetrofitInstance.getRetrofit(applicationContext).create(ApiService::class.java)
|
api = RetrofitInstance.getRetrofit(applicationContext).create(ApiService::class.java)
|
||||||
|
val projectId = intent.getIntExtra("project_id", -1)
|
||||||
|
|
||||||
projectTitleText = findViewById(R.id.projectTitleText)
|
projectTitleText = findViewById(R.id.projectTitleText)
|
||||||
projectDescriptionText = findViewById(R.id.projectDescriptionText)
|
projectDescriptionText = findViewById(R.id.projectDescriptionText)
|
||||||
completedPercentageText = findViewById(R.id.completedPercentageText)
|
completedPercentageText = findViewById(R.id.completedPercentageText)
|
||||||
|
|
||||||
returnActionButton = findViewById(R.id.returnActionButton)
|
returnActionButton = findViewById(R.id.returnActionButton)
|
||||||
returnActionButton.setOnClickListener { finish() }
|
returnActionButton.setOnClickListener { finish() }
|
||||||
|
|
||||||
val projectId : Int = intent.getIntExtra("project_id", -1)
|
addTaskButton = findViewById(R.id.addTaskButton)
|
||||||
|
// addTaskButton.setOnClickListener {
|
||||||
|
// val intent: Intent = Intent(this, CreateTaskActivity::class.java)
|
||||||
|
// intent.putExtra("project_id", projectId)
|
||||||
|
// startActivity(intent)
|
||||||
|
// }
|
||||||
|
|
||||||
|
addCollaboratorButton = findViewById(R.id.addCollaboratorButton)
|
||||||
|
// addCollaboratorButton.setOnClickListener {
|
||||||
|
// val intent: Intent = Intent(this, AddCollaboratorActivity::class.java)
|
||||||
|
// intent.putExtra("project_id", projectId)
|
||||||
|
// startActivity(intent)
|
||||||
|
// }
|
||||||
|
|
||||||
|
collaboratorListRecycler = findViewById(R.id.collaboratorListRecycler)
|
||||||
|
// collaboratorListAdapter =
|
||||||
|
collaboratorListRecycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this)
|
||||||
|
|
||||||
|
|
||||||
if (projectId > 0) {
|
if (projectId > 0) {
|
||||||
Log.d("ProjectDetailActivity", "Received project ID: $projectId")
|
Log.d("ProjectDetailActivity", "Received project ID: $projectId")
|
||||||
|
|
@ -83,10 +115,13 @@ class ProjectDetailActivity : AppCompatActivity() {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Log.e("ProjectDetailActivity", "No project ID found in intent")
|
Log.e("ProjectDetailActivity", "No project ID found in intent")
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,12 +33,12 @@ class ProjectItemAdapter(
|
||||||
override fun getItemCount(): Int = items.size
|
override fun getItemCount(): Int = items.size
|
||||||
|
|
||||||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
private val nameTv: TextView = itemView.findViewById(R.id.projectName)
|
private val nameTextView: TextView = itemView.findViewById(R.id.projectName)
|
||||||
private val descTv: TextView = itemView.findViewById(R.id.projectDescription)
|
private val descriptionTextView: TextView = itemView.findViewById(R.id.projectDescription)
|
||||||
|
|
||||||
fun bind(project: Project) {
|
fun bind(project: Project) {
|
||||||
nameTv.text = project.id.toString() + " " + project.name
|
nameTextView.text = project.name
|
||||||
descTv.text = project.description
|
descriptionTextView.text = project.description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,96 @@
|
||||||
android:id="@+id/completedPercentageText"
|
android:id="@+id/completedPercentageText"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/projectTitleText"
|
app:layout_constraintTop_toBottomOf="@+id/projectTitleText"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:paddingRight="12dp"
|
android:paddingRight="12dp"
|
||||||
android:paddingLeft="12dp" />
|
android:paddingLeft="12dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:textSize="18dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/projectDescriptionText"
|
android:id="@+id/projectDescriptionText"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/completedPercentageText"
|
app:layout_constraintTop_toBottomOf="@+id/projectDescriptionLabel"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:text="Project description"
|
android:text="Project description"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
android:gravity="start|top" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Project description:"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/projectDescriptionLabel"
|
||||||
|
tools:layout_editor_absoluteX="0dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/completedPercentageText"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:paddingLeft="12dp"
|
||||||
|
android:paddingRight="12dp"
|
||||||
|
android:labelFor="@id/projectDescriptionText"
|
||||||
|
android:textSize="18dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/projectDescriptionText"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:id="@+id/taskLinearLayout">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Tasks:"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/taskListTitle"
|
||||||
|
android:paddingLeft="12dp"
|
||||||
|
android:textSize="18dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:text="Add a task..."
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/addTaskButton"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:layout_editor_absoluteX="0dp"
|
||||||
|
android:id="@+id/collaboratorsLinearLayout"
|
||||||
|
android:gravity="top|center_vertical"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/taskLinearLayout"
|
||||||
|
android:layout_marginTop="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Collaborators:"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/collaboratorListTitle"
|
||||||
|
android:paddingLeft="12dp"
|
||||||
|
android:textSize="18dp" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/collaboratorListRecycler" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:text="Add a new collaborator..."
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/addCollaboratorButton"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue