Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
e85df5b3
Commit
e85df5b3
authored
Feb 04, 2019
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show placeholder in NotificationsFragment if none present
parent
823396a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
app/src/main/java/app/insti/fragment/NotificationsFragment.java
...c/main/java/app/insti/fragment/NotificationsFragment.java
+13
-1
app/src/main/res/layout/fragment_notifications.xml
app/src/main/res/layout/fragment_notifications.xml
+9
-0
No files found.
app/src/main/java/app/insti/fragment/NotificationsFragment.java
View file @
e85df5b3
...
...
@@ -3,6 +3,7 @@ package app.insti.fragment;
import
android.graphics.Canvas
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.BottomSheetDialogFragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.LinearLayoutManager
;
...
...
@@ -11,6 +12,7 @@ import android.support.v7.widget.helper.ItemTouchHelper;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
java.util.List
;
...
...
@@ -73,13 +75,22 @@ public class NotificationsFragment extends BottomSheetDialogFragment {
});
}
private
void
showNotifications
(
final
List
<
Notification
>
notifications
)
{
private
void
showNotifications
(
@Nullable
final
List
<
Notification
>
notifications
)
{
/* Check if activity is done with */
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
/* Hide loader */
getView
().
findViewById
(
R
.
id
.
loadingPanel
).
setVisibility
(
View
.
GONE
);
/* Check if there's nothing to show */
TextView
noNotifs
=
getView
().
findViewById
(
R
.
id
.
no_notifs
);
if
(
notifications
==
null
||
notifications
.
size
()
==
0
)
{
noNotifs
.
setVisibility
(
View
.
VISIBLE
);
return
;
}
else
{
noNotifs
.
setVisibility
(
View
.
GONE
);
}
/* Initialize */
if
(
notificationsAdapter
==
null
)
{
notificationsAdapter
=
new
NotificationsAdapter
(
notifications
,
this
);
...
...
@@ -114,6 +125,7 @@ public class NotificationsFragment extends BottomSheetDialogFragment {
Utils
.
getRetrofitInterface
().
markNotificationDeleted
(
Utils
.
getSessionIDHeader
(),
id
).
enqueue
(
new
EmptyCallback
<
Void
>());
NotificationId
.
setCurrentCount
(
Utils
.
notificationCache
.
size
());
ShortcutBadger
.
applyCount
(
getContext
().
getApplicationContext
(),
NotificationId
.
getCurrentCount
());
if
(
Utils
.
notificationCache
.
size
()
==
0
)
showNotifications
(
null
);
}
};
...
...
app/src/main/res/layout/fragment_notifications.xml
View file @
e85df5b3
...
...
@@ -5,6 +5,15 @@
tools:context=
"app.insti.fragment.NotificationsFragment"
android:background=
"?attr/themeColor"
>
<TextView
android:id=
"@+id/no_notifs"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
android:gravity=
"center"
android:textSize=
"16sp"
android:visibility=
"gone"
android:text=
"No notifications for now!"
/>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/notifications_recycler_view"
android:layout_width=
"match_parent"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment