mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Move @Suppress("DEPRECATION")
closer to the deprecated usage. Will help to detect other deprecated API usage.
This commit is contained in:
parent
24e4f94e61
commit
536b9cf926
9 changed files with 11 additions and 12 deletions
|
@ -136,7 +136,6 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun setDecorViewFullScreen() {
|
||||
// This is important for the dispatchTouchEvent, if not we must correct
|
||||
// the touch coordinates
|
||||
|
@ -155,11 +154,14 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
// new API instead of FLAG_TRANSLUCENT_NAVIGATION
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.half_transparent_status_bar)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = (
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
or View.SYSTEM_UI_FLAG_IMMERSIVE)
|
||||
@Suppress("DEPRECATION")
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
@Suppress("DEPRECATION")
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +346,6 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
?.handleCommand(commands)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun hideSystemUI() {
|
||||
systemUiVisibility = false
|
||||
// Enables regular immersive mode.
|
||||
|
@ -367,6 +368,7 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
// New API instead of FLAG_TRANSLUCENT_NAVIGATION
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.half_transparent_status_bar)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
// Set the content to appear under the system bars so that the
|
||||
// content doesn't resize when the system bars hide and show.
|
||||
|
@ -381,13 +383,13 @@ abstract class AttachmentViewerActivity : AppCompatActivity(), AttachmentEventLi
|
|||
|
||||
// Shows the system bars by removing all the flags
|
||||
// except for the ones that make the content appear under the system bars.
|
||||
@Suppress("DEPRECATION")
|
||||
private fun showSystemUI() {
|
||||
systemUiVisibility = true
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// New API instead of SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN and SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
window.setDecorFitsSystemWindows(false)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
|
||||
|
|
|
@ -104,7 +104,6 @@ internal class DefaultLegacySessionImporter @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun importCredentials(legacyConfig: LegacyHomeServerConnectionConfig) {
|
||||
@Suppress("DEPRECATION")
|
||||
val sessionParams = SessionParams(
|
||||
credentials = Credentials(
|
||||
userId = legacyConfig.credentials.userId,
|
||||
|
|
|
@ -92,7 +92,6 @@ private fun useMediaStoreScreenshotStorage(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun usePublicExternalScreenshotStorage(
|
||||
contentValues: ContentValues,
|
||||
contentResolver: ContentResolver,
|
||||
|
|
|
@ -91,7 +91,6 @@ fun Context.safeOpenOutputStream(uri: Uri): OutputStream? {
|
|||
*
|
||||
* @return true if no active connection is found
|
||||
*/
|
||||
@Suppress("deprecation")
|
||||
@SuppressLint("NewApi") // false positive
|
||||
fun Context.inferNoConnectivity(sdkIntProvider: BuildVersionSdkIntProvider): Boolean {
|
||||
val connectivityManager = getSystemService<ConnectivityManager>()!!
|
||||
|
@ -104,6 +103,7 @@ fun Context.inferNoConnectivity(sdkIntProvider: BuildVersionSdkIntProvider): Boo
|
|||
else -> true
|
||||
}
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
when (connectivityManager.activeNetworkInfo?.type) {
|
||||
ConnectivityManager.TYPE_WIFI -> false
|
||||
ConnectivityManager.TYPE_MOBILE -> false
|
||||
|
|
|
@ -464,7 +464,6 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
/**
|
||||
* Force to render the activity in fullscreen.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
private fun setFullScreen() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// New API instead of SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN and SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
|
@ -481,6 +480,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
// New API instead of FLAG_TRANSLUCENT_NAVIGATION
|
||||
window.navigationBarColor = ContextCompat.getColor(this, im.vector.lib.attachmentviewer.R.color.half_transparent_status_bar)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
|
|
|
@ -309,7 +309,6 @@ suspend fun saveMedia(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun saveMediaLegacy(
|
||||
context: Context,
|
||||
mediaMimeType: String?,
|
||||
|
@ -340,6 +339,7 @@ private fun saveMediaLegacy(
|
|||
val savedFile = saveFileIntoLegacy(file, downloadDir, outputFilename, currentTimeMillis)
|
||||
if (savedFile != null) {
|
||||
val downloadManager = context.getSystemService<DownloadManager>()
|
||||
@Suppress("DEPRECATION")
|
||||
downloadManager?.addCompletedDownload(
|
||||
savedFile.name,
|
||||
title,
|
||||
|
@ -430,7 +430,6 @@ fun selectTxtFileToWrite(
|
|||
* @param currentTimeMillis the current time in milliseconds
|
||||
* @return the created file
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
fun saveFileIntoLegacy(sourceFile: File, dstDirPath: File, outputFilename: String?, currentTimeMillis: Long): File? {
|
||||
// defines another name for the external media
|
||||
var dstFileName: String
|
||||
|
|
|
@ -169,11 +169,11 @@ class AttachmentsPreviewFragment :
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun applyInsets() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
activity?.window?.setDecorFitsSystemWindows(false)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
view?.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
}
|
||||
ViewCompat.setOnApplyWindowInsetsListener(views.attachmentPreviewerBottomContainer) { v, insets ->
|
||||
|
|
|
@ -92,7 +92,6 @@ class VectorActivityLifecycleCallbacks constructor(private val popupAlertManager
|
|||
* @return true if an app task is corrupted by a potentially malicious activity
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
@Suppress("DEPRECATION")
|
||||
private suspend fun isTaskCorrupted(activity: Activity): Boolean = withContext(Dispatchers.Default) {
|
||||
val context = activity.applicationContext
|
||||
val packageManager: PackageManager = context.packageManager
|
||||
|
@ -120,6 +119,7 @@ class VectorActivityLifecycleCallbacks constructor(private val popupAlertManager
|
|||
// This was present in ActivityManager.RunningTaskInfo class since API level 1!
|
||||
// and it is inherited from TaskInfo since Android Q (API level 29).
|
||||
// API 29 changes : https://developer.android.com/sdk/api_diff/29/changes/android.app.ActivityManager.RunningTaskInfo
|
||||
@Suppress("DEPRECATION")
|
||||
manager.getRunningTasks(10).any { runningTaskInfo ->
|
||||
runningTaskInfo.topActivity?.let {
|
||||
// Check whether the activity task affinity matches with app task affinity.
|
||||
|
|
|
@ -50,10 +50,10 @@ class FallbackBiometricDialogFragment : DialogFragment(R.layout.fragment_biometr
|
|||
|
||||
private val parsedArgs by args<Args>()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
retainInstance = true
|
||||
|
||||
setStyle(STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog)
|
||||
|
|
Loading…
Reference in a new issue