View EditTextCountWatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* EditText View 限制输入字符数,并倒计还能输入多少字符,兼容中英文字符 | |
* author : ruibin1 (ruibin1@staff.weibo.com) | |
* create : 2019/3/28 - 2:12 PM. | |
* thanks : https://github.com/FJ917/FJEditTextCount | |
*/ | |
public class EditTextCountWatch { | |
private EditText mEtContent; | |
private TextView mTvNum; | |
//最大字符 |
View DrawableBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** | |
* author : ruibin1 (ruibin1@staff.weibo.com) | |
* docs : https://github.com/maoruibin/maoruibin.github.com/issues/88 | |
* build : 2019/3/21 - 3:55 PM. | |
*/ | |
public class DrawableBuilder { | |
//默认线条粗细 1dp | |
private static final int defaultLineWidth = 1; | |
private static final int defaultLineColor = Color.parseColor("#e9e9e9"); |
View gist:ecd818dd5c878bbed07feceabb6bc8ea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```java | |
import android.content.Context; | |
import android.database.ContentObserver; | |
import android.database.Cursor; | |
import android.graphics.Point; | |
import android.net.Uri; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.provider.MediaStore; | |
import android.text.TextUtils; |
View 滑动 View 的五种方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onTouchEvent(MotionEvent event) { | |
int x = (int) event.getX(); | |
int y = (int) event.getY(); | |
switch (event.getAction()){ | |
case MotionEvent.ACTION_DOWN: | |
//记录触摸到坐标 | |
lastX = x; | |
lastY = y; | |
break; |
View gist:3044a47284312a234ae6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onTouchEvent(MotionEvent event) { | |
switch (event.getAction()) { | |
case MotionEvent.ACTION_DOWN: | |
Drawable drawable = getDrawable(); | |
if (drawable != null) { | |
drawable.mutate().setColorFilter(Color.GRAY, PorterDuff.Mode.MULTIPLY); | |
} |
View ListenClipboardService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void showNormalNotification(Context context) { | |
NotificationCompat.Builder builder = new NotificationCompat.Builder(context); | |
builder.setContentTitle("Title"); | |
builder.setContentText("Description"); | |
builder.setSmallIcon(R.mipmap.ic_launcher); | |
builder.setPriority(NotificationCompat.PRIORITY_MIN); | |
builder.setOngoing(true); | |
long[] vibrate = {0, 50, 0, 0}; | |
builder.setVibrate(vibrate); |
View RxUtils.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* make a operate change to observable | |
* @param func | |
* @param <T> | |
* @return | |
*/ | |
public static <T> Observable<T> makeObservable(final Callable<T> func) { | |
return Observable.create(new Observable.OnSubscribe<T>() { | |
@Override | |
public void call(Subscriber<? super T> subscriber) { |
View FileUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* copy file | |
* @param source | |
* @param dest | |
* @throws IOException | |
*/ | |
public static void copyFileUsingFileChannels(File source, File dest) | |
throws IOException { | |
FileChannel inputChannel = null; | |
FileChannel outputChannel = null; |
View git_toturial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init # 初始化本地git仓库(创建新仓库) | |
git config --global user.name "xxx" # 配置用户名 | |
git config --global user.email "xxx@xxx.com" # 配置邮件 | |
git config --global color.ui true # git status等命令自动着色 | |
git config --global color.status auto | |
git config --global color.diff auto | |
git config --global color.branch auto | |
git config --global color.interactive auto | |
git config --global --unset http.proxy # remove proxy configuration on Git. | |
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库 |