Skip to content

Instantly share code, notes, and snippets.

View wuyexiong's full-sized avatar

哈哈熊仔 wuyexiong

  • Shenzhen, China
View GitHub Profile
@wuyexiong
wuyexiong / DeviceUtil.java
Created June 21, 2013 19:15
Android设备相关的工具类
package com.omusic.library.utils;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
@wuyexiong
wuyexiong / GBK批量转UTF-8
Created July 2, 2013 14:10
把乱码的GBK编码的文件放到当前data目录下,然后就。。。嘿嘿
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class GBK2UTF8
public class NetworkButton extends Button {
// See Otto's sample application for how BusProvider works. Any mechanism
// for getting a singleton instance will work.
Bus bus = BusProvider.get();
public NetworkButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
public class FragmentUtils {
/**
* @param frag
* The Fragment whose parent is to be found
* @param callbackInterface
* The interface class that the parent should implement
* @return The parent of frag that implements the callbackInterface or null
/*
** Copyright 2012, Joel Pedraza
**
** 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
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
Checkstyle-Configuration: Android checkstyle by Enea
Description: none
-->
@wuyexiong
wuyexiong / getModifiers.java
Created August 10, 2013 17:59
反射获取类成员的属性
// Declare and initialize a Class object:
Class mc = java.lang.Byte.class;
// Declare and initialize a field object:
Field field = mc.getField("MIN_VALUE");
// Get the integer value of the modifiers:
int mod = field.getModifiers();
// Get the string value of the modifiers:
@wuyexiong
wuyexiong / build.gradle
Last active December 21, 2015 08:48
1.ndk动态库打包 2.多渠道编译
import java.util.regex.Pattern
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':omusic-library')
}
task copyNativeLibs(type: Copy) {
@wuyexiong
wuyexiong / CloneExample1.java
Created September 12, 2013 04:14
Java 浅拷贝深拷贝,以及深拷贝优化。我草,碉堡了。
package deepcopy;
import java.util.Vector;
public class CloneExample1 {
public static void main(String[] args) {
// Make a Vector
Vector original = new Vector();
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_app_name">AVélib</string>
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string>
<string name="config_com.google.android.maps.v2.api_key">XXX</string>
</resources>