finalize 4.4.2

This commit is contained in:
Phillip Thelen 2024-09-10 16:06:43 +02:00
parent 5f397430f4
commit b6d734f403
11 changed files with 104 additions and 96 deletions

View file

@ -116,12 +116,6 @@ abstract class HabiticaBaseApplication : Application(), Application.ActivityLife
// endregion
var animationsEnabled: Boolean =
!(Settings.Global.getFloat(contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1.0f) == 0f
&& Settings.Global.getFloat(contentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE, 1.0f) == 0f
&& Settings.Global.getFloat(contentResolver, Settings.Global.WINDOW_ANIMATION_SCALE, 1.0f) == 0f)
override fun onCreate() {
super.onCreate()
@ -148,7 +142,6 @@ abstract class HabiticaBaseApplication : Application(), Application.ActivityLife
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
setupCoil()
DataBindingUtils.disableAnimations = !animationsEnabled
ExceptionHandler.init {
Analytics.logException(it)

View file

@ -34,6 +34,7 @@ import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar.Companion.showSnackbar
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
import com.habitrpg.common.habitica.helpers.ExceptionHandler
import com.habitrpg.common.habitica.helpers.RecyclerViewState
import com.habitrpg.common.habitica.helpers.launchCatching
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
@ -256,6 +257,6 @@ class InboxMessageListFragment : BaseMainFragment<FragmentInboxMessageListBindin
}
private fun openProfile() {
viewModel.recipientID?.let { FullProfileActivity.open(it) }
viewModel.memberID?.let { FullProfileActivity.open(it) }
}
}

View file

