Skip to content

Instantly share code, notes, and snippets.

@aaalaniz
aaalaniz / perform_release.sh
Created May 21, 2014 04:32
Performing Android Release with Maven
# Create a release branch
RELEASE_VERSION=`mvn help:evaluate -Dexpression=project.version | grep -v INFO | grep SNAPSHOT | cut -d '-' -f 1`
git checkout -b release/$RELEASE_VERSION
# Prepare a release (Note we do not push any tags just yet)
mvn -B release:prepare -DpushChanges=false -DremoteTagging=false -DscmCommentPrefix= -P release
# The project has been built and now we want to deploy
# but we need to ensure our manifest stays in line with our releases
git reset HEAD~1
@aaalaniz
aaalaniz / pom.xml
Created May 22, 2014 02:38
Example Android pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-awesome-app</artifactId>
<version>1.0.0</version>
<packaging>apk</packaging>
<name>My Awesome Android Application</name>
<dependencies>
@aaalaniz
aaalaniz / MainThreadBus.java
Created June 10, 2014 05:22
Otto Main Thread Bus
public class MainThreadBus extends Bus {
private final Bus mBus;
private final Handler mHandler = new Handler(Looper.getMainLooper());
public MainThreadBus(final Bus bus) {
if (bus == null) {
throw new NullPointerException("bus must not be null");
}
mBus = bus;
}
@aaalaniz
aaalaniz / install_mvn_3_1_1.sh
Created October 13, 2014 18:09
Install Maven 3.1.1
# Install to home directory
cd ~
# Extract the package
wget http://mirror.metrocast.net/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar -xf apache-maven-3.1.1-bin.tar.gz
# Install mvn to path
M2_HOME=$HOME/apache-maven-3.1.1
echo -e "\n# Maven 3.1.1 Setup" >> ~/.bashrc
@aaalaniz
aaalaniz / install_java6.sh
Created October 27, 2014 13:31
Install Java 6
WORKING_DIR=`pwd`
# Download the jdk 1.6
wget http://ghaffarian.net/downloads/Java/JDK/jdk-6u45-linux-x64.bin
# Install the jdk
sudo mkdir /usr/lib/jvm
cd /usr/lib/jvm && sudo sh $WORKING_DIR/jdk-6u45-linux-x64.bin -noregister
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 50000
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 50000
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import io.realm.RealmObject;
import io.realm.RealmResults;
public abstract class RealmAdapter<E extends RealmObject, VH extends RealmAdapter.ViewHolder>
extends BaseAdapter {
@aaalaniz
aaalaniz / LinkerFlagsRuleSource.groovy
Last active February 22, 2016 16:02
Mutate Link Task Flags
class LinkerFlagsRuleSource extends RuleSource {
@Mutate
void modifyLinkerFlags(@Path('tasks.linkMy_moduleArmeabi-v7aDebugSharedLibrary') Task linkTask) {
linkTask.doFirst {
def newLinkerArgs = []
properties["linkerArgs"].each { linkerArg ->
def newLinkerArg = linkerArg.replaceAll(/ARCH/, 'armeabi-v7a')
newLinkerArgs.add(newLinkerArg)
}
setProperty("linkerArgs", newLinkerArgs)
@aaalaniz
aaalaniz / CameraCapturerTest.java
Last active August 31, 2017 22:11
Twilio Video Android Bug 1060453
@Test
public void canBeRenderedToView() throws InterruptedException {
VideoView localVideo = (VideoView) cameraCapturerActivity.findViewById(R.id.local_video);
VideoView localVideoTwo = (VideoView) cameraCapturerActivity.findViewById(R.id.local_video_two);
VideoView localVideoThree = (VideoView) cameraCapturerActivity.findViewById(R.id.local_video_three);
VideoView localVideoFour = (VideoView) cameraCapturerActivity.findViewById(R.id.local_video_four);
VideoView localVideoFive = (VideoView) cameraCapturerActivity.findViewById(R.id.local_video_five);
final CountDownLatch renderedFirstFrame = new CountDownLatch(5);
VideoRenderer.Listener rendererListener = new VideoRenderer.Listener() {
@Override
@aaalaniz
aaalaniz / EglBaseProviderReflectionUtils.java
Last active November 30, 2020 17:25
Rendering with a TextureView
import org.webrtc.EglBase;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/*
* Uses reflection to interact with non public class EglBaseProvider.
*/
public class EglBaseProviderReflectionUtils {
@aaalaniz
aaalaniz / VideoViewRecyclerViewAdapter.java
Created September 15, 2017 14:36
VideoView used in RecyclerView
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.twilio.video.LocalVideoTrack;
import com.twilio.video.VideoScaleType;