mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-29 04:55:15 +00:00
29 lines
855 B
Java
29 lines
855 B
Java
|
package org.thoughtcrime.securesms;
|
||
|
|
||
|
import android.os.Build;
|
||
|
import android.support.annotation.NonNull;
|
||
|
import android.support.v4.app.FragmentActivity;
|
||
|
import android.view.KeyEvent;
|
||
|
|
||
|
public abstract class BaseActivity extends FragmentActivity {
|
||
|
@Override
|
||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||
|
return isKeyCodeWorkaroundRequired(keyCode) || super.onKeyDown(keyCode, event);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
|
||
|
if (isKeyCodeWorkaroundRequired(keyCode)) {
|
||
|
openOptionsMenu();
|
||
|
return true;
|
||
|
}
|
||
|
return super.onKeyUp(keyCode, event);
|
||
|
}
|
||
|
|
||
|
public static boolean isKeyCodeWorkaroundRequired(int keyCode) {
|
||
|
return (keyCode == KeyEvent.KEYCODE_MENU) &&
|
||
|
(Build.VERSION.SDK_INT == 16) &&
|
||
|
("LGE".equalsIgnoreCase(Build.MANUFACTURER));
|
||
|
}
|
||
|
}
|