@ -51,12 +51,14 @@ class InboxViewModel
private val config =
PagingConfig(pageSize = 10, enablePlaceholders = false)
private var messagesDataSource = MessagesDataSource(socialRepository, memberID, ChatMessage())
val messages: LiveData<PagingData<ChatMessage>> =
Pager(
config,
null,
) {
MessagesDataSource(socialRepository, recipientID, ChatMessage())
messagesDataSource = MessagesDataSource(socialRepository, memberID, ChatMessage())
messagesDataSource
}.liveData
private val member =
memberIDFlow
@ -73,7 +75,7 @@ class InboxViewModel
get() = memberIDFlow.value
fun invalidateDataSource() {
messagesDataSource.invalidate()
}
init {
@ -84,8 +86,6 @@ class InboxViewModel
val member = socialRepository.retrieveMember(recipientUsername, false)
setMemberID(member?.id ?: "")
invalidateDataSource()
// dataSourceFactory.updateRecipientID(memberID)
}
}
}
@ -99,7 +99,7 @@ class MessagesDataSource(
private var lastFetchWasEnd = false
override fun getRefreshKey(state: PagingState<Int, ChatMessage>): Int? {
TODO("Not yet implemented")
return 0
}
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, ChatMessage> {

View file

@ -109,8 +109,10 @@ object DataBindingUtils {
return name +
if (!disableAnimations && imageFormat == null && FILEFORMAT_MAP.containsKey(imageName)) {
"." + FILEFORMAT_MAP[imageName]
} else {
} else if (!disableAnimations) {
".${imageFormat ?: "png"}"
} else {
".png"
}
}

View file

@ -14,6 +14,7 @@ import android.view.animation.LinearInterpolator
import android.view.animation.RotateAnimation
import android.view.animation.TranslateAnimation
import androidx.core.animation.doOnEnd
import com.habitrpg.common.habitica.extensions.DataBindingUtils
import kotlin.math.hypot
import kotlin.random.Random
@ -25,9 +26,13 @@ object Animations {
return min + Random.nextFloat() * (max - min)
}
private fun animationScale(): Long {
return if (DataBindingUtils.disableAnimations) 0L else 1L
}
fun bobbingAnimation(amount: Float = 8f): Animation {
val anim = TranslateAnimation(0f, 0f, -amount, amount)
anim.duration = 2500
anim.duration = 2500 * animationScale()
anim.interpolator = AccelerateDecelerateInterpolator()
anim.repeatCount = INFINITE
anim.repeatMode = REVERSE
@ -39,13 +44,13 @@ object Animations {
anim.interpolator = LinearInterpolator()
val translate = TranslateAnimation(randomFloat(-2f * intensity, 0f), randomFloat(0f, 2f * intensity), randomFloat(-1f * intensity, 0f), randomFloat(0f, 1f * intensity))
translate.duration = 70
translate.duration = 70 * animationScale()
translate.repeatCount = 5
translate.repeatMode = REVERSE
anim.addAnimation(translate)
val rotate = RotateAnimation(randomFloat(-0.4f * intensity, 0f), randomFloat(0f, 0.4f * intensity), RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f)
rotate.duration = 70
rotate.duration = 70 * animationScale()
rotate.repeatCount = 5
rotate.repeatMode = REVERSE
anim.addAnimation(rotate)
@ -62,7 +67,7 @@ object Animations {
val cy = view.height / 2
val finalRadius = hypot(cx.toDouble(), cy.toDouble()).toFloat()
val anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0f, finalRadius)
anim.duration = duration
anim.duration = duration * animationScale()
anim.interpolator = AccelerateInterpolator()
view.visibility = View.VISIBLE
anim.start()
@ -76,7 +81,7 @@ object Animations {
val cy = view.height / 2
val initialRadius = hypot(cx.toDouble(), cy.toDouble()).toFloat()
val anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0f)
anim.duration = duration
anim.duration = duration * animationScale()
anim.interpolator = AccelerateInterpolator()
anim.doOnEnd {
view.visibility = View.INVISIBLE
@ -89,7 +94,7 @@ object Animations {
anim.interpolator = AccelerateDecelerateInterpolator()
anim.fillBefore = true
anim.fillAfter = true
anim.duration = duration
anim.duration = duration * animationScale()
return anim
}

View file

@ -3,7 +3,7 @@
<color name="white">#ffffff</color>
<color name="black">#000000</color>
<color name="watch_white">#ffffff</color>
<color name="watch_black">#000000</color>
<color name="watch_black">#000000FF</color>
<color name="brand_50">#36205D</color>
<color name="brand_100">#432874</color>

View file

@ -1,2 +1,2 @@
NAME=4.5.0
CODE=8061
NAME=4.4.2
CODE=8101

View file

@ -25,6 +25,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
installSplashScreen()
binding = ActivitySplashBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState)
if (viewModel.hasAuthentication) {
startMainActivity()
return

View file

@ -16,8 +16,6 @@ class HabiticaScrollView
) : NestedScrollView(context, attrs) {
init {
isVerticalScrollBarEnabled = true
focusable = View.FOCUSABLE
isFocusableInTouchMode = true
}
override fun onAttachedToWindow() {

View file

@ -1,82 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.habitrpg.wearos.habitica.ui.views.HabiticaScrollView
android:id="@+id/scroll_view"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:scrollbarStyle="insideOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.habitrpg.wearos.habitica.ui.activities.LoginActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.habitrpg.wearos.habitica.ui.views.HabiticaScrollView
android:id="@+id/scroll_view"
android:orientation="vertical"
android:gravity="center"
android:animateLayoutChanges="true">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_gryphon_white"
android:importantForAccessibility="no"
android:layout_marginBottom="@dimen/spacing_medium"
android:layout_marginTop="24dp"/>
<TextView
android:id="@+id/title_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Text.SubHeader1"
android:textColor="@color/watch_white"
android:text="@string/sign_in"
android:layout_marginBottom="@dimen/spacing_large"/>
<TextView
android:id="@+id/description_view"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:scrollbarStyle="insideOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:text="@string/sign_in_description"
style="@style/Text.Body2"
android:textColor="@color/watch_white"
android:layout_marginBottom="18dp"/>
android:animateLayoutChanges="true">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_gryphon_white"
android:importantForAccessibility="no"
android:layout_marginBottom="@dimen/spacing_medium"
android:layout_marginTop="24dp" />
<TextView
android:id="@+id/title_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Text.SubHeader1"
android:textColor="@color/watch_white"
android:text="@string/sign_in"
android:layout_marginBottom="@dimen/spacing_large" />
<TextView
android:id="@+id/description_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/sign_in_description"
style="@style/Text.Body2"
android:textColor="@color/watch_white"
android:layout_marginBottom="18dp" />
<com.habitrpg.wearos.habitica.ui.views.ConnectedActionChipView
android:id="@+id/sign_in_on_phone_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/handoff"
app:chipText="@string/sign_in_on_phone" />
android:id="@+id/sign_in_on_phone_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/handoff"
app:chipText="@string/sign_in_on_phone" />
<com.habitrpg.wearos.habitica.ui.views.TextActionChipView
android:id="@+id/other_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/ic_keyboard"
app:chipText="@string/other_options" />
android:id="@+id/other_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/ic_keyboard"
app:chipText="@string/other_options" />
<com.habitrpg.wearos.habitica.ui.views.TextActionChipView
android:id="@+id/google_login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/google_icon"
app:chipText="@string/login_btn_google" />
android:id="@+id/google_login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/google_icon"
app:chipText="@string/login_btn_google" />
<com.habitrpg.wearos.habitica.ui.views.ConnectedActionChipView
android:id="@+id/register_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/handoff"
app:chipText="@string/create_account" />
android:id="@+id/register_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:chipImage="@drawable/handoff"
app:chipText="@string/create_account" />
</LinearLayout>
</com.habitrpg.wearos.habitica.ui.views.HabiticaScrollView>
<com.habitrpg.wearos.habitica.ui.views.TimeText
android:id="@+id/timeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:titleTextColor="@color/text_primary"
app:layout_behavior="com.habitrpg.wearos.habitica.util.TopScrollAwayBehavior" />
</com.habitrpg.wearos.habitica.ui.views.HabiticaScrollView>
<com.habitrpg.wearos.habitica.ui.views.TimeText
android:id="@+id/timeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:titleTextColor="@color/text_primary"
app:layout_behavior="com.habitrpg.wearos.habitica.util.TopScrollAwayBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -41,7 +41,7 @@
<color name="watch_purple_200">#BEAAF9</color>
<color name="watch_purple_100">#A675FF</color>
<color name="watch_purple_10">#6133B4</color>
<color name="watch_purple_5">#23202A</color>
<color name="watch_purple_5">#332F3D</color>
<color name="watch_gray_500">#EFEFEF</color>
<color name="watch_gray_200">#C3C0C7</color>
@ -52,7 +52,6 @@
<color name="watch_purple_100_20">#33A675FF</color>
<color name="ic_launcher_background">@color/brand_300</color>
<color name="surface">@color/watch_purple_5</color>
@ -61,4 +60,4 @@
<color name="mp_bar_color">@color/watch_blue_100</color>
<color name="hp_bar_color">@color/watch_red_100</color>
<color name="transparent">#00ffffff</color>
</resources>
</resources>