Skip to content

Commit

Permalink
MBL-1739: Support Android 15 (#2143)
Browse files Browse the repository at this point in the history
* MLB-1740: Fix Circle CI Pipeline to work with sdk 35 (Android 15) (#2141)

* Android sdk 35

- Change compile and target SDK to version 35
- change tag for CircleCI from 2024.01.1 to 2024.09.1

* downgrade tag to 2024.08.1

* 2024.07.1

* update gradle version

* add JDK_VERSION to executor environment

* UPGRADE VERSIONS

Kotlin version from 1.8.10 1.8.22
Jacoco_version from 0.8.8 to 0.8.11
compose version from 1.4.3 to 1.4.8


setted java 17 on the circle ci environment

* add validate java version on circle ci pipeline

* force java 17 on circle ci

* fix typo

* explicity install java 17

* specify jvm 17 on gradle

* force assembleExternalRelease to use java 17

* Fix lint external release

* change name of intent on ThreadView model

Changed the name for function intent and PublishSubject intent so it be more clear to read

* code more clean


* fix ktlint

* MBL-1673 [Android 15] Update Views to be compatible with edge to edge enforcement (#2131)

* Manage edge to edege

- Created utility to manage edge to edge on different screens
- fixed composable screens
- fixed other screens with the utility

* Manage edge to edge in all the screens

- Manage edge to edge behavior for all the screens
- modify solution

* Fix last screens

* Fix ktlint tests

* fix KTLint

* Fix test againt

* MBL-1825 Fix 'Back this project' component on Project activity (UI) (#2159)

* Fix pledge_container UI height bug on android 15

* fix ktlint

* set fitsSystemWindows to false on AppBarLayout on activity_proyect_page

* set fitsystemwinfows false

* fix thread

* fix comments threads

---------

Co-authored-by: Isabel Martin <[email protected]>
  • Loading branch information
jlplks and Arkariang authored Nov 20, 2024
1 parent 1660b7f commit 709b32f
Show file tree
Hide file tree
Showing 68 changed files with 1,759 additions and 1,153 deletions.
30 changes: 22 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ base_job: &base_job
executor:
name: android/android-machine
resource-class: xlarge
tag: 2024.01.1 #https://circleci.com/developer/images/image/cimg/android
tag: 2024.07.1 #https://circleci.com/developer/images/image/cimg/android
working_directory: "~/project"
environment:
TERM: dumb
Expand All @@ -27,13 +27,17 @@ jobs:
- v5-android-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- v5-android-
- run: make bootstrap-circle
- run: ./gradlew dependencies
- run:
name: Install dependencies
command: ./gradlew dependencies
- save_cache:
key: v5-android-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
paths:
- ~/.gradle
- ~/.android
- run: ./gradlew assembleExternalRelease
- run:
name: Assemble Release
command: ./gradlew assembleExternalRelease -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
- persist_to_workspace:
root: ~/project
paths:
Expand All @@ -49,11 +53,19 @@ jobs:
- v5-android-
- attach_workspace:
at: ~/project
- run: ./gradlew checkstyle
- run: ./gradlew ktlint
- run: ./gradlew lintExternalRelease
- run:
command: ./gradlew jacocoExternalDebugReport -PdisablePreDex
name: Check Style
command: ./gradlew checkstyle
- run:
name: KTLint
command: ./gradlew ktlint

- run:
name: Lint External Release
command: ./gradlew lintExternalRelease -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
- run:
name: Jacoco External Debug Report
command: ./gradlew jacocoExternalDebugReport -PdisablePreDex -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
no_output_timeout: 30m
- store_artifacts:
path: app/build/reports
Expand Down Expand Up @@ -94,7 +106,9 @@ jobs:
name: Config Emulator for Screenshot test
command: ./script/emulator/screenshot_config_emulator.sh
# Temporary JDK 17 workaround https://github.com/pedrovgs/Shot/issues/268 until https://github.com/pedrovgs/Shot/pull/292 is merged
- run: ./gradlew internalDebugExecuteScreenshotTests -Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED"
- run:
name: Internal Debug Execute Screenshot Tests
command: ./gradlew internalDebugExecuteScreenshotTests -Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" -Dorg.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
- android/save-gradle-cache:
cache-prefix: v1a
- store_artifacts:
Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ if (file('signing.gradle').exists()) {

android {
defaultConfig {
compileSdk 34
compileSdk = 35
applicationId "com.kickstarter"
minSdkVersion 24
targetSdkVersion 34
targetSdk = 35
testApplicationId "com.kickstarter.internal.debug.test"
testInstrumentationRunner "com.kickstarter.screenshoot.testing.KSScreenShotTestRunner"

Expand Down Expand Up @@ -198,6 +198,7 @@ repositories {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.cardview:cardview:1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import io.reactivex.functions.Function
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.PublishSubject
import java.net.MalformedURLException
import java.util.ArrayList

class ApolloPaginateV2<Data, Envelope : ApolloEnvelope, Params>(
val nextPage: Observable<Unit>,
Expand Down
88 changes: 70 additions & 18 deletions app/src/main/java/com/kickstarter/ui/activities/AccountActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.kickstarter.libs.utils.extensions.getEnvironment
import com.kickstarter.libs.utils.extensions.getPaymentMethodsIntent
import com.kickstarter.ui.extensions.setUpConnectivityStatusCheck
import com.kickstarter.ui.extensions.showSnackbar
import com.kickstarter.utils.WindowInsetsUtil
import com.kickstarter.viewmodels.AccountViewModel
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
Expand Down Expand Up @@ -59,7 +60,6 @@ class AccountActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

disposables = CompositeDisposable()

val env = this.getEnvironment()?.let { env ->
Expand All @@ -68,7 +68,10 @@ class AccountActivity : AppCompatActivity() {
}

binding = ActivityAccountBinding.inflate(layoutInflater)

WindowInsetsUtil.manageEdgeToEdge(
window,
binding.root,
)
setContentView(binding.root)

setUpConnectivityStatusCheck(lifecycle)
Expand All @@ -84,7 +87,11 @@ class AccountActivity : AppCompatActivity() {
this.viewModel.outputs.email()
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
binding.createPasswordTextView.text = this.ksString.format(getString(R.string.Youre_connected_via_Facebook_email_Create_a_password_for_this_account), "email", it)
binding.createPasswordTextView.text = this.ksString.format(
getString(R.string.Youre_connected_via_Facebook_email_Create_a_password_for_this_account),
"email",
it
)
}
.addToDisposable(disposables)

Expand Down Expand Up @@ -113,14 +120,53 @@ class AccountActivity : AppCompatActivity() {

this.viewModel.outputs.success()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { showSnackbar(binding.accountContainer, R.string.Got_it_your_changes_have_been_saved) }
.subscribe {
showSnackbar(
binding.accountContainer,
R.string.Got_it_your_changes_have_been_saved
)
}
.addToDisposable(disposables)

binding.createPasswordRow.setOnClickListener { startActivity(Intent(this, CreatePasswordActivity::class.java)) }
binding.changeEmailRow.setOnClickListener { startActivity(Intent(this, ChangeEmailActivity::class.java)) }
binding.changePasswordRow.setOnClickListener { startActivity(Intent(this, ChangePasswordActivity::class.java)) }
binding.paymentMethodsRow.setOnClickListener { startActivity(Intent().getPaymentMethodsIntent(this)) }
binding.privacyRow.setOnClickListener { startActivity(Intent(this, PrivacyActivity::class.java)) }
binding.createPasswordRow.setOnClickListener {
startActivity(
Intent(
this,
CreatePasswordActivity::class.java
)
)
}
binding.changeEmailRow.setOnClickListener {
startActivity(
Intent(
this,
ChangeEmailActivity::class.java
)
)
}
binding.changePasswordRow.setOnClickListener {
startActivity(
Intent(
this,
ChangePasswordActivity::class.java
)
)
}
binding.paymentMethodsRow.setOnClickListener {
startActivity(
Intent().getPaymentMethodsIntent(
this
)
)
}
binding.privacyRow.setOnClickListener {
startActivity(
Intent(
this,
PrivacyActivity::class.java
)
)
}
}

override fun onDestroy() {
Expand Down Expand Up @@ -186,17 +232,23 @@ class AccountActivity : AppCompatActivity() {
arrayAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown)
binding.currencySpinner.adapter = arrayAdapter

binding.currencySpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {}

override fun onItemSelected(parent: AdapterView<*>?, view: View?, postion: Int, id: Long) {
currentCurrencySelection?.let {
if (supportedCurrencies.indexOf(it) != postion) {
newCurrencySelection = supportedCurrencies[postion]
lazyFollowingOptOutConfirmationDialog().show()
binding.currencySpinner.onItemSelectedListener =
object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {}

override fun onItemSelected(
parent: AdapterView<*>?,
view: View?,
postion: Int,
id: Long
) {
currentCurrencySelection?.let {
if (supportedCurrencies.indexOf(it) != postion) {
newCurrencySelection = supportedCurrencies[postion]
lazyFollowingOptOutConfirmationDialog().show()
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.kickstarter.ui.data.LoginReason
import com.kickstarter.ui.extensions.finishWithAnimation
import com.kickstarter.ui.extensions.setUpConnectivityStatusCheck
import com.kickstarter.ui.extensions.startActivityWithTransition
import com.kickstarter.utils.WindowInsetsUtil
import com.kickstarter.viewmodels.ActivityFeedViewModel.ActivityFeedViewModel
import com.kickstarter.viewmodels.ActivityFeedViewModel.Factory
import io.reactivex.android.schedulers.AndroidSchedulers
Expand All @@ -36,7 +37,6 @@ class ActivityFeedActivity : AppCompatActivity() {
private var currentUser: CurrentUserTypeV2? = null
private var recyclerViewPaginator: RecyclerViewPaginatorV2? = null
private lateinit var binding: ActivityFeedLayoutBinding

private lateinit var viewModelFactory: Factory
private val viewModel: ActivityFeedViewModel by viewModels {
viewModelFactory
Expand All @@ -47,7 +47,10 @@ class ActivityFeedActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityFeedLayoutBinding.inflate(layoutInflater)

WindowInsetsUtil.manageEdgeToEdge(
window,
binding.root,
)
setContentView(binding.root)

setUpConnectivityStatusCheck(lifecycle)
Expand All @@ -65,7 +68,11 @@ class ActivityFeedActivity : AppCompatActivity() {

binding.recyclerView.layoutManager = LinearLayoutManager(this@ActivityFeedActivity)

recyclerViewPaginator = RecyclerViewPaginatorV2(binding.recyclerView, { viewModel.inputs.nextPage() }, viewModel.outputs.isFetchingActivities())
recyclerViewPaginator = RecyclerViewPaginatorV2(
binding.recyclerView,
{ viewModel.inputs.nextPage() },
viewModel.outputs.isFetchingActivities()
)

binding.activityFeedSwipeRefreshLayout.setOnRefreshListener {
viewModel.outputs.isFetchingActivities()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.kickstarter.libs.utils.extensions.getEnvironment
import com.kickstarter.ui.extensions.onChange
import com.kickstarter.ui.extensions.setUpConnectivityStatusCheck
import com.kickstarter.ui.extensions.showSnackbar
import com.kickstarter.utils.WindowInsetsUtil
import com.kickstarter.viewmodels.ChangeEmailViewModel
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
Expand All @@ -41,7 +42,10 @@ class ChangeEmailActivity : AppCompatActivity() {
}

binding = ActivityChangeEmailBinding.inflate(layoutInflater)

WindowInsetsUtil.manageEdgeToEdge(
window,
binding.root,
)
setContentView(binding.root)
setSupportActionBar(binding.changeEmailActivityToolbar.changeEmailToolbar)

Expand All @@ -62,7 +66,10 @@ class ChangeEmailActivity : AppCompatActivity() {
this.viewModel.outputs.emailErrorIsVisible()
.observeOn(AndroidSchedulers.mainThread())
.filter { it }
.subscribe { binding.newEmailContainer.error = getString(R.string.Email_must_be_a_valid_email_address) }
.subscribe {
binding.newEmailContainer.error =
getString(R.string.Email_must_be_a_valid_email_address)
}
.addToDisposable(disposables)

this.viewModel.outputs.emailErrorIsVisible()
Expand Down Expand Up @@ -124,7 +131,14 @@ class ChangeEmailActivity : AppCompatActivity() {

this.viewModel.outputs.warningTextColor()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { binding.emailWarningTextView.setTextColor(ContextCompat.getColor(this@ChangeEmailActivity, it)) }
.subscribe {
binding.emailWarningTextView.setTextColor(
ContextCompat.getColor(
this@ChangeEmailActivity,
it
)
)
}
.addToDisposable(disposables)

this.viewModel.outputs.verificationEmailButtonText()
Expand All @@ -142,6 +156,7 @@ class ChangeEmailActivity : AppCompatActivity() {
imm.hideSoftInputFromWindow(binding.newEmail.windowToken, 0)
true
}

else -> super.onOptionsItemSelected(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.kickstarter.ui.extensions.finishWithAnimation
import com.kickstarter.ui.extensions.hideKeyboard
import com.kickstarter.ui.extensions.setUpConnectivityStatusCheck
import com.kickstarter.ui.views.OnCommentComposerViewClickedListener
import com.kickstarter.utils.WindowInsetsUtil
import com.kickstarter.viewmodels.CommentsViewModel.CommentsViewModel
import com.kickstarter.viewmodels.CommentsViewModel.Factory
import io.reactivex.disposables.CompositeDisposable
Expand All @@ -56,7 +57,12 @@ class CommentsActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityCommentsLayoutBinding.inflate(layoutInflater)
WindowInsetsUtil.manageEdgeToEdge(
window,
binding.root
)
val view: View = binding.root

setContentView(view)

setUpConnectivityStatusCheck(lifecycle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.kickstarter.libs.utils.extensions.getEnvironment
import com.kickstarter.models.Project
import com.kickstarter.ui.IntentKey
import com.kickstarter.ui.extensions.finishWithAnimation
import com.kickstarter.utils.WindowInsetsUtil
import com.kickstarter.viewmodels.CreatorBioViewModel.CreatorBioViewModel
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
Expand All @@ -28,7 +29,10 @@ class CreatorBioActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityCreatorBioBinding.inflate(layoutInflater)

WindowInsetsUtil.manageEdgeToEdge(
window,
binding.root
)
this.getEnvironment()?.let { env ->
viewModelFactory = CreatorBioViewModel.Factory(env, intent = intent)
env
Expand Down
Loading

0 comments on commit 709b32f

Please sign in to comment.