From f6989f0ef5f2789462d03674fb988acda2d25bf5 Mon Sep 17 00:00:00 2001 From: "Keith D. Feldman" Date: Fri, 1 Jul 2016 13:19:20 -0600 Subject: [PATCH] 3.0 Release --- .gitignore | 9 + CHANGELOG.md | 7 + CheckoutExample/.gitignore | 8 + CheckoutExample/.idea/.name | 1 + CheckoutExample/.idea/compiler.xml | 22 +++ .../.idea/copyright/profiles_settings.xml | 3 + CheckoutExample/.idea/encodings.xml | 6 + CheckoutExample/.idea/gradle.xml | 24 +++ CheckoutExample/.idea/misc.xml | 46 +++++ CheckoutExample/.idea/modules.xml | 9 + CheckoutExample/.idea/runConfigurations.xml | 12 ++ CheckoutExample/app/.gitignore | 1 + CheckoutExample/app/build.gradle | 27 +++ CheckoutExample/app/proguard-rules.pro | 17 ++ .../app/src/main/AndroidManifest.xml | 35 ++++ .../checkoutexample/CollectionActivity.java | 39 +++++ .../kount/checkoutexample/MainActivity.java | 99 +++++++++++ .../main/res/layout/activity_collection.xml | 19 +++ .../app/src/main/res/layout/activity_main.xml | 101 +++++++++++ .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes .../app/src/main/res/values-w820dp/dimens.xml | 6 + .../app/src/main/res/values/colors.xml | 6 + .../app/src/main/res/values/dimens.xml | 5 + .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 11 ++ CheckoutExample/build.gradle | 23 +++ CheckoutExample/gradle.properties | 18 ++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + CheckoutExample/gradlew | 160 ++++++++++++++++++ CheckoutExample/gradlew.bat | 90 ++++++++++ CheckoutExample/settings.gradle | 1 + .../kount-data-collector-3.0.jar | Bin 0 -> 37931 bytes README.md | 129 ++++++++++++++ 38 files changed, 943 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 CheckoutExample/.gitignore create mode 100644 CheckoutExample/.idea/.name create mode 100644 CheckoutExample/.idea/compiler.xml create mode 100644 CheckoutExample/.idea/copyright/profiles_settings.xml create mode 100644 CheckoutExample/.idea/encodings.xml create mode 100644 CheckoutExample/.idea/gradle.xml create mode 100644 CheckoutExample/.idea/misc.xml create mode 100644 CheckoutExample/.idea/modules.xml create mode 100644 CheckoutExample/.idea/runConfigurations.xml create mode 100644 CheckoutExample/app/.gitignore create mode 100644 CheckoutExample/app/build.gradle create mode 100644 CheckoutExample/app/proguard-rules.pro create mode 100644 CheckoutExample/app/src/main/AndroidManifest.xml create mode 100644 CheckoutExample/app/src/main/java/com/kount/checkoutexample/CollectionActivity.java create mode 100644 CheckoutExample/app/src/main/java/com/kount/checkoutexample/MainActivity.java create mode 100644 CheckoutExample/app/src/main/res/layout/activity_collection.xml create mode 100644 CheckoutExample/app/src/main/res/layout/activity_main.xml create mode 100644 CheckoutExample/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 CheckoutExample/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 CheckoutExample/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 CheckoutExample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 CheckoutExample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 CheckoutExample/app/src/main/res/values-w820dp/dimens.xml create mode 100644 CheckoutExample/app/src/main/res/values/colors.xml create mode 100644 CheckoutExample/app/src/main/res/values/dimens.xml create mode 100644 CheckoutExample/app/src/main/res/values/strings.xml create mode 100644 CheckoutExample/app/src/main/res/values/styles.xml create mode 100644 CheckoutExample/build.gradle create mode 100644 CheckoutExample/gradle.properties create mode 100644 CheckoutExample/gradle/wrapper/gradle-wrapper.jar create mode 100644 CheckoutExample/gradle/wrapper/gradle-wrapper.properties create mode 100755 CheckoutExample/gradlew create mode 100644 CheckoutExample/gradlew.bat create mode 100644 CheckoutExample/settings.gradle create mode 100644 KountDataCollector/kount-data-collector-3.0.jar create mode 100644 README.md diff --git a/.gitignore b/.gitignore index e69de29..d65f388 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7564e1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Android SDK Release Notes + +## 3.0 +* Updated SDK with more intuitive configuration and collection +* Improved collection capabilities + + diff --git a/CheckoutExample/.gitignore b/CheckoutExample/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/CheckoutExample/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/CheckoutExample/.idea/.name b/CheckoutExample/.idea/.name new file mode 100644 index 0000000..e0e9371 --- /dev/null +++ b/CheckoutExample/.idea/.name @@ -0,0 +1 @@ +CheckoutExample \ No newline at end of file diff --git a/CheckoutExample/.idea/compiler.xml b/CheckoutExample/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/CheckoutExample/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/copyright/profiles_settings.xml b/CheckoutExample/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/CheckoutExample/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/encodings.xml b/CheckoutExample/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/CheckoutExample/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/gradle.xml b/CheckoutExample/.idea/gradle.xml new file mode 100644 index 0000000..58992cc --- /dev/null +++ b/CheckoutExample/.idea/gradle.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/misc.xml b/CheckoutExample/.idea/misc.xml new file mode 100644 index 0000000..1a3eaff --- /dev/null +++ b/CheckoutExample/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/modules.xml b/CheckoutExample/.idea/modules.xml new file mode 100644 index 0000000..6d96e55 --- /dev/null +++ b/CheckoutExample/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/CheckoutExample/.idea/runConfigurations.xml b/CheckoutExample/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/CheckoutExample/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/CheckoutExample/app/.gitignore b/CheckoutExample/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/CheckoutExample/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/CheckoutExample/app/build.gradle b/CheckoutExample/app/build.gradle new file mode 100644 index 0000000..a40ca09 --- /dev/null +++ b/CheckoutExample/app/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + applicationId "com.kount.checkoutexample" + minSdkVersion 10 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(dir: '../../KountDataCollector', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.3.0' +} diff --git a/CheckoutExample/app/proguard-rules.pro b/CheckoutExample/app/proguard-rules.pro new file mode 100644 index 0000000..39dfae1 --- /dev/null +++ b/CheckoutExample/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/kdf/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# 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 *; +#} diff --git a/CheckoutExample/app/src/main/AndroidManifest.xml b/CheckoutExample/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..970d9c4 --- /dev/null +++ b/CheckoutExample/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CheckoutExample/app/src/main/java/com/kount/checkoutexample/CollectionActivity.java b/CheckoutExample/app/src/main/java/com/kount/checkoutexample/CollectionActivity.java new file mode 100644 index 0000000..6199940 --- /dev/null +++ b/CheckoutExample/app/src/main/java/com/kount/checkoutexample/CollectionActivity.java @@ -0,0 +1,39 @@ +package com.kount.checkoutexample; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.widget.TextView; + +import com.kount.api.DataCollector; + +import java.util.UUID; + +public class CollectionActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_collection); + setTitle("Checkout Page"); + + final TextView textArea = (TextView) findViewById(R.id.textarea); + textArea.append("Collection Starting\n\n"); + + String sessionID = UUID.randomUUID().toString(); + sessionID = sessionID.replace("-", ""); + textArea.append("Session ID:\n" + sessionID + "\n\n"); + + DataCollector.getInstance().collectForSession(sessionID, new DataCollector.CompletionHandler() { + @Override + public void completed(String s) { + textArea.append("Collection Completed"); + } + + @Override + public void failed(String s, final DataCollector.Error error) { + textArea.append("Collection Failed\n\n"); + textArea.append(error.toString()); + } + }); + } +} diff --git a/CheckoutExample/app/src/main/java/com/kount/checkoutexample/MainActivity.java b/CheckoutExample/app/src/main/java/com/kount/checkoutexample/MainActivity.java new file mode 100644 index 0000000..8097ef5 --- /dev/null +++ b/CheckoutExample/app/src/main/java/com/kount/checkoutexample/MainActivity.java @@ -0,0 +1,99 @@ +package com.kount.checkoutexample; + +import android.Manifest; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.kount.api.DataCollector; + +import java.util.Locale; + +public class MainActivity extends AppCompatActivity { + + final int PERMISSIONS_REQUEST_LOCATION = 0; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + setTitle("Sample"); + + final int MERCHANT_ID = 0; // Insert your valid merchant ID + final int ENVIRONMENT = DataCollector.ENVIRONMENT_TEST; + + // Check for location permissions so the Data Collector can gather the device location + requestLocationPermissions(); + + // Configure the collector + DataCollector.getInstance().setDebug(true); + DataCollector.getInstance().setContext(this); + DataCollector.getInstance().setMerchantID(MERCHANT_ID); + DataCollector.getInstance().setEnvironment(ENVIRONMENT); + DataCollector.getInstance().setLocationCollectorConfig(DataCollector.LocationConfig.COLLECT); + + final TextView merchant = (TextView) findViewById(R.id.merchant); + final TextView environment = (TextView) findViewById(R.id.environment); + final Button checkoutButton = (Button) findViewById(R.id.checkoutButton); + + merchant.setText(String.format(Locale.US, "%d", MERCHANT_ID)); + switch (ENVIRONMENT) { + case DataCollector.ENVIRONMENT_TEST: + environment.setText("Test"); + break; + case DataCollector.ENVIRONMENT_PRODUCTION: + environment.setText("Production"); + break; + default: + environment.setText("Unknown"); + } + + checkoutButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(MainActivity.this, CollectionActivity.class); + startActivity(intent); + } + }); + } + + void requestLocationPermissions() { + final TextView location = (TextView) findViewById(R.id.location); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) { + ActivityCompat.requestPermissions(this, new String[]{ + Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_LOCATION); + } else { + ActivityCompat.requestPermissions(this, new String[]{ + Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_LOCATION); + } + } else { + location.setText("Allowed"); + } + } else { + // The permissions are allowed by default if installed on a device with a OS less than M + location.setText("Allowed"); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + final TextView location = (TextView) findViewById(R.id.location); + if (requestCode == PERMISSIONS_REQUEST_LOCATION) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + location.setText("Allowed"); + } else { + location.setText("Denied"); + } + } + } + +} diff --git a/CheckoutExample/app/src/main/res/layout/activity_collection.xml b/CheckoutExample/app/src/main/res/layout/activity_collection.xml new file mode 100644 index 0000000..428aa29 --- /dev/null +++ b/CheckoutExample/app/src/main/res/layout/activity_collection.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/CheckoutExample/app/src/main/res/layout/activity_main.xml b/CheckoutExample/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..d4022bf --- /dev/null +++ b/CheckoutExample/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +