From aedee26c246449227a2294068d2c76f4060b35d6 Mon Sep 17 00:00:00 2001 From: Tango Date: Sat, 19 Aug 2017 16:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E4=B8=BAformat?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- gradle.properties | 5 +++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- router/build.gradle | 2 +- .../main/java/cn/campusapp/router/Router.java | 18 +++++++++++++++--- sample/build.gradle | 2 +- .../campusapp/router/sample/MainActivity.java | 2 +- 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 2ec3ea5..cd0adb2 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' + classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' // Add this line diff --git a/gradle.properties b/gradle.properties index 6a9ffd9..a09916a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,12 @@ # # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m +# Default value: -Xmx1024m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -#Thu Dec 29 09:49:10 CST 2016 \ No newline at end of file +#Fri Jun 23 10:54:06 CST 2017 + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 139b1b5..ac56f77 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Mar 01 17:05:50 CST 2017 +#Fri Jun 23 10:58:51 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/router/build.gradle b/router/build.gradle index d0e1fc5..d81df7e 100644 --- a/router/build.gradle +++ b/router/build.gradle @@ -7,7 +7,7 @@ group='com.github.campusappcn' android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion '25.0.0' diff --git a/router/src/main/java/cn/campusapp/router/Router.java b/router/src/main/java/cn/campusapp/router/Router.java index 63e0635..23b933c 100644 --- a/router/src/main/java/cn/campusapp/router/Router.java +++ b/router/src/main/java/cn/campusapp/router/Router.java @@ -53,12 +53,12 @@ public static synchronized void initActivityRouter(Context context, String ... s } public static boolean open(String url, Object ... params){ - String temp = String.format(Locale.ENGLISH, url, params); + String temp = formatUrl(url, params); return RouterManager.getSingleton().open(temp); } public static boolean open(Context context, String url, Object ... params){ - String temp = String.format(Locale.ENGLISH, url, params); + String temp = formatUrl(url, params); return RouterManager.getSingleton().open(context, temp); } @@ -78,7 +78,7 @@ public static void setDebugMode(boolean debug){ * @return */ public static IRoute getRoute(String url, Object ... params){ - String temp = String.format(Locale.ENGLISH, url, params); + String temp = formatUrl(url, params); return RouterManager.getSingleton().getRoute(temp); } @@ -95,4 +95,16 @@ public static void setInterceptor(Interceptor interceptor){ RouterManager.getSingleton().setInterceptor(interceptor); } + private static String formatUrl(String url, Object ... params) { + String formatted = url; + try { + formatted = String.format(Locale.ENGLISH, url, params); + } catch (Exception e) { + Timber.e("ops", e); + } + + return formatted; + + } + } diff --git a/sample/build.gradle b/sample/build.gradle index ed7396f..9e52649 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion '25.0.0' defaultConfig { applicationId "cn.campusapp.router.sample" diff --git a/sample/src/main/java/cn/campusapp/router/sample/MainActivity.java b/sample/src/main/java/cn/campusapp/router/sample/MainActivity.java index 6779f28..0243ada 100644 --- a/sample/src/main/java/cn/campusapp/router/sample/MainActivity.java +++ b/sample/src/main/java/cn/campusapp/router/sample/MainActivity.java @@ -117,7 +117,7 @@ public void onClick(View v) { btn9.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Router.open(MainActivity.this, "http://www.souhu.com"); + Router.open(MainActivity.this, "https://yue.laobai.com/react/search/?q=%E9%A1%BA%E4%B8%B0%E4%BC%98%E9%80%89"); } });