Skip to content

Instantly share code, notes, and snippets.

View goodev's full-sized avatar

Goodev goodev

View GitHub Profile

转换方法:

  1. Convert Android VectorDrawable to SVG:

使用附件中的java程序。命令如下:

cp Vector2Svg.java path/to/xml_dir
javac Vector2Svg.java
java Vector2Svg ./*.xml
mkdir svg_dir
@goodev
goodev / AndroidLogKotlin.xml
Last active November 1, 2021 07:29
Android log live template for kotlin:
<templateSet group="AndroidLogKotlin">
<template name="logm" value="android.util.Log.d(TAG, $FORMAT$)" description="Log method name and its arguments" toReformat="true" toShortenFQNames="true">
<variable name="FORMAT" expression="groovyScript(&quot;def params = _2.collect {it + ' = [$' + it + ']'}.join(', '); return '\&quot;' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + '\&quot;'&quot;, kotlinFunctionName(), functionParameters())" defaultValue="" alwaysStopAt="false" />
<context>
<option name="KOTLIN_STATEMENT" value="true" />
</context>
</template>
<template name="logd" value="android.util.Log.d(TAG, &quot;$METHOD_NAME$: $content$&quot;)" description="Log.d(String)" toReformat="true" toShortenFQNames="true">
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" />
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" />
@goodev
goodev / TimberJava.xml
Created August 29, 2017 09:42 — forked from ericksli/TimberJava.xml
Timber Android Studio live template for Java and Kotlin
<templateSet group="TimberJava">
<template name="timd" value="timber.log.Timber.d(&quot;$METHOD_NAME$: $content$&quot;);" description="Timber.d(String)" toReformat="true" toShortenFQNames="true">
<variable name="METHOD_NAME" expression="methodName()" defaultValue="" alwaysStopAt="false" />
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
<template name="time" value="timber.log.Timber.e($exception$, &quot;$METHOD_NAME$: $content$&quot;);" description="Timber.e(Exception, String)" toReformat="true" toShortenFQNames="true">
<variable name="exception" expression="" defaultValue="e" alwaysStopAt="true" />
@goodev
goodev / github-schema.json
Created June 12, 2017 11:21
github GraphQL schema
This file has been truncated, but you can view the full file.
{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
# Autogenerated input type of AddComment
input AddCommentInput {
# A unique identifier for the client performing the mutation.
clientMutationId: String
# The Node ID of the subject to modify.
subjectId: ID!
# The contents of the comment.
body: String!
@goodev
goodev / gist:c8338bb1c96706b15fe7297048cbf4cc
Created April 24, 2017 12:55 — forked from brunodles/gist:badaa6de2ad3a84138d517795f15efc7
This is a test to show how to use expresso to check if a toast was displayed.
package com.github.brunodles.toastespresso;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@goodev
goodev / build.gradle
Created April 20, 2017 05:26
git version name and code
apply plugin: 'com.android.application'
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--dirty'
standardOutput = stdout
}
return stdout.toString().trim()
package despotoski.nikola.appbarlayoutsamples.view;
import android.animation.IntEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
package se.emilsjolander.flipview;
import se.emilsjolander.flipview.Recycler.Scrap;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;
import android.content.Context;
@goodev
goodev / FloatingActionMenuBehavior.java
Created September 21, 2015 01:50 — forked from NikolaDespotoski/FloatingActionMenuBehavior.java
FloatingActionMenuBehavior for FloatingActionsMenu library
//https://medium.com/@nullthemall/floatingactionmenu-floatingactionbutton-behavior-dd33cc0d9ba7
public class FloatingActionMenuBehavior extends android.support.design.widget.CoordinatorLayout.Behavior<FloatingActionsMenu> {
private static final Interpolator FAST_OUT_SLOW_IN_INTERPOLATOR = new FastOutLinearInInterpolator();
private int mTotalDy = 0;
private boolean isAnimating = false;
private FloatingActionsMenu.OnFloatingActionsMenuUpdateListener mFloatingMenuUpdateListener = new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuExpanded() {