Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
kernel0x committed Jul 11, 2024
1 parent cd6abad commit a13ad56
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ Pick a UI implementation and add the dependency:

````java
dependencies {
debugImplementation 'com.github.kernel0x.finch:ui-drawer:2.2.9'
releaseImplementation 'com.github.kernel0x.finch:noop:2.2.9'
debugImplementation 'com.github.kernel0x.finch:ui-drawer:2.2.10'
releaseImplementation 'com.github.kernel0x.finch:noop:2.2.10'
// optional only for OkHttp
debugImplementation 'com.github.kernel0x.finch:log-okhttp:2.2.9'
releaseImplementation 'com.github.kernel0x.finch:log-okhttp-noop:2.2.9'
debugImplementation 'com.github.kernel0x.finch:log-okhttp:2.2.10'
releaseImplementation 'com.github.kernel0x.finch:log-okhttp-noop:2.2.10'
// optional only for GRPC
debugImplementation 'com.github.kernel0x.finch:log-grpc:2.2.9'
releaseImplementation 'com.github.kernel0x.finch:log-grpc-noop:2.2.9'
debugImplementation 'com.github.kernel0x.finch:log-grpc:2.2.10'
releaseImplementation 'com.github.kernel0x.finch:log-grpc-noop:2.2.10'
// optional only for logs
debugImplementation 'com.github.kernel0x.finch:log:2.2.9'
releaseImplementation 'com.github.kernel0x.finch:log-noop:2.2.9'
debugImplementation 'com.github.kernel0x.finch:log:2.2.10'
releaseImplementation 'com.github.kernel0x.finch:log-noop:2.2.10'
}
````

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal class NetworkLogActivity : BaseFinchActivity() {
@SuppressLint("SetTextI18n")
private fun update() {
networkLog?.apply {
findViewById<TextView>(R.id.finch_text_view).text = "$method $path"
findViewById<TextView>(R.id.finch_text_view)?.text = "$method $path"
for (fragment in adapter.fragments) {
fragment.networkLogUpdated(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import android.view.LayoutInflater
import android.view.Menu
import android.view.View
import android.view.ViewGroup
import android.widget.ScrollView
import android.widget.TextView
import androidx.appcompat.widget.SearchView
import androidx.core.widget.NestedScrollView
import androidx.fragment.app.Fragment
import com.kernel.finch.common.loggers.data.models.MediaType
import com.kernel.finch.common.loggers.data.models.NetworkLogEntity
Expand Down Expand Up @@ -55,6 +55,7 @@ internal class NetworkLogPayloadFragment : Fragment(), NetworkLogFragment,
getFormattedRequestBody(),
requestBodyIsPlainText
)

TYPE_RESPONSE -> setText(
getResponseHeadersString(true),
getFormattedResponseBody(),
Expand Down Expand Up @@ -100,7 +101,7 @@ internal class NetworkLogPayloadFragment : Fragment(), NetworkLogFragment,

override fun onQueryTextChange(newText: String): Boolean {
view?.run {
findViewById<TextView>(R.id.finch_body).run {
findViewById<TextView>(R.id.finch_body)?.run {
var fullText = text.toString()
if (newText.isEmpty() || !fullText.contains(newText) || TextUtils.isEmpty(newText)) {
update()
Expand All @@ -110,7 +111,7 @@ internal class NetworkLogPayloadFragment : Fragment(), NetworkLogFragment,
val highlighted = "<font color='red'>$newText</font>"
fullText = fullText.replace(newText, highlighted)
text = Html.fromHtml(fullText)
findViewById<NestedScrollView>(R.id.finch_scroll_view).scrollTo(
findViewById<ScrollView>(R.id.finch_scroll_view)?.scrollTo(
0,
layout.getLineTop(lineNumber)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -244,4 +244,4 @@

</TableLayout>

</androidx.core.widget.NestedScrollView>
</ScrollView>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/finch_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -27,4 +27,4 @@

</LinearLayout>

</androidx.core.widget.NestedScrollView>
</ScrollView>
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext.versions = [
minSdk : 21,
targetSdk : 34,
compileSdk : 34,
libraryVersion : '2.2.9',
libraryVersion : '2.2.10',
libraryVersionCode: 15,

okhttp3 : '3.7.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class FinchClientInterceptor : ClientInterceptor {
responseListener
) {
override fun onMessage(message: RespT) {
networkLog.responseBody =
networkLog.responseBody +=
TextFormat.printer().escapingNonAscii(false).printToString(
message as MessageOrBuilder
)
Expand Down
13 changes: 6 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ android {
}

dependencies {
//debugImplementation 'com.github.kernel0x.finch:ui-drawer:2.2.9'
//releaseImplementation 'com.github.kernel0x.finch:noop:2.2.9'
//debugImplementation 'com.github.kernel0x.finch:log-okhttp:2.2.9'
//releaseImplementation 'com.github.kernel0x.finch:log-okhttp-noop:2.2.9'
//debugImplementation 'com.github.kernel0x.finch:log:2.2.9'
//releaseImplementation 'com.github.kernel0x.finch:log-noop:2.2.9'
//debugImplementation 'com.github.kernel0x.finch:ui-drawer:2.2.10'
//releaseImplementation 'com.github.kernel0x.finch:noop:2.2.10'
//debugImplementation 'com.github.kernel0x.finch:log-okhttp:2.2.10'
//releaseImplementation 'com.github.kernel0x.finch:log-okhttp-noop:2.2.10'
//debugImplementation 'com.github.kernel0x.finch:log:2.2.10'
//releaseImplementation 'com.github.kernel0x.finch:log-noop:2.2.10'
debugImplementation project(":ui-drawer")
debugImplementation project(":log")
debugImplementation project(":log-okhttp")
implementation "androidx.appcompat:appcompat:$versions.appCompat"
implementation "com.google.android.material:material:1.0.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.2.0"
Expand Down

0 comments on commit a13ad56

Please sign in to comment.