mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 23:13:38 +00:00
Workaround for LGE-related NPEs
See: https://code.google.com/p/android/issues/detail?id=78154 Fixes #2424 Closes #2428 // FREEBIE
This commit is contained in:
parent
8aa0f15740
commit
f092e85b62
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -44,7 +43,7 @@ import org.whispersystems.textsecure.api.push.PushAddress;
|
|||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AutoInitiateActivity extends Activity {
|
public class AutoInitiateActivity extends BaseActivity {
|
||||||
|
|
||||||
private long threadId;
|
private long threadId;
|
||||||
private Recipient recipient;
|
private Recipient recipient;
|
||||||
|
22
src/org/thoughtcrime/securesms/BaseActionBarActivity.java
Normal file
22
src/org/thoughtcrime/securesms/BaseActionBarActivity.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class BaseActionBarActivity extends ActionBarActivity {
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
return BaseActivity.isKeyCodeWorkaroundRequired(keyCode) || super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
|
||||||
|
if (BaseActivity.isKeyCodeWorkaroundRequired(keyCode)) {
|
||||||
|
openOptionsMenu();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onKeyUp(keyCode, event);
|
||||||
|
}
|
||||||
|
}
|
28
src/org/thoughtcrime/securesms/BaseActivity.java
Normal file
28
src/org/thoughtcrime/securesms/BaseActivity.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
public class CountrySelectionActivity extends BaseActivity
|
||||||
|
|
||||||
public class CountrySelectionActivity extends FragmentActivity
|
|
||||||
implements CountrySelectionFragment.CountrySelectedListener
|
implements CountrySelectionFragment.CountrySelectedListener
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -49,7 +48,7 @@ import java.io.File;
|
|||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
public class DatabaseUpgradeActivity extends Activity {
|
public class DatabaseUpgradeActivity extends BaseActivity {
|
||||||
|
|
||||||
public static final int NO_MORE_KEY_EXCHANGE_PREFIX_VERSION = 46;
|
public static final int NO_MORE_KEY_EXCHANGE_PREFIX_VERSION = 46;
|
||||||
public static final int MMS_BODY_VERSION = 46;
|
public static final int MMS_BODY_VERSION = 46;
|
||||||
|
@ -11,7 +11,7 @@ import org.whispersystems.libpastelog.SubmitLogFragment;
|
|||||||
/**
|
/**
|
||||||
* Activity for submitting logcat logs to a pastebin service.
|
* Activity for submitting logcat logs to a pastebin service.
|
||||||
*/
|
*/
|
||||||
public class LogSubmitActivity extends ActionBarActivity implements SubmitLogFragment.OnLogSubmittedListener {
|
public class LogSubmitActivity extends BaseActionBarActivity implements SubmitLogFragment.OnLogSubmittedListener {
|
||||||
private static final String TAG = LogSubmitActivity.class.getSimpleName();
|
private static final String TAG = LogSubmitActivity.class.getSimpleName();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +33,7 @@ import org.thoughtcrime.securesms.util.MemoryCleaner;
|
|||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
public abstract class PassphraseActivity extends ActionBarActivity {
|
public abstract class PassphraseActivity extends BaseActionBarActivity {
|
||||||
|
|
||||||
private KeyCachingService keyCachingService;
|
private KeyCachingService keyCachingService;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
|
|
||||||
public class PassphraseRequiredActionBarActivity extends ActionBarActivity implements PassphraseRequiredActivity {
|
public class PassphraseRequiredActionBarActivity extends BaseActionBarActivity implements PassphraseRequiredActivity {
|
||||||
|
|
||||||
private final PassphraseRequiredMixin delegate = new PassphraseRequiredMixin();
|
private final PassphraseRequiredMixin delegate = new PassphraseRequiredMixin();
|
||||||
|
|
||||||
@ -40,5 +39,4 @@ public class PassphraseRequiredActionBarActivity extends ActionBarActivity imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewMasterSecret(MasterSecret masterSecret) {}
|
public void onNewMasterSecret(MasterSecret masterSecret) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -68,7 +67,7 @@ import java.io.IOException;
|
|||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ReceiveKeyActivity extends Activity {
|
public class ReceiveKeyActivity extends BaseActivity {
|
||||||
|
|
||||||
private TextView descriptionText;
|
private TextView descriptionText;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ import org.whispersystems.textsecure.api.util.PhoneNumberFormatter;
|
|||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RegistrationActivity extends ActionBarActivity {
|
public class RegistrationActivity extends BaseActionBarActivity {
|
||||||
|
|
||||||
private static final int PICK_COUNTRY = 1;
|
private static final int PICK_COUNTRY = 1;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import android.view.View;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
|
|
||||||
public class RegistrationProblemsActivity extends ActionBarActivity {
|
public class RegistrationProblemsActivity extends BaseActionBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle) {
|
public void onCreate(Bundle bundle) {
|
||||||
|
@ -46,7 +46,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import static org.thoughtcrime.securesms.service.RegistrationService.RegistrationState;
|
import static org.thoughtcrime.securesms.service.RegistrationService.RegistrationState;
|
||||||
|
|
||||||
public class RegistrationProgressActivity extends ActionBarActivity {
|
public class RegistrationProgressActivity extends BaseActionBarActivity {
|
||||||
|
|
||||||
private static final int FOCUSED_COLOR = Color.parseColor("#ff333333");
|
private static final int FOCUSED_COLOR = Color.parseColor("#ff333333");
|
||||||
private static final int UNFOCUSED_COLOR = Color.parseColor("#ff808080");
|
private static final int UNFOCUSED_COLOR = Color.parseColor("#ff808080");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user