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>
apply plugin: 'com.android.model.application' | |
apply plugin: 'idea' | |
model { | |
android { | |
compileSdkVersion = 23 | |
buildToolsVersion = "23.0.2" | |
defaultConfig.with { | |
applicationId = "cn.septenary.keepdebug" |
// | |
// 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__) |
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": |
package cn.septenary; | |
import java.util.Locale; | |
public class MyLog { | |
// adb shell setprop log.tag.MyLog VERBOSE | |
public static String TAG = "MyLog"; | |
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); | |
} |
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) { |
package com.example.hellojni; | |
import java.io.BufferedReader; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.List; | |
/** | |
* ShellUtils |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>锚链接平滑滚动</title> | |
<meta name="description" content=""> | |
<meta name="keywords" content=""> | |
<style type="text/css"> | |
* { |
# Theme itg.flat config | |
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Theme - itg.flat/itg.dark.tmTheme", | |
"font_size": 16, | |
"ignored_packages": | |
[ | |
"Markdown", |