chore: uprev to targetSDK 35 and basic edge2edge inset fixes
All checks were successful
/ build-debug (push) Successful in 4m38s

This commit is contained in:
Peter Cai 2024-09-24 22:22:18 -04:00
parent 68f1e370fc
commit 97bc0a0827
18 changed files with 115 additions and 6 deletions

View file

@ -5,6 +5,9 @@
<SelectionState runConfigName="app-unpriv">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
</SelectionState>
</selectionStates>
</component>
</project>

View file

@ -5,7 +5,7 @@ plugins {
android {
namespace = "im.angry.openeuicc.common"
compileSdk = 34
compileSdk = 35
defaultConfig {
minSdk = 28

View file

@ -7,6 +7,7 @@ import android.view.MenuItem
import android.view.View
import android.widget.ScrollView
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
@ -37,9 +38,11 @@ class LogsActivity : AppCompatActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_logs)
setSupportActionBar(requireViewById(R.id.toolbar))
setupToolbarInsets()
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
swipeRefresh = requireViewById(R.id.swipe_refresh)

View file

@ -13,6 +13,7 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.ProgressBar
import androidx.activity.enableEdgeToEdge
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.adapter.FragmentStateAdapter
@ -64,9 +65,11 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
@SuppressLint("WrongConstant", "UnspecifiedRegisterReceiverFlag")
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(requireViewById(R.id.toolbar))
setupToolbarInsets()
loadingProgress = requireViewById(R.id.loading)
tabs = requireViewById(R.id.main_tabs)
viewPager = requireViewById(R.id.view_pager)

View file

@ -11,6 +11,7 @@ import android.view.MenuItem.OnMenuItemClickListener
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AlertDialog
import androidx.core.view.forEach
import androidx.lifecycle.lifecycleScope
@ -35,9 +36,11 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
private lateinit var euiccChannel: EuiccChannel
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_notifications)
setSupportActionBar(requireViewById(R.id.toolbar))
setupToolbarInsets()
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
}

View file

@ -2,14 +2,18 @@ package im.angry.openeuicc.ui
import android.os.Bundle
import android.view.MenuItem
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import im.angry.openeuicc.common.R
import im.angry.openeuicc.util.*
class SettingsActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
setSupportActionBar(requireViewById(R.id.toolbar))
setupToolbarInsets()
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportFragmentManager.beginTransaction()
.replace(R.id.settings_container, SettingsFragment())

View file

@ -2,8 +2,16 @@ package im.angry.openeuicc.util
import android.content.res.Resources
import android.graphics.Rect
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.fragment.app.DialogFragment
import im.angry.openeuicc.common.R
// Source: <https://stackoverflow.com/questions/12478520/how-to-set-dialogfragments-width-and-height>
/**
@ -26,3 +34,25 @@ fun DialogFragment.setWidthPercent(percentage: Int) {
fun DialogFragment.setFullScreen() {
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
fun AppCompatActivity.setupToolbarInsets() {
val spacer = requireViewById<View>(R.id.toolbar_spacer)
ViewCompat.setOnApplyWindowInsetsListener(requireViewById(R.id.toolbar)) { v, insets ->
val bars = insets.getInsets(
WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout()
)
v.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = bars.top
}
v.updatePadding(bars.left, v.paddingTop, bars.right, v.paddingBottom)
spacer.updateLayoutParams {
height = v.top
}
android.util.Log.d("aaa", "${(v as Toolbar).minimumHeight}")
WindowInsetsCompat.CONSUMED
}
}

View file

@ -5,6 +5,15 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
android:id="@+id/toolbar_spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="0dp"

View file

@ -5,6 +5,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/toolbar_spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="0dp"

View file

@ -4,6 +4,15 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
android:id="@+id/toolbar_spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="0dp"

View file

@ -4,6 +4,15 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
android:id="@+id/toolbar_spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="0dp"

View file

@ -17,13 +17,13 @@ apply {
android {
namespace = "im.angry.easyeuicc"
compileSdk = 34
compileSdk = 35
ndkVersion = "26.1.10909125"
defaultConfig {
applicationId = "im.angry.easyeuicc"
minSdk = 28
targetSdk = 34
targetSdk = 35
}
buildTypes {

View file

@ -6,6 +6,7 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.children
import androidx.lifecycle.lifecycleScope
@ -22,9 +23,11 @@ class CompatibilityCheckActivity: AppCompatActivity() {
private val adapter = CompatibilityChecksAdapter()
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_compatibility_check)
setSupportActionBar(requireViewById(R.id.toolbar))
setupToolbarInsets()
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
compatibilityCheckList = requireViewById(R.id.recycler_view)

View file

@ -4,6 +4,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/toolbar_spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/toolbar" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="0dp"

View file

@ -12,12 +12,12 @@ apply {
android {
namespace = "im.angry.openeuicc"
compileSdk = 34
compileSdk = 35
defaultConfig {
applicationId = "im.angry.openeuicc"
minSdk = 30
targetSdk = 34
targetSdk = 35
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

View file

@ -2,14 +2,28 @@ package im.angry.openeuicc.ui
import android.content.Intent
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
import im.angry.openeuicc.R
class LuiActivity : AppCompatActivity() {
override fun onStart() {
super.onStart()
enableEdgeToEdge()
setContentView(R.layout.activity_lui)
ViewCompat.setOnApplyWindowInsetsListener(requireViewById(R.id.lui_container)) { v, insets ->
val bars = insets.getInsets(
WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout()
)
v.updatePadding(bars.left, bars.top, bars.right, bars.bottom)
WindowInsetsCompat.CONSUMED
}
requireViewById<View>(R.id.lui_skip).setOnClickListener { finish() }
// TODO: Deactivate LuiActivity if there is no eSIM found.
// TODO: Support pre-filled download info (from carrier apps); UX

View file

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/lui_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurfaceVariant">

View file

@ -5,7 +5,7 @@ plugins {
android {
namespace = "net.typeblog.lpac_jni"
compileSdk = 34
compileSdk = 35
ndkVersion = "26.1.10909125"
defaultConfig {