mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Add notifications icon to navigation drawer + notifications activity
This commit is contained in:
parent
39587802df
commit
48c5fc59e3
11 changed files with 112 additions and 3 deletions
|
|
@ -64,6 +64,13 @@
|
|||
android:pathPattern="/settings/.*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.NotificationsActivity"
|
||||
android:parentActivityName=".ui.activities.MainActivity"
|
||||
android:label="@string/notifications"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="UnusedAttribute">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.FixCharacterValuesActivity"
|
||||
android:parentActivityName=".ui.activities.PrefsActivity"
|
||||
|
|
|
|||
BIN
Habitica/res/drawable-mdpi/menu_notifications.webp
Normal file
BIN
Habitica/res/drawable-mdpi/menu_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
BIN
Habitica/res/drawable-xhdpi/menu_notifications.webp
Normal file
BIN
Habitica/res/drawable-xhdpi/menu_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 B |
BIN
Habitica/res/drawable-xxhdpi/menu_notifications.webp
Normal file
BIN
Habitica/res/drawable-xxhdpi/menu_notifications.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
33
Habitica/res/layout/activity_notifications.xml
Normal file
33
Habitica/res/layout/activity_notifications.xml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.NotificationsActivity"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="@style/Toolbar"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_gravity="top|center" >
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingRight="1dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
|
@ -58,10 +58,39 @@
|
|||
</LinearLayout>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/messagesButtonWrapper"
|
||||
android:layout_width="45dp"
|
||||
android:id="@+id/notificationsButtonWrapper"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp">
|
||||
<ImageView
|
||||
android:id="@+id/notificationsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/menu_notifications"
|
||||
android:layout_centerVertical="true"
|
||||
android:clickable="false" />
|
||||
<TextView
|
||||
android:id="@+id/notificationsBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:paddingTop="0dp"
|
||||
android:layout_alignTop="@id/notificationsButton"
|
||||
android:layout_alignLeft="@id/notificationsButton"
|
||||
tools:text="1"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="12sp"
|
||||
android:background="@drawable/badge_circle"
|
||||
android:layout_marginTop="-12dp"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/messagesButtonWrapper"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="8dp">
|
||||
<ImageView
|
||||
android:id="@+id/messagesButton"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -210,6 +210,11 @@
|
|||
app:argType="string"
|
||||
app:nullable="true" />
|
||||
</fragment>
|
||||
<activity
|
||||
android:id="@+id/notificationsActivity"
|
||||
android:name="com.habitrpg.android.habitica.ui.activities.NotificationsActivity"
|
||||
android:label="@string/notifications">
|
||||
</activity>
|
||||
<fragment
|
||||
android:id="@+id/petDetailRecyclerFragment"
|
||||
android:name="com.habitrpg.android.habitica.ui.fragments.inventory.stable.PetDetailRecyclerFragment"
|
||||
|
|
|
|||
|
|
@ -535,6 +535,7 @@
|
|||
<string name="open_settings">Open Settings</string>
|
||||
<string name="dont_keep_activities_warning">It seems like you have the Developer option \“Don\'t keep Activities\” active. Currently this option causes issues with the habitica app, so we suggest disabling it.</string>
|
||||
<string name="inbox">Messages</string>
|
||||
<string name="notifications">Notifications</string>
|
||||
<string name="FAQ">Frequently Asked Questions</string>
|
||||
<string name="special">Special</string>
|
||||
<string name="gem_for_gold_description">Because you subscribe to Habitica, you can purchase a number of Gems each month using Gold.</string>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.habitrpg.android.habitica.ui.activities.IntroActivity;
|
|||
import com.habitrpg.android.habitica.ui.activities.LoginActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.MainActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.MaintenanceActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.NotificationsActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.GroupInviteActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.PrefsActivity;
|
||||
import com.habitrpg.android.habitica.ui.activities.ReportMessageActivity;
|
||||
|
|
@ -133,6 +134,8 @@ public interface AppComponent {
|
|||
|
||||
void inject(PrefsActivity prefsActivity);
|
||||
|
||||
void inject(NotificationsActivity notificationsActivity);
|
||||
|
||||
void inject(SetupActivity setupActivity);
|
||||
|
||||
void inject(SkillTasksActivity skillTasksActivity);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.habitrpg.android.habitica.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import kotlinx.android.synthetic.main.activity_notifications.*
|
||||
|
||||
class NotificationsActivity : BaseActivity() {
|
||||
|
||||
override fun getLayoutResId(): Int = R.layout.activity_notifications
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setupToolbar(toolbar)
|
||||
}
|
||||
|
||||
override fun injectActivity(component: AppComponent?) {
|
||||
component?.inject(this)
|
||||
}
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
if (supportFragmentManager.backStackEntryCount > 0) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onSupportNavigateUp()
|
||||
}
|
||||
}
|
||||
|
|
@ -97,6 +97,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
|
||||
messagesBadge.visibility = View.GONE
|
||||
settingsBadge.visibility = View.GONE
|
||||
notificationsBadge.visibility = View.GONE
|
||||
|
||||
/* Reenable this once the boss art can be displayed correctly.
|
||||
|
||||
|
|
@ -192,6 +193,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
|
||||
messagesButtonWrapper.setOnClickListener { setSelection(R.id.inboxFragment) }
|
||||
settingsButtonWrapper.setOnClickListener { setSelection(R.id.prefsActivity) }
|
||||
notificationsButtonWrapper.setOnClickListener { setSelection(R.id.notificationsActivity) }
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue