Skip to content

Commit

Permalink
API 35... Android 15???
Browse files Browse the repository at this point in the history
  • Loading branch information
ForceTower committed Oct 23, 2024
1 parent 5da45c3 commit 581e748
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 53 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
applicationId = "com.forcetower.uefs"
minSdk = 21
targetSdk = 34
targetSdk = 35
val (code, name) = buildVersion()
versionCode = code
versionName = name
Expand Down Expand Up @@ -112,15 +112,15 @@ android {
mapsKey = "AIzaSyAIb0g7GrjLgOwRqmKHhBxbxWKjct8IF8Y"
}
getByName("release") {
manifestPlaceholders += mapOf("crashlyticsEnabled" to true)
signingConfig = signingConfigs.getByName("release")
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
isMinifyEnabled = true
manifestPlaceholders += mapOf("crashlyticsEnabled" to true)
resValue("string", "google_maps_key", mapsKey)
}
getByName("debug") {
applicationIdSuffix = ".debug"
manifestPlaceholders += mapOf("crashlyticsEnabled" to false)
applicationIdSuffix = ".debug"
resValue("string", "google_maps_key", "AIzaSyAIb0g7GrjLgOwRqmKHhBxbxWKjct8IF8Y")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object AppModule {
@Reusable
@Named("unesUserAgent")
fun provideUnesUserAgent(context: Context): String {
val version = context.packageManager.getPackageInfo(context.packageName, 0).versionName
val version = context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: "0.0.-1"
val parts = version.split(".")
return "UNES/${parts[0]}.${parts[1]}.${parts[2]}.${parts[3]} (Android ${Build.VERSION.RELEASE}; Build/${Build.MODEL})"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import androidx.activity.viewModels
import androidx.core.app.ActivityCompat
import androidx.core.view.WindowCompat
import com.forcetower.uefs.R
import com.forcetower.uefs.core.vm.UserSessionViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
import androidx.viewpager.widget.ViewPager
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.forcetower.core.lifecycle.EventObserver
import com.forcetower.sagres.database.model.SagresDemandOffer
import com.forcetower.uefs.R
import com.forcetower.uefs.UApplication
import com.forcetower.uefs.core.model.unes.Semester
Expand All @@ -48,6 +53,7 @@ import com.forcetower.uefs.feature.shared.UFragment
import com.forcetower.uefs.feature.shared.extensions.makeSemester
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
Expand All @@ -63,7 +69,7 @@ class DisciplineFragment : UFragment() {
private val homeViewModel: HomeViewModel by activityViewModels()
private lateinit var binding: FragmentDisciplineOldBinding

private lateinit var viewPager: ViewPager
private lateinit var viewPager: ViewPager2
private lateinit var tabs: TabLayout
private lateinit var adapter: SemesterAdapter

Expand All @@ -82,17 +88,16 @@ class DisciplineFragment : UFragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
adapter = SemesterAdapter(childFragmentManager)
adapter = SemesterAdapter(childFragmentManager, lifecycle)
viewPager.adapter = adapter
tabs.setupWithViewPager(viewPager)
TabLayoutMediator(tabs, viewPager) { tab, position ->
tab.text = adapter.getPageTitle(position)
}

viewModel.semesters.observe(
viewLifecycleOwner,
{
val actualList = applySortOptions(it)
adapter.submitList(actualList)
}
)
viewModel.semesters.observe(viewLifecycleOwner) {
val actualList = applySortOptions(it)
adapter.submitList(actualList)
}

viewModel.navigateToDisciplineAction.observe(
viewLifecycleOwner,
Expand Down Expand Up @@ -189,17 +194,28 @@ class DisciplineFragment : UFragment() {
dialog.show(childFragmentManager, "select_discipline_group")
}

private inner class SemesterAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
private val semesters: MutableList<Semester> = ArrayList()
private inner class SemesterAdapter(
fm: FragmentManager,
lifecycle: Lifecycle
) : FragmentStateAdapter(fm, lifecycle) {
private val diffCallback = object : DiffUtil.ItemCallback<Semester>() {
override fun areItemsTheSame(oldItem: Semester, newItem: Semester): Boolean {
return oldItem.uid == newItem.uid
}

override fun areContentsTheSame(oldItem: Semester, newItem: Semester): Boolean {
return oldItem == newItem
}

}
private val differ = AsyncListDiffer(this, diffCallback)

fun submitList(list: List<Semester>) {
semesters.clear()
semesters.addAll(list)
notifyDataSetChanged()
differ.submitList(list)
}

override fun getCount() = semesters.size
override fun getItem(position: Int) = DisciplineSemesterFragment.newInstance(semesters[position])
override fun getPageTitle(position: Int) = semesters[position].codename.makeSemester()
override fun getItemCount() = differ.currentList.size
override fun createFragment(position: Int) = DisciplineSemesterFragment.newInstance(differ.currentList[position])
fun getPageTitle(position: Int) = differ.currentList[position].codename.makeSemester()
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_discipline_old.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
android:background="?attr/background"/>
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager_semester"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
25 changes: 24 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import javax.sound.sampled.Clip
import com.android.build.api.variant.AndroidComponentsExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* This file is part of the UNES Open Source Project.
Expand Down Expand Up @@ -69,4 +71,25 @@ subprojects {
mustRunAfter("lintKotlin")
}
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xstring-concat=inline")
}
}

pluginManager.withPlugin("com.android.application") {
extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_17
ext.compileOptions.targetCompatibility = JavaVersion.VERSION_17
}
}

pluginManager.withPlugin("com.android.library") {
extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_17
ext.compileOptions.targetCompatibility = JavaVersion.VERSION_17
}
}
}
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DarkenImage(context: Context, attrs: AttributeSet) : Transition(context, a
override fun captureEndValues(transitionValues: TransitionValues?) { }

override fun createAnimator(
sceneRoot: ViewGroup?,
sceneRoot: ViewGroup,
startValues: TransitionValues?,
endValues: TransitionValues?
): Animator? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DeparallaxChangeBounds(
sceneRoot: ViewGroup,
startValues: TransitionValues?,
endValues: TransitionValues?
): Animator {
): Animator? {
val changeBounds = super.createAnimator(sceneRoot, startValues, endValues)
if (startValues == null || endValues == null || endValues.view !is ParallaxScrimageView) return changeBounds

Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/com/forcetower/core/transition/LiftOff.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class LiftOff(context: Context, attrs: AttributeSet?) : Transition(context, attr

override fun createAnimator(
sceneRoot: ViewGroup,
startValues: TransitionValues,
endValues: TransitionValues
): Animator {
startValues: TransitionValues?,
endValues: TransitionValues?
): Animator? {
return ObjectAnimator.ofFloat(
endValues.view,
endValues?.view,
View.TRANSLATION_Z,
initialElevation,
finalElevation
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/aeri/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/conference/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/dashboard/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/disciplines/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/event/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
2 changes: 1 addition & 1 deletion dynamic-features/map/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ plugins {

android {
namespace = "dev.forcetower.map"
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down
26 changes: 13 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[versions]
aboutlibraries = "11.2.2"
agp = "8.5.2"
android-desugar = "2.0.4"
agp = "8.7.1"
android-desugar = "2.1.2"
android-image-cropper = "4.6.0"
androidx-lifecycle = "2.8.4"
androidx-lifecycle = "2.8.6"
androidx-hilt-compiler = "1.2.0"
annotation = "1.8.2"
annotation = "1.9.0"
app-update-ktx = "2.1.0"
appcompat = "1.7.0"
autostarter = "1.1.0"
billing = "7.0.0"
billing = "7.1.1"
browser = "1.8.0"
card-slider = "0.3.1"
constraintlayout = "2.1.4"
core-testing = "2.2.0"
credentials = "1.3.0-rc01"
credentials = "1.3.0"
dagger = "2.52"
datastore-preferences = "1.1.1"
espresso-core = "3.6.1"
Expand All @@ -23,11 +23,11 @@ firebase-crashlytics-gradle = "3.0.2"
firebase-ui-storage = "8.0.2"
flexbox = "3.0.0"
floatingsearchview = "2.1.1"
fragment = "1.8.2"
fragment = "1.8.4"
glide = "4.16.0"
google-ksp = "2.0.20-1.0.24"
google-services = "4.4.2"
guava = "33.3.0-android"
guava = "33.3.1-android"
gson = "2.11.0"
hilt-android = "2.52"
hilt-work = "1.2.0"
Expand All @@ -37,7 +37,7 @@ junit = "4.13.2"
junit-version = "1.2.1"
kotlin = "2.0.20"
kotlinter-gradle = "4.3.0"
kotlinx-coroutines-test = "1.8.1"
kotlinx-coroutines-test = "1.9.0"
ktx = "1.13.1"
chucker = "4.0.0"
listenablefuture = "9999.0-empty-to-avoid-conflict-with-guava"
Expand All @@ -47,7 +47,7 @@ materialdatetimepicker = "4.2.3"
markwon = "4.6.2"
mockk = "1.13.12"
mpandroidchart = "v3.1.0"
navigation = "2.7.7"
navigation = "2.8.3"
okhttp = "4.12.0"
oversee = "1.1.0"
paging = "3.3.2"
Expand All @@ -60,14 +60,14 @@ play-services-location = "21.3.0"
play-services-maps = "19.0.0"
preference = "1.2.1"
retrofit = "2.11.0"
review-ktx = "2.0.1"
review-ktx = "2.0.2"
room = "2.6.1"
rxkotlin = "2.4.0"
snowpiercer = "2.3.2"
snowpiercer = "2.4.0"
sqldelight = "2.0.1"
koin = "3.5.3"
ktor = "2.3.9"
coroutines = "1.8.1"
coroutines = "1.9.0"
kotlinx-datetime = "0.6.0"
swiperefreshlayout = "1.1.0"
taptargetview = "1.14.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
2 changes: 1 addition & 1 deletion third_party/bypass/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugins {
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
Expand Down

0 comments on commit 581e748

Please sign in to comment.