abrahamcaijin / commonutillibrary Goto Github PK
View Code? Open in Web Editor NEW快速开发工具类收集,史上最全的开发工具类,欢迎Follow、Fork、Star
Home Page: https://github.com/AbrahamCaiJin/CommonUtilLibrary
快速开发工具类收集,史上最全的开发工具类,欢迎Follow、Fork、Star
Home Page: https://github.com/AbrahamCaiJin/CommonUtilLibrary
FileUtils 中有个 CLoseIO 方法, 引入的是 import static com.jingewenku.abrahamcaijin.commonutil.AppFileMgr.closeIO; 然而 AppFileMgr 并没有这个类或方法
private File newFile(String key) {
return new File(cacheDir, key.hashCode() + "");
}
不同String的hashCode是会重复的
开头406252的光大银行借贷卡识别不出来,什么也没返回
能不能适配7.0 8.0的一些权限的东西 8.0 安装应用什么的都改了权限了
希望能加上,最好能测试一下小米6
看到很多用到单例的类中使用了double-check
在变量生命中少了一个关键字 volatile
引入该库后提示:
AAPT: error: unexpected element <uses-permission> found in <manifest><application>.
去除该库后,正常,多次验证确实是引入该库导致的问题。
我这边打开本地下载的CommonUtilLibrary库的配置文件如下:
`
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="25" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</application>
`
以上配置中的读写权限语句,放错位置了,导致编译提示错误,提示:
AAPT: error: unexpected element <uses-permission> found in <manifest><application>.
不清楚以上的权限语句是如何生成的,我这边看库的源码并未发现相关的语句
另外,该库1.0.0版本我这边也有问题,该库使用被引用次数蛮多的,不应该出现这样的问题,可能是我这边的其它配置,或环境问题???
我这边依赖的版本有:1.0.2,和 1.0.0 都有以上的问题,还望帮忙看一下
implementation 'com.abrahamcaijin.commonutil:CommonUtil:1.0.2'
希望能添加自定义入口
/**
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
* 定精度,以后的数字四舍五入
*
* @param v1 被除数
* @param v2 除数
* @param scale 表示需要精确到小数点以后几位
* @return 两个参数的商
*/
public static String divide(String v1, String v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v1); //都写成v1了
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).toString();
}
大神 在线工具有没有那种pl/sql里面已经美化的语句,转成java ,stringbuild.append()那种的啊,有没有啊地址发我[email protected]
Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :CommonUtilLibrary-master.
权限的注册不应该存在AndroidManifest中application下,而应该在application外面.
我的好像不能初始化
openKeybord的注释打错字了,执行觉得应该要做为空判断
感觉这种直接copy需要的代码更方便快捷,往往引入整个包,其实能用上的方法可能也就一两个。
这个函数没有closeIO(is, os);
error: unknown element found.
Message{kind=ERROR, text=error: unknown element found., sources=[C:\Users\mcxin\Documents\CodeHub\NJFANDROID\app\build\intermediates\manifests\full\njfBeta\debug\AndroidManifest.xml:874], original message=, tool name=Optional.of(AAPT)}
module下build.gradle中:compile 'com.abrahamcaijin.commonutil:CommonUtil:1.0.2'
erro: unknown element found.
应该是你的库中清单文件下的application节点下的一段话导致出现的这个bug,
boolean isKeybord(EditText edittext)
boolean KeyBoard(EditText edittext)
这两个重复了,删除一个即可。
目前正在使用kotlin,请问我可以做个转换吗?
也会添加一些响应的功能。
我查阅了相关资料还是没有;
/**
* 将年月日时分秒转成Long类型
* @param dateTime
* @return
*/
public static Long dateTimeToTimeStamp(String dateTime) {
try {
Date e = YYYYMMDDHHMMSS_FORMAT.parse(dateTime);
return Long.valueOf(e.getTime() / 1000L);
} catch (ParseException var2) {
var2.printStackTrace();
return Long.valueOf(0L);
}
}
/**
* 将Long类型转成年月日时分秒
* @param timeStamp
* @return
*/
public static String timeStampToDateTime(Long timeStamp) {
return YYYYMMDDHHMMSS_FORMAT.format(new Date(timeStamp.longValue() * 1000L));
}
这里面timeStampToDateTime的参数如果不应该为long 应该为int ,若果为long 不应该加下面的*1000L
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
不应该声明在application 标签内,在 android studio 3.0 编译时出现错误
199开头的手机号不合法?
WebViewManager 类中的 禁用自适应写错了 应该是false 是吗
Fileutiles 中 getStringFromFile 方法中convertStreamToString()方法不存在
public static String convertStreamToString(InputStream is) {
/*
* To convert the InputStream to String we use the BufferedReader.readLine()
* method. We iterate until the BufferedReader return null which means
* there's no more data to read. Each line will appended to a StringBuilder
* and returned as String.
*/
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
目前我试过有效的方法是监听软键盘弹出时引起的根布局高度的变化,当其变化值大于屏幕高度的三分之一时,即视为软键盘弹出。
llRoot.getViewTreeObserver().addOnGlobalLayoutListener(new
ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect rect = new Rect();
llRoot.getWindowVisibleDisplayFrame(rect);
int screenHeight = ScreenUtils.getSreenHeight(context);
int heightDiff = screenHeight - rect.bottom;
if (heightDiff <= screenHeight / 3) {
isKeyboardShown = false;
} else {
isKeyboardShown = true;
}
}
});
你按住控件然后划到控件外面,那个深色背景不会重置到浅色背景
error: unknown element found.
Message{kind=ERROR, text=error: unknown element found., sources=[/Users/liangzhou/Documents/GitStore/Android-Group/AndroidWallet/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:125], original message=, tool name=Optional.of(AAPT)}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.