mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
优化
This commit is contained in:
parent
c131f6da9d
commit
46b47bec75
@ -8,7 +8,6 @@ import android.view.MenuItem
|
||||
import android.widget.EditText
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
@ -42,8 +41,10 @@ import io.legado.app.ui.widget.dialog.VariableDialog
|
||||
import io.legado.app.ui.widget.keyboard.KeyboardToolPop
|
||||
import io.legado.app.ui.widget.text.EditEntity
|
||||
import io.legado.app.utils.GSON
|
||||
import io.legado.app.utils.imeHeight
|
||||
import io.legado.app.utils.isContentScheme
|
||||
import io.legado.app.utils.launch
|
||||
import io.legado.app.utils.navigationBarHeight
|
||||
import io.legado.app.utils.sendToClip
|
||||
import io.legado.app.utils.setEdgeEffectColor
|
||||
import io.legado.app.utils.share
|
||||
@ -201,10 +202,10 @@ class BookSourceEditActivity :
|
||||
}
|
||||
})
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.recyclerView) { _, windowInsets ->
|
||||
val typeMask = WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.ime()
|
||||
val insets = windowInsets.getInsets(typeMask)
|
||||
binding.recyclerView.bottomPadding = insets.bottom
|
||||
softKeyboardTool.initialPadding = insets.bottom
|
||||
val navigationBarHeight = windowInsets.navigationBarHeight
|
||||
val imeHeight = windowInsets.imeHeight
|
||||
binding.recyclerView.bottomPadding = if (imeHeight == 0) navigationBarHeight else 0
|
||||
softKeyboardTool.initialPadding = imeHeight
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import android.view.MenuItem
|
||||
import android.widget.EditText
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseActivity
|
||||
@ -17,10 +16,10 @@ import io.legado.app.databinding.ActivityReplaceEditBinding
|
||||
import io.legado.app.lib.dialogs.SelectItem
|
||||
import io.legado.app.ui.widget.keyboard.KeyboardToolPop
|
||||
import io.legado.app.utils.GSON
|
||||
import io.legado.app.utils.imeHeight
|
||||
import io.legado.app.utils.sendToClip
|
||||
import io.legado.app.utils.showHelp
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
import splitties.views.bottomPadding
|
||||
|
||||
/**
|
||||
* 编辑替换规则
|
||||
@ -93,10 +92,7 @@ class ReplaceEditActivity :
|
||||
showHelp("regexHelp")
|
||||
}
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
|
||||
val typeMask = WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.ime()
|
||||
val insets = windowInsets.getInsets(typeMask)
|
||||
binding.root.bottomPadding = insets.bottom
|
||||
softKeyboardTool.initialPadding = insets.bottom
|
||||
softKeyboardTool.initialPadding = windowInsets.imeHeight
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import android.view.MenuItem
|
||||
import android.widget.EditText
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
@ -30,9 +29,11 @@ import io.legado.app.ui.widget.dialog.VariableDialog
|
||||
import io.legado.app.ui.widget.keyboard.KeyboardToolPop
|
||||
import io.legado.app.ui.widget.text.EditEntity
|
||||
import io.legado.app.utils.GSON
|
||||
import io.legado.app.utils.imeHeight
|
||||
import io.legado.app.utils.isContentScheme
|
||||
import io.legado.app.utils.isTrue
|
||||
import io.legado.app.utils.launch
|
||||
import io.legado.app.utils.navigationBarHeight
|
||||
import io.legado.app.utils.sendToClip
|
||||
import io.legado.app.utils.setEdgeEffectColor
|
||||
import io.legado.app.utils.share
|
||||
@ -189,10 +190,10 @@ class RssSourceEditActivity :
|
||||
}
|
||||
})
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
|
||||
val typeMask = WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.ime()
|
||||
val insets = windowInsets.getInsets(typeMask)
|
||||
binding.root.bottomPadding = insets.bottom
|
||||
softKeyboardTool.initialPadding = insets.bottom
|
||||
val navigationBarHeight = windowInsets.navigationBarHeight
|
||||
val imeHeight = windowInsets.imeHeight
|
||||
binding.recyclerView.bottomPadding = if (imeHeight == 0) navigationBarHeight else 0
|
||||
softKeyboardTool.initialPadding = imeHeight
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class KeyboardToolPop(
|
||||
}
|
||||
} else {
|
||||
mIsSoftKeyBoardShowing = false
|
||||
//rootView.setPadding(0, 0, 0, 0)
|
||||
rootView.setPadding(0, 0, 0, 0)
|
||||
if (preShowing) {
|
||||
dismiss()
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package io.legado.app.utils
|
||||
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
||||
val WindowInsetsCompat.navigationBarHeight
|
||||
get() = getInsets(WindowInsetsCompat.Type.navigationBars()).bottom
|
||||
|
||||
val WindowInsetsCompat.imeHeight
|
||||
get() = getInsets(WindowInsetsCompat.Type.ime()).bottom
|
@ -67,6 +67,7 @@
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_source_edit" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user