diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5fe238587..9ef041779 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,19 @@ android:supportsRtl="true" android:usesCleartextTraffic="false" android:theme="@style/OmiseTheme"> - + + + + + + + + + + diff --git a/app/src/main/java/co/omise/android/example/PaymentResultActivity.kt b/app/src/main/java/co/omise/android/example/PaymentResultActivity.kt new file mode 100644 index 000000000..5b87fa2c7 --- /dev/null +++ b/app/src/main/java/co/omise/android/example/PaymentResultActivity.kt @@ -0,0 +1,23 @@ +package co.omise.android.example + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.widget.TextView + +/** + * The example activity to receive the result of the payment. + */ +class PaymentResultActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_payment_result) + + val resultText = findViewById(R.id.payment_result_text) + + intent.data?.getQueryParameter("result")?.let { result -> + resultText.text = "result: $result" + } ?: run { + resultText.text = "No result found" + } + } +} diff --git a/app/src/main/res/layout/activity_payment_result.xml b/app/src/main/res/layout/activity_payment_result.xml new file mode 100644 index 000000000..779e6b7f5 --- /dev/null +++ b/app/src/main/res/layout/activity_payment_result.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/bankapp/.gitignore b/bankapp/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/bankapp/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/bankapp/build.gradle b/bankapp/build.gradle new file mode 100644 index 000000000..e104613c9 --- /dev/null +++ b/bankapp/build.gradle @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'co.omise.android.bankapp' + compileSdk 33 + + defaultConfig { + applicationId "co.omise.android.bankapp" + minSdk 21 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.9.0' + implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0') + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} diff --git a/bankapp/proguard-rules.pro b/bankapp/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/bankapp/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 \ No newline at end of file diff --git a/bankapp/src/androidTest/java/co/omise/android/bankapp/ExampleInstrumentedTest.kt b/bankapp/src/androidTest/java/co/omise/android/bankapp/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..ab47b81d3 --- /dev/null +++ b/bankapp/src/androidTest/java/co/omise/android/bankapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package co.omise.android.bankapp + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("co.omise.android.bankapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/bankapp/src/main/AndroidManifest.xml b/bankapp/src/main/AndroidManifest.xml new file mode 100644 index 000000000..6312c9f57 --- /dev/null +++ b/bankapp/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bankapp/src/main/java/co/omise/android/bankapp/MainActivity.kt b/bankapp/src/main/java/co/omise/android/bankapp/MainActivity.kt new file mode 100644 index 000000000..f98c56981 --- /dev/null +++ b/bankapp/src/main/java/co/omise/android/bankapp/MainActivity.kt @@ -0,0 +1,26 @@ +package co.omise.android.bankapp + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.widget.Button +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val goBackButton = findViewById