Added some additional checks

This commit is contained in:
DrKLO 2014-04-05 04:00:47 +04:00
parent e8b3375df0
commit d0a686fccb
5 changed files with 36 additions and 21 deletions

View file

@ -82,7 +82,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 224 versionCode 225
versionName "1.4.10" versionName "1.4.10"
} }
} }

View file

@ -40,6 +40,7 @@ public class NativeLoader {
long libSize = 0; long libSize = 0;
long libSize2 = 0; long libSize2 = 0;
try {
if (Build.CPU_ABI.equalsIgnoreCase("armeabi-v7a")) { if (Build.CPU_ABI.equalsIgnoreCase("armeabi-v7a")) {
folder = "armeabi-v7a"; folder = "armeabi-v7a";
libSize = sizes[1]; libSize = sizes[1];
@ -55,11 +56,18 @@ public class NativeLoader {
folder = "mips"; folder = "mips";
libSize = sizes[3]; libSize = sizes[3];
} else { } else {
System.loadLibrary("tmessages"); folder = "armeabi";
nativeLoaded = true; libSize = sizes[0];
libSize2 = sizes[1];
FileLog.e("tmessages", "Unsupported arch: " + Build.CPU_ABI); FileLog.e("tmessages", "Unsupported arch: " + Build.CPU_ABI);
return;
} }
} catch (Exception e) {
FileLog.e("tmessages", e);
folder = "armeabi";
libSize = sizes[0];
libSize2 = sizes[1];
}
File destFile = new File(context.getApplicationInfo().nativeLibraryDir + "/libtmessages.so"); File destFile = new File(context.getApplicationInfo().nativeLibraryDir + "/libtmessages.so");
if (destFile.exists() && (destFile.length() == libSize || libSize2 != 0 && destFile.length() == libSize2)) { if (destFile.exists() && (destFile.length() == libSize || libSize2 != 0 && destFile.length() == libSize2)) {

View file

@ -3424,7 +3424,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
break; break;
} }
case attach_location: { case attach_location: {
if (!isGoogleMapsInstalled()) { if (!isGoogleMapsInstalled() || parentActivity == null) {
return true; return true;
} }
LocationActivity fragment = new LocationActivity(); LocationActivity fragment = new LocationActivity();
@ -3432,6 +3432,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
break; break;
} }
case attach_document: { case attach_document: {
if (parentActivity == null) {
return true;
}
DocumentSelectActivity fragment = new DocumentSelectActivity(); DocumentSelectActivity fragment = new DocumentSelectActivity();
fragment.delegate = this; fragment.delegate = this;
((LaunchActivity)parentActivity).presentFragment(fragment, "document", false); ((LaunchActivity)parentActivity).presentFragment(fragment, "document", false);

View file

@ -45,9 +45,6 @@ public class LoginActivity extends ActionBarActivity implements SlideView.SlideV
((LoginActivityPhoneView)views[0]).selectCountry(data.getStringExtra("country")); ((LoginActivityPhoneView)views[0]).selectCountry(data.getStringExtra("country"));
} }
} }
// if (views[currentViewNum] instanceof LoginActivityRegisterView) {
// ((LoginActivityRegisterView)views[currentViewNum]).avatarUpdater.onActivityResult(requestCode, resultCode, data);
// }
} }
@Override @Override

View file

@ -105,6 +105,9 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
@Override @Override
public void setParams(Bundle params) { public void setParams(Bundle params) {
if (params == null) {
return;
}
codeField.setText(""); codeField.setText("");
Utilities.setWaitingForSms(true); Utilities.setWaitingForSms(true);
NotificationCenter.getInstance().addObserver(this, 998); NotificationCenter.getInstance().addObserver(this, 998);
@ -116,6 +119,10 @@ public class LoginActivitySmsView extends SlideView implements NotificationCente
registered = params.getString("registered"); registered = params.getString("registered");
time = params.getInt("calltime"); time = params.getInt("calltime");
if (phone == null) {
return;
}
String number = PhoneFormat.getInstance().format(phone); String number = PhoneFormat.getInstance().format(phone);
confirmTextView.setText(Html.fromHtml(String.format(ApplicationLoader.applicationContext.getResources().getString(R.string.SentSmsCode) + " <b>%s</b>", number))); confirmTextView.setText(Html.fromHtml(String.format(ApplicationLoader.applicationContext.getResources().getString(R.string.SentSmsCode) + " <b>%s</b>", number)));