Refactor: View attribute apply

This commit is contained in:
zt515 2017-08-18 14:36:45 +08:00
parent e20ce65dd1
commit 37c7dfd709
6 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package io.neomodule.module;
import io.neomodule.module.abs.ModuleLifecycleCallback;
/**
* @author kiva
*/
public class Module implements ModuleLifecycleCallback {
private ModuleInfo moduleInfo;
public Module(ModuleInfo moduleInfo) {
this.moduleInfo = moduleInfo;
}
public ModuleInfo getModuleInfo() {
return moduleInfo;
}
@Override
public void onCreate() {
}
@Override
public void onDestroy() {
}
}

View File

@ -0,0 +1,35 @@
package io.neomodule.module;
/**
* @author kiva
*/
public class ModuleInfo {
private String moduleName;
private String moduleVersion;
public ModuleInfo() {
this("Unnamed", "0.1");
}
public ModuleInfo(String moduleName, String moduleVersion) {
this.moduleName = moduleName;
this.moduleVersion = moduleVersion;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getModuleVersion() {
return moduleVersion;
}
public void setModuleVersion(String moduleVersion) {
this.moduleVersion = moduleVersion;
}
}

View File

@ -0,0 +1,19 @@
package io.neomodule.module;
import io.neomodule.event.EventEmitter;
/**
* @author kiva
*/
public class ModuleProxy extends EventEmitter {
private Module module;
public ModuleProxy(Module module) {
this.module = module;
on("create", args -> module.onCreate());
on("destroy", args -> module.onDestroy());
}
}

View File

@ -0,0 +1,11 @@
package io.neomodule.module.abs;
/**
* @author kiva
*/
public interface ModuleLifecycleCallback {
void onCreate();
void onDestroy();
}

View File

@ -0,0 +1,8 @@
package io.neomodule.pm;
/**
* @author kiva
*/
public class ModulePackageArchive {
}

View File

@ -20,6 +20,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {