Skip to content

Instantly share code, notes, and snippets.

@Haldir65
Haldir65 / commit-msg
Created April 10, 2020 04:08
commit-msg for generating change-id on every commit
#!/bin/sh
# From Gerrit Code Review 2.6
#
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
#
# Copyright (C) 2009 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
/**
* Created by Harris on 2016/7/31.
*/
/**
*
* @ClassName: com.example.mediastore.Song
* @Description: 歌曲实体类
* @author zhaokaiqiang
* @date 2014-12-4 上午11:49:59
@Haldir65
Haldir65 / 状态栏.txt
Created June 8, 2016 05:44
针对小米和魅族手机的状态栏修改实现
/**
* Created by 赵晨璞
*/
public class StatusBarUtil {
/**
* 修改状态栏为全透明
* @param activity
*/
@TargetApi(19)
@Haldir65
Haldir65 / 状态栏.txt
Created June 8, 2016 05:44
针对小米和魅族手机的状态栏修改实现
/**
* Created by 赵晨璞
*/
public class StatusBarUtil {
/**
* 修改状态栏为全透明
* @param activity
*/
@TargetApi(19)
@Haldir65
Haldir65 / BitMapLurCache
Last active May 6, 2016 10:27
BitMap使用到的工具类
public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache {
public static int getDefaultLruCacheSize() {
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8;
return cacheSize;
}
public BitmapLruCache() {
this(getDefaultLruCacheSize());
@Haldir65
Haldir65 / 闹钟实现
Created March 1, 2016 10:36
可以去调用系统闹钟,记得manifest里面加权限
public final static String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR";
public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE";
public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES";
public static final String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_U";
Intent i = new Intent(ACTION_SET_ALARM);
i.putExtra(EXTRA_HOUR, 9);
i.putExtra(EXTRA_MINUTES,41);
i.putExtra(EXTRA_MESSAGE, "Good");
@Haldir65
Haldir65 / LogUtils
Created February 21, 2016 12:07
常用Utils类
import java.text.SimpleDateFormat;
import java.util.Date;
import android.util.Log;
public class LogUtil {
private static final boolean DEBUG = true;
public static void d(String TAG, String method, String msg) {
Log.d(TAG, "[" + method + "]" + msg);
@Haldir65
Haldir65 / git
Created February 17, 2016 16:48
git clone https://.....
git add .
git commint -m "First Commit"
git push origin master
改变云端文件后,本地需要
git pull origin master
才能进行操作
之后本地更改需要重复上面的add-commit-push操作。
git init将本地文件初始化为一个仓库,也就是生成一个.git隐藏文件。
/* * 文 件 名: DataCleanManager.java * 描 述: 主要功能有清除内/外缓存,清除数据库,清除sharedPreference,清除files和清除自定义目录 */
import java.io.File;
import android.content.Context;
import android.os.Environment;
/** * 本应用数据清除管理器 */
public class DataCleanManager {
/** * 清除本应用内部缓存(/data/data/com.xxx.xxx/cache) * * @param context */
public static void cleanInternalCache(Context context) {
package test;
import java.util.*;
import java.util.Map.Entry;
public class B {
public static void main(String[] args) {
Map<Integer,Integer> mm = new HashMap<Integer,Integer>();
for(int i=0;i<10;i++) {
mm.put(i, i);
}
for( Entry<Integer, Integer> e : mm.entrySet()) {