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.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -542,6 +543,11 @@ public class MainActivity extends CastEnabledActivity {
|
||||||
//Hardware keyboard support
|
//Hardware keyboard support
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
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);
|
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
|
||||||
Integer customKeyCode = null;
|
Integer customKeyCode = null;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.view.KeyEvent;
|
||||||
import android.view.animation.AlphaAnimation;
|
import android.view.animation.AlphaAnimation;
|
||||||
import android.view.animation.AnimationSet;
|
import android.view.animation.AnimationSet;
|
||||||
import android.view.animation.ScaleAnimation;
|
import android.view.animation.ScaleAnimation;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.appcompat.view.menu.ActionMenuItem;
|
import androidx.appcompat.view.menu.ActionMenuItem;
|
||||||
|
@ -489,6 +490,11 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
||||||
//Hardware keyboard support
|
//Hardware keyboard support
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
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);
|
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
|
||||||
|
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
|
|
Loading…
Reference in New Issue