feat(day-activity): Add back button
This commit is contained in:
parent
5ec0dbe7b7
commit
5358051034
|
@ -1,6 +1,7 @@
|
|||
package com.p_vacho.neat_calendar.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.ImageButton
|
||||
import android.widget.TextView
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -13,6 +14,11 @@ import com.p_vacho.neat_calendar.adapters.EventCardAdapter
|
|||
import com.p_vacho.neat_calendar.models.CalendarDay
|
||||
|
||||
class DayViewActivity : AppCompatActivity() {
|
||||
private lateinit var btnBack: ImageButton
|
||||
private lateinit var btnAddEvent: ImageButton
|
||||
private lateinit var tvDate: TextView
|
||||
private lateinit var rvEvents: RecyclerView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
|
@ -36,8 +42,19 @@ class DayViewActivity : AppCompatActivity() {
|
|||
val events = calendarDay.events.toMutableList()
|
||||
|
||||
// Setup the UI
|
||||
val tvDate: TextView = findViewById(R.id.tvDate)
|
||||
val rvEvents: RecyclerView = findViewById(R.id.rvEvents)
|
||||
tvDate = findViewById(R.id.tvDate)
|
||||
rvEvents = findViewById(R.id.rvEvents)
|
||||
btnBack = findViewById(R.id.btnBack)
|
||||
btnAddEvent = findViewById(R.id.btnAddEvent)
|
||||
|
||||
btnBack.setOnClickListener {
|
||||
// Handle back navigation
|
||||
finish()
|
||||
}
|
||||
|
||||
btnAddEvent.setOnClickListener {
|
||||
TODO("Implement adding events")
|
||||
}
|
||||
|
||||
tvDate.text = calendarDay.date.toString()
|
||||
|
||||
|
|
9
app/src/main/res/drawable/ic_arrow_back.xml
Normal file
9
app/src/main/res/drawable/ic_arrow_back.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="m313,520 l224,224 -57,56 -320,-320 320,-320 57,56 -224,224h487v80L313,520Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
|
@ -9,21 +9,36 @@
|
|||
android:padding="16dp"
|
||||
tools:context=".activities.DayViewActivity">
|
||||
|
||||
<!-- Row for Date and Add Button -->
|
||||
<FrameLayout
|
||||
<!-- Top row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/dividerHorizontal"> <!-- Bottom border -->
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:background="?android:attr/dividerHorizontal">
|
||||
|
||||
<!-- Back Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_arrow_back"
|
||||
android:contentDescription="@string/back"
|
||||
app:tint="?android:attr/textColorPrimary" />
|
||||
|
||||
<!-- Date -->
|
||||
<TextView
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
tools:text="2025-01-01" />
|
||||
|
||||
<!-- Add Button -->
|
||||
|
@ -31,13 +46,11 @@
|
|||
android:id="@+id/btnAddEvent"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_add"
|
||||
android:contentDescription="@string/add_event"
|
||||
app:tint="?android:attr/textColorPrimary" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Event List -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
|
|
@ -32,4 +32,5 @@
|
|||
<string name="delete_event">Delete this event</string>
|
||||
<string name="edit_event">Edit this event</string>
|
||||
<string name="add_event">Add a new event</string>
|
||||
<string name="back">Go to the previous page</string>
|
||||
</resources>
|
Loading…
Reference in a new issue