Skip to content

Commit

Permalink
Merge pull request #96 from infinum/develop
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
bojankoma authored Sep 13, 2021
2 parents 197cb43 + ceca569 commit e6c1a76
Show file tree
Hide file tree
Showing 39 changed files with 791 additions and 342 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
Changelog
=========

## Version 5.4.0

_2021-09-13_

* Update to Kotlin 1.5.30.
* Add blur for Android 12 devices.
* Replace all AlertDialogs with BottomSheetDialogFragments.

## Version 5.3.9

_2021-08-23_

* Fix R8 collisions on obfuscated class names.

## Version 5.3.8

_2021-08-21_

* Update dependencies to stable version.

## Version 5.3.7

_2021-07-22_
Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same [license](LICENSE).

For easier developing a `sample` application with proper implementations is provided.

It is also recommended to change `build.debug` property in `build.properties` to toggle dependency substitution in project level `build.gradle`.
For easier developing a `sample` application with proper implementations is provided.

Pushing changes directly into master branch is not allowed, please create a separate branch with your changes and then create a pull request.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.

**Groovy**
```groovy
debugImplementation "com.infinum.dbinspector:dbinspector:5.3.8"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.3.8"
debugImplementation "com.infinum.dbinspector:dbinspector:5.4.0"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.0"
```
**KotlinDSL**
```kotlin
debugImplementation("com.infinum.dbinspector:dbinspector:5.3.8")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.3.8")
debugImplementation("com.infinum.dbinspector:dbinspector:5.4.0")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.0")
```

### Usage
Expand Down
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ subprojects {
apply from: "$rootDir/dokka.gradle"
}

tasks.withType(JavaCompile) {
options.compilerArgs += ["--release", "8"]
}

apply from: "deploy.gradle"

