Skip to content

Instantly share code, notes, and snippets.

View Example.java
builder.photoSize(
firstAvailable(
wideRatio(biggestSize()),
standardRatio(biggestSize())
)
)
@dmitry-zaitsev
dmitry-zaitsev / scanbot-sdk-proguard.pro
Last active Apr 13, 2016
Scanbot SDK Proguard rules
View scanbot-sdk-proguard.pro
-dontwarn
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable,*Annotation*,Signature,InnerClasses
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
@dmitry-zaitsev
dmitry-zaitsev / jb.sh
Created Nov 30, 2015 — forked from rjeschke/jb.sh
jnibuild bash script
View jb.sh
#!/bin/bash
artifact=~/.m2/repository/com/github/rjeschke/jnibuild/0.1-SNAPSHOT/jnibuild-0.1-SNAPSHOT.jar
if [ ! -f $artifact ]
then
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=http://maven.renejeschke.de/snapshots/ -Dartifact=com.github.rjeschke:jnibuild:0.1-SNAPSHOT
fi
java -cp $artifact com.github.rjeschke.jnibuild.Build $@
View gist:b03ca967ec1a455372d5
package net.anichart.ui.util.Binding;
import android.databinding.BindingAdapter;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
/**
* Binds image related properties
*/
View Executing SQLite queries in background (example for article)
public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> {
@Override
protected Cursor doInBackground(Void... params) {
DatabaseHelper helper = new DatabaseHelper(MainActivity.this);
return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null);
}
@Override
View gist:5605839
package robotograph;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;
@dmitry-zaitsev
dmitry-zaitsev / AndroidSideMenu_AlwaysOpen
Created Apr 4, 2013
How to properly set "alwaysOpen" property for big devices. This snippet causes side menu to be always opened ONLY on big devices ONLY in landscape mode.
View AndroidSideMenu_AlwaysOpen
Configuration config = getResources().getConfiguration();
boolean alwaysOpen = config.orientation == Configuration.ORIENTATION_LANDSCAPE
&& ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
|| (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE);