Code to retrive unknown notification and UI (#2340)

* request change, changed notification icon

* Completed task 1 of the work

* commit changes

* commit changes

* updated notification class

* before notification id

* gradle reverted

* Minor changes to mark notifications as read

* commit changes

* delete on swipe

* notification count

* sipe to delete

* changes

* worked on changes requested

* commit changes

* Fix notification count

* reviewed changes

* round icon, swipe with icon

* Fix pending NPE issues with notifications

* final commit

* graddle changes

* removed changes for testing
This commit is contained in:
Vanshika Arora 2019-02-02 19:21:58 +05:30 committed by Vivek Maskara
parent 9451b00a15
commit 1b62ac4d2d
22 changed files with 381 additions and 195 deletions

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -30,6 +31,45 @@
/>
</RelativeLayout>
<android.support.constraint.ConstraintLayout
android:id="@+id/no_notification_background"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="118dp"
android:layout_height="172dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.763"
app:srcCompat="@drawable/ic_notifications_off_black_24dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="188dp"
android:text="@string/no_notification"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"

View file

@ -1,10 +1,36 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:foreground="?selectableItemBackground"
android:minHeight="72dp">
<com.daimajia.swipe.SwipeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/swipeLayout"
>
<LinearLayout
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/bottom_wrapper_child1"
android:background="@color/deleteRed"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/star"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
app:srcCompat="@drawable/ic_done_black_24dp"
android:layout_width="20dp"
android:layout_height="20dp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/icon"
@ -16,9 +42,9 @@
android:background="@android:color/white"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_message_black_24dp"
app:tint="@color/primaryDarkColor"
/>
/>
<!--app:tint="@color/primaryDarkColor"-->
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
@ -47,4 +73,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:padding="12dp"
/>
</RelativeLayout>
</com.daimajia.swipe.SwipeLayout>
</RelativeLayout>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clickable="true"
android:focusable="true"
android:gravity="center"
tools:background="@color/black">
<ImageView
android:id="@+id/cart_icon_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:gravity="center"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_notifications_white_24dp" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/notification_count_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/cart_icon_image_view"
android:layout_alignEnd="@id/cart_icon_image_view"
android:layout_alignRight="@id/cart_icon_image_view"
android:background="@drawable/notification_badge"
android:gravity="center"
android:padding="2dp"
android:textColor="#ffffffff"
android:textSize="7sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="9+"
tools:visibility="visible" />
</RelativeLayout>