diff --git a/build.gradle b/build.gradle index e3a0dc0..36a7ada 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.61' + ext.kotlin_version = '1.2.41' repositories { google() jcenter() @@ -18,7 +18,6 @@ buildscript { allprojects { repositories { google() - mavenLocal() jcenter() maven { url "https://jitpack.io" } diff --git a/router-api/src/main/java/com/lzh/nonview/router/route/ActivityRoute.java b/router-api/src/main/java/com/lzh/nonview/router/route/ActivityRoute.java index bc9d9a4..5f98670 100644 --- a/router-api/src/main/java/com/lzh/nonview/router/route/ActivityRoute.java +++ b/router-api/src/main/java/com/lzh/nonview/router/route/ActivityRoute.java @@ -37,7 +37,7 @@ public class ActivityRoute extends BaseRoute implements IActivit @Override public Intent createIntent(Context context) { ActivityLauncher activityLauncher = (ActivityLauncher) launcher; - activityLauncher.set(uri, bundle, callback.getExtras(), (ActivityRouteRule) routeRule, remote); + activityLauncher.set(uri, bundle, callback.getExtras(), routeRule, remote); return activityLauncher.createIntent(context); } @@ -77,7 +77,7 @@ public void open(Fragment fragment) { try { Utils.checkInterceptor(uri, callback.getExtras(), fragment.getActivity(), getInterceptors()); ActivityLauncher activityLauncher = (ActivityLauncher) launcher; - activityLauncher.set(uri, bundle, callback.getExtras(), (ActivityRouteRule) routeRule, remote); + activityLauncher.set(uri, bundle, callback.getExtras(), routeRule, remote); activityLauncher.open(fragment); callback.onOpenSuccess(routeRule); } catch (Throwable e) { @@ -92,7 +92,7 @@ public void open(android.support.v4.app.Fragment fragment) { try { Utils.checkInterceptor(uri, callback.getExtras(), fragment.getActivity(), getInterceptors()); ActivityLauncher activityLauncher = (ActivityLauncher) launcher; - activityLauncher.set(uri, bundle, callback.getExtras(), (ActivityRouteRule) routeRule, remote); + activityLauncher.set(uri, bundle, callback.getExtras(), routeRule, remote); activityLauncher.open(fragment); callback.onOpenSuccess(routeRule); } catch (Throwable e) { diff --git a/router-compiler/src/main/java/com/lzh/nonview/router/compiler/util/Utils.java b/router-compiler/src/main/java/com/lzh/nonview/router/compiler/util/Utils.java index 0debb26..3144470 100644 --- a/router-compiler/src/main/java/com/lzh/nonview/router/compiler/util/Utils.java +++ b/router-compiler/src/main/java/com/lzh/nonview/router/compiler/util/Utils.java @@ -23,11 +23,7 @@ public static boolean checkTypeValid (TypeElement type) { Set modifiers = type.getModifiers(); if (modifiers.contains(Modifier.PRIVATE)) { throw new RouterException(String.format("The class %s should not be modified by private",type.getSimpleName()),type); - } else if (modifiers.contains(Modifier.ABSTRACT)) { - // skip it - return false; - } - return true; + } else return !modifiers.contains(Modifier.ABSTRACT); } /** diff --git a/router-host/src/main/java/com/lzh/nonview/router/host/DefaultVerify.java b/router-host/src/main/java/com/lzh/nonview/router/host/DefaultVerify.java index 0927ece..f12d2db 100644 --- a/router-host/src/main/java/com/lzh/nonview/router/host/DefaultVerify.java +++ b/router-host/src/main/java/com/lzh/nonview/router/host/DefaultVerify.java @@ -12,7 +12,7 @@ final class DefaultVerify implements RemoteVerify{ @Override - public boolean verify(Context context) throws Exception { + public boolean verify(Context context) { String packageName = context.getPackageName(); int uid = Binder.getCallingUid(); String[] packages = context.getPackageManager().getPackagesForUid(uid); diff --git a/router-host/src/main/java/com/lzh/nonview/router/host/RouterHostService.java b/router-host/src/main/java/com/lzh/nonview/router/host/RouterHostService.java index 8a0055a..4ca607f 100644 --- a/router-host/src/main/java/com/lzh/nonview/router/host/RouterHostService.java +++ b/router-host/src/main/java/com/lzh/nonview/router/host/RouterHostService.java @@ -20,7 +20,6 @@ import android.net.Uri; import android.os.IBinder; import android.os.Parcel; -import android.os.RemoteException; import com.lzh.nonview.router.module.RemoteRule; import com.lzh.nonview.router.protocol.IService; @@ -48,39 +47,39 @@ public static void setVerify(RemoteVerify verify) { List plugins = new ArrayList<>(); @Override - public void register(String pluginName) throws RemoteException { + public void register(String pluginName) { if (!plugins.contains(pluginName)) { plugins.add(pluginName); } } @Override - public boolean isRegister(String pluginName) throws RemoteException { + public boolean isRegister(String pluginName) { return plugins.contains(pluginName); } @Override - public void addActivityRules(Map rules) throws RemoteException { + public void addActivityRules(Map rules) { activities.putAll(rules); } @Override - public void addActionRules(Map rules) throws RemoteException { + public void addActionRules(Map rules) { actions.putAll(rules); } @Override - public RemoteRule getActionRule(Uri uri) throws RemoteException { + public RemoteRule getActionRule(Uri uri) { return findRule(uri, actions); } @Override - public RemoteRule getActivityRule(Uri uri) throws RemoteException { + public RemoteRule getActivityRule(Uri uri) { return findRule(uri, activities); } @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { + public boolean onTransact(int code, Parcel data, Parcel reply, int flags) { try { // check for security verification if (verify != null && !verify.verify(getApplicationContext())) { diff --git a/sample/build.gradle b/sample/build.gradle index e3402ac..fbc044c 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -28,7 +28,7 @@ android { } def parceler_version="1.3.9" -def router_version="2.8.3" +def router_version="29795baa44" def butterknife_version='8.8.1' dependencies { api fileTree(include: ['*.jar'], dir: 'libs') diff --git a/sample/src/main/java/com/lzh/nonview/router/demo/ArgsActivity.kt b/sample/src/main/java/com/lzh/nonview/router/demo/ArgsActivity.kt index 25dc2d7..cda4e1e 100644 --- a/sample/src/main/java/com/lzh/nonview/router/demo/ArgsActivity.kt +++ b/sample/src/main/java/com/lzh/nonview/router/demo/ArgsActivity.kt @@ -43,7 +43,7 @@ class ArgsActivity:BaseActivity() { @Arg var mUrl:String? = null - val mPrinter:TextView by lazy { findViewById(R.id.printer_tv) as TextView } + val mPrinter:TextView by lazy { findViewById(R.id.printer_tv) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/sample/src/main/java/com/lzh/nonview/router/demo/IntentPrinterActivity.kt b/sample/src/main/java/com/lzh/nonview/router/demo/IntentPrinterActivity.kt index 6921f31..cbe31ef 100644 --- a/sample/src/main/java/com/lzh/nonview/router/demo/IntentPrinterActivity.kt +++ b/sample/src/main/java/com/lzh/nonview/router/demo/IntentPrinterActivity.kt @@ -11,7 +11,7 @@ import com.lzh.nonview.router.anno.RouterRule @RouterRule("intent/printer") class IntentPrinterActivity:BaseActivity() { - val mPrinter:TextView by lazy { findViewById(R.id.printer_tv) as TextView } + val mPrinter:TextView by lazy { findViewById(R.id.printer_tv) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,6 @@ class IntentPrinterActivity:BaseActivity() { message.append("\n") } } - mPrinter.text = message; + mPrinter.text = message } } \ No newline at end of file diff --git a/sample/src/main/java/com/lzh/nonview/router/demo/UserActivity.kt b/sample/src/main/java/com/lzh/nonview/router/demo/UserActivity.kt index b776460..3a67366 100644 --- a/sample/src/main/java/com/lzh/nonview/router/demo/UserActivity.kt +++ b/sample/src/main/java/com/lzh/nonview/router/demo/UserActivity.kt @@ -20,7 +20,7 @@ class UserActivity :BaseActivity(){ @Arg("username") var username = "HaogeStudio" - val userTv:TextView by lazy { findViewById(R.id.username) as TextView } + val userTv:TextView by lazy { findViewById(R.id.username) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/sample/src/main/java/com/lzh/nonview/router/demo/interceptors/LoginInterceptor.kt b/sample/src/main/java/com/lzh/nonview/router/demo/interceptors/LoginInterceptor.kt index c5d1e6a..570b79b 100644 --- a/sample/src/main/java/com/lzh/nonview/router/demo/interceptors/LoginInterceptor.kt +++ b/sample/src/main/java/com/lzh/nonview/router/demo/interceptors/LoginInterceptor.kt @@ -23,7 +23,7 @@ class LoginInterceptor : RouteInterceptor { override fun intercept(uri: Uri?, extras: RouteBundleExtras?, context: Context?): Boolean { // 判断是否已登录。已登录:不拦截、登录:拦截 - return !DataManager.login; + return !DataManager.login } } \ No newline at end of file