Skip to content

Instantly share code, notes, and snippets.

View almozavr's full-sized avatar

Oleksii Malovanyi almozavr

  • Lviv, UA
View GitHub Profile
@amlcurran
amlcurran / MultiContentAdapter.java
Last active December 11, 2015 03:38
Simple Adapter which can handle multiple input cursors asynchronously (ideal for usage with CursorLoaders)
/* Copyright 2013 Alex Curran
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
distributed under the License is distributed on an "AS IS" BASIS,
@nrudenko
nrudenko / open_db.sh
Last active December 28, 2015 05:18
Script for getting database form device via adb and open in sqlite_client(work with not rooted devices)
#!/bin/sh
# Script for getting database form device via adb and open in sqlite_client(work with not rooted devices)
#
# While you aren't breaking script execution(CTLR+C),
# each closing of sqlite_client will be download and open database again and again.
#
# Note: if you don't have installed sqliteman override sqlite_client variable with your favorite client
#
# Usage: open_db.sh {app_package} {db_name}
@imminent
imminent / ExampleActivity.java
Last active October 23, 2017 07:39
Gist for a modified approach to integrating Palette with Picasso proposed by Jake Wharton for the interim while Picasso doesn't have a supported way to pass meta data along the pipeline. http://jakewharton.com/coercing-picasso-to-play-with-palette/
package your.package;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Picasso;
import your.package.PaletteTransformation;
import static your.package.PaletteTransformation.PaletteCallback;
package trikke.gists;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
@daj
daj / BaseStatelessBlackBoxEspressoTest.java
Last active December 20, 2018 09:44 — forked from xrigau/AndroidManifest.xml
The set of changes required to disable animations any time Espresso tests run. These instructions will only work on emulators and on rooted devices. This is based on the instructions in: https://code.google.com/p/android-test-kit/wiki/DisablingAnimations
public abstract class BaseStatelessBlackBoxEspressoTest<T extends Activity> extends ActivityInstrumentationTestCase2<T> {
private SystemAnimations mSystemAnimations;
public BaseStatelessBlackBoxEspressoTest(Class clazz) {
super(clazz);
}
@Override
protected void setUp() throws Exception {
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@gabrielemariotti
gabrielemariotti / GridActivity.java
Created July 27, 2014 21:38
Android Wear: How to use a simple a GridViewPager with a FragmentGridPagerAdapter.
public class GridActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
final GridViewPager mGridPager = (GridViewPager) findViewById(R.id.pager);
mGridPager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager()));
}
@JakeWharton
JakeWharton / README.md
Last active January 8, 2020 02:13
A special activity which facilitates restarting your application process.
@romannurik
romannurik / SwipeDismissListViewTouchListener.java
Last active May 1, 2021 10:16
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
Moved to
https://github.com/romannurik/android-swipetodismiss
@JakeWharton
JakeWharton / AutoGson.java
Last active November 28, 2021 12:32
A Gson TypeAdapterFactory which allows serialization of @autovalue types. Apache 2 licensed.
import com.google.auto.value.AutoValue;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization.
* <p>