cpp-117: java.lang.NullPointerException : at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:987)
Fixes #117
This commit is contained in:
parent
16e7095fb5
commit
95df8a7cdc
@ -25,7 +25,10 @@ package org.solovyev.android.calculator;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.solovyev.android.UiThreadExecutor;
|
import org.solovyev.android.UiThreadExecutor;
|
||||||
import org.solovyev.android.Views;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.calculator.ga.Ga;
|
import org.solovyev.android.calculator.ga.Ga;
|
||||||
@ -92,6 +95,9 @@ public final class App {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private static final Products products = Products.create().add(ProductTypes.IN_APP, Arrays.asList("ad_free"));
|
private static final Products products = Products.create().add(ProductTypes.IN_APP, Arrays.asList("ad_free"));
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static Boolean lg = null;
|
||||||
|
|
||||||
private App() {
|
private App() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
@ -230,4 +236,17 @@ public final class App {
|
|||||||
public static Preferences.Gui.Theme getTheme() {
|
public static Preferences.Gui.Theme getTheme() {
|
||||||
return Preferences.Gui.getTheme(getPreferences());
|
return Preferences.Gui.getTheme(getPreferences());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLg() {
|
||||||
|
if (lg == null) {
|
||||||
|
lg = "lge".equalsIgnoreCase(Build.BRAND) || "lge".equalsIgnoreCase(Build.MANUFACTURER);
|
||||||
|
}
|
||||||
|
return lg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// see https://code.google.com/p/android/issues/detail?id=78154
|
||||||
|
// and http://developer.lge.com/community/forums/RetrieveForumContent.dev?detailContsId=FC29190703
|
||||||
|
public static boolean shouldOpenMenuManually() {
|
||||||
|
return isLg() && Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package org.solovyev.android.calculator;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -54,6 +55,15 @@ public class BaseActivity extends ActionBarActivity {
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (App.shouldOpenMenuManually() && keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
|
openOptionsMenu();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
Loading…
Reference in New Issue
Block a user