Bumped dependencies

This commit is contained in:
Sylvain Berfini 2021-09-09 10:03:41 +02:00
parent bed6ff19c9
commit e65957f047
5 changed files with 38 additions and 63 deletions

View file

@ -213,22 +213,22 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.media:media:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0-alpha04'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.media:media:1.4.1'
implementation 'androidx.fragment:fragment-ktx:1.4.0-alpha08'
implementation 'androidx.core:core-ktx:1.7.0-alpha02'
def nav_version = "2.3.5"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0-alpha03"
implementation "androidx.window:window:1.0.0-alpha09"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0-beta01"
implementation "androidx.window:window:1.0.0-beta02"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03"
implementation 'com.google.android.material:material:1.4.0'

View file

@ -23,20 +23,20 @@ import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.DisplayMetrics
import android.view.Display
import android.view.Surface
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.util.Consumer
import androidx.lifecycle.lifecycleScope
import androidx.navigation.ActivityNavigator
import androidx.window.FoldingFeature
import androidx.window.WindowLayoutInfo
import androidx.window.WindowManager
import androidx.window.layout.FoldingFeature
import androidx.window.layout.WindowInfoRepository.Companion.windowInfoRepository
import androidx.window.layout.WindowLayoutInfo
import java.util.*
import java.util.concurrent.Executor
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.LinphoneApplication.Companion.ensureCoreExists
@ -49,48 +49,6 @@ abstract class GenericActivity : AppCompatActivity() {
val isDestructionPending: Boolean
get() = _isDestructionPending
private lateinit var windowManagerX: WindowManager
inner class LayoutStateChangeCallback : Consumer<WindowLayoutInfo> {
override fun accept(newLayoutInfo: WindowLayoutInfo) {
Log.i("[Layout State Change] $newLayoutInfo")
if (newLayoutInfo.displayFeatures.isEmpty()) {
onLayoutChanges(null)
} else {
for (feature in newLayoutInfo.displayFeatures) {
val foldingFeature = feature as? FoldingFeature
if (foldingFeature != null) {
onLayoutChanges(foldingFeature)
}
}
}
}
}
private val layoutStateChangeCallback = LayoutStateChangeCallback()
private fun runOnUiThreadExecutor(): Executor {
val handler = Handler(Looper.getMainLooper())
return Executor() {
handler.post(it)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
windowManagerX.registerLayoutChangeCallback(
runOnUiThreadExecutor(),
layoutStateChangeCallback
)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
windowManagerX.unregisterLayoutChangeCallback(layoutStateChangeCallback)
}
open fun onLayoutChanges(foldingFeature: FoldingFeature?) {
}
@ -98,10 +56,14 @@ abstract class GenericActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
windowManagerX = WindowManager(this)
ensureCoreExists(applicationContext)
lifecycleScope.launch(Dispatchers.Main) {
windowInfoRepository().windowLayoutInfo.collect { newLayoutInfo ->
updateCurrentLayout(newLayoutInfo)
}
}
requestedOrientation = if (corePreferences.forcePortrait) {
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
} else {
@ -170,4 +132,17 @@ abstract class GenericActivity : AppCompatActivity() {
coreContext.screenWidth = screenWidth
coreContext.screenHeight = screenHeight
}
private fun updateCurrentLayout(newLayoutInfo: WindowLayoutInfo) {
if (newLayoutInfo.displayFeatures.isEmpty()) {
onLayoutChanges(null)
} else {
for (feature in newLayoutInfo.displayFeatures) {
val foldingFeature = feature as? FoldingFeature
if (foldingFeature != null) {
onLayoutChanges(foldingFeature)
}
}
}
}
}

View file

@ -39,7 +39,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import androidx.navigation.findNavController
import androidx.window.FoldingFeature
import androidx.window.layout.FoldingFeature
import com.google.android.material.snackbar.Snackbar
import java.io.UnsupportedEncodingException
import java.net.URLDecoder

View file

@ -40,7 +40,7 @@ class RichEditText : AppCompatEditText {
fun onCommitContent(
inputContentInfo: InputContentInfoCompat,
flags: Int,
opts: Bundle,
opts: Bundle?,
contentMimeTypes: Array<String>?
): Boolean
}

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.5.20'
ext.kotlin_version = '1.5.30'
repositories {
google()
@ -14,7 +14,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.1.0"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'