diff --git a/app/build.gradle b/app/build.gradle index 10b54b8..63e0975 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,18 +1,16 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' def fileProvider = "file_provider" android { - compileSdkVersion 33 - buildToolsVersion "33.0.1" - defaultConfig { applicationId "com.dp.logcatapp" minSdkVersion 16 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode 33 versionName "1.7.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -20,6 +18,10 @@ android { multiDexEnabled true } + buildFeatures { + viewBinding true + } + signingConfigs { release { try { @@ -35,22 +37,18 @@ android { } } - dexOptions { - javaMaxHeapSize "2g" - } - lintOptions { abortOnError false disable 'MissingTranslation' } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_17 } buildTypes { @@ -65,6 +63,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + namespace 'com.dp.logcatapp' } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 363da4a..dee6b5c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,104 +1,102 @@ + xmlns:tools="http://schemas.android.com/tools"> - - - - - - + + + + + + android:name=".LogcatApp" + android:allowBackup="true" + android:fullBackupContent="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:largeHeap="true" + android:supportsRtl="true" + android:theme="@style/LightTheme" + tools:ignore="GoogleAppIndexingWarning"> + android:name=".activities.SplashActivity" + android:exported="true" + android:theme="@style/SplashScreenTheme"> - + - + + android:name=".activities.MainActivity" + android:launchMode="singleTask" /> + android:name=".activities.SettingsActivity" + android:launchMode="singleTask" + android:parentActivityName=".activities.MainActivity" + android:windowSoftInputMode="adjustResize"> + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.MainActivity" /> + android:name=".activities.FiltersActivity" + android:launchMode="singleTask" + android:parentActivityName=".activities.MainActivity" + android:windowSoftInputMode="adjustResize"> + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.MainActivity" /> + android:name=".activities.SavedLogsActivity" + android:launchMode="singleTask" + android:parentActivityName=".activities.MainActivity" + android:windowSoftInputMode="adjustResize"> + android:name="android.support.PARENT_ACTIVITY" + android:value=".activities.MainActivity" /> - + android:name=".activities.SavedLogsViewerActivity" + android:exported="true" + android:launchMode="singleTask" + android:parentActivityName=".activities.SavedLogsActivity" + android:windowSoftInputMode="adjustResize"> - - + + + android:mimeType="text/plain" + android:scheme="file" /> + android:mimeType="text/plain" + android:scheme="content" /> + - - + android:name="androidx.core.content.FileProvider" + android:authorities="${applicationId}.${fileProvider}" + android:exported="false" + android:grantUriPermissions="true"> + android:name="android.support.FILE_PROVIDER_PATHS" + android:resource="@xml/file_provider_paths" /> - + + \ No newline at end of file diff --git a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt index da65c44..87da683 100644 --- a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt +++ b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/LogcatLiveFragment.kt @@ -63,7 +63,7 @@ import kotlinx.coroutines.withContext class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListener { companion object { - val TAG = LogcatLiveFragment::class.qualifiedName + val TAG = LogcatLiveFragment::class.qualifiedName!! const val LOGCAT_DIR = "logcat" private const val SEARCH_FILTER_TAG = "search_filter_tag" @@ -297,7 +297,7 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen } } - viewModel.getFilters().observe(viewLifecycleOwner, Observer { filters -> + viewModel.getFilters().observe(viewLifecycleOwner) { filters -> if (filters != null) { logcatService?.let { val logcat = it.logcat @@ -319,13 +319,14 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen } } + Logger.debug(TAG, "setting filtered logs") adapter.setItems(logcat.getLogsFiltered()) updateToolbarSubtitle(adapter.itemCount) scrollRecyclerView() resumeLogcat() } } - }) + } } override fun onActivityCreated(savedInstanceState: Bundle?) { @@ -657,6 +658,7 @@ class LogcatLiveFragment : BaseFragment(), ServiceConnection, LogsReceivedListen } override fun onReceivedLogs(logs: List) { + Logger.debug(TAG, "received logs") adapter.addItems(logs) updateToolbarSubtitle(adapter.itemCount) if (viewModel.autoScroll) { diff --git a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/MyRecyclerViewAdapter.kt b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/MyRecyclerViewAdapter.kt index ce15f6e..2a0b0b2 100644 --- a/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/MyRecyclerViewAdapter.kt +++ b/app/src/main/java/com/dp/logcatapp/fragments/logcatlive/MyRecyclerViewAdapter.kt @@ -17,7 +17,7 @@ import com.logcat.collections.FixedCircularArray internal class MyRecyclerViewAdapter( context: Context, - initialCapacity: Int + initialCapacity: Int, ) : RecyclerView.Adapter(), View.OnClickListener, @@ -50,7 +50,7 @@ internal class MyRecyclerViewAdapter( override fun onBindViewHolder( holder: MyViewHolder, - position: Int + position: Int, ) { val log = list[position] holder.date.text = log.date @@ -66,7 +66,7 @@ internal class MyRecyclerViewAdapter( override fun onCreateViewHolder( parent: ViewGroup, - viewType: Int + viewType: Int, ): MyViewHolder { val view = LayoutInflater.from(parent.context) .inflate(R.layout.fragment_logcat_live_list_item, parent, false) @@ -115,7 +115,7 @@ internal class MyRecyclerViewAdapter( override fun onSharedPreferenceChanged( sharedPreferences: SharedPreferences, - key: String + key: String?, ) { when (key) { PreferenceKeys.Logcat.KEY_MAX_LOGS -> { diff --git a/app/src/main/java/com/dp/logcatapp/services/BaseService.kt b/app/src/main/java/com/dp/logcatapp/services/BaseService.kt index f7398e7..07c0d91 100644 --- a/app/src/main/java/com/dp/logcatapp/services/BaseService.kt +++ b/app/src/main/java/com/dp/logcatapp/services/BaseService.kt @@ -34,7 +34,7 @@ abstract class BaseService : LifecycleService(), override fun onSharedPreferenceChanged( sharedPreferences: SharedPreferences, - key: String + key: String? ) { } diff --git a/app/src/main/java/com/dp/logcatapp/services/LogcatService.kt b/app/src/main/java/com/dp/logcatapp/services/LogcatService.kt index f8becbe..01eac62 100644 --- a/app/src/main/java/com/dp/logcatapp/services/LogcatService.kt +++ b/app/src/main/java/com/dp/logcatapp/services/LogcatService.kt @@ -10,6 +10,7 @@ import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.content.Context import android.content.Intent import android.content.SharedPreferences +import android.content.pm.ServiceInfo import android.graphics.BitmapFactory import android.os.Build.VERSION import android.os.Build.VERSION_CODES @@ -187,7 +188,7 @@ class LogcatService : BaseService() { override fun onSharedPreferenceChanged( sharedPreferences: SharedPreferences, - key: String + key: String? ) { super.onSharedPreferenceChanged(sharedPreferences, key) when (key) { diff --git a/build.gradle b/build.gradle index b24f0ee..bca6bc3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.7.20' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:8.1.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong @@ -23,25 +23,25 @@ allprojects { } ext { - appcompat_version = "1.5.1" + appcompat_version = "1.6.1" constraint_layout_version = "2.1.4" - core_ktx_version = "1.9.0" + core_ktx_version = "1.12.0" documentfile_version = "1.0.1" - fragment_ktx_version = "1.5.5" - kotlin_coroutines_android_version = "1.5.2" - kotlin_coroutines_core_version = "1.5.2" + fragment_ktx_version = "1.6.2" + kotlin_coroutines_android_version = "1.7.1" + kotlin_coroutines_core_version = "1.7.1" legacy_preference_v14_version = "1.0.0" lifecycle_ext = "2.2.0" - lifecycle_version = "2.5.1" - material_version = "1.7.0" + lifecycle_version = "2.6.2" + material_version = "1.10.0" multidex_version = "2.0.1" - preference_version = "1.2.0" - room_version = "2.4.3" + preference_version = "1.2.1" + room_version = "2.6.0" // test dependencies junit_version = "4.13.2" - runner_version = "1.5.1" - espresso_core_version = "3.5.0" + runner_version = "1.5.2" + espresso_core_version = "3.5.1" } task clean(type: Delete) { diff --git a/collections/build.gradle b/collections/build.gradle index c7a5590..d12a62a 100644 --- a/collections/build.gradle +++ b/collections/build.gradle @@ -1,24 +1,26 @@ apply plugin: 'com.android.library' - apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - android { - compileSdkVersion 29 - defaultConfig { + compileSdk 34 minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + namespace 'com.logcat.collections' } dependencies { diff --git a/collections/src/main/AndroidManifest.xml b/collections/src/main/AndroidManifest.xml index 3d8273f..cc947c5 100644 --- a/collections/src/main/AndroidManifest.xml +++ b/collections/src/main/AndroidManifest.xml @@ -1 +1 @@ - + diff --git a/gradle.properties b/gradle.properties index 54b6904..7be0f05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,3 +14,6 @@ org.gradle.jvmargs=-Xmx2560M # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true kapt.incremental.apt=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b3e9a70..6b06a6f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip diff --git a/logcat/build.gradle b/logcat/build.gradle index 73416d2..0107023 100644 --- a/logcat/build.gradle +++ b/logcat/build.gradle @@ -1,20 +1,19 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 29 - defaultConfig { + compileSdk 34 minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } buildTypes { @@ -23,6 +22,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + namespace 'com.dp.logcat' } dependencies { diff --git a/logcat/src/main/AndroidManifest.xml b/logcat/src/main/AndroidManifest.xml index 2ff65f4..cc947c5 100644 --- a/logcat/src/main/AndroidManifest.xml +++ b/logcat/src/main/AndroidManifest.xml @@ -1 +1 @@ - + diff --git a/logcat/src/main/java/com/dp/logcat/Log.kt b/logcat/src/main/java/com/dp/logcat/Log.kt index 91aa570..9fd3810 100644 --- a/logcat/src/main/java/com/dp/logcat/Log.kt +++ b/logcat/src/main/java/com/dp/logcat/Log.kt @@ -1,7 +1,7 @@ package com.dp.logcat import android.os.Parcelable -import kotlinx.android.parcel.Parcelize +import kotlinx.parcelize.Parcelize private var logCounter = 0 @@ -14,7 +14,7 @@ data class Log( val tid: String, val priority: String, val tag: String, - val msg: String + val msg: String, ) : Parcelable { fun metadataToString() = "[$date $time $pid:$tid $priority/$tag]" @@ -24,7 +24,7 @@ data class Log( companion object { fun parse( metadata: String, - msg: String + msg: String, ): Log { val date: String val time: String diff --git a/logger/build.gradle b/logger/build.gradle index 46e59e7..476ca29 100644 --- a/logger/build.gradle +++ b/logger/build.gradle @@ -1,19 +1,17 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 29 - defaultConfig { + compileSdk 34 minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } buildTypes { @@ -22,6 +20,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + namespace 'com.dp.logger' } dependencies { diff --git a/logger/src/main/AndroidManifest.xml b/logger/src/main/AndroidManifest.xml index 2c3598f..cc947c5 100644 --- a/logger/src/main/AndroidManifest.xml +++ b/logger/src/main/AndroidManifest.xml @@ -1 +1 @@ - +