Skip to content

Instantly share code, notes, and snippets.

Avatar

James Avyaz ayvazj

View GitHub Profile
@ayvazj
ayvazj / main.dart
Created Jul 14, 2019
Mapbox main.dart - v1
View main.dart
import 'package:flutter/material.dart';
import 'package:mapbox_gl/mapbox_gl.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: MapWidget());
}
View BtfyAnimationView
public class BtfyAnimationView extends ViewGroup {
// ... load .btfy into a BtfyStage object at property this.btfyStage
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (this.btfyStage == null) {
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
MeasureSpec.getSize(heightMeasureSpec));
return;
View btfy meta
{
"version": 1,
"comment": "'20150313T13:08:29-OOB attract loop V2' exported by AE Butterfly Format Exporter v0.37",
"type": "stage",
"aspectRatio": 0.5625,
"size": {
"width": 720,
"height": 1280
},
...
View parse btfy
public BtfyAnimationGroup parseAnimationGroup(JsonNode jSONObject) throws BtfyParseException {
String typeStr = jSONObject.path("type").asText();
if (typeStr.equals("animationGroup")) {
String jsonId = jSONObject.path("id").asText();
if (TextUtils.isEmpty(jsonId)) {
throw new BtfyParseException("Animation missing id.");
}
if (!jSONObject.has("initialValues")) {
throw new BtfyParseException("Animation group missing initial values.");
View opacity keyframe
[
0,
0,
{
"name": "cubic-bezier",
"x1": 0.33333333,
"y1": 0,
"x2": 0.66666667,
"y2": 1
}
View position keyframe
[
0,
{
"x": 1.1875,
"y": 0.22421875
},
{
"name": "cubic-bezier",
"x1": 0.0001,
"y1": 0,
View intro.btfy
{
"version": 1,
"comment": "'20150313T13:08:29-OOB attract loop V2' exported by AE Butterfly Format Exporter v0.37",
"type": "stage",
"aspectRatio": 0.5625,
"size": {
"width": 720,
"height": 1280
},
"animations": [
@ayvazj
ayvazj / LinkedHashMapAdapter
Created Sep 19, 2015
A HashMap adapter for Android
View LinkedHashMapAdapter
package com.github.ayvazj.hashadapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;