View CursorRecyclerViewAdapter.java
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* 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
View JavlibrarySearch.user.js
// ==UserScript==
// @name JavlibrarySearch
// @namespace JavlibrarySearch
// @description Add search function for Javlibrary
// @include http://www.javlibrary.com/*/?v=*
// @include *://www.13vlib.com/*/?v=*
// @version 3
// @grant none
// ==/UserScript==
View AutoResizeTextView.java
package com.thoughtmonkeys.pitstop;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextPaint;
View gist:9771906873508624cbba
<receiver
android:name="com.talentstech.mediaboardusbupdate.DiskMountReceiver">
<intent-filter >
<action android:name="android.intent.action.MEDIA_MOUNTED"/>
<action android:name="android.intent.action.MEDIA_BAD_REMOVAL"/>
<action android:name="android.intent.action.MEDIA_EJECT"/>
<action android:name="android.intent.action.MEDIA_REMOVED"/>
<data android:scheme="file"/>
</intent-filter>
</receiver>
View gbk2utf
把 1.txt 从 gbk 转成 utf-8 并保存为 2.txt
iconv -f gbk -t utf-8 1.txt > 2.txt
View FileUtils.java
/**
* 文件大小格式转换
* @param fileS 文件大小
* @return 文件大小
*/
public static String FormatFileSize(long fileS)
{
// 转换文件大小
DecimalFormat df = new DecimalFormat("#.00");
String fileSizeString = "";
View gist:8573804
要特别注意的是,dialog.show(),一定要放在dialog.setContentView()的前面
View MusicParseUtil.java
/**解析音乐标签
* 测试发现无法解析wma音乐文件
* 可解析mp3 ma4等
* Created by junny on 12/17/13.
*/
public class MusicParseUtil {
public static String getAlbum(String filePath){
String album;
View VideoPlayerActivity.java
MovieBannerView.clearAnimation();
TranslateAnimation TransAnim;
TransAnim = new TranslateAnimation(0.0f, 0.0f, banner_h, 0.0f);
TransAnim.setDuration(bannerAnimTime);
MovieBannerView.startAnimation(TransAnim);
View MusicLyrcUtil.java
public String GetCharset(File file) {
String charset = "GBK";
byte[] first3Bytes = new byte[3];
try {
boolean checked = false;
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
bis.mark(0);
int read = bis.read(first3Bytes, 0, 3);
if (read == -1)
return charset;