Fix various minor issues

This commit is contained in:
Phillip Thelen 2020-09-29 12:48:20 +02:00
parent 79ff3c2414
commit e3e53f0060
52 changed files with 168 additions and 90 deletions

View file

@ -12,6 +12,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" tools:node="remove" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
<application
@ -132,6 +133,7 @@
android:name=".ui.activities.TaskFormActivity"
android:parentActivityName=".ui.activities.MainActivity"
tools:ignore="UnusedAttribute"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateVisible|adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"

View file

@ -11,7 +11,6 @@
android:minSdkVersion="15"
android:targetSdkVersion="24" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

View file

@ -156,8 +156,8 @@ android {
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"
versionCode 2561
versionName "3.0"
versionCode 2571
versionName "3.0.1"
}
viewBinding {

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="@dimen/daily_checkbox_corner_radius"/>
<solid android:color="@color/checkbox_fill" />
<solid android:color="@color/white" />
<size android:height="20dp" android:width="20dp" />
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="@color/checkbox_fill" />
<solid android:color="@color/white" />
<size android:height="20dp" android:width="20dp" />
</shape>

View file

@ -19,7 +19,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar.Modern"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/Theme.AppCompat.Light"/>
app:popupTheme="@style/PopupTheme"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView

View file

@ -37,7 +37,7 @@
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorContentBackground"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.AppCompat.Light" />
app:popupTheme="@style/PopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -19,7 +19,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar.Modern"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
app:popupTheme="@style/PopupTheme"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView

View file

@ -234,6 +234,19 @@
android:textColor="@color/white_75_alpha"
android:background="@color/transparent" />
<TextView
android:id="@+id/privacy_policy"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_xlarge"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:text="@string/login_disclaimer"
android:linksClickable="true"
android:layout_gravity="center_horizontal"
android:textColor="@color/white_75_alpha"
android:background="@color/transparent" />
</LinearLayout>
</ScrollView>

View file

@ -19,7 +19,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar.Modern"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
app:popupTheme="@style/PopupTheme" />
</com.google.android.material.appbar.AppBarLayout>

View file

@ -19,7 +19,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar.Modern"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
app:popupTheme="@style/PopupTheme"/>
</com.google.android.material.appbar.AppBarLayout>

View file

@ -19,7 +19,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar.Modern"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
app:popupTheme="@style/PopupTheme"/>
</com.google.android.material.appbar.AppBarLayout>

View file

@ -74,7 +74,7 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/edit_tag_btn_edit"
android:textColor="@color/text_brand"
android:textColor="?colorPrimary"
android:textSize="16sp"
android:gravity="end|center_vertical"
android:paddingEnd="0dp"/>

View file

@ -5,12 +5,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<Button
<ImageButton
android:id="@+id/delete_button"
android:layout_width="45dp"
android:layout_height="wrap_content"
android:padding="0dp"
android:drawableStart="@drawable/ic_close_purple_300_36dp"
android:src="@drawable/ic_close_purple_300_36dp"
android:tint="?colorPrimary"
android:tintMode="src_atop"
style="@style/Base.Widget.AppCompat.Button.Borderless"/>
<EditText
android:id="@+id/edit_text"

View file

@ -55,8 +55,7 @@
android:id="@+id/gift_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:paddingTop="@dimen/spacing_small"/>
android:inputType="number"/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:layout_width="match_parent"

View file

@ -45,7 +45,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginHorizontal="@dimen/spacing_large">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -99,7 +100,8 @@
android:gravity="center"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_xlarge"
style="@style/Caption2"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -324,7 +324,7 @@
<Button
android:text="@string/subscribe"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_height="wrap_content"
android:id="@+id/subscribeButton"
style="@style/HabiticaButton.Purple.Small"
android:textAllCaps="false"

View file

@ -37,9 +37,16 @@
android:id="@+id/more_button"
android:src="@drawable/ic_more_horiz_black_18dp"
android:background="@color/transparent"
android:tint="?textColorPrimary"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_gravity="end"/>
<TextView
android:id="@+id/you_pill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Pill"
android:text="@string/you"/>
</LinearLayout>
<TableLayout
android:layout_width="match_parent"

View file

@ -217,7 +217,7 @@
<Button
android:id="@+id/change_subscription_button"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_height="wrap_content"
android:text="@string/visit_website"
android:layout_gravity="center"
style="@style/HabiticaButton.Purple"

View file

@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="2sp"
android:textSize="14sp"
android:textSize="15sp"
android:letterSpacing="0.025"
tools:text="Habit Title" />
@ -30,7 +30,7 @@
android:textColor="@color/text_ternary"
android:maxLines="3"
android:ellipsize="end"
android:textSize="12sp"
android:textSize="13sp"
tools:text="Notes"
android:layout_marginBottom="7dp"/>

View file

@ -11,10 +11,11 @@
android:layout_height="1dp"
android:background="@color/content_background_offset"/>
<LinearLayout
android:id="@+id/title_view"
android:id="@+id/section_title_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/spacing_large"
android:paddingEnd="32dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/titleTextView"
@ -41,7 +42,6 @@
android:id="@+id/caretView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:paddingEnd="32dp" />
android:scaleType="center" />
</LinearLayout>
</merge>

View file

@ -13,8 +13,7 @@
android:orientation="horizontal"
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/CardContent">
android:layout_height="match_parent">
<com.habitrpg.android.habitica.ui.RoundedFrameLayout
android:layout_width="@dimen/party_invite_avatar"
@ -38,7 +37,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/party_invite_separator"
android:text="@string/invitation_title" />
android:text="@string/invitation_title_no_leader" />
<Space
android:layout_width="0dp"
@ -52,19 +51,21 @@
android:layout_marginEnd="@dimen/party_invite_separator"
android:layout_gravity="end|center_vertical|fill_horizontal">
<Button
<ImageButton
android:id="@+id/accept_button"
android:layout_width="@dimen/party_invite_button"
android:layout_height="@dimen/party_invite_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/party_accept_button_start_margin"
android:background="@drawable/party_invite_accept" />
android:src="@drawable/party_invite_accept"
android:background="@color/transparent" />
<Button
<ImageButton
android:id="@+id/reject_button"
android:layout_width="@dimen/party_invite_button"
android:layout_height="@dimen/party_invite_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/party_accept_button_start_margin"
android:background="@drawable/party_invite_reject" />
android:src="@drawable/party_invite_reject"
android:background="@color/transparent" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -830,7 +830,7 @@
<string name="register_btn_google">Registrarse con Google</string>
<string name="register_btn_fb">Registrarse con Facebook</string>
<string name="login_btn_apple">Registrarse con Apple</string>
<string name="x_months">Meses</string>
<string name="x_months">%d Meses</string>
<string name="inbox_messages_title_nosender">Recibiste %d mensajes</string>
<string name="inbox_messages_title">Recibiste %d mensajes de %s</string>
<string name="create_task">Crear %s</string>

View file

@ -900,7 +900,7 @@
<string name="renew_subscription">寄付を再開する</string>
<string name="thanks_for_subscribing">寄付に感謝します</string>
<string name="subscribe_options_title">あなたのご都合にあった寄付の期間を選びましょう</string>
<string name="ending_on">%@に止める</string>
<string name="ending_on">%sに止める</string>
<string name="not_recurring">くり返さない</string>
<string name="cancelled">キャンセルしました</string>
<string name="send_invites">招待状を送る</string>

View file

@ -13,7 +13,7 @@
<dimen name="section_top_padding">16dp</dimen>
<dimen name="card_margin">6dp</dimen>
<dimen name="party_invite_button">31dp</dimen>
<dimen name="party_invite_button">34dp</dimen>
<dimen name="party_accept_button_start_margin">5dp</dimen>
<dimen name="party_invite_avatar">46dp</dimen> <!--50?-->
<dimen name="party_invite_separator">4dp</dimen>

View file

@ -1110,4 +1110,7 @@
<string name="user_is_blocked">You blocked this user</string>
<string name="user_is_blocked_explanation">A blocked user cannot send you Private Messages but you will still see their posts in Tavern or Guilds.</string>
<string name="finish">Finish</string>
<string name="login_disclaimer">By signing up, you are indicating that you have read and agree to the <a href="https://habitica.com/static/terms">Terms of Service</a> and <a href="https://habitica.com/static/privacy">Privacy Policy.</a></string>
<string name="you">You</string>
<string name="invitation_title_no_leader">You were invited to join a party</string>
</resources>

View file

@ -8,7 +8,7 @@
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">@null</item>
<item name="actionMenuTextColor">@color/white</item>
<item name="actionMenuTextColor">@color/text_primary</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
@ -50,7 +50,7 @@
<item name="android:navigationBarColor">@color/system_bars</item>
<item name="searchViewStyle">@style/SearchViewStyle</item>
<item name="toolbarContentColor">@color/white</item>
<item name="toolbarContentColor">@color/text_primary</item>
<item name="colorPrimaryText">@color/brand_50</item>
<item name="headerBackgroundColor">@color/content_background</item>
<item name="headerOffsetColor">@color/window_background</item>
@ -67,6 +67,12 @@
<item name="textColorPrimaryDark">@color/gray_200</item>
</style>
<style name="MainAppTheme.TaskForm">
<item name="toolbarContentColor">@color/white</item>
<item name="headerTextColor">@color/white</item>
</style>
<style name="MainAppTheme.Red">
<item name="colorPrimary">@color/red_10</item>
<item name="colorPrimaryDark">@color/red_5</item>
@ -90,6 +96,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/red_100</item>
</style>
<style name="MainAppTheme.Maroon">
@ -114,6 +121,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/maroon_100</item>
</style>
<style name="MainAppTheme.Orange">
@ -139,6 +147,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/orange_100</item>
</style>
<style name="MainAppTheme.Yellow">
@ -164,6 +173,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/yellow_100</item>
</style>
<style name="MainAppTheme.Green">
@ -189,6 +199,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/green_100</item>
</style>
<style name="MainAppTheme.Teal">
@ -214,6 +225,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/teal_100</item>
</style>
<style name="MainAppTheme.Blue">
@ -239,6 +251,7 @@
<item name="barColor">@color/gray_1</item>
<item name="colorPrimaryOffset">@color/gray_10</item>
<item name="textColorPrimaryDark">@color/gray_200</item>
<item name="toolbarContentColor">@color/blue_100</item>
</style>
<style name="BottomSheetTheme" parent="Theme.AppCompat.NoActionBar">

View file

@ -142,6 +142,19 @@ open class Task : RealmObject, Parcelable {
}
}
val darkestTaskColor: Int
get() {
return when {
this.value < -20 -> return R.color.maroon_5
this.value < -10 -> return R.color.red_5
this.value < -1 -> return R.color.orange_5
this.value < 1 -> return R.color.yellow_5
this.value < 5 -> return R.color.green_5
this.value < 10 -> return R.color.teal_5
else -> R.color.blue_5
}
}
val isDisplayedActive: Boolean
get() = isDue == true && !completed

