Skip to content

Commit

Permalink
update AboutMeActivity + MainActivity logic + use RelativeLinksCard +…
Browse files Browse the repository at this point in the history
… BottomTipView + minor improvements
  • Loading branch information
Lemkinator committed Dec 29, 2024
1 parent 35caca5 commit 65e1a04
Show file tree
Hide file tree
Showing 13 changed files with 207 additions and 231 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ dependencies {
implementation("sesl.androidx.picker:picker-color:1.0.6+1.0.6-sesl6+rev3")
//SESL6(OneUI 6) Material Components + Design Lib + Icons
implementation("sesl.com.google.android.material:material:1.12.0+1.0.23-sesl6+rev2")
implementation("io.github.tribalfs:oneui-design:0.3.4+oneui6")
implementation("io.github.tribalfs:oneui-design:0.3.6+oneui6")
implementation("io.github.oneuiproject:icons:1.1.0")

implementation("io.github.lemkinator:common-utils:0.5.7")
Expand All @@ -116,8 +116,8 @@ dependencies {
implementation("androidx.room:room-runtime:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
implementation("com.google.dagger:hilt-android:2.53.1")
ksp("com.google.dagger:hilt-compiler:2.53.1")
implementation("com.google.dagger:hilt-android:2.54")
ksp("com.google.dagger:hilt-compiler:2.54")
}

configurations.implementation {
Expand Down
15 changes: 0 additions & 15 deletions app/src/main/java/de/lemke/oneurl/domain/GetSearchListUseCase.kt

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/java/de/lemke/oneurl/domain/GetURLsUseCase.kt

This file was deleted.

32 changes: 30 additions & 2 deletions app/src/main/java/de/lemke/oneurl/domain/ObserveURLsUseCase.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
package de.lemke.oneurl.domain


import android.util.Log
import de.lemke.oneurl.data.URLRepository
import de.lemke.oneurl.domain.model.URL
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import javax.inject.Inject

class ObserveURLsUseCase @Inject constructor(
private val urlRepository: URLRepository,
private val urlRepository: URLRepository
) {
operator fun invoke() = urlRepository.observeURLs().flowOn(Dispatchers.Default)
@OptIn(ExperimentalCoroutinesApi::class)
operator fun invoke(searchQuery: Flow<String?>, filterFavorite: Flow<Boolean>): Flow<List<URL>> =
searchQuery.flatMapLatest { query -> // observe search query
if (query != null) {
if (query.isBlank()) {
urlRepository.observeURLs().map { emptyList() }
} else {
urlRepository.observeURLs().map { urls ->
urls.filter { url -> url.contains(query) }
}
}
} else {
filterFavorite.flatMapLatest { filterFavorite -> // observe favorite filter
if (filterFavorite) {
urlRepository.observeURLs().map { urls ->
urls.filter { url -> url.favorite }
}
} else {
urlRepository.observeURLs()
}
}
}
}.flowOn(Dispatchers.Default)
}
4 changes: 2 additions & 2 deletions app/src/main/java/de/lemke/oneurl/ui/AboutMeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ class AboutMeActivity : AppCompatActivity() {
binding.aboutSwipeUpContainer.alpha = (1 - offsetAlpha * -3).coerceIn(0f, 1f)
}
// Handle the bottom part of the UI
val alphaRange = binding.aboutCtl.height * 0.143f
val alphaRange = binding.aboutCTL.height * 0.143f
val layoutPosition = abs(appBarLayout.top).toFloat()
val bottomAlpha = (150.0f / alphaRange * (layoutPosition - binding.aboutCtl.height * 0.35f)).coerceIn(0f, 255f)
val bottomAlpha = (150.0f / alphaRange * (layoutPosition - binding.aboutCTL.height * 0.35f)).coerceIn(0f, 255f)
binding.aboutBottomContainer.alpha = bottomAlpha / 255
}
}
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/java/de/lemke/oneurl/ui/AddURLActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.lifecycle.lifecycleScope
import com.skydoves.transformationlayout.TransformationAppCompatActivity
import dagger.hilt.android.AndroidEntryPoint
import de.lemke.commonutils.hideSoftInput
import de.lemke.commonutils.openURL
import de.lemke.commonutils.setCustomBackPressAnimation
import de.lemke.commonutils.toast
import de.lemke.oneurl.R
Expand Down Expand Up @@ -139,11 +140,14 @@ class AddURLActivity : TransformationAppCompatActivity() {
else binding.textInputLayoutAlias.visibility = View.GONE
val tipsCardInfo = selectedShortURLProvider.getTipsCardTitleAndInfo(this)
if (tipsCardInfo != null) {
binding.tipsCard.titleText = tipsCardInfo.first
binding.tipsCardText.text = tipsCardInfo.second
binding.tipsCardText.setTextColor(getColor(de.lemke.commonutils.R.color.commonutils_primary_text_icon_color))
binding.tipsCard.visibility = View.VISIBLE
} else binding.tipsCard.visibility = View.GONE
binding.addUrlBottomTip.setTitle(tipsCardInfo.first)
binding.addUrlBottomTip.setContent(tipsCardInfo.second)
binding.addUrlBottomTip.setLink(de.lemke.commonutils.R.string.more_information) {
openURL(selectedShortURLProvider.infoURL)
}
//binding.tipsCardText.setTextColor(getColor(de.lemke.commonutils.R.color.commonutils_primary_text_icon_color))
binding.addUrlBottomTip.visibility = View.VISIBLE
} else binding.addUrlBottomTip.visibility = View.GONE
}

private fun initFooterButton() {
Expand Down Expand Up @@ -255,6 +259,7 @@ class AddURLActivity : TransformationAppCompatActivity() {
},
successCallback = { shortURL ->
lifecycleScope.launch {
MainActivity.scrollToTop = true
addURL(
URL(
shortURL = shortURL,
Expand Down
Loading

0 comments on commit 65e1a04

Please sign in to comment.