Skip to content

Instantly share code, notes, and snippets.

View davinctor's full-sized avatar
🎯
Focusing

Viktor Ponomarenko davinctor

🎯
Focusing
View GitHub Profile
**
* Receiver for detecting new sms
*/
public class SmsReceiveUtil {
public static final String TEST_ACTION = "TEST_SMS_RECEIVED";
private static final String EXTRA_BODY = MiscellaneousUtils.getExtra("body");
private final ObservableImpl observable;
Observable.just(new ArrayList<String>())
.flatMap(new Func1<ArrayList<String>, Observable<String>>() {
@Override
public Observable<String> call(ArrayList<String> strings) {
int N = 10;
return Observable.range(0, strings.size() / N)
.flatMap(count -> {
return Observable.from(strings)
.skip(count * N)
.take(count * N)

1. Store api keys in a xml file

Put xml file "api_keys.xml" in the directory "res/value/".

api_keys.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="THE_MOVIE_DB_API_TOKEN">XXXXX</string>
</resources>
@davinctor
davinctor / ff.stable.txt
Created July 22, 2016 09:20 — forked from 2bits/ff.stable.txt
ffmpeg-0.10.2 configure options
Usage: configure [options]
Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
--logfile=FILE log tests and output to FILE [config.log]
--disable-logging do not log configure debug information
--prefix=PREFIX install in PREFIX []
--bindir=DIR install binaries in DIR [PREFIX/bin]
--datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
@davinctor
davinctor / FetchPointsRxEvent.java
Last active August 8, 2016 15:45
Implementation of bus with RxJava with simple example
/**
*
* After receiving {@link FetchPointsRxEvent} receiver must to update views with points count
*
* 21.04.16
* Created by Victor Ponomarenko
*/
public class FetchPointsRxEvent {
}
@davinctor
davinctor / DrawableUtils.java
Created August 25, 2016 11:54
Drawable util methods
package com.cleveroad.slidingtutorial.sample.util;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Build;
@davinctor
davinctor / sample.xml
Created September 2, 2016 10:43
Most used views.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/ivImage"
android:layout_width="wrap_content"
@davinctor
davinctor / FileUtil.java
Created September 9, 2016 13:30
Helper class for working with files in android.
public class FileUtil {
private static final String APP_FOLDER_NAME = ".skillconnect";
private static final String TAG = "FileUtil";
private static final SimpleDateFormat sdf = new SimpleDateFormat("MMdd_HHmmssms", Locale.getDefault());
private static final String PREFIX = "IMG_";
private static final String EXTENSION = ".jpg";
private static final File dirPictures = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), APP_FOLDER_NAME);
@davinctor
davinctor / BackPressUtil.java
Created September 16, 2016 11:58
Simple util for checking if app should be closed on back pressed.
/**
* Simple util for checking if app should be closed on back pressed.
*/
public class BackPressUtil {
private long timeout;
private long prevCheck = -1;
public BackPressUtil(long timeout) {
this.timeout = timeout;
@davinctor
davinctor / GifDecoder.java
Created September 30, 2016 09:39 — forked from devunwired/GifDecoder.java
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: