recyclerview with notification list
This commit is contained in:
22
app/src/main/res/layout/notification_list_fragment.xml
Normal file
22
app/src/main/res/layout/notification_list_fragment.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/nList_notificationList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nList_emptyView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/notification_list_empty" />
|
||||
|
||||
</FrameLayout>
|
||||
76
app/src/main/res/layout/notification_list_item.xml
Normal file
76
app/src/main/res/layout/notification_list_item.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:andorid="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_marginEnd="16dp"
|
||||
android:id="@+id/notification_item_appIcon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notification_item_smallIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
tools:src="@drawable/ic_sd_card" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notification_item_appName"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:lines="1"
|
||||
tools:text="A really long app name thats ellipsed"
|
||||
android:ellipsize="end"
|
||||
android:layout_toEndOf="@+id/notification_item_smallIcon"
|
||||
android:layout_toStartOf="@+id/notification_item_date"/>
|
||||
|
||||
<TextView
|
||||
android:lines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginTop="4dp"
|
||||
android:id="@+id/notification_item_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/notification_item_appName"
|
||||
tools:text="Notification title" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginStart="4dp"
|
||||
android:id="@+id/notification_item_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
tools:text="16 hours ago"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
|
||||
|
||||
<TextView
|
||||
android:lines="3"
|
||||
android:ellipsize="end"
|
||||
android:id="@+id/notification_item_message"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/notification_item_title"
|
||||
tools:text="Some messages wit lots of text and \nTwo lines" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
<string name="create_shedule_snack">Notification sheduled for %1$s</string>
|
||||
<string name="create_shedule_snack_undo">Undo</string>
|
||||
<string name="notification_list_empty">No notifications found.</string>
|
||||
|
||||
<string-array name="create_categories">
|
||||
<item>Alarm</item>
|
||||
|
||||
Reference in New Issue
Block a user