mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
1aec794a34
// FREEBIE
31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
package org.thoughtcrime.securesms;
|
|
|
|
import android.os.Build;
|
|
import android.os.Build.VERSION;
|
|
import android.os.Build.VERSION_CODES;
|
|
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 (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) || super.onKeyDown(keyCode, event);
|
|
}
|
|
|
|
@Override
|
|
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
|
|
if (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) {
|
|
openOptionsMenu();
|
|
return true;
|
|
}
|
|
return super.onKeyUp(keyCode, event);
|
|
}
|
|
|
|
public static boolean isMenuWorkaroundRequired() {
|
|
return VERSION.SDK_INT < VERSION_CODES.KITKAT &&
|
|
VERSION.SDK_INT > VERSION_CODES.GINGERBREAD_MR1 &&
|
|
("LGE".equalsIgnoreCase(Build.MANUFACTURER) || "E6710".equalsIgnoreCase(Build.DEVICE));
|
|
}
|
|
}
|