Skip to content

Instantly share code, notes, and snippets.

View antonshkurenko's full-sized avatar
⚜️
:)

Anton Shkurenko antonshkurenko

⚜️
:)
View GitHub Profile
@antonshkurenko
antonshkurenko / styles.xml
Created October 30, 2015 09:47
No ui activity theme for the AppCompat
<!-- No ui for appcompat -->
<style name="NoUiAppTheme"
parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoDisplay">true</item>
</style>
@antonshkurenko
antonshkurenko / RawStringConverter.java
Created October 28, 2015 11:48
Converter Factory for Retrofit 2.0
public class RawStringConverter extends Converter.Factory {
@Override
public Converter<ResponseBody, ?> fromResponseBody(Type type, Annotation[] annotations) {
//noinspection EqualsBetweenInconvertibleTypes
if (String.class.equals(type)) {
return ResponseBody::string;
}
return null;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
public class FractalTree extends JFrame {
public FractalTree() {
super("Fractal Tree");
setBounds(100, 100, 800, 600);
setResizable(false);
int a = in0[i], b = in1[i];
int cmp = a < b; //if TRUE, cmp has all bits 1, if FALSE all bits 0
// & bitwise AND
// | bitwise OR
// ~ flips all bits
out[i] = (a&cmp) | (b&~cmp); //a when TRUE and b when FALSE
@antonshkurenko
antonshkurenko / Dagger 2, quick start
Last active June 18, 2018 19:27
Everything I found about Dagger 2
Dagger step 1: Add android-apt, dagger 2, dagger2-compiler, and javax annotation to the build.gradle files.
Note that they're not all "compile" dependencies.
Step 2: Add our module. Our ApplicationModule will be able to inject the ApplicationContext to classes that need it.
Step 3: Add our Component.Dagger 2 generates code for each Component you create,
using the file name Dagger(NameOfComponent).
Example: DaggerApplicationComponent.
Components can have multiple modules, in our case we have one.
@antonshkurenko
antonshkurenko / Endless scroll
Created October 11, 2015 15:00
Endless scroll listener
/**
* This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling.
* If a scroll listener is already assigned, the caller should still pass scroll changes through
* to this listener.
*/
public static abstract class EndlessScrollListener extends RecyclerView.OnScrollListener {
private int mPreviousTotal = 0; // The total number of items in the dataset after the last load
@antonshkurenko
antonshkurenko / introrx.md
Created September 23, 2015 19:09 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Genymotion: 10.0.3.2
AVD: 10.0.2.2
@antonshkurenko
antonshkurenko / ViewExpander.java
Created September 11, 2015 15:01
Util class to expand/collapse views with animations. Android.
package ua.com.i2i.futurum.utils;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Transformation;
/**
* credits: http://stackoverflow.com/a/13381228/4142087
* util class to expand/collapse view with animation
@antonshkurenko
antonshkurenko / genymotionwithplay.txt
Last active September 3, 2015 12:54 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161892865 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)