mirror of
https://github.com/a-mayb3/KanbanCloneAndroid.git
synced 2026-03-21 18:15:38 +01:00
Added CreateProjectActivity.kt
This commit is contained in:
parent
39276513a9
commit
39f28f619a
5 changed files with 54 additions and 0 deletions
|
|
@ -15,6 +15,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.KanbanCloneAndroid"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".ui.CreateProjectActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.ProjectDetailActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.campusaula.edbole.kanban_clone_android.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.campusaula.edbole.kanban_clone_android.R
|
||||
|
||||
class CreateProjectActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_create_project)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,14 +15,17 @@ import com.campusaula.edbole.kanban_clone_android.R
|
|||
import com.campusaula.edbole.kanban_clone_android.kanban.Project
|
||||
import com.campusaula.edbole.kanban_clone_android.network.ApiService
|
||||
import com.campusaula.edbole.kanban_clone_android.network.RetrofitInstance
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var api: ApiService
|
||||
private lateinit var projectList : List<Project>
|
||||
|
||||
private lateinit var loggedInAs: TextView
|
||||
private lateinit var logoutButton: Button
|
||||
private lateinit var addProjectActionButton: FloatingActionButton
|
||||
private lateinit var projectsRecyclerView: RecyclerView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
|
@ -41,6 +44,7 @@ class MainActivity : AppCompatActivity() {
|
|||
/* Activity components */
|
||||
loggedInAs = findViewById(R.id.loggedInAs)
|
||||
logoutButton = findViewById(R.id.logoutButton)
|
||||
addProjectActionButton = findViewById(R.id.addProjectActionButton)
|
||||
projectsRecyclerView = findViewById(R.id.projectsRecyclerView)
|
||||
projectsRecyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this)
|
||||
val adapter = ProjectItemAdapter(projectList) { project ->
|
||||
|
|
@ -50,6 +54,11 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
projectsRecyclerView.adapter = adapter
|
||||
|
||||
addProjectActionButton.setOnClickListener {
|
||||
val intent = Intent(this, CreateProjectActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
/* Getting the logged-in user info */
|
||||
lifecycleScope.launch{
|
||||
|
||||
|
|
|
|||
10
app/src/main/res/layout/activity_create_project.xml
Normal file
10
app/src/main/res/layout/activity_create_project.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.CreateProjectActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -40,4 +40,15 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:id="@+id/projectsRecyclerView" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
app:srcCompat="@android:drawable/ic_input_add"
|
||||
android:id="@+id/addProjectActionButton"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue