Skip to content

Commit

Permalink
Upgrade AGP, and dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanparajuli committed Dec 10, 2022
1 parent 4fe384d commit fd73132
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 120 deletions.
8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ apply plugin: 'kotlin-kapt'
def fileProvider = "file_provider"

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 33
buildToolsVersion "33.0.1"

defaultConfig {
applicationId "com.dp.logcatapp"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 33
versionCode 33
versionName "1.7.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}

signingConfigs {
Expand Down Expand Up @@ -90,6 +91,7 @@ dependencies {
kapt "androidx.room:room-compiler:$room_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_core_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_android_version"
implementation "androidx.multidex:multidex:$multidex_version"

testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test:runner:$runner_version"
Expand Down
122 changes: 62 additions & 60 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,101 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.dp.logcatapp">
xmlns:tools="http://schemas.android.com/tools"
package="com.dp.logcatapp">

<!-- adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS -->
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_LOGS"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<application
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=".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">
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashScreenTheme">
android:exported="true"
android:name=".activities.SplashActivity"
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTask" />
android:name=".activities.MainActivity"
android:launchMode="singleTask"/>
<activity
android:name=".activities.SettingsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.SettingsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
</activity>

<activity
android:name=".activities.FiltersActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.FiltersActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
</activity>

<activity
android:name=".activities.SavedLogsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.SavedLogsActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
</activity>

<activity
android:name=".activities.SavedLogsViewerActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.SavedLogsActivity"
android:windowSoftInputMode="adjustResize">
android:name=".activities.SavedLogsViewerActivity"
android:launchMode="singleTask"
android:parentActivityName=".activities.SavedLogsActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.SavedLogsActivity" />
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.SavedLogsActivity"/>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>

<data
android:mimeType="text/plain"
android:scheme="file" />
android:mimeType="text/plain"
android:scheme="file"/>
<data
android:mimeType="text/plain"
android:scheme="content" />
android:mimeType="text/plain"
android:scheme="content"/>
</intent-filter>
</activity>

<service
android:name=".services.LogcatService"
android:exported="false"
android:stopWithTask="false" />
android:name=".services.LogcatService"
android:exported="false"
android:stopWithTask="false"/>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.${fileProvider}"
android:exported="false"
android:grantUriPermissions="true">
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.${fileProvider}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths"/>
</provider>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.TextView
import androidx.fragment.app.setFragmentResultListener
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.DividerItemDecoration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
}

private fun setupAppearanceCategory() {
val sharedPrefs = preferenceScreen.sharedPreferences
val sharedPrefs = preferenceScreen.sharedPreferences!!
val themePref = findPreference<ListPreference>(PreferenceKeys.Appearance.KEY_THEME)!!
val useBlackThemePref =
findPreference<Preference>(PreferenceKeys.Appearance.KEY_USE_BLACK_THEME)!!
Expand Down Expand Up @@ -91,7 +91,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
val prefBuffers = findPreference<MultiSelectListPreference>(PreferenceKeys.Logcat.KEY_BUFFERS)!!
val prefMaxLogs = findPreference<Preference>(PreferenceKeys.Logcat.KEY_MAX_LOGS)!!

prefPollInterval.summary = preferenceScreen.sharedPreferences
prefPollInterval.summary = preferenceScreen.sharedPreferences!!
.getString(
PreferenceKeys.Logcat.KEY_POLL_INTERVAL,
PreferenceKeys.Logcat.Default.POLL_INTERVAL
Expand Down Expand Up @@ -119,7 +119,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
val availableBuffers = Logcat.AVAILABLE_BUFFERS
val defaultBuffers = PreferenceKeys.Logcat.Default.BUFFERS
if (availableBuffers.isNotEmpty() && defaultBuffers.isNotEmpty()) {
val bufferValues = preferenceScreen.sharedPreferences
val bufferValues = preferenceScreen.sharedPreferences!!
.getStringSet(PreferenceKeys.Logcat.KEY_BUFFERS, defaultBuffers)!!

val toSummary = { values: Set<String> ->
Expand Down Expand Up @@ -153,7 +153,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
prefBuffers.isVisible = false
}

val maxLogs = preferenceScreen.sharedPreferences.getString(
val maxLogs = preferenceScreen.sharedPreferences!!.getString(
PreferenceKeys.Logcat.KEY_MAX_LOGS,
PreferenceKeys.Logcat.Default.MAX_LOGS
)!!.trim().toInt()
Expand All @@ -163,7 +163,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
.OnPreferenceChangeListener callback@{ preference, newValue ->
val activity = requireActivity()
try {
val oldValue = preferenceScreen.sharedPreferences.getString(
val oldValue = preferenceScreen.sharedPreferences!!.getString(
PreferenceKeys.Logcat.KEY_MAX_LOGS,
PreferenceKeys.Logcat.Default.MAX_LOGS
)!!.trim().toInt()
Expand All @@ -190,8 +190,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
}

private fun setupSaveLocationOption() {
prefSaveLocation = findPreference<Preference>(PreferenceKeys.Logcat.KEY_SAVE_LOCATION)!!
val saveLocation = preferenceScreen.sharedPreferences.getString(
prefSaveLocation = findPreference(PreferenceKeys.Logcat.KEY_SAVE_LOCATION)!!
val saveLocation = preferenceScreen.sharedPreferences!!.getString(
PreferenceKeys.Logcat.KEY_SAVE_LOCATION,
PreferenceKeys.Logcat.Default.SAVE_LOCATION
)!!.trim()
Expand Down Expand Up @@ -250,7 +250,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
return
}

preferenceScreen.sharedPreferences.edit {
preferenceScreen.sharedPreferences!!.edit {
putString(PreferenceKeys.Logcat.KEY_SAVE_LOCATION, file.absolutePath)
}
prefSaveLocation.summary = "%s/%s".format(
Expand Down Expand Up @@ -311,12 +311,12 @@ class SettingsFragment : PreferenceFragmentCompat() {
SAVE_LOCATION_REQ -> {
val uri = data?.data
if (uri != null) {
activity!!.contentResolver.takePersistableUriPermission(
requireActivity().contentResolver.takePersistableUriPermission(
uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_GRANT_WRITE_URI_PERMISSION
)
preferenceScreen.sharedPreferences.edit {
preferenceScreen.sharedPreferences!!.edit {
putString(
PreferenceKeys.Logcat.KEY_SAVE_LOCATION,
uri.toString()
Expand All @@ -329,7 +329,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
}

private fun setupDefaultSaveLocation() {
preferenceScreen.sharedPreferences.edit {
preferenceScreen.sharedPreferences!!.edit {
putString(PreferenceKeys.Logcat.KEY_SAVE_LOCATION, "")
}
prefSaveLocation.summary = getString(R.string.save_location_internal)
Expand Down Expand Up @@ -359,7 +359,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(activity!!)
return AlertDialog.Builder(requireActivity())
.setTitle(R.string.save_location)
.setItems(R.array.save_location_options) { _, which ->
if (which == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.dp.logcat.Log
import com.dp.logcatapp.R
import com.dp.logcatapp.activities.FiltersActivity
import com.dp.logcatapp.fragments.base.BaseDialogFragment
import com.dp.logcatapp.util.getParcelableCompat

class FilterExclusionDialogFragment : BaseDialogFragment(), DialogInterface.OnClickListener {

Expand Down Expand Up @@ -42,7 +43,7 @@ class FilterExclusionDialogFragment : BaseDialogFragment(), DialogInterface.OnCl
dialog: DialogInterface,
which: Int
) {
val log = requireArguments().getParcelable<Log>(KEY_LOG)!!
val log = requireArguments().getParcelableCompat<Log>(KEY_LOG)!!
when (which) {
LogContentType.FILTER.ordinal -> moveToFilterActivity(log, false)
LogContentType.EXCLUDE.ordinal -> moveToFilterActivity(log, true)
Expand Down
Loading

0 comments on commit fd73132

Please sign in to comment.