Commit 864fd762 by 王宇航

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	user/component-login/src/main/AndroidManifest.xml
#	user/component-login/src/main/java/com/gingersoft/gsa/cloud/user/login/LoginActivity.java
#	user/component-login/src/main/res/layout/user_login_activity.xml
parents 2059e3be fe7a7dbe
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.cloud.gsa">
package="com.gingersoft.gsa.cloud">
<application
android:allowBackup="true"
......
package com.gingersoft.cloud.gsa.main;
package com.gingersoft.gsa.cloud.main;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.gingersoft.cloud.gsa.R;
import com.gingersoft.gsa.cloud.R;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
......
package com.gingersoft.cloud.gsa.main;
package com.gingersoft.gsa.cloud.main;
import android.app.Application;
......
......@@ -31,4 +31,7 @@ project.dependencies.add('api', "com.billy.android:cc:2.1.6") //用最新版
// , 'codeInsertToClassName' : 'com.billy.cc.demo.component.b.ComponentB'
// , 'codeInsertToMethodName' : 'initProcessors'
// , 'registerMethodName' : 'add'
//])
\ No newline at end of file
//])
//开启app内部多进程组件调用
ccregister.multiProcessEnabled = true
\ No newline at end of file
apply plugin: 'com.android.library'
ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gsa.cloud.order.detail">
package="com.gingersoft.gsa.cloud.order.detail">
<application>
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gsa.cloud.order.list">
package="com.gingersoft.gsa.cloud.order.list">
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gsa.cloud.database">
package="com.gingersoft.gsa.cloud.database">
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gsa.cloud.network">
package="com.gingersoft.gsa.cloud.network">
</manifest>
\ No newline at end of file
......@@ -3,7 +3,6 @@ include ':app',
':cc-register', ':cc',
':android_internal',
':public2:component-database',
':public2:component-network',
':order:component-order-list',
':order:component-order-detail',
':user:component-login',
......
......@@ -12,13 +12,13 @@ android {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
if (project.ext.runAsApp) {
applicationId 'com.gingersoft.cloud.gsa.user.login'
applicationId 'com.gingersoft.gsa.cloud.user.login'
}
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
}
resourcePrefix "gsa_user_login"
resourcePrefix "user_login"
buildTypes {
......@@ -37,4 +37,5 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':mvp:arms')
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.user.login">
<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/user_login_AppTheme">
<activity android:name="com.gingersoft.gsa.cloud.user.login.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package debug;
import android.app.Application;
import com.billy.cc.core.component.CC;
/**
* @author billy.qi
* @since 17/11/20 20:02
*/
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
<resources>
<string name="demo_a_app_name">Demo_A</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="user_login_colorPrimary">#3F51B5</color>
<color name="user_login_colorPrimaryDark">#303F9F</color>
<color name="user_login_colorAccent">#FF4081</color>
</resources>
<resources>
<string name="user_login_app_name">Demo_A</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="user_login_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/user_login_colorPrimary</item>
<item name="colorPrimaryDark">@color/user_login_colorPrimaryDark</item>
<item name="colorAccent">@color/user_login_colorAccent</item>
</style>
</resources>
package com.gsa.cloud.user.login;
package com.gingersoft.gsa.cloud.user.login;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
......@@ -72,8 +72,8 @@ public class ComponentLogin implements IComponent {
}
private void openActivity(CC cc) {
// CCUtil.navigateTo(cc, ActivityA.class);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
CCUtil.navigateTo(cc, LoginActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
}
<resources>
<string name="app_name">component-order-list</string>
<string name="user_login_name">component-user-login</string>
</resources>
......@@ -12,13 +12,13 @@ android {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
if (project.ext.runAsApp) {
applicationId 'com.gingersoft.cloud.gsa.user.register'
applicationId 'com.gingersoft.gsa.cloud.user.register'
}
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
}
resourcePrefix "gsa_user_register"
resourcePrefix "user_register"
buildTypes {
......@@ -36,5 +36,5 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':mvp:arms')
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gsa.cloud.register">
package="com.gingersoft.gsa.cloud.user.register">
<application>
<activity android:name=".RegisterActivity">
</activity>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.user.register">
<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/user_register_AppTheme">
<activity android:name=".RegisterActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package debug;
import android.app.Application;
import com.billy.cc.core.component.CC;
/**
* @author billy.qi
* @since 17/11/20 20:02
*/
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
<resources>
<string name="demo_a_app_name">Demo_A</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="user_register_colorPrimary">#3F51B5</color>
<color name="user_register_colorPrimaryDark">#303F9F</color>
<color name="user_register_colorAccent">#FF4081</color>
</resources>
<resources>
<string name="user_register_app_name">Demo_A</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="user_register_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/user_register_colorPrimary</item>
<item name="colorPrimaryDark">@color/user_register_colorPrimaryDark</item>
<item name="colorAccent">@color/user_register_colorAccent</item>
</style>
</resources>
package com.gingersoft.gsa.cloud.user.register;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
public class ComponentRegister implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.Register";
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到CC.sendCCResult,
* 包括try-catch,if-else,switch-case-default,startActivity
* @param cc 组件调用对象,可从此对象中获取相关信息
* @return true:将异步调用CC.sendCCResult(...),用于异步实现相关功能,例如:文件加载、网络请求等
* false:会同步调用CC.sendCCResult(...),即在onCall方法return之前调用,否则将被视为不合法的实现
*/
@Override
public boolean onCall(CC cc) {
String actionName = cc.getActionName();
switch (actionName) {
case "showRegisterActivity":
openActivity(cc);
break;
case "getLifecycleFragment":
//demo for provide fragment object to other component
getLifecycleFragment(cc);
break;
case "lifecycleFragment.addText":
lifecycleFragmentDoubleText(cc);
break;
case "getInfo":
getInfo(cc);
break;
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
private void lifecycleFragmentDoubleText(CC cc) {
// LifecycleFragment lifecycleFragment = cc.getParamItem("fragment");
// if (lifecycleFragment != null) {
// String text = cc.getParamItem("text", "");
// lifecycleFragment.addText(text);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
// } else {
// CC.sendCCResult(cc.getCallId(), CCResult.error("no fragment params"));
// }
}
private void getLifecycleFragment(CC cc) {
// CC.sendCCResult(cc.getCallId(), CCResult.successWithNoKey(new LifecycleFragment()));
}
private void getInfo(CC cc) {
String userName = "billy";
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
}
private void openActivity(CC cc) {
CCUtil.navigateTo(cc, RegisterActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
}
package com.gingersoft.gsa.cloud.user.register;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
public class RegisterActivity extends AppCompatActivity {
private static final String COMPONENT_NAME_A = "COMPONENT_NAME_A";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_register_activity);
TextView textView = new TextView(this);
textView.setGravity(Gravity.CENTER);
textView.setText("this is register activity");
setContentView(textView);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// CC cc = CC.obtainBuilder(COMPONENT_NAME_A)
// .setActionName("getInfo")
// .build();
// CCResult result = cc.call();
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
<resources>
<string name="app_name">component-order-list</string>
<string name="user_register_name">component-user-register</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment