From c507bd179dcfd5d6cd9371b4c06eb228f06748d4 Mon Sep 17 00:00:00 2001 From: King Date: Fri, 2 Nov 2018 15:59:24 +0800 Subject: [PATCH] add ignore file --- .gitignore | 8 + README | 0 app/.gitignore | 2 + app/build.gradle | 39 +++++ app/proguard-rules.pro | 21 +++ .../passport/demo/ExampleInstrumentedTest.java | 26 ++++ app/src/main/AndroidManifest.xml | 52 +++++++ .../java/com/gump/passport/demo/MainActivity.java | 111 +++++++++++++ .../res/drawable-v24/ic_launcher_foreground.xml | 34 ++++ .../main/res/drawable/ic_launcher_background.xml | 171 ++++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 34 ++++ app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2963 bytes app/src/main/res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4905 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2060 bytes app/src/main/res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2783 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4490 bytes .../main/res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 6895 bytes app/src/main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6387 bytes .../main/res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10413 bytes app/src/main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9128 bytes .../main/res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15132 bytes app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/ids.xml | 22 +++ app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 11 ++ .../com/gump/passport/demo/ExampleUnitTest.java | 17 ++ build.gradle | 27 ++++ gradle.properties | 15 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 5 + gradlew | 172 +++++++++++++++++++++ gradlew.bat | 84 ++++++++++ settings.gradle | 1 + 35 files changed, 871 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/gump/passport/demo/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/gump/passport/demo/MainActivity.java create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/ids.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 app/src/test/java/com/gump/passport/demo/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09b993d --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..950eef7 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,2 @@ +/build +release diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..47df5b7 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 27 + defaultConfig { + applicationId "com.gump.passport.demo" + minSdkVersion 14 + targetSdkVersion 27 + versionCode 2 + versionName "1.0.1" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + applicationVariants.all{ + variant-> + variant.outputs.all{ + outputFileName = "SDKDemo-"+variant.name+defaultConfig.versionName+".apk" + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + + implementation project(':base') + implementation project(':passport') + implementation project(':payment') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/gump/passport/demo/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/gump/passport/demo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..81cd09f --- /dev/null +++ b/app/src/androidTest/java/com/gump/passport/demo/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.gump.passport.demo; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.gump.passport.demo", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9bc1a29 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/gump/passport/demo/MainActivity.java b/app/src/main/java/com/gump/passport/demo/MainActivity.java new file mode 100644 index 0000000..ccaa5bf --- /dev/null +++ b/app/src/main/java/com/gump/passport/demo/MainActivity.java @@ -0,0 +1,111 @@ +package com.gump.passport.demo; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.TextView; + +import com.gump.PaymentVersion; +import com.gump.SDKAgent; +import com.gump.gpassport.Actions; +import com.gump.gpassport.GamePlayer; +import com.gump.gpassport.Passport; +import com.gump.gpassport.StateListener; +import com.gump.payment.Payment; +import com.gump.payment.PurchaseCallback; + +public class MainActivity extends AppCompatActivity implements StateListener, PurchaseCallback { + + private static final String TAG = "Gump Demo"; + + private Passport passport; + + private TextView tvInfo; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + SDKAgent.init(getApplicationContext(), "100", "1000"); + + SDKAgent.getSettings().setDebug(true); + SDKAgent.getSettings().setScreenLandscape(true); + SDKAgent.getSettings().setPaymentVersion(PaymentVersion.V4); + + tvInfo = findViewById(R.id.info); + passport = new Passport.Builder().context(this).setListener(this).build(); + findViewById(R.id.login).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + passport.signIn(MainActivity.this); + } + }); + + + findViewById(R.id.iab).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Bundle payInfo = new Bundle(); + payInfo.putString("product", "180010"); + payInfo.putFloat("amount", 0.1f); + payInfo.putString("extraInfo", "This is demo!"); + payInfo.putString("serverId", "100"); + payInfo.putString("roleId", "41080"); + Payment.launchIAP(MainActivity.this, payInfo, MainActivity.this); + } + }); + + findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Bundle payInfo = new Bundle(); + payInfo.putString("product", "wa2"); + payInfo.putFloat("amount", 0.1f); + payInfo.putString("extraInfo", "This is demo!"); + payInfo.putString("serverId", "100"); + payInfo.putString("roleId", "41080"); + Payment.pay(MainActivity.this, payInfo, MainActivity.this); + } + }); + } + + @Override + protected void onResume() { + super.onResume(); + passport.onResume(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (!passport.onActivityResult(requestCode, resultCode, data)) + super.onActivityResult(requestCode, resultCode, data); + } + + @Override + public void onActionSucced(Actions action, GamePlayer player) { + tvInfo.setText("login succed! gump id=" + player.getId() + ",playerType=" + player.getPlayerType()); + } + + @Override + public void onActionFailured() { + tvInfo.setText("login has error"); + } + + @Override + public void onPurchaseCompleted() { + Log.i(TAG, "purchase completed"); + } + + @Override + public void onPurchaseError(int code, String msg) { + Log.i(TAG, "purchase error"); + } + + @Override + public void onPurchaseCanceled() { + Log.i(TAG, "purchase canceled"); + } +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..485bbd3 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..7ca0909 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..8436d9c --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,34 @@ + + + + + +