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 {
minSdkVersion 8
targetSdkVersion 19
versionCode 224
versionCode 225
versionName "1.4.10"
}
}

View File

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

View File

@ -3424,7 +3424,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
break;
}
case attach_location: {
if (!isGoogleMapsInstalled()) {
if (!isGoogleMapsInstalled() || parentActivity == null) {
return true;
}
LocationActivity fragment = new LocationActivity();
@ -3432,6 +3432,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
break;
}
case attach_document: {
if (parentActivity == null) {
return true;
}
DocumentSelectActivity fragment = new DocumentSelectActivity();
fragment.delegate = this;
((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"));
}
}
// if (views[currentViewNum] instanceof LoginActivityRegisterView) {
// ((LoginActivityRegisterView)views[currentViewNum]).avatarUpdater.onActivityResult(requestCode, resultCode, data);
// }
}
@Override

View File

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