Skip to content

Commit 988ecb2

Browse files
committed
Update Demo
1 parent c19328c commit 988ecb2

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

PluginBase/src/main/java/com/example/plugintestbase/ILoginService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.example.plugintestbase;
22

3+
import java.io.Serializable;
4+
35
/**
46
* Created by cailiming on 16/1/1.
57
*/
6-
public interface ILoginService {
8+
public interface ILoginService extends Serializable {
79

810
public LoginVO login(String username, String password);
911

PluginTest/AndroidManifest.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
android:name="com.example.plugintest.PluginTestApplication"
2121
android:label="@*com.example.pluginmain:string/share_string_2"
2222
android:theme="@style/PluginTheme2">
23-
23+
24+
<meta-data android:name="abcdef" android:value="654321"/>
25+
2426
<!-- for fragment -->
25-
<meta-data android:name="fragment_id_fragmentTest1" android:value="com.example.plugintest.fragment.PluginSpecFragment"/>
27+
<exported-fragment android:name="some_id_for_fragment1" android:value="com.example.plugintest.fragment.PluginNormalFragment"/>
2628
<!-- for fragment -->
27-
<meta-data android:name="fragment_id_fragmentTest2" android:value="com.example.plugintest.fragment.PluginNormalFragment"/>
28-
29-
<meta-data android:name="test_meta_1" android:value="123"/>
29+
<exported-fragment android:name="some_id_for_fragment2" android:value="com.example.plugintest.fragment.PluginSpecFragment" />
30+
<!-- for localservice -->
31+
<exported-service android:name="login_service" android:value="com.example.plugintest.PluginLoginService" />
3032

3133
<activity
3234
android:name="com.example.plugintest.activity.PluginTestActivity"

PluginTest/src/com/example/plugintest/PluginTestApplication.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ public class PluginTestApplication extends Application {
1010
@Override
1111
public void onCreate() {
1212
super.onCreate();
13-
14-
/**
15-
* 其他插件可通过LocalServiceManager.getService("plugin_test_service")获得这个service
16-
*/
17-
LocalServiceManager.registerService("plugin_login_service", new PluginLoginService());
18-
19-
Log.d("PluginTestApplication", "PluginTestApplication onCreate called");
2013
}
2114

2215
}

PluginTest/src/com/example/plugintest/activity/PluginSingleTaskActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void onCreate(Bundle savedInstanceState) {
2525

2626
@Override
2727
public void onClick(View v) {
28-
ILoginService login = (ILoginService) LocalServiceManager.getService("plugin_login_service");
28+
ILoginService login = (ILoginService) getSystemService("login_service");
2929
if (login != null) {
3030
LoginVO vo = login.login("admin", "123456");
3131
Toast.makeText(this, vo.getUsername() + ":" + vo.getPassword(), Toast.LENGTH_SHORT).show();

0 commit comments

Comments
 (0)