Skip to content

Instantly share code, notes, and snippets.

View SeniorZhai's full-sized avatar
🏠
Working from home

SeniorZhai SeniorZhai

🏠
Working from home
View GitHub Profile

DAO

负责SQL CRUD

  • insert
    • single insertX(x:X)
    • multiple insertXxList(xxs:List<X>)
  • update updateXXbyYY(xx:X,yy:Y)
  • delete
    • single deleteX(x:X)
    • multiple deleteByYY(yy:Y)
  • read
@SeniorZhai
SeniorZhai / cloudSettings
Last active May 25, 2020 06:49
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-25T06:49:00.087Z","extensionVersion":"v3.4.3"}
@SeniorZhai
SeniorZhai / Layout
Last active May 9, 2016 08:42
Toolbar
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final boolean isRtl = ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL;
final int width = getWidth();
final int height = getHeight();
final int paddingLeft = getPaddingLeft();
final int paddingRight = getPaddingRight();
final int paddingTop = getPaddingTop();
final int paddingBottom = getPaddingBottom();
int left = paddingLeft;
/*
* Copyright (C) 2006 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
/*
* Copyright (C) 2006 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
@SeniorZhai
SeniorZhai / git-pip.py
Created October 10, 2014 07:03
pypi安装文件
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# an entire copy of pip.
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
import java.lang.ref.WeakReference;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.widget.TextView;
public final class JumpingBeans {
/**
* The default fraction of the whole animation time spent actually animating.
@SeniorZhai
SeniorZhai / CommonUtils.java
Created September 2, 2014 03:18
通用工具类
public class CommonUtils {
private static NetworkInfo getNetworkInfo(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetWorkInfo();
}
// 是否存在网络
public static boolean isNetworkAvailable(Context context) {
NetworkInfo info = getNetworkInfo(context);
@SeniorZhai
SeniorZhai / CacheUtils.java
Created September 2, 2014 03:05
Cache工具类
public class CacheUtils {
// 获取文件目录
public static File getFileDirectory(Context context) {
File appCacheDir = null;
if(appCacheDir == null) {
appCacheDir = context.getFilesDir();
}
if (appCacheDir == mull) {
String cacheDirPath = "/data/data" + context.getPackageName() + "/files/";
appCacheDir = new File(cacheDirPath);
@SeniorZhai
SeniorZhai / PackageUtils.java
Created September 2, 2014 02:30
Package、Shell管理工具
public class PackageUtils {
public static final String TAG = "PackageUtils";
public static final int APP_INSTALL_AUTO = 0;
public static final int APP_INSTALL_INTERNAL = 1;
public static final int APP_INSTALL_EXTERNAL = 2;
public static final int install(Context context,String filePath) {
if (PackageUtils.isSystemApplication(context) || ShellUtils.RootPermission()) {
return installSilent(context,filePath);