Permalink
Browse files

upgrade to SMSSDK 3.0.0

  • Loading branch information...
shijiewei committed Jun 13, 2017
1 parent 419db4e commit f288c4922adc10c9286eac8da93fb6ecf2929407
Showing with 1,034 additions and 696 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 Classes/AppDelegate.cpp
  3. +13 −13 Classes/SMSSDK/Android/SMSSDK_android.cpp
  4. +20 −15 Classes/SMSSDK/Android/SMSSDK_android.h
  5. +11 −11 Classes/SMSSDK/SMSSDK.cpp
  6. +1 −1 proj.android-studio/app/AndroidManifest.xml
  7. +2 −2 proj.android-studio/app/build.gradle
  8. +7 −0 proj.android-studio/app/jni/hellocpp/main.cpp
  9. BIN proj.android-studio/app/libs/MobCommons-2016.1201.1839.jar
  10. BIN proj.android-studio/app/libs/MobCommons-2017.0607.1736.jar
  11. BIN proj.android-studio/app/libs/MobTools-2016.1201.1839.jar
  12. BIN proj.android-studio/app/libs/MobTools-2017.0607.1736.jar
  13. BIN proj.android-studio/app/libs/SMSSDK-2.1.3.aar
  14. BIN proj.android-studio/app/libs/SMSSDK-3.0.0.aar
  15. BIN proj.android-studio/app/libs/{SMSSDKGUI-2.1.3.aar → SMSSDKGUI-3.0.0.aar}
  16. +9 −3 proj.android-studio/app/src/cn/smssdk/cocos2dx/SMSSDKBridge.java
  17. +1 −1 proj.android/.classpath
  18. +82 −11 proj.android/.cproject
  19. +8 −1 proj.android/jni/hellocpp/main.cpp
  20. BIN proj.android/libs/MobCommons-2016.1201.1839.jar
  21. BIN proj.android/libs/MobCommons-2017.0607.1736.jar
  22. BIN proj.android/libs/MobTools-2016.1201.1839.jar
  23. BIN proj.android/libs/MobTools-2017.0607.1736.jar
  24. BIN proj.android/libs/SMSSDK-2.1.3.jar
  25. BIN proj.android/libs/SMSSDK-3.0.0.jar
  26. BIN proj.android/libs/armeabi/libMyGame.so
  27. +41 −1 proj.android/res/values-en/smssdk_errors.xml
  28. +41 −0 proj.android/res/values/smssdk_errors.xml
  29. +40 −0 proj.android/res/values/smssdk_ids.xml
  30. +15 −0 proj.android/res/values/smssdk_styles.xml
  31. +7 −4 proj.android/src/cn/smssdk/cocos2dx/SMSSDKBridge.java
  32. +10 −5 proj.android/src/cn/smssdk/gui/CommonDialog.java
  33. +35 −34 proj.android/src/cn/smssdk/gui/ContactDetailPage.java
  34. +4 −2 proj.android/src/cn/smssdk/gui/ContactEntry.java
  35. +4 −2 proj.android/src/cn/smssdk/gui/ContactItemMaker.java
  36. +13 −9 proj.android/src/cn/smssdk/gui/ContactsAdapter.java
  37. +10 −8 proj.android/src/cn/smssdk/gui/ContactsListView.java
  38. +38 −37 proj.android/src/cn/smssdk/gui/ContactsPage.java
  39. +20 −16 proj.android/src/cn/smssdk/gui/CountryAdapter.java
  40. +24 −23 proj.android/src/cn/smssdk/gui/CountryListView.java
  41. +33 −32 proj.android/src/cn/smssdk/gui/CountryPage.java
  42. +26 −25 proj.android/src/cn/smssdk/gui/DefaultContactViewItem.java
  43. +4 −2 proj.android/src/cn/smssdk/gui/GroupListView.java
  44. +84 −88 proj.android/src/cn/smssdk/gui/IdentifyNumPage.java
  45. +50 −53 proj.android/src/cn/smssdk/gui/RegisterPage.java
  46. +16 −13 proj.android/src/cn/smssdk/gui/SMSReceiver.java
  47. +5 −4 proj.android/src/cn/smssdk/gui/SearchEngine.java
  48. +38 −39 proj.android/src/cn/smssdk/gui/SmartVerifyPage.java
  49. +17 −11 proj.android/src/cn/smssdk/gui/layout/BackVerifyDialogLayout.java
  50. +6 −3 proj.android/src/cn/smssdk/gui/layout/BasePageLayout.java
  51. +27 −17 proj.android/src/cn/smssdk/gui/layout/ContactDetailPageLayout.java
  52. +11 −5 proj.android/src/cn/smssdk/gui/layout/ContactListPageLayout.java
  53. +22 −14 proj.android/src/cn/smssdk/gui/layout/ContactsListviewItemLayout.java
  54. +11 −5 proj.android/src/cn/smssdk/gui/layout/CountryListPageLayout.java
  55. +20 −18 proj.android/src/cn/smssdk/gui/layout/DrawableHelper.java
  56. +35 −24 proj.android/src/cn/smssdk/gui/layout/IdentifyNumPageLayout.java
  57. +13 −28 proj.android/src/cn/smssdk/gui/layout/LayoutFactory.java
  58. +11 −7 proj.android/src/cn/smssdk/gui/layout/ListviewTitleLayout.java
  59. +8 −4 proj.android/src/cn/smssdk/gui/layout/ProgressDialogLayout.java
  60. +33 −21 proj.android/src/cn/smssdk/gui/layout/RegisterPageLayout.java
  61. +27 −16 proj.android/src/cn/smssdk/gui/layout/SendMsgDialogLayout.java
  62. +5 −3 proj.android/src/cn/smssdk/gui/layout/SizeHelper.java
  63. +72 −63 proj.android/src/cn/smssdk/gui/layout/TitleLayout.java
