Skip to content

Commit 0630b01

Browse files
authored
Merge pull request #175 from 1951FDG/activity-restart
Set minimum width equal to parent
2 parents 8d00ac7 + a869aec commit 0630b01

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

LogcatCoreLib/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ android {
1616
}
1717

1818
dependencies {
19+
implementation "androidx.core:core-ktx:1.3.2"
1920
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
2021
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3"
2122
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

LogcatCoreLib/src/main/java/info/hannes/logcat/base/LogBaseFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import android.view.*
1212
import android.widget.CompoundButton
1313
import androidx.appcompat.widget.SearchView
1414
import androidx.core.content.FileProvider
15+
import androidx.core.view.doOnLayout
1516
import androidx.fragment.app.Fragment
1617
import androidx.lifecycle.coroutineScope
1718
import androidx.recyclerview.widget.LinearLayoutManager
@@ -50,6 +51,11 @@ abstract class LogBaseFragment : Fragment() {
5051
it.layoutManager = LinearLayoutManager(it.context)
5152
it.recycledViewPool.setMaxRecycledViews(R.layout.item_log, DEFAULT_MAX_SCRAP)
5253
}
54+
55+
logsRecycler.doOnLayout {
56+
it.minimumWidth = (it.parent as ViewGroup).width
57+
}
58+
5359
// empty adapter to avoid "E/RecyclerView﹕ No adapter attached; skipping layou..."
5460
logListAdapter = LogListAdapter(mutableListOf(), currentFilter).also {
5561
it.stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY

0 commit comments

Comments
 (0)