-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Optable/2-issue-java-demo
Add DemoAppJava to show integration from Java app.
- Loading branch information
Showing
48 changed files
with
1,415 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
*.iml | ||
.gradle | ||
local.properties | ||
.idea/caches | ||
.idea/libraries | ||
.idea/modules.xml | ||
.idea/workspace.xml | ||
.idea/navEditor.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/gradle.xml | ||
.idea/shelf/ | ||
.idea/tasks.xml | ||
.idea/.name | ||
.idea/compiler.xml | ||
.idea/copyright/profiles_settings.xml | ||
.idea/encodings.xml | ||
.idea/misc.xml | ||
.idea/dictionaries | ||
.idea/vcs.xml | ||
.idea/jsLibraryMappings.xml | ||
.idea/datasources.xml | ||
.idea/dataSources.ids | ||
.idea/sqlDataSources.xml | ||
.idea/dynamic.xml | ||
.idea/uiDesigner.xml | ||
.idea/modules | ||
.DS_Store | ||
build | ||
captures | ||
.externalNativeBuild | ||
.cxx |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
plugins { | ||
id("de.nanogiants.android-versioning") version "2.4.0" | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.2" | ||
|
||
defaultConfig { | ||
applicationId "co.optable.demoappjava" | ||
minSdkVersion 16 | ||
targetSdkVersion 29 | ||
|
||
// Here we get version code and version name from latest git release tags: | ||
versionCode versioning.getVersionCode() | ||
versionName versioning.getVersionName(false) | ||
archivesBaseName = "optable-android-sdk-demo-java" | ||
|
||
multiDexEnabled true | ||
|
||
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 | ||
} | ||
|
||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.2.1' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2' | ||
implementation 'androidx.vectordrawable:vectordrawable:1.1.0' | ||
implementation 'androidx.navigation:navigation-fragment:2.3.0' | ||
implementation 'androidx.navigation:navigation-ui:2.3.0' | ||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
|
||
implementation 'com.google.android.gms:play-services-ads:19.3.0' | ||
implementation "com.github.Optable:optable-android-sdk:2-issue-java-demo-SNAPSHOT" //+ versioning.getVersionName(false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
26 changes: 26 additions & 0 deletions
26
.../DemoAppJava/app/src/androidTest/java/co/optable/demoappjava/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package co.optable.demoappjava; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.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 <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("co.optable.demoappjava", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="co.optable.demoappjava"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
android:usesCleartextTraffic="true"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<meta-data | ||
android:name="com.google.android.gms.ads.AD_MANAGER_APP" | ||
android:value="true" /> | ||
</application> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
</manifest> |
35 changes: 35 additions & 0 deletions
35
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package co.optable.demoappjava; | ||
|
||
import android.os.Bundle; | ||
|
||
import com.google.android.material.bottomnavigation.BottomNavigationView; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.navigation.NavController; | ||
import androidx.navigation.Navigation; | ||
import androidx.navigation.ui.AppBarConfiguration; | ||
import androidx.navigation.ui.NavigationUI; | ||
import co.optable.android_sdk.OptableSDK; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
public static OptableSDK OPTABLE; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
MainActivity.OPTABLE = new OptableSDK(this.getApplicationContext(), "sandbox.optable.co", "android-sdk-demo"); | ||
|
||
BottomNavigationView navView = findViewById(R.id.nav_view); | ||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); | ||
// Passing each menu ID as a set of Ids because each | ||
// menu should be considered as top level destinations. | ||
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( | ||
R.id.navigation_identify, R.id.navigation_gambanner) | ||
.build(); | ||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); | ||
NavigationUI.setupWithNavController(navView, navController); | ||
} | ||
|
||
} |
Oops, something went wrong.