Skip to content

Instantly share code, notes, and snippets.

@poutyface
poutyface / gist:1119105
Created August 1, 2011 22:00
Android RegisterNatives
#include <stdio.h>
#include <android/log.h>
#include "calvals.h"
#define EXPORT __attribute__((visibility("default")))
#define LOG_TAG "native"
#define log_info(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define log_error(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
@DDRBoxman
DDRBoxman / create_images
Created November 2, 2011 03:05
Script to scale and create Android images at the correct dpi levels
#!/bin/bash
#Requires ImageMagick to be installed.
#Some builds of ImageMagick on OSX have problems generating the images correctly.
#This script scales and creates images at the correct dpi level for Android.
#It gets placed in a folder called res/drawable/source_images/ in your #Android project along with all your svg files.
#When creating svg files set the image size to the size that you want your hdpi images to be.
#To use simply run the create_images script from its folder and it will generate images for all the svg files.
@jrudolph
jrudolph / .gitignore
Created December 5, 2011 17:51
Dalvik dexopt failure
/bin
/gen
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.plugins.BasePlugin
/**
* apply this plugin after doing all dependency and repo stuff. It will create two idea 'libraries' per subproject
* and add them to your .iml files
*
* Forked from https://gist.github.com/360092
*
@markus2610
markus2610 / AsyncTaskExecutionHelper.java
Created June 19, 2012 19:14 — forked from greenrobot/AsyncTaskExecutionHelper.java
Helper bringing back parallel execution for AsyncTask (you are no serial execution and pseudo threading wimp, right?). Uses level 11 APIs when possible.
package de.greenrobot.util;
import java.util.concurrent.Executor;
import android.os.AsyncTask;
import android.os.Build;
/**
* Uses level 11 APIs when possible to use parallel/serial executors and falls back to standard execution if API level
* is below 11.
@chrisjenx
chrisjenx / gist:3405429
Created August 20, 2012 16:14
BasePagerFragment - Simple way to place a FragmentViewPager in a Fragment!
/**
* @project
* @author chris.jenkins
* @created Dec 28, 2011
*/
package com.application.android.ui.fragments;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentStatePagerAdapter;
@okor
okor / ffmpeg.rb
Created September 28, 2012 18:14
homebrew formula to install ffmpeg 1.0
require 'formula'
class Ffmpeg < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-1.0.tar.bz2'
sha1 'bf1f917c4fa26cf225616f2063e60c33cac546be'
head 'git://git.videolan.org/ffmpeg.git'
option "without-x264", "Disable H264 encoder"
@romannurik
romannurik / CheatSheet.java
Last active May 16, 2023 13:42
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wobbals
wobbals / AvcEncoder.java
Created October 31, 2012 22:46
MediaCodec encoder sample
package com.opentok.media.avc;
import java.io.IOException;
import java.nio.ByteBuffer;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
public class AvcEncoder {
@emil2k
emil2k / Connectivity.java
Last active August 5, 2024 10:48
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: