mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
Implement "no notifications" view, display when notifications list empty
This commit is contained in:
parent
6c09f32e63
commit
4c2a48ae69
7 changed files with 70 additions and 0 deletions
BIN
Habitica/res/drawable-hdpi/no_notifications.webp
Normal file
BIN
Habitica/res/drawable-hdpi/no_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4 KiB |
BIN
Habitica/res/drawable-mdpi/no_notifications.webp
Normal file
BIN
Habitica/res/drawable-mdpi/no_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Habitica/res/drawable-xhdpi/no_notifications.webp
Normal file
BIN
Habitica/res/drawable-xhdpi/no_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
BIN
Habitica/res/drawable-xxhdpi/no_notifications.webp
Normal file
BIN
Habitica/res/drawable-xxhdpi/no_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
53
Habitica/res/layout/no_notifications.xml
Normal file
53
Habitica/res/layout/no_notifications.xml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/spacing_large">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="@dimen/spacing_medium"
|
||||||
|
android:paddingTop="44dp"
|
||||||
|
android:paddingRight="@dimen/spacing_medium">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/noNotifications"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
android:clickable="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@drawable/no_notifications" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingRight="40dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="26dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/SectionTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/no_notifications_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineHeight="20dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:text="@string/no_notifications_text" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -860,6 +860,8 @@
|
||||||
<string name="discover">Discover</string>
|
<string name="discover">Discover</string>
|
||||||
<string name="damage_paused">Damage paused</string>
|
<string name="damage_paused">Damage paused</string>
|
||||||
<string name="preference_push_important_announcements">Important Announcements</string>
|
<string name="preference_push_important_announcements">Important Announcements</string>
|
||||||
|
<string name="no_notifications_title">You’re all caught up!</string>
|
||||||
|
<string name="no_notifications_text">The notification fairies give you a raucous round of applause! Well done!</string>
|
||||||
<string name="create">Create</string>
|
<string name="create">Create</string>
|
||||||
<string name="only_leader_create_challenge">Only leader can create Challenges</string>
|
<string name="only_leader_create_challenge">Only leader can create Challenges</string>
|
||||||
<string name="create_party">Create Party</string>
|
<string name="create_party">Create Party</string>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.habitrpg.android.habitica.ui.activities
|
package com.habitrpg.android.habitica.ui.activities
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
import com.habitrpg.android.habitica.R
|
import com.habitrpg.android.habitica.R
|
||||||
import com.habitrpg.android.habitica.components.AppComponent
|
import com.habitrpg.android.habitica.components.AppComponent
|
||||||
import com.habitrpg.android.habitica.data.UserRepository
|
import com.habitrpg.android.habitica.data.UserRepository
|
||||||
|
|
@ -56,6 +58,19 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setNotifications(notifications: RealmList<GlobalNotification>) {
|
private fun setNotifications(notifications: RealmList<GlobalNotification>) {
|
||||||
|
if (notification_items == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
notification_items.removeAllViewsInLayout()
|
||||||
|
|
||||||
|
val inflater = getSystemService(Context.LAYOUT_INFLATER_SERVICE) as? LayoutInflater
|
||||||
|
if (notifications.isEmpty()) {
|
||||||
|
val item = inflater?.inflate(R.layout.no_notifications, notification_items, false)
|
||||||
|
notification_items.addView(item)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//TODO("not implemented")
|
//TODO("not implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue