Skip to content

Instantly share code, notes, and snippets.

View razerdp's full-sized avatar
😀
Happy

Razerdp razerdp

😀
Happy
  • Netease
  • Guangzhou,China
View GitHub Profile
@razerdp
razerdp / DividerItemDecoration.java
Last active August 29, 2015 14:25 — forked from alexfu/DividerItemDecoration.java
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@razerdp
razerdp / 2015-07-27
Last active August 29, 2015 14:27
这里是MyAndroidDevTools的详细情况
增加方法:
DevToolsFactory.getFileTools().createFolder(String rootPath,String PATH)
rootPath代表着您要创建的根路径,如果创建于SD卡上,请确保SD卡存在,否则可能会崩溃。
当传入""空字符串时,代表着默认的路径,即有SD卡的时候默认根路径为SD卡路径,无SD卡时,默认为包内路径。
传入的PATH格式应为"A/B/C/D/E"这样该工具类会自动创建 SD卡/A/B/C/D/E(如果SD卡存在)或者是 /data/data/packagename/A/B/C/D/E(如果SD卡不存在) 当然,您也可以在当前文件夹存在的时候进行创建。
新增方法
DevToolsFactory.getFileTools().copyfile(String fromPath, String toPath, Boolean rewrite)
在您需要用的地方请调用它,然后传入源文件的路径和目标文件的路径,并设置是否可以覆盖目标文件
请务必保证路径的绝对性以及加上文件的后缀
例如fromPath="sdcard/xxx/xxx.txt"
同样,目标文件例子:toPath="sdcard/xxx/xxx.txt"
当rewrite为true时,若目标文件存在,则会覆盖目标文件。
当rewrite为false时,若目标文件存在,则会在原目标文件的末尾加上-new。
使用前请务必加上必要的权限。
增加了BitmapTools和ViewTools
如之前一样,直接调用
DevToolsFactory.getBitmapTools()
或者
DevToolsFactory.getViewTools()
里面的方法吧-V-
getBitmapTools():
ps:暂时来说我就这么有更新就写更新日志吧.....见谅
新增方法:
DevToolsFactory.getBitmapTools().createBitmapWithAlphaMatte(Context context, Bitmap maskPic, Bitmap bgPic, boolean hasAlpha)
因为这个方法是对图片的像素进行操作,所以建议您将方法放到异步线程里面做,避免阻塞UI线程。Demo因为为了偷懒,所以就没有放到子线程里面做。。。。
关于这个方法的参数如下:
Context context:上下文对象
Bitmap maskPic:传入蒙板层的Bitmap
Bitmap bgPic:传入背景层的Bitmap
新增方法
public List<String> getFilesFromFolder(String folderPath, String prefixion, String type);//获取指定文件夹指定后缀和自定义前缀的方法,支持"*"后缀
public String getFileNameNoEx(String filename);//获取指定文件的文件名
public String getExtensionName(String filename);//获取指定文件的后缀名
这里主要说明第一个方法,第一个方法有三个参数
-folderPath:文件夹路径,方法会判断是否为文件夹,如果不是,则返回null,所以使用方法请判断返回值是否为空
-prefixion:这个我应该打错英文了,晚会修改,这个用于添加前缀,主要方便为文件路径添加如file://这种uri,可以为空
-type:文件的后缀,可以写".txt"或者"txt",也就是说文件后缀您加点或者不加点都一样,也可以传入"*",这样就会找寻指定文件夹内所有的文件(不会找出文件夹哦)
@razerdp
razerdp / git_diff.md
Created June 7, 2018 08:03 — forked from jhjguxin/git_diff.md
Git diff 比较不同版本的差异

Git 比较不同版本文件差异的常用命令格式:

git diff                                       查看尚未暂存的文件更新了哪些部分

git diff filename 查看尚未暂存的某个文件更新了哪些

git diff –cached                    查看已经暂存起来的文件和上次提交的版本之间的差异

git diff –cached filename 查看已经暂存起来的某个文件和上次提交的版本之间的差异