feat(event-card): Add edit & delete buttons

This commit is contained in:
Peter Vacho 2024-12-31 14:07:51 +01:00
parent 8c7fffca6f
commit a4ddb2709d
Signed by: school
GPG key ID: 8CFC3837052871B4
4 changed files with 108 additions and 58 deletions

View 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="M200,760h57l391,-391 -57,-57 -391,391v57ZM120,840v-170l528,-527q12,-11 26.5,-17t30.5,-6q16,0 31,6t26,18l55,56q12,11 17.5,26t5.5,30q0,16 -5.5,30.5T817,313L290,840L120,840ZM760,256 L704,200 760,256ZM619,341 L591,312 648,369 619,341Z"
android:fillColor="#e8eaed"/>
</vector>

View 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="M280,840q-33,0 -56.5,-23.5T200,760v-520h-40v-80h200v-40h240v40h200v80h-40v520q0,33 -23.5,56.5T680,840L280,840ZM680,240L280,240v520h400v-520ZM360,680h80v-360h-80v360ZM520,680h80v-360h-80v360ZM280,240v520,-520Z"
android:fillColor="#e8eaed"/>
</vector>

View file

@ -11,73 +11,103 @@
app:cardBackgroundColor="?android:attr/colorBackground"
android:background="@drawable/card_border">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Event Title Row -->
<!-- Event Details -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
android:orientation="vertical"
android:paddingTop="8dp">
<!-- Event Color Indicator -->
<View
android:id="@+id/eventColorIndicator"
android:layout_width="8dp"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:background="@color/event_indicator_color"
android:contentDescription="@string/event_color_indicator" />
<!-- Event Title -->
<TextView
android:id="@+id/tvTitle"
android:layout_width="0dp"
<!-- Event Title Row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:orientation="horizontal"
android:gravity="center_vertical">
<!-- Event Color Indicator -->
<View
android:id="@+id/eventColorIndicator"
android:layout_width="8dp"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:background="@color/event_indicator_color"
android:contentDescription="@string/event_color_indicator" />
<!-- Event Title -->
<TextView
android:id="@+id/tvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="end"
android:maxLines="1"
tools:text="Event Title" />
<!-- Edit Button -->
<ImageButton
android:id="@+id/btnEditEvent"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="4dp"
android:src="@drawable/ic_pencil"
android:contentDescription="@string/edit_event"
app:tint="?android:attr/textColorSecondary" />
<!-- Delete Button -->
<ImageButton
android:id="@+id/btnDeleteEvent"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="4dp"
android:src="@drawable/ic_trashbin"
android:contentDescription="@string/delete_event"
app:tint="?android:attr/textColorSecondary" />
</LinearLayout>
<!-- Event Time -->
<TextView
android:id="@+id/tvTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:paddingTop="4dp"
tools:text="10:00 AM - 11:00 AM" />
<!-- Event Description -->
<TextView
android:id="@+id/tvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:paddingTop="8dp"
android:ellipsize="end"
android:maxLines="1"
tools:text="Event Title" />
android:maxLines="2"
tools:text="This is a sample description for the event. It gives an overview of what the event is about." />
<!-- Categories Section -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/categoryChipRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
tools:listitem="@layout/item_category_chip"
tools:itemCount="3"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:orientation="horizontal" />
</LinearLayout>
<!-- Event Time -->
<TextView
android:id="@+id/tvTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:paddingTop="4dp"
tools:text="10:00 AM - 11:00 AM" />
<!-- Event Description -->
<TextView
android:id="@+id/tvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:paddingTop="8dp"
android:ellipsize="end"
android:maxLines="2"
tools:text="This is a sample description for the event. It gives an overview of what the event is about." />
<!-- Categories Section -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/categoryChipRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
tools:listitem="@layout/item_category_chip"
tools:itemCount="3"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:orientation="horizontal" />
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>

View file

@ -29,4 +29,6 @@
<string name="error_stacktrace">Stack Trace:</string>
<string name="hide_stack_trace">Hide stack trace</string>
<string name="show_stack_trace">Show stack trace</string>
<string name="delete_event">Delete this event</string>
<string name="edit_event">Edit this event</string>
</resources>