Skip to content

Instantly share code, notes, and snippets.

View oksep's full-sized avatar
🎯
Cogito, ergo sum

Septenary oksep

🎯
Cogito, ergo sum
View GitHub Profile
@oksep
oksep / app build.gradle
Last active May 16, 2016 06:57
AndroidStudio JNI-support
apply plugin: 'com.android.model.application'
apply plugin: 'idea'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "cn.septenary.keepdebug"
@oksep
oksep / log.h
Created May 16, 2016 06:52
jni log.h
//
// 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__)
@oksep
oksep / GetCpuAbi.java
Created May 13, 2016 07:46
Get Cpu Abi
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":
@oksep
oksep / MyLog.java
Last active May 12, 2016 04:11
Custom Log Util
package cn.septenary;
import java.util.Locale;
public class MyLog {
// adb shell setprop log.tag.MyLog VERBOSE
public static String TAG = "MyLog";
@oksep
oksep / ImageUtil.java
Created April 1, 2016 09:31
ImageUtil
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);
}
@oksep
oksep / CustomTheme.md
Created February 24, 2016 02:34
Define your custom widget theme

Define your custom widget theme:

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>
@oksep
oksep / RoundedCornerLayout.java
Last active February 19, 2016 03:04
RoundedCorner
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) {
@oksep
oksep / ShellUtils.java
Created February 15, 2016 06:21
ShellUtils
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
@oksep
oksep / gist:a7747de15000e31041fa
Created February 15, 2016 03:37
锚链接平滑滚动
<!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",