Skip to content

Commit

Permalink
Javadoc can not recognize kotlin file for now
Browse files Browse the repository at this point in the history
  • Loading branch information
zhi1ong committed Aug 8, 2017
1 parent 0572eb4 commit 1bd4eb3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 52 deletions.
2 changes: 0 additions & 2 deletions arouter-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

ext {
bintrayName = 'arouter-api'
Expand Down Expand Up @@ -43,7 +42,6 @@ dependencies {
annotationProcessor 'com.alibaba:arouter-compiler:1.0.3'
compile 'com.alibaba:arouter-annotation:1.0.3'
compile "com.android.support:support-v4:${SUPPORT_LIB_VERSION}"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public synchronized static void init(Context context, ThreadPoolExecutor tpe) th
Set<String> routerMap;

// It will rebuild router map every times when debuggable.
if (ARouter.debuggable() || PackageUtils.INSTANCE.isNewVersion(context)) {
if (ARouter.debuggable() || PackageUtils.isNewVersion(context)) {
logger.info(TAG, "Run with debug mode or new install, rebuild router map.");
// These class was generate by arouter-compiler.
routerMap = ClassUtils.getFileNameByPackageName(mContext, ROUTE_ROOT_PAKCAGE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.alibaba.android.arouter.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import static com.alibaba.android.arouter.launcher.ARouter.logger;
import static com.alibaba.android.arouter.utils.Consts.AROUTER_SP_CACHE_KEY;
import static com.alibaba.android.arouter.utils.Consts.LAST_VERSION_CODE;
import static com.alibaba.android.arouter.utils.Consts.LAST_VERSION_NAME;

/**
* Android package utils
*
* @author zhilong <a href="mailto:[email protected]">Contact me.</a>
* @version 1.0
* @since 2017/8/8 下午8:19
*/
public class PackageUtils {
public static boolean isNewVersion(Context context) {
PackageInfo packageInfo = getPackageInfo(context);
if (null != packageInfo) {
String versionName = packageInfo.versionName;
int versionCode = packageInfo.versionCode;

SharedPreferences sp = context.getSharedPreferences(AROUTER_SP_CACHE_KEY, Context.MODE_PRIVATE);
if (!versionName.equals(sp.getString(LAST_VERSION_NAME, null)) || versionCode != sp.getInt(LAST_VERSION_CODE, -1)) {
// new version
sp.edit().putString(LAST_VERSION_NAME, versionName).putInt(LAST_VERSION_CODE, versionCode).apply();
return true;
} else {
return false;
}
} else {
return true;
}
}

public static PackageInfo getPackageInfo(Context context) {
PackageInfo packageInfo = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_CONFIGURATIONS);
} catch (Exception ex) {
logger.error(Consts.TAG, "Get package info error.");
}

return packageInfo;
}
}

This file was deleted.

0 comments on commit 1bd4eb3

Please sign in to comment.