View
@@ -27,6 +27,7 @@ Thumbs.db
# Eclipse project files
.classpath
.project
.settings/
# Android Studio
*.iml
@@ -39,3 +40,4 @@ build/
#NDK
obj/
proj.android/ant.properties
View
@@ -90,7 +90,7 @@ void AppDelegate::applicationWillEnterForeground()
void AppDelegate::initSMSSDK()
{
string appKey("f3fc6baa9ac4");
string appSecret("7f3dedcb36d92deebcb373af921d635a");
string appKey("moba6b6c6d6");
string appSecret("b89d2427a3bc7ad1aea1e1e8c1d36bf3");
SMSSDK::init(appKey,appSecret,false);
}
@@ -45,16 +45,16 @@ JNIEXPORT void JNICALL Java_cn_smssdk_cocos2dx_SMSSDKBridge_onJavaCallback
dic->release();
}
bool getMethod(JniMethodInfo &mi, const char *methodName, const char *paramCode) {
bool SMSSDK_android::getMethod(JniMethodInfo &mi, const char *methodName, const char *paramCode) {
return JniHelper::getStaticMethodInfo(mi, "cn/smssdk/cocos2dx/SMSSDKBridge", methodName, paramCode);
}
void releaseMethod(JniMethodInfo &mi) {
void SMSSDK_android::releaseMethod(JniMethodInfo &mi) {
if(mi.classID != NULL)
mi.env->DeleteLocalRef(mi.classID);
}
bool initSDKJNI(string appKey, string appSecret, bool isWarn) {
bool SMSSDK_android::initSDKJNI(string appKey, string appSecret, bool isWarn) {
JniMethodInfo mi;
bool isHave = getMethod(mi, "init", "(Ljava/lang/String;Ljava/lang/String;Z)V");
if (!isHave) {
@@ -70,7 +70,7 @@ bool initSDKJNI(string appKey, string appSecret, bool isWarn) {
return true;
}
bool getCodeJNI(SMSSDKCodeType type, string zone, string phone) {
bool SMSSDK_android::getCodeJNI(SMSSDKCodeType type, string zone, string phone) {
JniMethodInfo mi;
bool isHave;
if(type == TextCode) {
@@ -91,7 +91,7 @@ bool getCodeJNI(SMSSDKCodeType type, string zone, string phone) {
return true;
}
bool commitCodeJNI(string zone, string phone, string code) {
bool SMSSDK_android::commitCodeJNI(string zone, string phone, string code) {
JniMethodInfo mi;
bool isHave = getMethod(mi, "commitCode", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
if (!isHave) {
@@ -107,7 +107,7 @@ bool commitCodeJNI(string zone, string phone, string code) {
return true;
}
bool getSupportedCountriesJNI() {
bool SMSSDK_android::getSupportedCountriesJNI() {
JniMethodInfo mi;
bool isHave = getMethod(mi, "getSupportedCountries", "()V");
if (!isHave) {
@@ -119,7 +119,7 @@ bool getSupportedCountriesJNI() {
return true;
}
bool getFriendsJNI() {
bool SMSSDK_android::getFriendsJNI() {
JniMethodInfo mi;
bool isHave = getMethod(mi, "getFriendsInApp", "()V");
if (!isHave) {
@@ -131,7 +131,7 @@ bool getFriendsJNI() {
return true;
}
bool submitUserInfoJNI(UserInfo &userinfo){
bool SMSSDK_android::submitUserInfoJNI(UserInfo &userinfo){
JniMethodInfo mi;
bool isHave = getMethod(mi, "submitUserInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
if (!isHave) {
@@ -148,7 +148,7 @@ bool submitUserInfoJNI(UserInfo &userinfo){
return true;
}
string getVersionJNI(){
string SMSSDK_android::getVersionJNI(){
JniMethodInfo mi;
bool isHave = getMethod(mi, "getVersion", "()Ljava/lang/String;");
if(!isHave){
@@ -161,7 +161,7 @@ string getVersionJNI(){
}
bool enableWarnJNI(bool isWarn){
bool SMSSDK_android::enableWarnJNI(bool isWarn){
JniMethodInfo mi;
bool isHave = getMethod(mi, "enableWarn", "(Z)V");
if (!isHave) {
@@ -174,7 +174,7 @@ bool enableWarnJNI(bool isWarn){
return true;
}
bool showRegisterPageJNI()
bool SMSSDK_android::showRegisterPageJNI()
{
JniMethodInfo mi;
bool isHave = getMethod(mi, "showRegisterPage", "()V");
@@ -187,7 +187,7 @@ bool showRegisterPageJNI()
return true;
}
bool showContactsPageJNI()
bool SMSSDK_android::showContactsPageJNI()
{
JniMethodInfo mi;
bool isHave = getMethod(mi, "showContactsPage", "()V");
@@ -201,7 +201,7 @@ bool showContactsPageJNI()
return true;
}
void setHandlerAndroid(SMSSDKHandler* handler)
void SMSSDK_android::setHandlerAndroid(SMSSDKHandler* handler)
{
_handler = handler;
}
@@ -29,33 +29,38 @@ extern "C" {
*/
JNIEXPORT void JNICALL Java_cn_smssdk_cocos2dx_SMSSDKBridge_onJavaCallback
(JNIEnv * env, jclass thiz, jstring resp);
namespace smssdk {
class SMSSDK_android
{
public:
static bool getMethod(JniMethodInfo &mi, const char *methodName, const char *paramCode);
bool getMethod(JniMethodInfo &mi, const char *methodName, const char *paramCode);
static void releaseMethod(JniMethodInfo &mi);
void releaseMethod(JniMethodInfo &mi);
//jni methods
static bool initSDKJNI(string appKey, string appSecret, bool isWarn);
//jni methods
bool initSDKJNI(string appKey, string appSecret, bool isWarn);
static bool getCodeJNI(SMSSDKCodeType codetype,string zone,string phone);
bool getCodeJNI(SMSSDKCodeType codetype,string zone,string phone);
static bool commitCodeJNI(string zone, string phone, string code);
bool commitCodeJNI(string zone, string phone, string code);
static bool getSupportedCountriesJNI();
bool getSupportedCountriesJNI();
static bool getFriendsJNI();
bool getFriendsJNI();
static bool submitUserInfoJNI(UserInfo& userinfo);
bool submitUserInfoJNI(UserInfo& userinfo);
static string getVersionJNI();
string getVersionJNI();
static bool enableWarnJNI(bool isWarn);
bool enableWarnJNI(bool isWarn);
static bool showRegisterPageJNI();
bool showRegisterPageJNI();
static bool showContactsPageJNI();
bool showContactsPageJNI();
void setHandlerAndroid(SMSSDKHandler* handler);
static void setHandlerAndroid(SMSSDKHandler* handler);
};
}
#ifdef __cplusplus
}
View
@@ -24,7 +24,7 @@ bool SMSSDK::init(string appKey, string appSecret, bool isWarn)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return initSDKJNI(appKey, appSecret, isWarn);
return SMSSDK_android::initSDKJNI(appKey, appSecret, isWarn);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -40,7 +40,7 @@ bool SMSSDK::getCode(SMSSDKCodeType codeType, string phone, string zone)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return getCodeJNI(codeType, zone, phone);
return SMSSDK_android::getCodeJNI(codeType, zone, phone);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -55,7 +55,7 @@ bool SMSSDK::commitCode(string phone, string zone, string code)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return commitCodeJNI(zone, phone, code);
return SMSSDK_android::commitCodeJNI(zone, phone, code);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -71,7 +71,7 @@ bool SMSSDK::getSupportedCountries()
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return getSupportedCountriesJNI();
return SMSSDK_android::getSupportedCountriesJNI();
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -87,7 +87,7 @@ bool SMSSDK::getFriends()
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return getFriendsJNI();
return SMSSDK_android::getFriendsJNI();
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
//iOS
@@ -103,7 +103,7 @@ bool SMSSDK::submitUserInfo(UserInfo &userinfo)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return submitUserInfoJNI(userinfo);
return SMSSDK_android::submitUserInfoJNI(userinfo);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
//iOS
@@ -118,7 +118,7 @@ string SMSSDK::getVersion()
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return getVersionJNI();
return SMSSDK_android::getVersionJNI();
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -134,7 +134,7 @@ bool SMSSDK::enableWarn(bool isWarn)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return enableWarnJNI(isWarn);
return SMSSDK_android::enableWarnJNI(isWarn);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -150,7 +150,7 @@ bool SMSSDK::showRegisterPage(SMSSDKCodeType type)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return showRegisterPageJNI();
return SMSSDK_android::showRegisterPageJNI();
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -166,7 +166,7 @@ bool SMSSDK::showContactsPage()
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Andorid
return showContactsPageJNI();
return SMSSDK_android::showContactsPageJNI();
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -182,7 +182,7 @@ void SMSSDK::setHandler(SMSSDKHandler* handler)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//Android
setHandlerAndroid(handler);
SMSSDK_android::setHandlerAndroid(handler);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
@@ -16,7 +16,7 @@
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:screenOrientation="landscape"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
@@ -63,8 +63,8 @@ repositories {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libcocos2dx')
compile name:'SMSSDK-2.1.3', ext:'aar'
compile name:'SMSSDKGUI-2.1.3', ext:'aar'
compile name:'SMSSDK-3.0.0', ext:'aar'
compile name:'SMSSDKGUI-3.0.0', ext:'aar'
}
task cleanAssets(type: Delete) {
@@ -9,6 +9,13 @@
using namespace cocos2d;
// Cocos2dx sdk 3.7以下
// void cocos_android_app_init (JNIEnv* env, jobject thiz) {
// LOGD("cocos_android_app_init");
// AppDelegate *pAppDelegate = new AppDelegate();
// }
// Cocos2dx sdk 3.7及以上
void cocos_android_app_init (JNIEnv* env) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,8 @@
import android.text.TextUtils;
import android.util.Log;
import com.mob.MobSDK;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.plugin.PluginWrapper;
@@ -15,6 +17,7 @@
import cn.smssdk.utils.SPHelper;
public class SMSSDKBridge {
private static final String TAG = SMSSDKBridge.class.getSimpleName();
private static boolean DEBUG = true;
private static Context context;
@@ -27,8 +30,11 @@ public static void init(String appKey, String appSecret, boolean isWarn) {
}
if(Looper.myLooper() == null)
Looper.prepare();
SMSSDK.initSDK(context,appKey,appSecret,isWarn);
EventHandler handler = new EventHandler(){
MobSDK.init(context, appKey, appSecret);
if (isWarn) {
SMSSDK.setAskPermisionOnReadContact(isWarn);
}
EventHandler handler = new EventHandler(){
public void afterEvent(int event, int result, Object data) {
final String resp = JavaTools.javaActionResToCS(event, result, data);
Log.e("COCOS2D",resp);
@@ -74,7 +80,7 @@ public static String getVersion() {
}
public static void enableWarn(boolean isWarn) {
SPHelper.getInstance(context).setWarnWhenReadContact(isWarn);
SPHelper.getInstance().setWarnWhenReadContact(isWarn);
}
public static void showRegisterPage() {
View
@@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Oops, something went wrong.

0 comments on commit f288c49

Please sign in to comment.