diff --git a/config.gradle b/config.gradle index 8f971f88..205571ee 100644 --- a/config.gradle +++ b/config.gradle @@ -5,8 +5,8 @@ ext { buildConfig = [ "minSdk" : 21, - "compileSdk": 34, - "targetSdk" : 34, + "compileSdk": 35, + "targetSdk" : 35, "buildTools": "34.0.0" ] releaseConfig = [ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 49123b0e..fa93b867 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ ktlintplugin = "11.3.1" ktlint = "0.45.2" cpd = "3.3" dokka = "1.8.10" -chucker = "4.0.0" +chucker = "4.1.0" collar = "1.4.0" dbinspector = "5.4.9" leakcanary = "2.11" diff --git a/sample/src/main/kotlin/com/infinum/sentinel/sample/BundleActivity.kt b/sample/src/main/kotlin/com/infinum/sentinel/sample/BundleActivity.kt index 0f9e3782..9de32a87 100644 --- a/sample/src/main/kotlin/com/infinum/sentinel/sample/BundleActivity.kt +++ b/sample/src/main/kotlin/com/infinum/sentinel/sample/BundleActivity.kt @@ -1,6 +1,7 @@ package com.infinum.sentinel.sample import android.os.Bundle +import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import com.infinum.sentinel.sample.databinding.ActivityBundleBinding @@ -9,6 +10,7 @@ class BundleActivity : AppCompatActivity() { private lateinit var viewBinding: ActivityBundleBinding override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() super.onCreate(savedInstanceState) viewBinding = ActivityBundleBinding.inflate(layoutInflater) diff --git a/sample/src/main/kotlin/com/infinum/sentinel/sample/JavaMainActivity.java b/sample/src/main/kotlin/com/infinum/sentinel/sample/JavaMainActivity.java index a2338fce..0b10c28f 100644 --- a/sample/src/main/kotlin/com/infinum/sentinel/sample/JavaMainActivity.java +++ b/sample/src/main/kotlin/com/infinum/sentinel/sample/JavaMainActivity.java @@ -1,10 +1,15 @@ package com.infinum.sentinel.sample; +import android.content.res.Configuration; +import android.graphics.Color; import android.os.Build; import android.os.Bundle; +import android.view.View; +import android.view.Window; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.WindowCompat; import com.infinum.sentinel.Sentinel; import com.infinum.sentinel.sample.databinding.ActivityJavaMainBinding; @@ -23,8 +28,8 @@ public class JavaMainActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { + setEdgeToEdge(); super.onCreate(savedInstanceState); - final ActivityJavaMainBinding viewBinding = ActivityJavaMainBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); @@ -35,11 +40,34 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { tools.add(new GooglePlayTool()); tools.add(new ThimbleTool()); tools.add(new TimberTool()); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { tools.add(new CertificateTool()); } Sentinel.watch(tools); viewBinding.showSentinel.setOnClickListener(v -> Sentinel.show()); } + + private void setEdgeToEdge() { + Window window = getWindow(); + WindowCompat.setDecorFitsSystemWindows(window, false); + window.setStatusBarColor(Color.TRANSPARENT); + window.setNavigationBarColor(Color.TRANSPARENT); + + handleStatusBarFlag(window); + } + + private void handleStatusBarFlag(Window window) { + View decorView = window.getDecorView(); + int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + if (isLightMode() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } + decorView.setSystemUiVisibility(flags); + } + + private boolean isLightMode() { + int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + return currentNightMode != Configuration.UI_MODE_NIGHT_YES; + } } diff --git a/sample/src/main/kotlin/com/infinum/sentinel/sample/MainActivity.kt b/sample/src/main/kotlin/com/infinum/sentinel/sample/MainActivity.kt index 02e5cf23..af4aac8f 100644 --- a/sample/src/main/kotlin/com/infinum/sentinel/sample/MainActivity.kt +++ b/sample/src/main/kotlin/com/infinum/sentinel/sample/MainActivity.kt @@ -5,7 +5,12 @@ import android.content.Intent import android.content.SharedPreferences import android.os.Bundle import android.util.Log +import android.view.ViewGroup +import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updateLayoutParams import androidx.preference.PreferenceManager import androidx.security.crypto.EncryptedSharedPreferences import androidx.security.crypto.MasterKey @@ -23,10 +28,14 @@ class MainActivity : AppCompatActivity() { @Suppress("TooGenericExceptionCaught", "LongMethod") override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() super.onCreate(savedInstanceState) + viewBinding = ActivityMainBinding.inflate(layoutInflater) setContentView(viewBinding.root) + applyInsetsToLastElement() + val allPrefs = listOf( PreferenceManager.getDefaultSharedPreferences(applicationContext), applicationContext.getSharedPreferences( @@ -158,6 +167,16 @@ class MainActivity : AppCompatActivity() { } } + private fun applyInsetsToLastElement() { + ViewCompat.setOnApplyWindowInsetsListener(viewBinding.generateErrorException) { view, insets -> + val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.updateLayoutParams { + bottomMargin = systemBarsInsets.bottom + } + insets + } + } + private fun putRandomIntoPreferences(sharedPreferences: SharedPreferences) = sharedPreferences.edit() .putBoolean(randomizeName(Boolean::class.simpleName), Random.nextBoolean()) diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 6287ada9..4c69df7a 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -1,5 +1,5 @@ - diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/data/models/raw/ApplicationData.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/data/models/raw/ApplicationData.kt index ad25da58..593020b1 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/data/models/raw/ApplicationData.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/data/models/raw/ApplicationData.kt @@ -6,7 +6,7 @@ internal data class ApplicationData( val applicationIcon: Drawable, val applicationName: String, val versionCode: String, - val versionName: String, + val versionName: String?, val firstInstall: String, val lastUpdate: String, val minSdk: String, diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlFormatter.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlFormatter.kt index 05a5fa20..0ec24ddb 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlFormatter.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlFormatter.kt @@ -83,7 +83,7 @@ internal class HtmlFormatter( .apply { applicationCollector().let { addDiv(R.string.sentinel_version_code, it.versionCode) - addDiv(R.string.sentinel_version_name, it.versionName) + addDiv(R.string.sentinel_version_name, it.versionName ?: "") addDiv(R.string.sentinel_first_install, it.firstInstall) addDiv(R.string.sentinel_last_update, it.lastUpdate) addDiv(R.string.sentinel_min_sdk, it.minSdk) diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonFormatter.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonFormatter.kt index db160a80..ab20bd11 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonFormatter.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonFormatter.kt @@ -60,7 +60,7 @@ internal class JsonFormatter( JSONObject().apply { applicationCollector().let { addKey(R.string.sentinel_version_code, it.versionCode) - addKey(R.string.sentinel_version_name, it.versionName) + addKey(R.string.sentinel_version_name, it.versionName ?: "") addKey(R.string.sentinel_first_install, it.firstInstall) addKey(R.string.sentinel_last_update, it.lastUpdate) addKey(R.string.sentinel_min_sdk, it.minSdk) diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlFormatter.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlFormatter.kt index c6a4415d..e8730409 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlFormatter.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlFormatter.kt @@ -91,7 +91,7 @@ internal class XmlFormatter( startTag(NAMESPACE, APPLICATION) applicationCollector().let { addNode(R.string.sentinel_version_code, it.versionCode) - addNode(R.string.sentinel_version_name, it.versionName) + addNode(R.string.sentinel_version_name, it.versionName ?: "") addNode(R.string.sentinel_first_install, it.firstInstall) addNode(R.string.sentinel_last_update, it.lastUpdate) addNode(R.string.sentinel_min_sdk, it.minSdk) diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/shared/StringBuilderFormatter.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/shared/StringBuilderFormatter.kt index 09dc7922..c05852df 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/shared/StringBuilderFormatter.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/data/sources/raw/formatters/shared/StringBuilderFormatter.kt @@ -34,7 +34,7 @@ internal abstract class StringBuilderFormatter { internal fun addApplicationData(builder: StringBuilder, data: ApplicationData) { addLine(builder, R.string.sentinel_version_code, data.versionCode) - addLine(builder, R.string.sentinel_version_name, data.versionName) + addLine(builder, R.string.sentinel_version_name, data.versionName ?: "") addLine(builder, R.string.sentinel_first_install, data.firstInstall) addLine(builder, R.string.sentinel_last_update, data.lastUpdate) addLine(builder, R.string.sentinel_min_sdk, data.minSdk) diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/ui/main/application/ApplicationFragment.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/ui/main/application/ApplicationFragment.kt index be389583..2c38787a 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/ui/main/application/ApplicationFragment.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/ui/main/application/ApplicationFragment.kt @@ -26,7 +26,7 @@ internal class ApplicationFragment : when (state) { is ApplicationState.Data -> with(binding) { versionCodeView.data = state.value.versionCode - versionNameView.data = state.value.versionName + versionNameView.data = state.value.versionName ?: "" firstInstallView.data = state.value.firstInstall lastUpdateView.data = state.value.lastUpdate minSdkView.data = state.value.minSdk diff --git a/sentinel/src/main/kotlin/com/infinum/sentinel/ui/shared/base/BaseActivity.kt b/sentinel/src/main/kotlin/com/infinum/sentinel/ui/shared/base/BaseActivity.kt index 59948487..967c83c7 100644 --- a/sentinel/src/main/kotlin/com/infinum/sentinel/ui/shared/base/BaseActivity.kt +++ b/sentinel/src/main/kotlin/com/infinum/sentinel/ui/shared/base/BaseActivity.kt @@ -3,6 +3,7 @@ package com.infinum.sentinel.ui.shared.base import android.content.res.Configuration import android.os.Build import android.os.Bundle +import androidx.activity.enableEdgeToEdge import androidx.annotation.CallSuper import androidx.annotation.RestrictTo import androidx.core.content.ContextCompat @@ -17,6 +18,8 @@ internal abstract class BaseActivity : FragmentActivity(), BaseVie override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + enableEdgeToEdge() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) { Configuration.UI_MODE_NIGHT_YES -> false diff --git a/sentinel/src/main/res/layout/sentinel_fragment_bundle_details.xml b/sentinel/src/main/res/layout/sentinel_fragment_bundle_details.xml index 2b8170c7..0b27ecd0 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_bundle_details.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_bundle_details.xml @@ -8,6 +8,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_bundles.xml b/sentinel/src/main/res/layout/sentinel_fragment_bundles.xml index 4de04181..8b96badd 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_bundles.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_bundles.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_certificate_details.xml b/sentinel/src/main/res/layout/sentinel_fragment_certificate_details.xml index b25987dd..d9006cd1 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_certificate_details.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_certificate_details.xml @@ -8,6 +8,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_certificates.xml b/sentinel/src/main/res/layout/sentinel_fragment_certificates.xml index bfbbc8f4..9e7896b0 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_certificates.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_certificates.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_crash_details.xml b/sentinel/src/main/res/layout/sentinel_fragment_crash_details.xml index 9c1df033..663b1fcd 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_crash_details.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_crash_details.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_crashes.xml b/sentinel/src/main/res/layout/sentinel_fragment_crashes.xml index f93fd3dc..42e20478 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_crashes.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_crashes.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_preference_editor.xml b/sentinel/src/main/res/layout/sentinel_fragment_preference_editor.xml index 978a5321..868e9533 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_preference_editor.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_preference_editor.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/nestedScrollView"> diff --git a/sentinel/src/main/res/layout/sentinel_fragment_settings.xml b/sentinel/src/main/res/layout/sentinel_fragment_settings.xml index 953fdbec..8efc6db2 100644 --- a/sentinel/src/main/res/layout/sentinel_fragment_settings.xml +++ b/sentinel/src/main/res/layout/sentinel_fragment_settings.xml @@ -8,6 +8,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/nestedScrollView"> diff --git a/tool-timber/src/main/res/layout/sentinel_activity_logger.xml b/tool-timber/src/main/res/layout/sentinel_activity_logger.xml index d6e334be..72fba56f 100644 --- a/tool-timber/src/main/res/layout/sentinel_activity_logger.xml +++ b/tool-timber/src/main/res/layout/sentinel_activity_logger.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView"> diff --git a/tool-timber/src/main/res/layout/sentinel_activity_logs.xml b/tool-timber/src/main/res/layout/sentinel_activity_logs.xml index d585744a..6d9c750c 100644 --- a/tool-timber/src/main/res/layout/sentinel_activity_logs.xml +++ b/tool-timber/src/main/res/layout/sentinel_activity_logs.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:colorBackground" + android:fitsSystemWindows="true" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$Behavior" app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/recyclerView">