Skip to content

Instantly share code, notes, and snippets.

View sbaar's full-sized avatar

Scott Baar sbaar

  • Cover
  • San Francisco
View GitHub Profile
Annotation to create serialization type adapters for gson to differentiate kotlin sealed classes subtypes
@sbaar
sbaar / Privacy.html
Last active February 15, 2017 08:31
Daydream Widgets privacy policy
<html>
<body>
<h2>Privacy Policy</h2>
<p>Shirase Apps built the Daydream Widgets app as a commercial app. This SERVICE is provided by Daydream Widgets at no cost and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding our policies with the collection, use, and
disclosure of Personal Information if anyone decided to use |our Service.</p>
<p>If you choose to use our Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that we collect are used for providing and
improving the Service. We will not use or share your information with anyone except as described
@sbaar
sbaar / kb_layout.xml
Created November 21, 2016 17:45
3pk tab customization
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/_mm_top_layout_bg"
app:theme="@style/KBAppTheme"
android:theme="@style/KBAppTheme"
android:layout_height="wrap_content">
<LinearLayout
@sbaar
sbaar / MAdapter.java
Created April 14, 2016 04:33
MAdapter with clickable hashtags and @
//the magic happens just before return convertView; in getView()
package com.makemoji.sbaar.mojilist;
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
import android.view.View;
@sbaar
sbaar / BitrateController.java
Last active August 19, 2020 03:11
libstreaming bitrate controller
import android.annotation.TargetApi;
import android.media.MediaCodec;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.SeekBar;
import android.widget.Toast;
@sbaar
sbaar / AACStream.java
Last active April 18, 2018 08:11
libstreaming muxer
protected void encodeWithMediaCodec(){
...
mAudioRecord.startRecording();
mMediaCodec.start();
final MediaCodecInputStream inputStream = new MediaCodecInputStream(mMediaCodec);
if (mMuxer!=null) inputStream.setMuxer(mMuxer);
final ByteBuffer[] inputBuffers = mMediaCodec.getInputBuffers();
}
@sbaar
sbaar / nv21converter.java
Created January 3, 2016 11:12
nv21 180 rotate
/**
* Borrowed from http://stackoverflow.com/questions/23107057/rotate-yuv420-nv21-image-in-android
* Note, this will distort images if rotating 90 or 270 because it does not work well with rectangles.
*/
public static void rotateNV21(byte[] input, byte[] output, int width, int height, int rotation) {
if (rotation==0){
System.arraycopy(input, 0, output, 0, input.length);
return;
}
@sbaar
sbaar / Nexus 6 camera 2 supported capture request keys
Last active November 10, 2016 05:45
Nexus 6 camera 2 exploration
android.blackLevel.lock
android.colorCorrection.mode
android.control.aeAntibandingMode
android.control.aeExposureCompensation
android.control.aeLock
android.control.aeMode
android.control.aePrecaptureTrigger
android.control.aeRegions
android.control.aeTargetFpsRange
android.control.afMode
@sbaar
sbaar / TapContext Mopub adapter
Created March 26, 2014 04:31
TapContext Mopub custom network adapter
//Mopub custom network adapter for https://www.tapcontext.com/register/?r=geemf5acp9
package com.yourapps.packagename;
import android.app.Activity;
import android.util.Log;
import com.google.ads.mediation.MediationAdRequest;
import com.google.ads.mediation.customevent.CustomEventInterstitial;