mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Make it easier to confirm usernames
This commit is contained in:
parent
153b56e8e5
commit
d6973d905d
13 changed files with 304 additions and 80 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="1995"
|
||||
android:versionCode="1996"
|
||||
android:versionName="1.5.1"
|
||||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
|
|
|||
13
Habitica/res/drawable/badge_circle.xml
Normal file
13
Habitica/res/drawable/badge_circle.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:radius="10dip"/>
|
||||
<solid
|
||||
android:color="@color/red_50" />
|
||||
<padding
|
||||
android:left="5dip"
|
||||
android:right="5dip"
|
||||
android:top="5dip"
|
||||
android:bottom="5dip" />
|
||||
</shape>
|
||||
|
|
@ -40,21 +40,61 @@
|
|||
tools:text="Habitica"
|
||||
style="@style/Body1"
|
||||
android:textColor="@color/white"/>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp">
|
||||
<ImageButton
|
||||
android:id="@+id/messagesButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/menu_messages"
|
||||
android:layout_centerVertical="true"/>
|
||||
<TextView
|
||||
android:id="@+id/messagesBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:paddingTop="0dp"
|
||||
android:layout_alignTop="@id/messagesButton"
|
||||
android:layout_alignLeft="@id/messagesButton"
|
||||
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:layout_width="35dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp">
|
||||
<ImageButton
|
||||
android:id="@+id/settingsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/menu_settings"
|
||||
android:layout_centerVertical="true"/>
|
||||
<TextView
|
||||
android:id="@+id/settingsBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:paddingTop="0dp"
|
||||
android:layout_alignTop="@id/settingsButton"
|
||||
android:layout_alignLeft="@id/settingsButton"
|
||||
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>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/messagesButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/menu_messages"
|
||||
android:layout_marginLeft="16dp"/>
|
||||
<ImageButton
|
||||
android:id="@+id/settingsButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/menu_settings"
|
||||
android:layout_marginLeft="20dp"/>
|
||||
</LinearLayout>
|
||||
<com.habitrpg.android.habitica.ui.views.social.QuestMenuView
|
||||
android:id="@+id/questMenuView"
|
||||
|
|
|
|||
42
Habitica/res/layout/preference_child_summary.xml
Normal file
42
Habitica/res/layout/preference_child_summary.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Layout for a visually child-like Preference in a PreferenceActivity. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingRight="?android:attr/scrollbarSize"
|
||||
android:paddingLeft="16dip">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_weight="1" >
|
||||
|
||||
<TextView
|
||||
android:id="@+android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/black"
|
||||
tools:text="Title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:layout_below="@android:id/title"
|
||||
android:maxLines="4"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
43
Habitica/res/layout/preference_child_summary_error.xml
Normal file
43
Habitica/res/layout/preference_child_summary_error.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Layout for a visually child-like Preference in a PreferenceActivity. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingRight="?android:attr/scrollbarSize"
|
||||
android:paddingLeft="16dip">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_weight="1" >
|
||||
|
||||
<TextView
|
||||
android:id="@+android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/black"
|
||||
tools:text="Title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:layout_below="@android:id/title"
|
||||
android:maxLines="4"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/red_10"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -814,4 +814,14 @@
|
|||
<string name="last_login">Latest Check In</string>
|
||||
<string name="total_checkins">Total Checkins</string>
|
||||
<string name="two_handed">Two-Handed</string>
|
||||
<string name="usernamePromptTitle">It’s time to set your username!</string>
|
||||
<string name="usernamePromptBody">Your display name hasn’t changed but your old login name will now be your public username used for invitations, chat @mentions, and messaging.</string>
|
||||
<string name="usernamePromptWiki">If you’d like to learn more about this change, visit our wiki.</string>
|
||||
<string name="confirmUsername">Confirm Username</string>
|
||||
<string name="usernamePromptDisclaimer">Usernames should conform to our Terms of Service and Community Guidelines. If you didn’t previously set a login name, your username was auto-generated.</string>
|
||||
<string name="confirm_username_title">Are you sure you want to confirm your current username?</string>
|
||||
<string name="confirm_username_description">Confirming your username will make it public for invitations, @mentions and messaging. You can change your username from settings at any time.</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="confirm_username">Confirm Username</string>
|
||||
<string name="username_not_confirmed">Username not confirmed</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -10,56 +10,71 @@
|
|||
|
||||
<PreferenceScreen android:title="@string/profile"
|
||||
android:summary="@string/profile_summary"
|
||||
android:key="profile">
|
||||
android:key="profile"
|
||||
android:layout="@layout/preference_child_summary">
|
||||
<EditTextPreference android:key="display_name"
|
||||
android:title="@string/display_name" />
|
||||
android:title="@string/display_name"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
<EditTextPreference android:key="photo_url"
|
||||
android:title="@string/photo_url" />
|
||||
android:title="@string/photo_url"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
<EditTextPreference android:key="about"
|
||||
android:title="@string/about" />
|
||||
android:title="@string/about"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="authentication"
|
||||
android:title="@string/authentication"
|
||||
android:summary="@string/authentication_summary"
|
||||
app:key="authentication">
|
||||
app:key="authentication"
|
||||
android:layout="@layout/preference_child_summary">
|
||||
<Preference
|
||||
android:key="login_name"
|
||||
android:title="@string/login_name"
|
||||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false" />
|
||||
android:shouldDisableView="false"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
<Preference android:title="@string/confirm_username"
|
||||
android:key="confirm_username"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
|
||||
<Preference
|
||||
android:key="email"
|
||||
android:title="@string/email"
|
||||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false"/>
|
||||
android:shouldDisableView="false"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<Preference
|
||||
android:key="subscription_status"
|
||||
android:title="@string/subscription_status"
|
||||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false"/>
|
||||
android:shouldDisableView="false"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<PreferenceCategory android:title="@string/danger_zone">
|
||||
<Preference android:title="@string/reset_account"
|
||||
android:key="reset_account" />
|
||||
android:key="reset_account"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
<Preference android:title="@string/delete_account"
|
||||
android:key="delete_account" />
|
||||
android:key="delete_account"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="API"
|
||||
android:key="api">
|
||||
android:key="api"
|
||||
android:layout="@layout/preference_child_summary">
|
||||
<Preference
|
||||
android:key="@string/SP_userID"
|
||||
android:title="@string/SP_userID_title"
|
||||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false"
|
||||
android:summary="@string/SP_userID_summary"/>
|
||||
android:summary="@string/SP_userID_summary"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<Preference
|
||||
android:key="@string/SP_APIToken"
|
||||
|
|
@ -67,7 +82,8 @@
|
|||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false"
|
||||
android:summary="@string/SP_APIToken_summary"/>
|
||||
android:summary="@string/SP_APIToken_summary"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<Preference
|
||||
android:key="SP_user_qr_code"
|
||||
|
|
@ -75,17 +91,21 @@
|
|||
android:selectable="true"
|
||||
android:persistent="false"
|
||||
android:shouldDisableView="false"
|
||||
android:summary="@string/SP_user_qr_code"/>
|
||||
android:summary="@string/SP_user_qr_code"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<Preference
|
||||
android:key="choose_class"
|
||||
tools:title="Change Class"/>
|
||||
tools:title="Change Class"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<Preference android:title="@string/fix_character_values"
|
||||
app:key="fixCharacterValues"/>
|
||||
app:key="fixCharacterValues"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<Preference android:title="@string/logout"
|
||||
android:key="logout"
|
||||
android:summary="@string/logout_description"/>
|
||||
android:summary="@string/logout_description"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
@ -95,20 +115,24 @@
|
|||
android:key="@string/pref_first_day_of_the_week_key"
|
||||
android:entries="@array/weekdays"
|
||||
android:entryValues="@array/weekdayValues"
|
||||
android:summary="@string/pref_first_day_of_the_week_summary"/>
|
||||
android:summary="@string/pref_first_day_of_the_week_summary"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<ListPreference android:title="@string/Language_title"
|
||||
android:key="language"
|
||||
android:entries="@array/Language"
|
||||
android:entryValues="@array/LanguageValues"
|
||||
android:summary="@string/Language_summary"/>
|
||||
android:summary="@string/Language_summary"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<ListPreference android:title="@string/AudioTheme_title"
|
||||
android:key="audioTheme"
|
||||
android:entries="@array/AudioThemes"
|
||||
android:entryValues="@array/AudioValues"
|
||||
android:summary="@string/AudioTheme_summary"/>
|
||||
android:summary="@string/AudioTheme_summary"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
<CheckBoxPreference android:title="@string/dailyDueDefaultView"
|
||||
android:key="dailyDueDefaultView"
|
||||
android:summary="@string/dailyDueDefaultViewDescription"
|
||||
android:layout="@layout/preference_child_summary"
|
||||
/>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
@ -118,12 +142,14 @@
|
|||
<CheckBoxPreference
|
||||
android:key="use_reminder"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/pref_reminder_checkbox"/>
|
||||
android:title="@string/pref_reminder_checkbox"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<com.habitrpg.android.habitica.prefs.TimePreference
|
||||
android:key="reminder_time"
|
||||
android:defaultValue="19:30"
|
||||
android:title="@string/pref_reminder_picker" />
|
||||
android:title="@string/pref_reminder_picker"
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
@ -133,7 +159,7 @@
|
|||
<com.habitrpg.android.habitica.prefs.TimePreference
|
||||
android:key="cds_time"
|
||||
android:defaultValue="00:00"
|
||||
android:title="@string/pref_cds_picker" />
|
||||
android:layout="@layout/preference_child_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
@ -143,54 +169,64 @@
|
|||
<CheckBoxPreference
|
||||
android:key="usePushNotifications"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/pref_push_notifications_checkbox"/>
|
||||
android:title="@string/pref_push_notifications_checkbox"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="pushNotifications"
|
||||
android:title="@string/push_notifications"
|
||||
android:summary="@string/push_notifications_sum">
|
||||
android:summary="@string/push_notifications_sum"
|
||||
android:layout="@layout/preference_child_summary">
|
||||
|
||||
<PreferenceCategory android:title="Push Notifications">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_you_won_challenge"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_you_won_challenge"/>
|
||||
android:title="@string/preference_push_you_won_challenge"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_received_a_private_message"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_received_a_private_message"/>
|
||||
android:title="@string/preference_push_received_a_private_message"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_gifted_gems"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_gifted_gems"/>
|
||||
android:title="@string/preference_push_gifted_gems"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_gifted_subscription"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_gifted_subscription"/>
|
||||
android:title="@string/preference_push_gifted_subscription"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_invited_to_party"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_invited_to_party"/>
|
||||
android:title="@string/preference_push_invited_to_party"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_invited_to_guild"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_invited_to_guild"/>
|
||||
android:title="@string/preference_push_invited_to_guild"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_your_quest_has_begun"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_your_quest_has_begun"/>
|
||||
android:title="@string/preference_push_your_quest_has_begun"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="preference_push_invited_to_quest"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/preference_push_invited_to_quest"/>
|
||||
android:title="@string/preference_push_invited_to_quest"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
|
@ -202,7 +238,8 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/maintenance">
|
||||
<Preference android:title="@string/reload_content"
|
||||
android:key="reload_content"/>
|
||||
android:key="reload_content"
|
||||
android:layout="@layout/preference_child_summary"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
@ -118,6 +118,7 @@ abstract class HabiticaBaseApplication : MultiDexApplication() {
|
|||
.build()
|
||||
Instabug.setWelcomeMessageState(WelcomeMessage.State.DISABLED)
|
||||
Instabug.setUserAttribute("", lazyApiHelper.hostConfig.user)
|
||||
BugReporting.setShakingThreshold(450)
|
||||
BugReporting.setPromptOptionsEnabled(PromptOption.BUG, PromptOption.FEEDBACK)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public class Flags extends RealmObject {
|
|||
private boolean armoireOpened;
|
||||
private boolean armoireEmpty;
|
||||
private boolean communityGuidelinesAccepted;
|
||||
private boolean verifiedUsername;
|
||||
|
||||
public List<TutorialStep> getTutorial() {
|
||||
return tutorial;
|
||||
|
|
@ -129,4 +130,12 @@ public class Flags extends RealmObject {
|
|||
public void setCommunityGuidelinesAccepted(boolean communityGuidelinesAccepted) {
|
||||
this.communityGuidelinesAccepted = communityGuidelinesAccepted;
|
||||
}
|
||||
|
||||
public boolean isVerifiedUsername() {
|
||||
return verifiedUsername;
|
||||
}
|
||||
|
||||
public void setVerifiedUsername(boolean verifiedUsername) {
|
||||
this.verifiedUsername = verifiedUsername;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -398,34 +398,14 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
displayDeathDialogIfNeeded()
|
||||
YesterdailyDialog.showDialogIfNeeded(this, user?.id, userRepository, taskRepository)
|
||||
|
||||
displayNewInboxMessagesBadge()
|
||||
drawerFragment?.setMessagesCount(this.user?.inbox?.newMessages ?: 0)
|
||||
if (remoteConfigManager.enableChangeUsername()) {
|
||||
drawerFragment?.setSettingsCount(if (this.user?.flags?.isVerifiedUsername != true) 1 else 0 )
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun displayNewInboxMessagesBadge() {
|
||||
/*int numberOfUnreadPms = this.user.getInbox().getNewMessages();
|
||||
IDrawerItem newInboxItem;
|
||||
|
||||
if (numberOfUnreadPms <= 0) {
|
||||
newInboxItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_inbox))
|
||||
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_INBOX());
|
||||
} else {
|
||||
String numberOfUnreadPmsLabel = String.valueOf(numberOfUnreadPms);
|
||||
BadgeStyle badgeStyle = new BadgeStyle()
|
||||
.withTextColor(Color.WHITE)
|
||||
.withColorRes(R.color.md_red_700);
|
||||
|
||||
newInboxItem = new PrimaryDrawerItem()
|
||||
.withName(this.getString(R.string.sidebar_inbox))
|
||||
.withIdentifier(MainDrawerBuilder.INSTANCE.getSIDEBAR_INBOX())
|
||||
.withBadge(numberOfUnreadPmsLabel)
|
||||
.withBadgeStyle(badgeStyle);
|
||||
}
|
||||
if (this.drawerFragment != null) {
|
||||
this.drawer.updateItemAtPosition(newInboxItem, this.drawer.getPosition(MainDrawerBuilder.INSTANCE.getSIDEBAR_INBOX()));
|
||||
}*/
|
||||
}
|
||||
|
||||
private fun updateSidebar() {
|
||||
drawerFragment?.setUsername(user?.profile?.name)
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
adapter.backgroundTintColor = questContent.colors?.darkColor ?: 0
|
||||
|
||||
|
||||
messagesBadge.visibility = View.GONE
|
||||
settingsBadge.visibility = View.GONE
|
||||
|
||||
/* Reenable this once the boss art can be displayed correctly.
|
||||
|
||||
val preferences = context?.getSharedPreferences("collapsible_sections", 0)
|
||||
|
|
@ -366,6 +369,24 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition)
|
||||
}
|
||||
|
||||
fun setMessagesCount(unreadMessages: Int) {
|
||||
if (unreadMessages == 0) {
|
||||
messagesBadge.visibility = View.GONE
|
||||
} else {
|
||||
messagesBadge.visibility = View.VISIBLE
|
||||
messagesBadge.text = unreadMessages.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun setSettingsCount(count: Int) {
|
||||
if (count == 0) {
|
||||
settingsBadge.visibility = View.GONE
|
||||
} else {
|
||||
settingsBadge.visibility = View.VISIBLE
|
||||
settingsBadge.text = count.toString()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val SIDEBAR_TASKS = "tasks"
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class AuthenticationPreferenceFragment: BasePreferencesFragment() {
|
|||
|
||||
if (configManager.enableChangeUsername()) {
|
||||
findPreference("login_name").title = context?.getString(R.string.username)
|
||||
findPreference("confirm_username").isVisible = user?.flags?.isVerifiedUsername != true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +67,7 @@ class AuthenticationPreferenceFragment: BasePreferencesFragment() {
|
|||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||
when (preference.key) {
|
||||
"login_name" -> showLoginNameDialog()
|
||||
"confirm_username" -> showConfirmUsernameDialog()
|
||||
"email" -> showEmailDialog()
|
||||
"change_password" -> showChangePasswordDialog()
|
||||
"subscription_status" -> {
|
||||
|
|
@ -198,6 +200,22 @@ class AuthenticationPreferenceFragment: BasePreferencesFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun showConfirmUsernameDialog() {
|
||||
context.notNull { context ->
|
||||
val dialog = AlertDialog.Builder(context)
|
||||
.setTitle(R.string.confirm_username_title)
|
||||
.setMessage(R.string.confirm_username_description)
|
||||
.setPositiveButton(R.string.confirm) { thisDialog, _ ->
|
||||
thisDialog.dismiss()
|
||||
userRepository.updateLoginName(user?.authentication?.localAuthentication?.username ?: "")
|
||||
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
.setNegativeButton(R.string.cancel) { thisDialog, _ -> thisDialog.dismiss() }
|
||||
.create()
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetAccount() {
|
||||
@Suppress("DEPRECATION")
|
||||
val dialog = ProgressDialog.show(context, context?.getString(R.string.resetting_account), null, true)
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ import com.habitrpg.android.habitica.HabiticaBaseApplication
|
|||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.data.InventoryRepository
|
||||
import com.habitrpg.android.habitica.extensions.notNull
|
||||
import com.habitrpg.android.habitica.helpers.LanguageHelper
|
||||
import com.habitrpg.android.habitica.helpers.RxErrorHandler
|
||||
import com.habitrpg.android.habitica.helpers.SoundManager
|
||||
import com.habitrpg.android.habitica.helpers.TaskAlarmManager
|
||||
import com.habitrpg.android.habitica.helpers.*
|
||||
import com.habitrpg.android.habitica.helpers.notifications.PushNotificationManager
|
||||
import com.habitrpg.android.habitica.models.ContentResult
|
||||
import com.habitrpg.android.habitica.models.user.User
|
||||
|
|
@ -38,6 +35,8 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
|
|||
lateinit var soundManager: SoundManager
|
||||
@Inject
|
||||
lateinit var pushNotificationManager: PushNotificationManager
|
||||
@Inject
|
||||
lateinit var configManager: RemoteConfigManager
|
||||
|
||||
private var timePreference: TimePreference? = null
|
||||
private var pushNotificationsPreference: PreferenceScreen? = null
|
||||
|
|
@ -54,12 +53,12 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
|
|||
}
|
||||
|
||||
override fun setupPreferences() {
|
||||
timePreference = findPreference("reminder_time") as TimePreference
|
||||
timePreference = findPreference("reminder_time") as? TimePreference
|
||||
val useReminder = preferenceManager.sharedPreferences.getBoolean("use_reminder", false)
|
||||
timePreference?.isEnabled = useReminder
|
||||
|
||||
|
||||
pushNotificationsPreference = findPreference("pushNotifications") as PreferenceScreen
|
||||
pushNotificationsPreference = findPreference("pushNotifications") as? PreferenceScreen
|
||||
val userPushNotifications = preferenceManager.sharedPreferences.getBoolean("usePushNotifications", true)
|
||||
pushNotificationsPreference?.isEnabled = userPushNotifications
|
||||
|
||||
|
|
@ -246,5 +245,16 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
|
|||
val cdsTimePreference = findPreference("cds_time") as? TimePreference
|
||||
cdsTimePreference?.text = user?.preferences?.dayStart.toString() + ":00"
|
||||
findPreference("dailyDueDefaultView").setDefaultValue(user?.preferences?.dailyDueDefaultView)
|
||||
|
||||
if (configManager.enableChangeUsername()) {
|
||||
val preference = findPreference("authentication")
|
||||
if (user?.flags?.isVerifiedUsername == true) {
|
||||
preference.layoutResource = R.layout.preference_child_summary
|
||||
preference.summary = context?.getString(R.string.authentication_summary)
|
||||
} else {
|
||||
preference.layoutResource = R.layout.preference_child_summary_error
|
||||
preference.summary = context?.getString(R.string.username_not_confirmed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue