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

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#959594"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,18.69L7.84,6.14 5.27,3.49 4,4.76l2.8,2.8v0.01c-0.52,0.99 -0.8,2.16 -0.8,3.42v5l-2,2v1h13.73l2,2L21,19.72l-1,-1.03zM12,22c1.11,0 2,-0.89 2,-2h-4c0,1.11 0.89,2 2,2zM18,14.68L18,11c0,-3.08 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68c-0.15,0.03 -0.29,0.08 -0.42,0.12 -0.1,0.03 -0.2,0.07 -0.3,0.11h-0.01c-0.01,0 -0.01,0 -0.02,0.01 -0.23,0.09 -0.46,0.2 -0.68,0.31 0,0 -0.01,0 -0.01,0.01L18,14.68z"/>
</vector>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#F00" />
<size
android:width="12dp"
android:height="12dp" />
</shape>

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>

View file

@ -1,11 +1,11 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/notifications"
android:title="@string/notifications"
app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_notifications_white_24dp"
/>
android:title="@string/notifications"
app:showAsAction="ifRoom|withText"
android:menuCategory="secondary"
app:actionLayout="@layout/notification_icon"
/>
<item android:id="@+id/list_sheet"
android:title="@string/list_sheet"
app:showAsAction="ifRoom|withText"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Main application background color -->
<color name="main_background_dark">#303030</color>
<color name="main_background_light">#fafafa</color>
@ -57,4 +57,6 @@
<color name="opak_middle_grey">#757575</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="swipe_red" tools:ignore="MissingDefaultResource">#FF0000</color>
</resources>

View file

@ -460,5 +460,7 @@ Upload your first media by touching the camera or gallery icon above.</string>
<string name="no_image">No images used</string>
<string name="no_image_reverted">No images reverted</string>
<string name="no_image_uploaded">No images uploaded</string>
<string name="share_logs_using">Share logs using</string>
<string name="no_notification">You have no unread Notification</string>
<string name="share_logs_using">Share logs using</string>
</resources>