desc:取消左右按键触发音量功能

main
xiaowusky 1 year ago
parent 796844ce35
commit 9e53e027cc

@ -105,8 +105,7 @@ abstract class BaseActivity : AppCompatActivity() {
val contentView = generateContentView() val contentView = generateContentView()
baseBinding.container.addView( baseBinding.container.addView(
contentView, 0, ViewGroup.LayoutParams( contentView, 0, ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
ViewGroup.LayoutParams.MATCH_PARENT
) )
) )
if (!isHome) { if (!isHome) {
@ -122,7 +121,8 @@ abstract class BaseActivity : AppCompatActivity() {
} }
val options = getOptions() val options = getOptions()
if (options.isNullOrEmpty()) { if (options.isNullOrEmpty()) {
baseBinding.topBar.getBackArea()?.nextFocusRightId = baseBinding.topBar.getBackArea()?.id!! baseBinding.topBar.getBackArea()?.nextFocusRightId =
baseBinding.topBar.getBackArea()?.id!!
} else { } else {
baseBinding.topBar.setOptions(options) baseBinding.topBar.setOptions(options)
baseBinding.topBar.setOpClickListener(object : CommonTopBar.OpClickListener { baseBinding.topBar.setOpClickListener(object : CommonTopBar.OpClickListener {
@ -172,10 +172,7 @@ abstract class BaseActivity : AppCompatActivity() {
val inflater = LayoutInflater.from(this) val inflater = LayoutInflater.from(this)
inflater.factory2 = object : Factory2 { inflater.factory2 = object : Factory2 {
override fun onCreateView( override fun onCreateView(
parent: View?, parent: View?, name: String, context: Context, attrs: AttributeSet
name: String,
context: Context,
attrs: AttributeSet
): View? { ): View? {
val booleanValue = val booleanValue =
attrs.getAttributeBooleanValue(NAMESPACE_ANDROID, "focusable", false) attrs.getAttributeBooleanValue(NAMESPACE_ANDROID, "focusable", false)
@ -247,12 +244,13 @@ abstract class BaseActivity : AppCompatActivity() {
private fun dealActionUp(event: KeyEvent): Boolean { private fun dealActionUp(event: KeyEvent): Boolean {
val repeatCount = event.repeatCount val repeatCount = event.repeatCount
val keyCode = event.keyCode val keyCode = event.keyCode
if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) { /*if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) {
if (isLeftRightLongPress && baseBinding.areaSound.visibility == View.VISIBLE) { if (isLeftRightLongPress && baseBinding.areaSound.visibility == View.VISIBLE) {
baseBinding.areaSound.postDelayed(hideVoiceAreaRunnable, 1500) baseBinding.areaSound.postDelayed(hideVoiceAreaRunnable, 1500)
return true return true
} }
} else if (keyCode == KeyEvent.KEYCODE_F1) { } else */
if (keyCode == KeyEvent.KEYCODE_F1) {
LogUtils.w("BaseActivity F1 up") LogUtils.w("BaseActivity F1 up")
onSosHelp(false) onSosHelp(false)
SoundUtils.stopSoundIo() SoundUtils.stopSoundIo()
@ -266,7 +264,7 @@ abstract class BaseActivity : AppCompatActivity() {
private fun dealActionDown(event: KeyEvent): Boolean { private fun dealActionDown(event: KeyEvent): Boolean {
val repeatCount = event.repeatCount val repeatCount = event.repeatCount
val keyCode = event.keyCode val keyCode = event.keyCode
if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) { /*if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) {
isLeftRightLongPress = repeatCount > 8 isLeftRightLongPress = repeatCount > 8
if (isLeftRightLongPress && currentFocus !is SeekBar) { if (isLeftRightLongPress && currentFocus !is SeekBar) {
showVoiceArea() showVoiceArea()
@ -274,7 +272,8 @@ abstract class BaseActivity : AppCompatActivity() {
if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode) mediaVolume-- else mediaVolume++ if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode) mediaVolume-- else mediaVolume++
baseBinding.sbSound.progress = mediaVolume baseBinding.sbSound.progress = mediaVolume
} }
} else if (keyCode == KeyEvent.KEYCODE_ENTER) { } else */
if (keyCode == KeyEvent.KEYCODE_ENTER) {
if (repeatCount == 0) { if (repeatCount == 0) {
centerDownTime = System.currentTimeMillis() centerDownTime = System.currentTimeMillis()
} else { } else {

Loading…
Cancel
Save