Skip to content

Commit 6b240f7

Browse files
sdk functionality check
1 parent 6e8202d commit 6b240f7

File tree

25 files changed

+212
-3
lines changed

25 files changed

+212
-3
lines changed

app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
23

34
android {
45
compileSdkVersion 28
@@ -26,4 +27,8 @@ dependencies {
2627
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
2728
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
2829
implementation project(':customsdk')
30+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
31+
}
32+
repositories {
33+
mavenCentral()
2934
}

app/src/main/java/com/example/abhishekbharti/sdkexample/MainActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
import android.os.Bundle;
66

7+
import com.example.abhishekbharti.customsdk.activity.activity.RouterActivity;
8+
79
public class MainActivity extends AppCompatActivity {
810

911
@Override
1012
protected void onCreate(Bundle savedInstanceState) {
1113
super.onCreate(savedInstanceState);
1214
setContentView(R.layout.activity_main);
15+
16+
RouterActivity.Companion.start(this, RouterActivity.Companion.getFEATURE_2());
1317
}
1418
}

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
4+
ext.kotlin_version = '1.2.71'
5+
56
repositories {
67
google()
78
jcenter()
89
}
910
dependencies {
1011
classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
11-
12+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1213

1314
// NOTE: Do not place your application dependencies here; they belong
1415
// in the individual module build.gradle files

customsdk/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
23

34
android {
45
compileSdkVersion 28
@@ -31,4 +32,8 @@ dependencies {
3132
testImplementation 'junit:junit:4.12'
3233
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
3334
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
35+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
36+
}
37+
repositories {
38+
mavenCentral()
3439
}
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.abhishekbharti.customsdk" />
2+
package="com.example.abhishekbharti.customsdk" >
3+
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:roundIcon="@mipmap/ic_launcher_round"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme">
11+
<activity android:name=".activity.activity.RouterActivity">
12+
<intent-filter>
13+
<action android:name="android.intent.action.MAIN" />
14+
15+
<category android:name="android.intent.category.LAUNCHER" />
16+
</intent-filter>
17+
</activity>
18+
19+
<activity android:name=".activity.activity.Activity1"/>
20+
<activity android:name=".activity.activity.Activity2"/>
21+
</application>
22+
23+
</manifest>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.abhishekbharti.customsdk.activity.activity
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import androidx.core.content.ContextCompat
7+
import com.example.abhishekbharti.customsdk.R
8+
9+
class Activity1: BaseActivity() {
10+
11+
companion object {
12+
fun start(context: Context, bundle: Bundle?) {
13+
var intent: Intent = Intent(context, Activity1::class.java)
14+
if(bundle != null){
15+
intent.putExtras(bundle)
16+
}
17+
18+
ContextCompat.startActivity(context, intent, null)
19+
}
20+
}
21+
22+
override fun onCreate(savedInstanceState: Bundle?) {
23+
super.onCreate(savedInstanceState)
24+
setContentView(R.layout.activity_1)
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.example.abhishekbharti.customsdk.activity.activity
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import androidx.core.content.ContextCompat
7+
import com.example.abhishekbharti.customsdk.R
8+
9+
class Activity2: BaseActivity() {
10+
11+
companion object {
12+
fun start(context: Context, bundle: Bundle?) {
13+
var intent: Intent = Intent(context, Activity2::class.java)
14+
if(bundle != null){
15+
intent.putExtras(bundle)
16+
}
17+
ContextCompat.startActivity(context, intent, null)
18+
}
19+
}
20+
21+
override fun onCreate(savedInstanceState: Bundle?) {
22+
super.onCreate(savedInstanceState)
23+
setContentView(R.layout.activity_2)
24+
}
25+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.example.abhishekbharti.customsdk.activity.activity
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
6+
open class BaseActivity: AppCompatActivity() {
7+
8+
override fun onCreate(savedInstanceState: Bundle?) {
9+
super.onCreate(savedInstanceState)
10+
}
11+
12+
override fun onStart() {
13+
super.onStart()
14+
}
15+
16+
override fun onStop() {
17+
super.onStop()
18+
}
19+
20+
override fun onDestroy() {
21+
super.onDestroy()
22+
}
23+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.example.abhishekbharti.customsdk.activity.activity
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import androidx.core.content.ContextCompat.startActivity
7+
8+
class RouterActivity : BaseActivity() {
9+
10+
companion object {
11+
val FEATURE_1 = 101
12+
val FEATURE_2 = 102
13+
val FEATURE_3 = 103
14+
val FEATURE_4 = 104
15+
16+
val ROUTE_FEATURE = "route_feature"
17+
18+
fun start(context: Context, feature: Int) {
19+
var intent: Intent = Intent(context, RouterActivity::class.java)
20+
intent.putExtra(ROUTE_FEATURE, feature)
21+
startActivity(context, intent, null)
22+
}
23+
}
24+
25+
26+
27+
28+
override fun onCreate(savedInstanceState: Bundle?) {
29+
super.onCreate(savedInstanceState)
30+
31+
if (intent != null) {
32+
routeTo(intent.getIntExtra(ROUTE_FEATURE, 101))
33+
}
34+
35+
}
36+
37+
private fun routeTo(feature: Int) {
38+
when (feature) {
39+
101 -> {
40+
Activity1.start(this, null)
41+
}
42+
102 -> {
43+
Activity2.start(this, null)
44+
}
45+
103 -> {
46+
47+
}
48+
104 -> {
49+
50+
}
51+
else -> {
52+
53+
}
54+
}
55+
}
56+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:background="@color/colorAccent">
7+
8+
</LinearLayout>

0 commit comments

Comments
 (0)