Skip to content

Commit

Permalink
完成引用kotlin模块
Browse files Browse the repository at this point in the history
  • Loading branch information
YummyLau committed Aug 26, 2019
1 parent b1128b8 commit a0e7048
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

// implementation ':com.effective.android-librarySdk:'
implementation component(':library')
implementation component(':librarykotlin')
implementation project(':core')
}

Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/plugin/component/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.android.material.snackbar.Snackbar;
import com.plugin.component.anno.MethodCost;
import com.plugin.library.ISdk2;
import com.plugin.librarykotlin.IKotlinSdk;
import com.plugin.module.R;

import androidx.appcompat.app.AppCompatActivity;
Expand Down Expand Up @@ -34,7 +35,11 @@ public void onClick(View view) {
}
});
ComponentManager.init(getApplication());
((TextView) findViewById(R.id.text)).setText(SdkManager.getSdk(ISdk2.class).getSdk2Name());
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(SdkManager.getSdk(ISdk2.class).getSdk2Name());
stringBuilder.append("\n");
stringBuilder.append(SdkManager.getSdk(IKotlinSdk.class).getKotlinSdkName());
((TextView) findViewById(R.id.text)).setText(stringBuilder);
}

@MethodCost
Expand Down
Binary file modified component-plugin/build/libs/module-1.0.0.jar
Binary file not shown.
1 change: 1 addition & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':core')
// implementation component(':libraryKotlin')
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package com.plugin.library;

import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.plugin.component.ComponentManager;
import com.plugin.component.SdkManager;

public class LibraryMainActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity_layout);
Toast.makeText(this, new SdkImpl().getSdkName(), Toast.LENGTH_LONG).show();
ComponentManager.init(getApplication());
// ((TextView) findViewById(R.id.text)).setText(SdkManager.getSdk(IKotlinSdk.class).getSdk2Name());
}
}
5 changes: 5 additions & 0 deletions library/src/main/debug/res/layout/main_activity_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
android:background="@android:color/black"
android:orientation="vertical">

<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.plugin.librarykotlin

import com.plugin.component.anno.AutoInjectImpl

@AutoInjectImpl(sdk = [IKotlinSdk::class])
class KotlinSdkImpl : IKotlinSdk {

override fun getKotlinSdkName(): String = "KotlinSdkImpl"
Expand Down

0 comments on commit a0e7048

Please sign in to comment.