1.Suppose you have a declaration of attributes for your widget (in attrs.xml):
<declare-styleable name="CustomImageButton">
<attr name="customAttr" format="string"/>
</declare-styleable>
public class RoundedCornerLayout extends FrameLayout { | |
private final static float CORNER_RADIUS = 6.0f; | |
private float cornerRadius; | |
public RoundedCornerLayout(Context context) { | |
super(context); | |
init(context, null, 0); | |
} | |
public RoundedCornerLayout(Context context, AttributeSet attrs) { |
public class ImageUtil { | |
public static void setColorFilter(ImageView imageView, int color) { | |
final float r = Color.red(color) / 255f; | |
final float g = Color.green(color) / 255f; | |
final float b = Color.blue(color) / 255f; | |
final float a = Color.alpha(color) / 255f; | |
setColorFilter(imageView, r, g, b, a); | |
} |
package cn.septenary; | |
import java.util.Locale; | |
public class MyLog { | |
// adb shell setprop log.tag.MyLog VERBOSE | |
public static String TAG = "MyLog"; | |
private static String getCpuAbi() { | |
ShellUtils.CommandResult result = ShellUtils.execCommand("getprop ro.product.cpu.abi", false); | |
String cpuAbi; | |
switch (result.successMsg) { | |
case "arm64-v8a": | |
cpuAbi = "arm64-v8a"; | |
break; | |
case "armeabi": |
// | |
// log.h | |
#ifndef __CUSTOM__LOG_H | |
#define __CUSTOM__LOG_H | |
#include <android/log.h> | |
#define TAG "jni" | |
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) |
apply plugin: 'com.android.model.application' | |
apply plugin: 'idea' | |
model { | |
android { | |
compileSdkVersion = 23 | |
buildToolsVersion = "23.0.2" | |
defaultConfig.with { | |
applicationId = "cn.septenary.keepdebug" |
import android.content.Context; | |
import android.graphics.Color; | |
import android.graphics.PixelFormat; | |
import android.os.Handler; | |
import android.support.annotation.NonNull; | |
import android.util.TypedValue; | |
import android.view.Gravity; | |
import android.view.View; | |
import android.view.ViewGroup.LayoutParams; |
Open terminal
adb shell
su
mount -o rw,remount,rw /system