disable hardware keyboard shortcuts when an EditText is focused
This commit is contained in:
parent
29f46d97c0
commit
1e14cacf89
|
@ -16,6 +16,7 @@ import android.view.KeyEvent;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -542,6 +543,11 @@ public class MainActivity extends CastEnabledActivity {
|
|||
//Hardware keyboard support
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
View currentFocus = getCurrentFocus();
|
||||
if (currentFocus instanceof EditText) {
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
|
||||
Integer customKeyCode = null;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.view.KeyEvent;
|
|||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.appcompat.view.menu.ActionMenuItem;
|
||||
|
@ -489,6 +490,11 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
//Hardware keyboard support
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
View currentFocus = getCurrentFocus();
|
||||
if (currentFocus instanceof EditText) {
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
|
||||
|
||||
switch (keyCode) {
|
||||
|
|
Loading…
Reference in New Issue