Skip to content

Instantly share code, notes, and snippets.

View ongakuer's full-sized avatar

relex ongakuer

  • Beijing , China
  • 19:30 (UTC +08:00)
View GitHub Profile
#!/bin/bash
: << '#__REM__'
指定さたライブラリをAndroid用にフルオートで作成します。ダウンロード、toolchainsの作成、複数のアーキテクチャのビルドも自動的に行います。デフォルトではarmv5te、armv7-a、mips1、i386のアーキテクチャを作成します。
Create a full-auto for Android the library specified. Creating download, toolchains, build the architecture of multiple automatically. Create architecture, mips1, i386 armv5te, armv7-a by default.
#__REM__
TARGET_VERSION="1.3.1"
anonymous
anonymous / Camera2VideoFragment.java
Created March 19, 2015 10:19
fix for Camera2Video from google's sample
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
@shawnlinboy
shawnlinboy / SmartBarUtils.java
Last active November 3, 2016 03:37
一个扩展后的魅族SmartBar工具类,增加三种隐藏SmartBar的方法,过期一种方法。
package in.mobilelin.smartbar;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.app.ActionBar;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
@ec84b4
ec84b4 / gist:d56c00fb5fd2dfaf279b
Last active June 26, 2018 06:22
recycler view header adapter
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by khaled bakhtiari on 10/26/2014.
* <a href="http://about.me/kh.bakhtiari">
*/
@darnmason
darnmason / HeaderViewRecyclerAdapter.java
Last active March 21, 2020 17:19
RecyclerView adapter designed to wrap an existing adapter allowing the addition of header views and footer views.
/*
* Copyright (C) 2014 darnmason
*
* 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
@JakeWharton
JakeWharton / BaseActivity.java
Created July 6, 2012 01:17
Scoped event bus which automatically registers and unregisters with the lifecycle.
package com.squareup.example;
public abstract BaseActivity extends SherlockActivity {
private final ScopedBus scopedBus = new ScopedBus();
protected ScopedBus getBus() {
return scopedBus;
}
@Override public void onPause() {
@meoyawn
meoyawn / EmptyRecyclerView.java
Created November 1, 2014 11:20
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@gabrielemariotti
gabrielemariotti / Activity.java
Last active November 27, 2022 09:27
Floating Action Button (requires Android-L preview)
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layoutfab);
//Outline
int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
Outline outline = new Outline();
@chalup
chalup / GagSsl.java
Created January 30, 2014 11:30
Get OkHttpClient which ignores all SSL errors.
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
@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 {