mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
First implementation of adventure guide
This commit is contained in:
parent
fb4860d441
commit
c68684cb1f
29 changed files with 455 additions and 16 deletions
|
|
@ -80,6 +80,12 @@
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activities.AdventureGuideActivity"
|
||||||
|
android:label="@string/LoginActivityName"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activities.IntroActivity"
|
android:name=".ui.activities.IntroActivity"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
|
|
||||||
BIN
Habitica/alpha/release/Habitica-alpha-release.aab
Normal file
BIN
Habitica/alpha/release/Habitica-alpha-release.aab
Normal file
Binary file not shown.
|
|
@ -146,7 +146,7 @@ dependencies {
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '28.0.3'
|
buildToolsVersion '29.0.3'
|
||||||
testOptions {
|
testOptions {
|
||||||
unitTests {
|
unitTests {
|
||||||
includeAndroidResources = true
|
includeAndroidResources = true
|
||||||
|
|
@ -162,7 +162,7 @@ android {
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||||
|
|
||||||
versionCode 2421
|
versionCode 2426
|
||||||
versionName "2.6.2"
|
versionName "2.6.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
BIN
Habitica/res/drawable-hdpi/adventure_guide_art.png
Normal file
BIN
Habitica/res/drawable-hdpi/adventure_guide_art.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
BIN
Habitica/res/drawable-mdpi/adventure_guide_art.png
Normal file
BIN
Habitica/res/drawable-mdpi/adventure_guide_art.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
BIN
Habitica/res/drawable-xhdpi/adventure_guide_art.png
Normal file
BIN
Habitica/res/drawable-xhdpi/adventure_guide_art.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
Habitica/res/drawable-xxhdpi/adventure_guide_art.png
Normal file
BIN
Habitica/res/drawable-xxhdpi/adventure_guide_art.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -5,8 +5,8 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingTop="13dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="13dp">
|
android:paddingBottom="8dp">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="86dp">
|
android:layout_height="86dp">
|
||||||
|
|
|
||||||
99
Habitica/res/layout/activity_adventure_guide.xml
Normal file
99
Habitica/res/layout/activity_adventure_guide.xml
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
<?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.PrefsActivity"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@color/white">
|
||||||
|
|
||||||
|
<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"
|
||||||
|
android:background="@color/white"/>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scrollbarSize="3dp"
|
||||||
|
android:scrollbarThumbVertical="@color/scrollbarThumb"
|
||||||
|
android:scrollbars="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/adventure_guide_art"
|
||||||
|
android:layout_marginBottom="@dimen/spacing_medium"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/getting_started"
|
||||||
|
style="@style/Subheader1"
|
||||||
|
android:textColor="@color/gray_50"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
|
android:layout_marginBottom="@dimen/spacing_medium"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/adventure_guide_description"
|
||||||
|
style="@style/Body2"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginEnd="30dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/spacing_large"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginEnd="30dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/your_progress"
|
||||||
|
android:textColor="@color/gray_100"
|
||||||
|
style="@style/Caption1"/>
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progress_textview"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Caption2.Regular"
|
||||||
|
android:textColor="@color/gray_300"
|
||||||
|
android:text="@string/lets_get_started"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
|
android:progressBackgroundTint="@color/gray_600"
|
||||||
|
android:progressTint="@color/yellow_50"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/achievement_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
</LinearLayout>
|
||||||
38
Habitica/res/layout/adventure_guide_item.xml
Normal file
38
Habitica/res/layout/adventure_guide_item.xml
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
android:id="@+id/icon_view"
|
||||||
|
android:layout_width="52dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
app:actualImageScaleType="fitCenter"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginStart="30dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginStart="17dp"
|
||||||
|
android:layout_marginEnd="30dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Body1"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Caption2.Regular"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="52dp"
|
android:layout_height="52dp"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:layout_marginStart="@dimen/spacing_large"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="@dimen/spacing_large" />
|
android:layout_marginEnd="20dp" />
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="41dp"
|
android:layout_width="41dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -38,5 +38,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Body2"
|
style="@style/Body2"
|
||||||
|
android:textColor="@color/gray_200"
|
||||||
android:gravity="center_horizontal"/>
|
android:gravity="center_horizontal"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
45
Habitica/res/layout/dialog_first_drop.xml
Normal file
45
Habitica/res/layout/dialog_first_drop.xml
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginTop="@dimen/spacing_small"
|
||||||
|
android:layout_marginBottom="@dimen/spacing_large">
|
||||||
|
|
||||||
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
android:id="@+id/egg_view"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_marginEnd="@dimen/spacing_large"
|
||||||
|
app:actualImageScaleType="center"
|
||||||
|
android:background="@drawable/layout_rounded_bg_gray_700"/>
|
||||||
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
android:id="@+id/hatchingPotion_view"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
app:actualImageScaleType="center"
|
||||||
|
android:background="@drawable/layout_rounded_bg_gray_700" />
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Body2"
|
||||||
|
android:textColor="@color/gray_200"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/first_drop_explanation1"
|
||||||
|
android:layout_marginBottom="@dimen/spacing_medium"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Body1"
|
||||||
|
android:textColor="@color/gray_100"
|
||||||
|
android:text="@string/first_drop_explanation2"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -429,4 +429,8 @@
|
||||||
android:id="@+id/bugFixFragment"
|
android:id="@+id/bugFixFragment"
|
||||||
android:name="com.habitrpg.android.habitica.ui.fragments.support.BugFixFragment"
|
android:name="com.habitrpg.android.habitica.ui.fragments.support.BugFixFragment"
|
||||||
android:label="@string/bugs_fixes" />
|
android:label="@string/bugs_fixes" />
|
||||||
|
<activity
|
||||||
|
android:id="@+id/adventureGuideActivity"
|
||||||
|
android:name="com.habitrpg.android.habitica.ui.activities.AdventureGuideActivity"
|
||||||
|
android:label="" />
|
||||||
</navigation>
|
</navigation>
|
||||||
|
|
@ -1017,5 +1017,37 @@
|
||||||
<string name="task_display">Task list display</string>
|
<string name="task_display">Task list display</string>
|
||||||
<string name="onboarding_tasks">Onboarding Tasks</string>
|
<string name="onboarding_tasks">Onboarding Tasks</string>
|
||||||
<string name="complete_for_gold">Complete to earn 100 Gold!</string>
|
<string name="complete_for_gold">Complete to earn 100 Gold!</string>
|
||||||
<string name="delete_checklist_entry">Delete...</string>
|
<string name="delete_checklist_entry">Delete…</string>
|
||||||
|
<string name="getting_started">Getting Started</string>
|
||||||
|
<string name="adventure_guide_description">Complete these onboarding tasks and you’ll earn 5 Achievements and 100 Gold once you’re done!</string>
|
||||||
|
<string name="your_progress">Your Progress</string>
|
||||||
|
<string name="lets_get_started">Let\'s get started</string>
|
||||||
|
<string name="percent_completed">%d%% Complete</string>
|
||||||
|
<string name="create_task_title">Create a Task</string>
|
||||||
|
<string name="complete_task_title">Complete a Task</string>
|
||||||
|
<string name="hatch_pet_title">Hatch a Pet</string>
|
||||||
|
<string name="feedPet_title">Feed a Pet</string>
|
||||||
|
<string name="purchase_equipment_title">Purchase Equipment</string>
|
||||||
|
<string name="create_task_description">Add a task for something you would like to accomplish this week</string>
|
||||||
|
<string name="complete_task_description">Check off any of your tasks to earn rewards</string>
|
||||||
|
<string name="hatch_pet_description">Head over to your Items and try combining a Hatching Potion and Egg</string>
|
||||||
|
<string name="feedPet_description">There are many different types of food, but pets can be picky</string>
|
||||||
|
<string name="purchase_equipment_description">Equipment is a way to customize your avatar and improve your stats</string>
|
||||||
|
<string name="createdTaskTitle">Created your first task</string>
|
||||||
|
<string name="completedTaskTitle">Completed a task</string>
|
||||||
|
<string name="hatchedPetTitle">Hatched a Pet</string>
|
||||||
|
<string name="fedPetTitle">Fed a Pet</string>
|
||||||
|
<string name="purchasedEquipmentTitle">Purchased Equipment</string>
|
||||||
|
<string name="createdTaskDescription">You created your first task</string>
|
||||||
|
<string name="completedTaskDescription">You completed a task for the first time</string>
|
||||||
|
<string name="hatchedPetDescription">You hatched your first pet</string>
|
||||||
|
<string name="fedPetDescription">You fed your first piece of food to a pet</string>
|
||||||
|
<string name="purchasedEquipmentDescription">You purchased your first piece of equipment for your avatar</string>
|
||||||
|
<string name="first_drop_explanation1">Completing tasks gives you a chance to find eggs, hatching potions, and pet food.</string>
|
||||||
|
<string name="first_drop_explanation2">Head to your Items and try combining your new Egg and Hatching Potion!</string>
|
||||||
|
<string name="go_to_items">Go to Items</string>
|
||||||
|
<string name="first_drop_title">You found new items!</string>
|
||||||
|
<string name="onboardingCompleteTitle">You earned 5 Achievements and 100 Gold for your efforts.</string>
|
||||||
|
<string name="onboardingCompleteDescription">If you want even more, check out Achievements and start collecting!</string>
|
||||||
|
<string name="onboardingComplete_achievement_title">You completed your OnboardingTasks!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
<!-- Captions -->
|
<!-- Captions -->
|
||||||
<style name="Caption1">
|
<style name="Caption1">
|
||||||
<item name="android:fontFamily">@string/font_family_regular</item>
|
<item name="android:fontFamily">@string/font_family_regular</item>
|
||||||
<item name="android:textSize">14sp</item>
|
<item name="android:textSize">12sp</item>
|
||||||
<item name="android:textStyle">bold</item>
|
<item name="android:textStyle">bold</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.habitrpg.android.habitica.receivers.NotificationPublisher;
|
||||||
import com.habitrpg.android.habitica.receivers.TaskAlarmBootReceiver;
|
import com.habitrpg.android.habitica.receivers.TaskAlarmBootReceiver;
|
||||||
import com.habitrpg.android.habitica.receivers.TaskReceiver;
|
import com.habitrpg.android.habitica.receivers.TaskReceiver;
|
||||||
import com.habitrpg.android.habitica.ui.activities.AboutActivity;
|
import com.habitrpg.android.habitica.ui.activities.AboutActivity;
|
||||||
|
import com.habitrpg.android.habitica.ui.activities.AdventureGuideActivity;
|
||||||
import com.habitrpg.android.habitica.ui.activities.ChallengeFormActivity;
|
import com.habitrpg.android.habitica.ui.activities.ChallengeFormActivity;
|
||||||
import com.habitrpg.android.habitica.ui.activities.ClassSelectionActivity;
|
import com.habitrpg.android.habitica.ui.activities.ClassSelectionActivity;
|
||||||
import com.habitrpg.android.habitica.ui.activities.FixCharacterValuesActivity;
|
import com.habitrpg.android.habitica.ui.activities.FixCharacterValuesActivity;
|
||||||
|
|
@ -340,4 +341,6 @@ public interface UserComponent {
|
||||||
void inject(@NotNull AvatarEquipmentFragment avatarEquipmentFragment);
|
void inject(@NotNull AvatarEquipmentFragment avatarEquipmentFragment);
|
||||||
|
|
||||||
void inject(@NotNull FAQDetailFragment faqDetailFragment);
|
void inject(@NotNull FAQDetailFragment faqDetailFragment);
|
||||||
|
|
||||||
|
void inject(@NotNull AdventureGuideActivity adventureGuideFragment);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
package com.habitrpg.android.habitica.events
|
||||||
|
|
||||||
|
class ShowFirstDropDialog(val egg: String, val hatchingPotion: String, val id: String)
|
||||||
|
|
@ -5,8 +5,11 @@ import com.habitrpg.android.habitica.R
|
||||||
import com.habitrpg.android.habitica.data.ApiClient
|
import com.habitrpg.android.habitica.data.ApiClient
|
||||||
import com.habitrpg.android.habitica.events.ShowAchievementDialog
|
import com.habitrpg.android.habitica.events.ShowAchievementDialog
|
||||||
import com.habitrpg.android.habitica.events.ShowCheckinDialog
|
import com.habitrpg.android.habitica.events.ShowCheckinDialog
|
||||||
|
import com.habitrpg.android.habitica.events.ShowFirstDropDialog
|
||||||
import com.habitrpg.android.habitica.events.ShowSnackbarEvent
|
import com.habitrpg.android.habitica.events.ShowSnackbarEvent
|
||||||
import com.habitrpg.android.habitica.models.Notification
|
import com.habitrpg.android.habitica.models.Notification
|
||||||
|
import com.habitrpg.android.habitica.models.notifications.AchievementData
|
||||||
|
import com.habitrpg.android.habitica.models.notifications.FirstDropData
|
||||||
import com.habitrpg.android.habitica.models.notifications.LoginIncentiveData
|
import com.habitrpg.android.habitica.models.notifications.LoginIncentiveData
|
||||||
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
||||||
import io.reactivex.BackpressureStrategy
|
import io.reactivex.BackpressureStrategy
|
||||||
|
|
@ -49,7 +52,7 @@ class NotificationsManager (private val context: Context) {
|
||||||
this.apiClient = apiClient
|
this.apiClient = apiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handlePopupNotifications(notifications: List<Notification>): Boolean? {
|
private fun handlePopupNotifications(notifications: List<Notification>): Boolean? {
|
||||||
val now = Date()
|
val now = Date()
|
||||||
if (now.time - (lastNotificationHandling?.time ?: 0) < 500) {
|
if (now.time - (lastNotificationHandling?.time ?: 0) < 500) {
|
||||||
return true
|
return true
|
||||||
|
|
@ -68,6 +71,9 @@ class NotificationsManager (private val context: Context) {
|
||||||
Notification.Type.ACHIEVEMENT_GUILD_JOINED.type -> displayAchievementNotification(it)
|
Notification.Type.ACHIEVEMENT_GUILD_JOINED.type -> displayAchievementNotification(it)
|
||||||
Notification.Type.ACHIEVEMENT_CHALLENGE_JOINED.type -> displayAchievementNotification(it)
|
Notification.Type.ACHIEVEMENT_CHALLENGE_JOINED.type -> displayAchievementNotification(it)
|
||||||
Notification.Type.ACHIEVEMENT_INVITED_FRIEND.type -> displayAchievementNotification(it)
|
Notification.Type.ACHIEVEMENT_INVITED_FRIEND.type -> displayAchievementNotification(it)
|
||||||
|
Notification.Type.ACHIEVEMENT_GENERIC.type -> displayGenericAchievementNotification(it)
|
||||||
|
Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type -> displayAchievementNotification(it)
|
||||||
|
Notification.Type.FIRST_DROP.type -> displayFirstDropNotification(it)
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,7 +86,13 @@ class NotificationsManager (private val context: Context) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun displayLoginIncentiveNotification(notification: Notification): Boolean? {
|
private fun displayFirstDropNotification(notification: Notification): Boolean {
|
||||||
|
val data = (notification.data as? FirstDropData)
|
||||||
|
EventBus.getDefault().post(ShowFirstDropDialog(data?.egg ?: "", data?.hatchingPotion ?: "", notification.id))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun displayLoginIncentiveNotification(notification: Notification): Boolean? {
|
||||||
val notificationData = notification.data as? LoginIncentiveData
|
val notificationData = notification.data as? LoginIncentiveData
|
||||||
val nextUnlockText = context.getString(R.string.nextPrizeUnlocks, notificationData?.nextRewardAt)
|
val nextUnlockText = context.getString(R.string.nextPrizeUnlocks, notificationData?.nextRewardAt)
|
||||||
if (notificationData?.rewardKey != null) {
|
if (notificationData?.rewardKey != null) {
|
||||||
|
|
@ -104,4 +116,9 @@ class NotificationsManager (private val context: Context) {
|
||||||
EventBus.getDefault().post(ShowAchievementDialog(notification.type ?: "", notification.id))
|
EventBus.getDefault().post(ShowAchievementDialog(notification.type ?: "", notification.id))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun displayGenericAchievementNotification(notification: Notification): Boolean {
|
||||||
|
EventBus.getDefault().post(ShowAchievementDialog((notification.data as? AchievementData)?.achievement ?: "", notification.id))
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ class Notification {
|
||||||
ACHIEVEMENT_GUILD_JOINED("GUILD_JOINED_ACHIEVEMENT"),
|
ACHIEVEMENT_GUILD_JOINED("GUILD_JOINED_ACHIEVEMENT"),
|
||||||
ACHIEVEMENT_CHALLENGE_JOINED("CHALLENGE_JOINED_ACHIEVEMENT"),
|
ACHIEVEMENT_CHALLENGE_JOINED("CHALLENGE_JOINED_ACHIEVEMENT"),
|
||||||
ACHIEVEMENT_INVITED_FRIEND("INVITED_FRIEND_ACHIEVEMENT"),
|
ACHIEVEMENT_INVITED_FRIEND("INVITED_FRIEND_ACHIEVEMENT"),
|
||||||
|
ACHIEVEMENT_GENERIC("ACHIEVEMENT"),
|
||||||
|
ACHIEVEMENT_ONBOARDING_COMPLETE("ONBOARDING_COMPLETE"),
|
||||||
|
|
||||||
|
FIRST_DROP("FIRST_DROPS"),
|
||||||
|
|
||||||
// Custom notification types (created by this app)
|
// Custom notification types (created by this app)
|
||||||
GUILD_INVITATION("GUILD_INVITATION"),
|
GUILD_INVITATION("GUILD_INVITATION"),
|
||||||
|
|
@ -49,6 +53,8 @@ class Notification {
|
||||||
Type.GUILD_INVITATION.type -> GuildInvitationData::class.java
|
Type.GUILD_INVITATION.type -> GuildInvitationData::class.java
|
||||||
Type.PARTY_INVITATION.type -> PartyInvitationData::class.java
|
Type.PARTY_INVITATION.type -> PartyInvitationData::class.java
|
||||||
Type.QUEST_INVITATION.type -> QuestInvitationData::class.java
|
Type.QUEST_INVITATION.type -> QuestInvitationData::class.java
|
||||||
|
Type.FIRST_DROP.type -> FirstDropData::class.java
|
||||||
|
Type.ACHIEVEMENT_GENERIC.type -> AchievementData::class.java
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.habitrpg.android.habitica.models.notifications
|
||||||
|
|
||||||
|
open class AchievementData : NotificationData {
|
||||||
|
|
||||||
|
var achievement: String? = null
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.habitrpg.android.habitica.models.notifications
|
||||||
|
|
||||||
|
open class FirstDropData : NotificationData {
|
||||||
|
|
||||||
|
var egg: String? = null
|
||||||
|
var hatchingPotion: String? = null
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.habitrpg.android.habitica.ui.activities
|
||||||
|
|
||||||
|
import android.graphics.Paint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import com.habitrpg.android.habitica.R
|
||||||
|
import com.habitrpg.android.habitica.components.UserComponent
|
||||||
|
import com.habitrpg.android.habitica.data.UserRepository
|
||||||
|
import com.habitrpg.android.habitica.databinding.ActivityAdventureGuideBinding
|
||||||
|
import com.habitrpg.android.habitica.databinding.AdventureGuideItemBinding
|
||||||
|
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||||
|
import com.habitrpg.android.habitica.models.user.User
|
||||||
|
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils
|
||||||
|
import io.reactivex.functions.Consumer
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class AdventureGuideActivity : BaseActivity() {
|
||||||
|
private lateinit var binding: ActivityAdventureGuideBinding
|
||||||
|
|
||||||
|
|
||||||
|
private lateinit var achievementTitles: Map<String, String>
|
||||||
|
private lateinit var achievementDescriptions: Map<String, String>
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
internal lateinit var userRepository: UserRepository
|
||||||
|
|
||||||
|
override fun getLayoutResId(): Int {
|
||||||
|
return R.layout.activity_main
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContentView(): View {
|
||||||
|
binding = ActivityAdventureGuideBinding.inflate(layoutInflater)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun injectActivity(component: UserComponent?) {
|
||||||
|
component?.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
setupToolbar(binding.toolbar)
|
||||||
|
|
||||||
|
achievementTitles = mapOf(
|
||||||
|
Pair("createdTask", getString(R.string.create_task_title)),
|
||||||
|
Pair("completedTask", getString(R.string.complete_task_title)),
|
||||||
|
Pair("hatchedPet", getString(R.string.hatch_pet_title)),
|
||||||
|
Pair("fedPet", getString(R.string.feedPet_title)),
|
||||||
|
Pair("purchasedEquipment", getString(R.string.purchase_equipment_title))
|
||||||
|
)
|
||||||
|
achievementDescriptions = mapOf(
|
||||||
|
Pair("createdTask", getString(R.string.create_task_description)),
|
||||||
|
Pair("completedTask", getString(R.string.complete_task_description)),
|
||||||
|
Pair("hatchedPet", getString(R.string.hatch_pet_description)),
|
||||||
|
Pair("fedPet", getString(R.string.feedPet_description)),
|
||||||
|
Pair("purchasedEquipment", getString(R.string.purchase_equipment_description))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
compositeSubscription.add(userRepository.getUser().subscribe(Consumer {
|
||||||
|
updateUser(it)
|
||||||
|
}, RxErrorHandler.handleEmptyError()))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateUser(user: User) {
|
||||||
|
val achievements = user.onboardingAchievements
|
||||||
|
val completed = achievements.count { it.earned }
|
||||||
|
binding.progressBar.max = achievements.size
|
||||||
|
binding.progressBar.progress = completed
|
||||||
|
|
||||||
|
if (completed > 0) {
|
||||||
|
binding.progressTextview.text = getString(R.string.percent_completed, ((completed / achievements.size.toFloat()) * 100).toInt())
|
||||||
|
binding.progressTextview.setTextColor(ContextCompat.getColor(this, R.color.yellow_10))
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.achievementContainer.removeAllViews()
|
||||||
|
for (achievement in achievements) {
|
||||||
|
val itemBinding = AdventureGuideItemBinding.inflate(layoutInflater, binding.achievementContainer, true)
|
||||||
|
itemBinding.titleView.text = achievementTitles[achievement.key]
|
||||||
|
itemBinding.descriptionView.text = achievementDescriptions[achievement.key]
|
||||||
|
|
||||||
|
val iconName = if (achievement.earned) {
|
||||||
|
"achievement-" + achievement.key + "2x"
|
||||||
|
} else {
|
||||||
|
"achievement-unearned2x"
|
||||||
|
}
|
||||||
|
DataBindingUtils.loadImage(itemBinding.iconView, iconName)
|
||||||
|
if (achievement.earned) {
|
||||||
|
itemBinding.titleView.paintFlags = itemBinding.titleView.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
||||||
|
itemBinding.titleView.setTextColor(ContextCompat.getColor(this, R.color.gray_200))
|
||||||
|
itemBinding.descriptionView.setTextColor(ContextCompat.getColor(this, R.color.gray_200))
|
||||||
|
} else {
|
||||||
|
itemBinding.titleView.setTextColor(ContextCompat.getColor(this, R.color.gray_50))
|
||||||
|
itemBinding.descriptionView.setTextColor(ContextCompat.getColor(this, R.color.gray_50))
|
||||||
|
itemBinding.iconView.alpha = 0.5f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -62,6 +62,7 @@ import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
|
||||||
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar.SnackbarDisplayType
|
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar.SnackbarDisplayType
|
||||||
import com.habitrpg.android.habitica.ui.views.ValueBar
|
import com.habitrpg.android.habitica.ui.views.ValueBar
|
||||||
import com.habitrpg.android.habitica.ui.views.dialogs.AchievementDialog
|
import com.habitrpg.android.habitica.ui.views.dialogs.AchievementDialog
|
||||||
|
import com.habitrpg.android.habitica.ui.views.dialogs.FirstDropDialog
|
||||||
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
|
||||||
import com.habitrpg.android.habitica.ui.views.dialogs.QuestCompletedDialog
|
import com.habitrpg.android.habitica.ui.views.dialogs.QuestCompletedDialog
|
||||||
import com.habitrpg.android.habitica.ui.views.yesterdailies.YesterdailyDialog
|
import com.habitrpg.android.habitica.ui.views.yesterdailies.YesterdailyDialog
|
||||||
|
|
@ -166,6 +167,7 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupToolbar(binding.toolbar)
|
setupToolbar(binding.toolbar)
|
||||||
|
drawerIcon = AdventureGuideDrawerArrowDrawable(supportActionBar?.themedContext)
|
||||||
|
|
||||||
avatarInHeader = AvatarWithBarsViewModel(this, binding.avatarWithBars, userRepository)
|
avatarInHeader = AvatarWithBarsViewModel(this, binding.avatarWithBars, userRepository)
|
||||||
sideAvatarView = AvatarView(this, showBackground = true, showMount = false, showPet = false)
|
sideAvatarView = AvatarView(this, showBackground = true, showMount = false, showPet = false)
|
||||||
|
|
@ -195,7 +197,6 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
||||||
R.string.navigation_drawer_open, /* "open drawer" description */
|
R.string.navigation_drawer_open, /* "open drawer" description */
|
||||||
R.string.navigation_drawer_close /* "close drawer" description */
|
R.string.navigation_drawer_close /* "close drawer" description */
|
||||||
) {}
|
) {}
|
||||||
drawerIcon = AdventureGuideDrawerArrowDrawable(supportActionBar?.themedContext)
|
|
||||||
drawerToggle?.drawerArrowDrawable = drawerIcon
|
drawerToggle?.drawerArrowDrawable = drawerIcon
|
||||||
// Set the drawer toggle as the DrawerListener
|
// Set the drawer toggle as the DrawerListener
|
||||||
drawerToggle?.let { drawerLayout.addDrawerListener(it) }
|
drawerToggle?.let { drawerLayout.addDrawerListener(it) }
|
||||||
|
|
@ -700,6 +701,19 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
||||||
}, RxErrorHandler.handleEmptyError()))
|
}, RxErrorHandler.handleEmptyError()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
fun showFirstDropDialog(event: ShowFirstDropDialog) {
|
||||||
|
compositeSubscription.add(Completable.complete()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(Action {
|
||||||
|
val dialog = FirstDropDialog(this)
|
||||||
|
dialog.configure(event.egg, event.hatchingPotion)
|
||||||
|
dialog.enqueue()
|
||||||
|
apiClient.readNotification(event.id)
|
||||||
|
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError())
|
||||||
|
}, RxErrorHandler.handleEmptyError()))
|
||||||
|
}
|
||||||
|
|
||||||
override fun onEvent(event: ShowConnectionProblemEvent) {
|
override fun onEvent(event: ShowConnectionProblemEvent) {
|
||||||
if (event.title != null) {
|
if (event.title != null) {
|
||||||
super.onEvent(event)
|
super.onEvent(event)
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ class NavigationDrawerAdapter(tintColor: Int, backgroundTintColor: Int): Recycle
|
||||||
(holder as? SectionHeaderViewHolder)?.bind(drawerItem)
|
(holder as? SectionHeaderViewHolder)?.bind(drawerItem)
|
||||||
} else if (getItemViewType(position) == 4) {
|
} else if (getItemViewType(position) == 4) {
|
||||||
drawerItem.user?.let { (holder.itemView as? AdventureGuideMenuBanner)?.updateData(it) }
|
drawerItem.user?.let { (holder.itemView as? AdventureGuideMenuBanner)?.updateData(it) }
|
||||||
|
holder.itemView.setOnClickListener { itemSelectedEvents.onNext(drawerItem) }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package com.habitrpg.android.habitica.ui.fragments
|
package com.habitrpg.android.habitica.ui.fragments
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import com.habitrpg.android.habitica.R
|
||||||
import com.habitrpg.android.habitica.data.ApiClient
|
import com.habitrpg.android.habitica.data.ApiClient
|
||||||
import com.habitrpg.android.habitica.data.UserRepository
|
import com.habitrpg.android.habitica.data.UserRepository
|
||||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ class NavigationDrawerFragment : DialogFragment() {
|
||||||
private fun initializeMenuItems() {
|
private fun initializeMenuItems() {
|
||||||
val items = ArrayList<HabiticaDrawerItem>()
|
val items = ArrayList<HabiticaDrawerItem>()
|
||||||
context?.let {context ->
|
context?.let {context ->
|
||||||
val adventureItem = HabiticaDrawerItem(R.id.tasksFragment, SIDEBAR_ADVENTURE_GUIDE)
|
val adventureItem = HabiticaDrawerItem(R.id.adventureGuideActivity, SIDEBAR_ADVENTURE_GUIDE)
|
||||||
adventureItem.itemViewType = 4
|
adventureItem.itemViewType = 4
|
||||||
items.add(adventureItem)
|
items.add(adventureItem)
|
||||||
items.add(HabiticaDrawerItem(R.id.tasksFragment, SIDEBAR_TASKS, context.getString(R.string.sidebar_tasks)))
|
items.add(HabiticaDrawerItem(R.id.tasksFragment, SIDEBAR_TASKS, context.getString(R.string.sidebar_tasks)))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.habitrpg.android.habitica.ui.views.dialogs
|
package com.habitrpg.android.habitica.ui.views.dialogs
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
|
@ -36,6 +37,12 @@ class AchievementDialog(context: Context) : HabiticaAlertDialog(context) {
|
||||||
Notification.Type.ACHIEVEMENT_GUILD_JOINED.type -> configure(R.string.joinedGuildTitle, R.string.joinedGuildDescription, "guild")
|
Notification.Type.ACHIEVEMENT_GUILD_JOINED.type -> configure(R.string.joinedGuildTitle, R.string.joinedGuildDescription, "guild")
|
||||||
Notification.Type.ACHIEVEMENT_CHALLENGE_JOINED.type -> configure(R.string.joinedChallengeTitle, R.string.joinedChallengeDescription, "challenge")
|
Notification.Type.ACHIEVEMENT_CHALLENGE_JOINED.type -> configure(R.string.joinedChallengeTitle, R.string.joinedChallengeDescription, "challenge")
|
||||||
Notification.Type.ACHIEVEMENT_INVITED_FRIEND.type -> configure(R.string.inviteFriendTitle, R.string.inviteFriendDescription, "friends")
|
Notification.Type.ACHIEVEMENT_INVITED_FRIEND.type -> configure(R.string.inviteFriendTitle, R.string.inviteFriendDescription, "friends")
|
||||||
|
"createdTask" -> configure(R.string.createdTaskTitle, R.string.createdTaskDescription, type)
|
||||||
|
"completedTask" -> configure(R.string.completedTaskTitle, R.string.completedTaskDescription, type)
|
||||||
|
"hatchedPet" -> configure(R.string.hatchedPetTitle, R.string.hatchedPetDescription, type)
|
||||||
|
"fedPet" -> configure(R.string.fedPetTitle, R.string.fedPetDescription, type)
|
||||||
|
"purchasedEquipment" -> configure(R.string.purchasedEquipmentTitle, R.string.purchasedEquipmentDescription, type)
|
||||||
|
Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type -> configure(R.string.onboardingCompleteTitle, R.string.onboardingCompleteDescription, "onboardingComplete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,10 +50,15 @@ class AchievementDialog(context: Context) : HabiticaAlertDialog(context) {
|
||||||
titleView?.text = context.getString(titleID)
|
titleView?.text = context.getString(titleID)
|
||||||
descriptionView?.text = context.getString(descriptionID)
|
descriptionView?.text = context.getString(descriptionID)
|
||||||
DataBindingUtils.loadImage(iconView, "achievement-${iconName}2x")
|
DataBindingUtils.loadImage(iconView, "achievement-${iconName}2x")
|
||||||
setTitle(R.string.achievement_title)
|
if (iconName == "onboardingComplete") {
|
||||||
addButton(R.string.onwards, true)
|
setTitle(R.string.onboardingComplete_achievement_title)
|
||||||
addButton(R.string.view_achievements, isPrimary = false, isDestructive = false) { _, _ ->
|
titleView?.setTextSize(TypedValue.COMPLEX_UNIT_SP,14f)
|
||||||
|
} else {
|
||||||
|
setTitle(R.string.achievement_title)
|
||||||
|
}
|
||||||
|
addButton(R.string.view_achievements, isPrimary = true, isDestructive = false) { _, _ ->
|
||||||
MainNavigationController.navigate(R.id.achievementsFragment)
|
MainNavigationController.navigate(R.id.achievementsFragment)
|
||||||
}
|
}
|
||||||
|
addButton(R.string.close, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.habitrpg.android.habitica.ui.views.dialogs
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
import com.habitrpg.android.habitica.R
|
||||||
|
import com.habitrpg.android.habitica.helpers.MainNavigationController
|
||||||
|
import com.habitrpg.android.habitica.models.Notification
|
||||||
|
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils
|
||||||
|
|
||||||
|
class FirstDropDialog(context: Context) : HabiticaAlertDialog(context) {
|
||||||
|
|
||||||
|
private var eggView: SimpleDraweeView?
|
||||||
|
private var hatchingPotionView: SimpleDraweeView?
|
||||||
|
|
||||||
|
init {
|
||||||
|
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as? LayoutInflater
|
||||||
|
val view = inflater?.inflate(R.layout.dialog_first_drop, null)
|
||||||
|
eggView = view?.findViewById(R.id.egg_view)
|
||||||
|
hatchingPotionView = view?.findViewById(R.id.hatchingPotion_view)
|
||||||
|
setAdditionalContentView(view)
|
||||||
|
addButton(R.string.go_to_items, isPrimary = true, isDestructive = false) { _, _ ->
|
||||||
|
MainNavigationController.navigate(R.id.itemsFragment)
|
||||||
|
}
|
||||||
|
addButton(R.string.close, false)
|
||||||
|
setTitle(R.string.first_drop_title)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun configure(egg: String, hatchingPotion: String) {
|
||||||
|
DataBindingUtils.loadImage(eggView, "Pet_Egg_$egg")
|
||||||
|
DataBindingUtils.loadImage(hatchingPotionView, "Pet_HatchingPotion_$hatchingPotion")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.61'
|
ext.kotlin_version = '1.3.72'
|
||||||
ext.build_tools_version = '29.0.0'
|
ext.build_tools_version = '29.0.0'
|
||||||
ext.sdk_version = 28
|
ext.sdk_version = 28
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue