Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
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
package com.google.sample.castcompanionlibrary.cast.imageloader;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
package be.digitalia.common.adapters;
import android.database.DataSetObserver;
import android.util.SparseIntArray;
import android.widget.Adapter;
import android.widget.SectionIndexer;
/**
* An optimized version of the framework's AlphabetIndexer which is compatible with any Adapter
* returning non-null items with a meaningful toString() representation. Section indexes will be
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
@leasual
leasual / HttpClientSslHelper.java
Created September 25, 2015 09:08 — forked from Frank-Zhu/HttpClientSslHelper.java
Android HTTPS SSL双向验证
package com.ecloud.ssldemo;
import android.content.Context;
import android.util.Log;
import com.squareup.okhttp.OkHttpClient;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.scheme.Scheme;
@leasual
leasual / ExampleStaticHandler.java
Created October 21, 2015 09:53 — forked from yeoupooh/ExampleStaticHandler.java
Avoiding "This Handler class should be static or leaks might occur".
// This is OLD way of usnig Handler which shows an warning.
private Handler oldHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// Handle a message as you want.
}
}
@leasual
leasual / build.gradle
Created November 9, 2015 09:05 — forked from twocity/build.gradle
android gradle change output apk file name.
android.applicationVariants.all { variant ->
println "*********" + variant.description + "**********";
def variants = variant.baseName.split("-");
def apkName = "ricebook-";
apkName += variants[0];
apkName += "-v" + android.defaultConfig.versionName;
if (!variant.zipAlign) {
apkName += "-unaligned";
}
if (variant.buildType.name == "release") {
@leasual
leasual / RevealBackgroundView.java
Created November 30, 2015 02:23 — forked from brucetoo/RevealBackgroundView.java
Activity自定义转场动画的实现,如果需要返回的动画 见 Spotlight工程 MaskView
package com.bruce.materialapp.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@leasual
leasual / build.gradle
Created December 30, 2015 08:38 — forked from miao1007/build.gradle
Retrofit 2.0 RxJava Sample
dependencies {
compile 'io.reactivex:rxjava:1.0.12'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta1'
}
@leasual
leasual / .eslintrc
Created January 10, 2017 14:16 — forked from sunnylqm/.eslintrc
eslint for reactnative
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"rules": {
// Disable for __DEV__, __SERVER__ usage.