task clean(type: Delete) {
Expand Down
10 changes: 5 additions & 5 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ext {
buildConfig = [
"minSdk" : 21,
"compileSdk": 30,
"targetSdk" : 30,
"buildTools": "30.0.3"
"compileSdk": 31,
"targetSdk" : 31,
"buildTools": "31.0.0"
]
releaseConfig = [
"group" : "com.infinum.dbinspector",
"version" : "5.3.8",
"versionCode": 5 * 100 * 100 + 3 * 100 + 8
"version" : "5.4.0",
"versionCode": 5 * 100 * 100 + 4 * 100 + 0
]
}
1 change: 1 addition & 0 deletions dbinspector-no-op/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-keeppackagenames
-keep public class com.infinum.dbinspector.DbInspector {
public protected *;
}
Expand Down
3 changes: 2 additions & 1 deletion dbinspector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import groovy.time.TimeDuration
plugins {
id "com.android.library"
id "kotlin-android"
id "kotlin-parcelize"
id "com.google.protobuf"
}

Expand Down Expand Up @@ -48,7 +49,7 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xexplicit-api=strict'
]
}
Expand Down
1 change: 1 addition & 0 deletions dbinspector/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-keeppackagenames
-keep public class com.infinum.dbinspector.* {
public protected *;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.infinum.dbinspector.domain.database.models

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

@Parcelize
internal data class DatabaseDescriptor(
val exists: Boolean,
val parentPath: String,
val name: String,
val extension: String = "",
val version: String = ""
) {
) : Parcelable {
val absolutePath: String
get() = if (extension.isEmpty()) "$parentPath/$name" else "$parentPath/$name.$extension"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.infinum.dbinspector.domain.shared.models

import android.os.Parcelable
import com.infinum.dbinspector.domain.schema.shared.models.ImageType
import kotlinx.parcelize.Parcelize

@Parcelize
internal data class Cell(
val text: String? = null,
val data: ByteArray? = null,
val imageType: ImageType = ImageType.UNSUPPORTED,
val linesShown: Int = Int.MAX_VALUE,
val truncateMode: TruncateMode = TruncateMode.UNKNOWN
) {
) : Parcelable {

override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.infinum.dbinspector.ui.content.trigger.TriggerViewModel
import com.infinum.dbinspector.ui.content.view.ViewViewModel
import com.infinum.dbinspector.ui.databases.DatabaseViewModel
import com.infinum.dbinspector.ui.databases.edit.EditDatabaseViewModel
import com.infinum.dbinspector.ui.databases.remove.RemoveDatabaseViewModel
import com.infinum.dbinspector.ui.edit.EditViewModel
import com.infinum.dbinspector.ui.edit.history.HistoryViewModel
import com.infinum.dbinspector.ui.pragma.PragmaViewModel
Expand Down Expand Up @@ -37,6 +38,13 @@ internal object Presentation {
const val DATABASE_EXTENSION = "KEY_DATABASE_EXTENSION"
const val SCHEMA_NAME = "KEY_SCHEMA_NAME"
const val SHOULD_REFRESH = "KEY_SHOULD_REFRESH"
const val ERROR_MESSAGE = "KEY_ERROR_MESSAGE"
const val REMOVE_DATABASE_DESCRIPTOR = "KEY_REMOVE_DATABASE_DESCRIPTOR"
const val REMOVE_DATABASE = "KEY_REMOVE_DATABASE"
const val DROP_MESSAGE = "KEY_DROP_MESSAGE"
const val DROP_NAME = "KEY_DROP_NAME"
const val DROP_CONTENT = "KEY_DROP_CONTENT"
const val PREVIEW_CELL = "KEY_PREVIEW_CELL"
}

object Limits {
Expand Down Expand Up @@ -78,8 +86,9 @@ internal object Presentation {
)

private fun viewModels() = module {
viewModel { DatabaseViewModel(get(), get(), get(), get()) }
viewModel { DatabaseViewModel(get(), get(), get()) }
viewModel { EditDatabaseViewModel(get()) }
viewModel { RemoveDatabaseViewModel(get()) }

viewModel { SettingsViewModel(get(), get(), get(), get(), get(), get(), get()) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.infinum.dbinspector.ui.content.shared

import android.app.Activity
import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import androidx.activity.result.ActivityResultLauncher
Expand All @@ -12,12 +11,15 @@ import androidx.paging.LoadState
import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.infinum.dbinspector.R
import com.infinum.dbinspector.databinding.DbinspectorActivityContentBinding
import com.infinum.dbinspector.domain.shared.models.Sort
import com.infinum.dbinspector.extensions.setupAsTable
import com.infinum.dbinspector.ui.Presentation
import com.infinum.dbinspector.ui.Presentation.Constants.Keys.DROP_CONTENT
import com.infinum.dbinspector.ui.Presentation.Constants.Keys.DROP_NAME
import com.infinum.dbinspector.ui.content.shared.drop.DropContentDialog
import com.infinum.dbinspector.ui.content.shared.preview.PreviewContentDialog
import com.infinum.dbinspector.ui.content.table.TableViewModel
import com.infinum.dbinspector.ui.content.trigger.TriggerViewModel
import com.infinum.dbinspector.ui.content.view.ViewViewModel
Expand Down Expand Up @@ -49,8 +51,6 @@ internal abstract class ContentActivity : BaseActivity<ContentState, ContentEven
@get:StringRes
abstract val drop: Int

private lateinit var contentPreviewFactory: ContentPreviewFactory

private val headerAdapter: HeaderAdapter = HeaderAdapter()

private val contentAdapter: ContentAdapter = ContentAdapter()
Expand All @@ -62,22 +62,28 @@ internal abstract class ContentActivity : BaseActivity<ContentState, ContentEven

binding.toolbar.setNavigationOnClickListener { finish() }

contentPreviewFactory = ContentPreviewFactory(this)

headerAdapter.isClickable = true
headerAdapter.onClick = { header ->
query(connection.schemaName!!, header.name, header.sort)
headerAdapter.updateHeader(header)
}

contentAdapter.onCellClicked = { cell -> contentPreviewFactory.showCell(cell) }
contentAdapter.onCellClicked = { cell ->
PreviewContentDialog
.setCell(cell)
.show(supportFragmentManager, null)
}

contract = registerForActivityResult(EditContract()) { shouldRefresh ->
if (shouldRefresh) {
contentAdapter.refresh()
}
}

supportFragmentManager.setFragmentResultListener(DROP_CONTENT, this) { _, bundle ->
bundle.getString(DROP_NAME)?.let { viewModel.drop(it) }
}

if (connection.hasSchemaData) {
viewModel.databasePath = connection.databasePath!!
viewModel.open()
Expand Down Expand Up @@ -195,18 +201,9 @@ internal abstract class ContentActivity : BaseActivity<ContentState, ContentEven
}

private fun drop(name: String) =
MaterialAlertDialogBuilder(this)
.setTitle(R.string.dbinspector_title_info)
.setMessage(String.format(getString(drop), name))
.setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _: Int ->
viewModel.drop(name)
dialog.dismiss()
}
.setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
dialog.dismiss()
}
.create()
.show()
DropContentDialog
.setMessage(drop, name)
.show(supportFragmentManager, null)

private fun query(
name: String,
Expand Down
Loading

0 comments on commit e6c1a76

Please sign in to comment.