Based on Volley Cache
/**
* An interface for a cache keyed by a String with a byte array as data
*/
interface Cache {
/* | |
* Copyright (C) 2012 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 |
先从windows系统复制文件simsun.ttf到你的虚拟机下(c:\windows\fonts\
),在CrossOver下打开regedit
(命令行方式)
找到HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements
,删除下面的项目simsun 宋体 新宋体
public class Hex { | |
private static final char[] HEX_DIGITS = new char[] { | |
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | |
}; | |
private static final char[] FIRST_CHAR = new char[256]; | |
private static final char[] SECOND_CHAR = new char[256]; | |
static { |
inline bool LoadBinaryFile(const char *name, std::vector<uint8_t> *v) { | |
std::ifstream ifs(name, std::ifstream::binary); | |
if(!ifs.is_open()) return false; | |
ifs.seekg(0, std::ios::end); | |
(*v).resize(static_cast<size_t>(ifs.tellg())); | |
ifs.seekg(0, std::ios::beg); | |
ifs.read(reinterpret_cast<char *>(&(*v)[0]), (*v).size()); | |
return !ifs.bad(); | |
} |
自定义一个MODULE,名为libFoo,对应的so为libFoo.so, 头文件.h文件与.so文件放在当前目录的Foo目录中
# Android.mk增加LOCAL_MODULE libFoo
FOO_LIBRARY_PATH = $(LOCAL_PATH)/Foo
include $(CLEAR_VARS)
LOCAL_MODULE := libFoo
LOCAL_SRC_FILES := $(FOO_LIBRARY_PATH)/libFoo.so
LOCAL_EXPORT_C_INCLUDES := $(FOO_LIBRARY_PATH)
# 预编译的共享库
include $(PREBUILT_SHARED_LIBRARY)
/**
* Version of {@link #resolveSizeAndState(int, int, int)}
* returning only the {@link #MEASURED_SIZE_MASK} bits of the result.
*/
public static int resolveSize(int size, int measureSpec) {
return resolveSizeAndState(size, measureSpec, 0) & MEASURED_SIZE_MASK;
}
/**
A MeasureSpec encapsulates the layout requirements passed from parent to child. Each MeasureSpec represents a requirement for either the width or the height. A MeasureSpec is comprised of a size and a mode. There are three possible modes: UNSPECIFIED The parent has not imposed any constraint on the child. It can be whatever size it wants. EXACTLY The parent has determined an exact size for the child. The child is going to be given those bounds regardless of how big it wants to be. AT_MOST The child can be as large as it wants up to the specified size. MeasureSpecs are implemented as ints to reduce object allocation. This class is provided to pack and unpack the <size, mode> tuple into the int.
public class Installation { | |
private static String sID = null; | |
private static final String INSTALLATION = "INSTALLATION"; | |
public synchronized static String id(Context context) { | |
if (sID == null) { | |
File installation = new File(context.getFilesDir(), INSTALLATION); | |
try { | |
if (!installation.exists()) writeInstallationFile(installation); | |
sID = readInstallationFile(installation); |
buildscript { | |
repositories { | |
jcenter() | |
mavenCentral() | |
maven { | |
url "https://oss.sonatype.org/content/repositories/snapshots" | |
} | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:2.0.0-beta5' |