View file

@ -125,6 +125,7 @@ abstract class BaseActivity : AppCompatActivity() {
"green" -> R.style.MainAppTheme_Green
"teal" -> R.style.MainAppTheme_Teal
"blue" -> R.style.MainAppTheme_Blue
"taskform" -> R.style.MainAppTheme_TaskForm
else -> R.style.MainAppTheme
})
}

View file

@ -32,6 +32,7 @@ import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
import io.reactivex.Flowable
import io.reactivex.rxkotlin.zipWith
import java.lang.NumberFormatException
import java.util.*
import javax.inject.Inject
import javax.inject.Named
@ -89,9 +90,11 @@ class ChallengeFormActivity : BaseActivity() {
if (groupID != null) {
c.groupId = groupID
} else {
val locationGroup = locationAdapter.getItem(locationPos)
if (locationGroup != null) {
c.groupId = locationGroup.id
if (locationAdapter.count > locationPos) {
val locationGroup = locationAdapter.getItem(locationPos)
if (locationGroup != null) {
c.groupId = locationGroup.id
}
}
}
c.name = binding.createChallengeTitle.text.toString()
@ -277,7 +280,11 @@ class ChallengeFormActivity : BaseActivity() {
inputValue = "0"
}
val currentVal = Integer.parseInt(inputValue)
val currentVal = try {
Integer.parseInt(inputValue)
} catch (_: NumberFormatException) {
0
}
// 0 is Tavern
val selectedLocation = binding.challengeLocationSpinner.selectedItemPosition

View file

@ -61,7 +61,6 @@ class FixCharacterValuesActivity: BaseActivity() {
binding.experienceIconView.setImageBitmap(HabiticaIconsHelper.imageOfExperience())
binding.manaIconView.setImageBitmap(HabiticaIconsHelper.imageOfMagic())
binding.goldIconView.setImageBitmap(HabiticaIconsHelper.imageOfGold())
binding.levelIconView.setImageBitmap(HabiticaIconsHelper.imageOfRogueLightBg())
binding.streakIconView.setImageResource(R.drawable.achievement_thermometer)
}

View file

@ -110,7 +110,7 @@ class GiftGemsActivity : BaseActivity() {
private fun setViewPagerAdapter() {
val fragmentManager = supportFragmentManager
binding.viewPager.adapter = object : FragmentPagerAdapter(fragmentManager) {
binding.viewPager.adapter = object : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): Fragment {
return if (position == 0) {

View file

@ -103,7 +103,7 @@ class GroupInviteActivity : BaseActivity() {
private fun setViewPagerAdapter() {
val fragmentManager = supportFragmentManager
binding.viewPager.adapter = object : FragmentPagerAdapter(fragmentManager) {
binding.viewPager.adapter = object : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): Fragment {
val fragment = PartyInviteFragment()

View file

@ -10,6 +10,7 @@ import android.os.Build
import android.os.Bundle
import android.text.InputType
import android.text.SpannableString
import android.text.method.LinkMovementMethod
import android.text.style.UnderlineSpan
import android.view.MenuItem
import android.view.View
@ -144,6 +145,7 @@ class LoginActivity : BaseActivity(), Consumer<UserAuthResponse> {
val content = SpannableString(binding.forgotPassword.text)
content.setSpan(UnderlineSpan(), 0, content.length, 0)
binding.forgotPassword.text = content
binding.privacyPolicy.movementMethod = LinkMovementMethod.getInstance()
this.isRegistering = true

View file

@ -232,7 +232,7 @@ class SetupActivity : BaseActivity(), ViewPager.OnPageChangeListener {
.subscribe({ }, RxErrorHandler.handleEmptyError()))
}
private inner class ViewPageAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm), IconPagerAdapter {
private inner class ViewPageAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT), IconPagerAdapter {
override fun getItem(position: Int): Fragment {
return when (position) {

View file

@ -115,14 +115,14 @@ class TaskFormActivity : BaseActivity() {
else -> "blue"
}
} else {
"purple"
"taskform"
}
super.onCreate(savedInstanceState)
if (forcedTheme == "yellow") {
binding.taskDifficultyButtons.textTintColor = ContextCompat.getColor(this, R.color.text_yellow)
binding.habitScoringButtons.textTintColor = ContextCompat.getColor(this, R.color.text_yellow)
} else if (forcedTheme == "purple") {
} else if (forcedTheme == "taskform") {
binding.taskDifficultyButtons.textTintColor = ContextCompat.getColor(this, R.color.text_brand_neon)
binding.habitScoringButtons.textTintColor = ContextCompat.getColor(this, R.color.text_brand_neon)
}
@ -185,7 +185,7 @@ class TaskFormActivity : BaseActivity() {
task = it
//tintColor = ContextCompat.getColor(this, it.mediumTaskColor)
fillForm(it)
task?.challengeID?.let { challengeID ->
it.challengeID?.let { challengeID ->
compositeSubscription.add(challengeRepository.retrieveChallenge(challengeID)
.subscribe({ challenge ->
this.challenge = challenge

View file

@ -38,11 +38,6 @@ abstract class BaseFragment<VB: ViewBinding> : DialogFragment() {
open val displayedClassName: String?
get() = this.javaClass.simpleName
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
showTutorialIfNeeded()
}
override fun onCreate(savedInstanceState: Bundle?) {
HabiticaBaseApplication.userComponent?.let {
injectFragment(it)

View file

@ -51,7 +51,7 @@ class ItemsFragment : BaseMainFragment<FragmentViewpagerBinding>() {
private fun setViewPagerAdapter() {
val fragmentManager = childFragmentManager
binding?.viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager) {
binding?.viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
val fragment = ItemRecyclerFragment()

View file

@ -39,7 +39,7 @@ class StableFragment : BaseMainFragment<FragmentViewpagerBinding>() {
private fun setViewPagerAdapter() {
val fragmentManager = childFragmentManager
binding?.viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager) {
binding?.viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
override fun getItem(position: Int): androidx.fragment.app.Fragment {

View file

@ -99,11 +99,7 @@ class AvatarSetupFragment : BaseFragment<FragmentSetupAvatarBinding>() {
this.updateAvatar()
}
this.selectedBodyCategory()
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser && context != null) {
if (context != null) {
binding?.speechBubble?.animateText(context?.getString(R.string.avatar_setup_description) ?: "")
}
}

View file

@ -51,9 +51,9 @@ class TaskSetupFragment : BaseFragment<FragmentSetupTasksBinding>() {
binding?.heartIcon?.setImageDrawable(BitmapDrawable(HabiticaIconsHelper.imageOfHeartLightBg()))
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser && context != null) {
override fun onResume() {
super.onResume()
if (context != null) {
binding?.speechBubble?.animateText(context?.getString(R.string.task_setup_description) ?: "")
}
}

View file

@ -48,6 +48,7 @@ class ChatFragment : BaseFragment<FragmentChatBinding>() {
private var chatAdapter: ChatRecyclerViewAdapter? = null
private var navigatedOnceToFragment = false
private var isScrolledToBottom = true
private var isFirstRefresh = true
private var refreshDisposable: Disposable? = null
var autocompleteContext: String = ""
@ -108,13 +109,14 @@ class ChatFragment : BaseFragment<FragmentChatBinding>() {
stopAutoRefreshing()
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser) {
startAutoRefreshing()
} else {
stopAutoRefreshing()
}
override fun onResume() {
super.onResume()
startAutoRefreshing()
}
override fun onPause() {
super.onPause()
stopAutoRefreshing()
}
private fun startAutoRefreshing() {
@ -126,6 +128,7 @@ class ChatFragment : BaseFragment<FragmentChatBinding>() {
.subscribe({
refresh()
}, RxErrorHandler.handleEmptyError())
refresh()
}
private fun stopAutoRefreshing() {
@ -145,9 +148,10 @@ class ChatFragment : BaseFragment<FragmentChatBinding>() {
private fun refresh() {
viewModel?.retrieveGroupChat {
if (isScrolledToBottom) {
if (isScrolledToBottom || isFirstRefresh) {
binding?.recyclerView?.scrollToPosition(0)
}
isFirstRefresh = false
}
}

View file

@ -73,7 +73,7 @@ class NoPartyFragmentFragment : BaseMainFragment<FragmentNoPartyBinding>() {
socialRepository.getMember(leader)
.subscribe({
binding?.root?.findViewById<AvatarView>(R.id.groupleader_avatar_view)?.setAvatar(it)
binding?.root?.findViewById<TextView>(R.id.groupleader_avatar_view)?.text = getString(R.string.invitation_title,it.displayName, binding?.invitationsView?.groupName)
binding?.root?.findViewById<TextView>(R.id.groupleader_text_view)?.text = getString(R.string.invitation_title,it.displayName, binding?.invitationsView?.groupName)
}, RxErrorHandler.handleEmptyError())
)
}

View file

@ -137,7 +137,7 @@ class ChallengeListFragment : BaseFragment<FragmentChallengeslistBinding>(), and
}
internal fun retrieveChallengesPage(forced: Boolean = false) {
if ((!forced && binding?.refreshLayout?.isRefreshing == true) || loadedAllData) {
if ((!forced && binding?.refreshLayout?.isRefreshing == true) || loadedAllData || !this::challengeRepository.isInitialized) {
return
}
setRefreshing(true)

View file

@ -298,9 +298,11 @@ open class TaskRecyclerViewFragment : BaseFragment<FragmentRefreshRecyclerviewBi
dialog.setTitle(R.string.broken_challenge)
dialog.setMessage(it.getString(R.string.broken_challenge_description, taskCount))
dialog.addButton(it.getString(R.string.keep_x_tasks, taskCount), true) { _, _ ->
if (!task.isValid) return@addButton
taskRepository.unlinkAllTasks(task.challengeID, "keep-all").subscribe({}, RxErrorHandler.handleEmptyError())
}
dialog.addButton(it.getString(R.string.delete_x_tasks, taskCount), false, true) { _, _ ->
if (!task.isValid) return@addButton
taskRepository.unlinkAllTasks(task.challengeID, "remove-all").subscribe({}, RxErrorHandler.handleEmptyError())
}
dialog.setExtraCloseButtonVisibility(View.VISIBLE)

View file

@ -16,12 +16,14 @@ limitations under the License.
package com.habitrpg.android.habitica.ui.helpers
import android.app.Activity
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.os.Build
import android.view.View
import android.view.ViewTreeObserver.OnGlobalLayoutListener
import android.widget.ImageButton
import android.widget.TextView
import androidx.appcompat.view.menu.ActionMenuItemView
import androidx.appcompat.widget.ActionMenuView
import androidx.appcompat.widget.Toolbar
@ -59,8 +61,7 @@ object ToolbarColorHelper {
if (v is ImageButton) {
//Action Bar back button
v.drawable.colorFilter = colorFilter
}
if (v is ActionMenuView) {
} else if (v is ActionMenuView) {
for (j in 0 until v.childCount) {
//Step 2: Changing the color of any ActionMenuViews - icons that are not back button, nor text, nor overflow menu icon.
@ -77,6 +78,8 @@ object ToolbarColorHelper {
}
}
}
} else if (v is TextView) {
v.setTextColor(toolbarIconsColor)
}
}

View file

@ -53,8 +53,10 @@ class GroupMemberViewHolder(itemView: View) : androidx.recyclerview.widget.Recyc
this.currentUserID = userID
if (user.id == userID) {
binding.youPill.visibility = View.VISIBLE
binding.moreButton.visibility = View.GONE
} else {
binding.youPill.visibility = View.GONE
binding.moreButton.visibility = View.VISIBLE
}

View file

@ -39,7 +39,9 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
checklistIndicatorWrapper.isClickable = true
checklistIndicatorWrapper.setOnClickListener { onChecklistIndicatorClicked() }
checkboxHolder.setOnClickListener {
onCheckedChanged(!(task?.completed ?: false))
if (task?.isValid == true) {
onCheckedChanged(!(task?.completed ?: false))
}
}
}
@ -92,9 +94,11 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
if (task?.type == Task.TYPE_TODO) {
checkboxBackground?.setBackgroundResource(R.drawable.round_checklist_unchecked)
}
checkboxBackground?.backgroundTintList = ContextCompat.getColorStateList(context, (if (context.isUsingNightModeResources()) task?.lightTaskColor else R.color.checkbox_fill) ?: R.color.checkbox_fill)
val textView = itemView?.findViewById<HabiticaEmojiTextView>(R.id.checkedTextView)
// Populate the data into the template view using the data object
textView?.text = item.text
textView?.setTextColor(ContextCompat.getColor(context, if (item.completed) R.color.text_dimmed else R.color.text_secondary))
if (item.text != null) {
Observable.just(item.text)
.map { MarkdownParser.parseMarkdown(it) }
@ -113,7 +117,8 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
checkmark?.drawable?.setTint(ContextCompat.getColor(context, R.color.text_dimmed))
R.color.offset_background
} else {
checkmark?.drawable?.setTint(ContextCompat.getColor(context, task?.darkTaskColor ?: R.color.text_dimmed))
val color = if (context.isUsingNightModeResources()) task?.darkestTaskColor else task?.darkTaskColor
checkmark?.drawable?.setTint(ContextCompat.getColor(context, color ?: R.color.text_dimmed))
task?.extraLightTaskColor ?: R.color.offset_background
})
color.let { checkboxHolder?.setBackgroundColor(it) }

View file

@ -20,7 +20,7 @@ import io.reactivex.Flowable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.subjects.BehaviorSubject
import io.realm.RealmResults
import java.util.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
enum class GroupViewType(internal val order: String) {
@ -216,7 +216,10 @@ open class GroupViewModel : BaseViewModel() {
onComplete()
return
}
disposable.add(socialRepository.retrieveGroupChat(groupID).subscribe({
disposable.add(socialRepository.retrieveGroupChat(groupID)
.delay(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
onComplete()
}, RxErrorHandler.handleEmptyError()))
}

View file

@ -59,9 +59,9 @@ class CollapsibleSectionView(context: Context, attrs: AttributeSet?) : LinearLay
private fun showViews() {
updatePreferences()
setCaretImage()
(2 until childCount)
.filter { getChildAt(it) != binding.titleView }
.forEach { getChildAt(it).visibility = View.VISIBLE }
(0 until childCount)
.map { getChildAt(it) }
.forEach { it.visibility = View.VISIBLE }
}
private fun hideViews() {
@ -69,6 +69,7 @@ class CollapsibleSectionView(context: Context, attrs: AttributeSet?) : LinearLay
setCaretImage()
(2 until childCount)
.map { getChildAt(it) }
.filter { it != binding.sectionTitleView }
.forEach {
it.visibility = View.GONE
}
@ -88,6 +89,7 @@ class CollapsibleSectionView(context: Context, attrs: AttributeSet?) : LinearLay
private fun setChildMargins() {
(2 until childCount)
.map { getChildAt(it) }
.filter { it != binding.sectionTitleView }
.forEach {
val lp = it.layoutParams as? LayoutParams
lp?.setMargins(padding, 0, padding, bottomPadding)
@ -104,8 +106,8 @@ class CollapsibleSectionView(context: Context, attrs: AttributeSet?) : LinearLay
var height = 0
measureChildWithMargins(binding.separator, widthMeasureSpec, 0, heightMeasureSpec, height)
height += binding.separator.measuredHeight
measureChildWithMargins(binding.titleTextView, widthMeasureSpec, 0, heightMeasureSpec, height)
height += binding.titleTextView.measuredHeight
measureChildWithMargins(binding.sectionTitleView, widthMeasureSpec, 0, heightMeasureSpec, height)
height += binding.sectionTitleView.measuredHeight
(2 until childCount)
.map { getChildAt(it) }
.forEach {
@ -123,7 +125,7 @@ class CollapsibleSectionView(context: Context, attrs: AttributeSet?) : LinearLay
init {
caretColor = ContextCompat.getColor(context, R.color.black_50_alpha)
orientation = VERTICAL
binding.titleTextView.setOnClickListener {
binding.sectionTitleView.setOnClickListener {
isCollapsed = !isCollapsed
}
val attributes = context.theme?.obtainStyledAttributes(

View file

@ -269,7 +269,7 @@ open class HabiticaAlertDialog(context: Context) : AlertDialog(context, R.style.
dialogQueue.removeAt(0)
}
if (dialogQueue.size > 0) {
if ((dialogQueue[0].context as? Activity) == null || (dialogQueue[0].context as? Activity)?.isFinishing == false) {
if ((dialogQueue[0].context as? Activity)?.isFinishing == false) {
dialogQueue[0].show()
}
}

View file

@ -147,6 +147,9 @@ class TaskFilterDialog(context: Context, component: UserComponent?) : HabiticaAl
button.setText(R.string.add_tag)
button.setOnClickListener { createTag() }
button.setCompoundDrawablesWithIntrinsicBounds(addIcon, null, null, null)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
button.compoundDrawableTintList = ColorStateList.valueOf(context.getThemeColor(R.attr.colorPrimary))
}
button.setBackgroundResource(R.drawable.layout_rounded_bg_lighter_gray)
button.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
tagsList.addView(button)