Skip to content

Commit 20ab9f9

Browse files
authored
Merge pull request #156 from AppDevNext/SwitchLayout
Switch layout
2 parents 519e02a + b58ccdb commit 20ab9f9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import android.os.Handler
99
import android.os.Looper
1010
import android.os.StrictMode
1111
import android.view.*
12-
import android.widget.Switch
12+
import android.widget.CompoundButton
1313
import androidx.appcompat.widget.SearchView
1414
import androidx.core.content.FileProvider
1515
import androidx.fragment.app.Fragment
@@ -136,6 +136,7 @@ abstract class LogBaseFragment : Fragment() {
136136
searchView?.let {
137137
it.setSearchableInfo(searchManager.getSearchableInfo(activity!!.componentName))
138138
it.setIconifiedByDefault(true)
139+
it.setMaxWidth(Int.MAX_VALUE)
139140
it.setOnQueryTextListener(queryTextListener)
140141
if (currentFilter != "") {
141142
if (searchAutoComplete != null && searchItem != null) {
@@ -145,7 +146,7 @@ abstract class LogBaseFragment : Fragment() {
145146
}
146147
}
147148

148-
val switch = menu.findItem(R.id.menu_live).actionView as Switch
149+
val switch = menu.findItem(R.id.menu_live).actionView as CompoundButton
149150
switch.setOnCheckedChangeListener { _, isChecked ->
150151
live = isChecked
151152
if (live)

LogcatCoreLib/src/main/res/menu/menu_log.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
android:orderInCategory="100"
1717
android:title="@string/live"
1818
android:visible="false"
19-
app:actionViewClass="android.widget.Switch"
19+
app:actionViewClass="androidx.appcompat.widget.SwitchCompat"
2020
app:showAsAction="always" />
2121

2222
<group

0 commit comments

Comments
 (0)