Skip to content

Instantly share code, notes, and snippets.

View miroslavign's full-sized avatar

Miroslav Ignjatovic miroslavign

View GitHub Profile
@miroslavign
miroslavign / EndlessRecyclerOnScrollListener.java
Created January 16, 2016 18:01 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@miroslavign
miroslavign / RoundedQuickContactBadge
Created January 20, 2016 09:55 — forked from kishu27/RoundedQuickContactBadge
Just a quick and dirty method to get a rounded QuickContactBadge
/**
* A rounded version of {@link QuickContactBadge]
* @author kishu27 (http://linkd.in/1laN852)
*
*/
public class RoundedQuickContactBadge extends QuickContactBadge {
/**
* This path is used to mask out the outer edges of a circle on this View
*/
@miroslavign
miroslavign / NotificationExamplesMainActivity
Created January 27, 2016 00:44 — forked from waynepiekarski/NotificationExamplesMainActivity
Example of using stack and page notifications with the Android Wear SDK
package testing.blog.waynepie.blogtesting;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
private final int BORDER_COLOR = Color.WHITE;
@miroslavign
miroslavign / AndroidManifest.xml
Created December 27, 2016 13:23 — forked from vikrum/AndroidManifest.xml
Firebase+Android sample app with background Service + local notifications.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bgfirebaseapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
private void setUpSearchQuerySubscription2(){
Subscription searchQuerySubscription = searchQueryChangeObservable
.doOnNext(new Action1<CharSequence>() {
@Override
public void call(CharSequence charSequence) {
searchProgressBar.setVisibility(View.INVISIBLE);
}
})
.debounce(400, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
PublishRelay<Integer> publishRelay = PublishRelay.create();
Observable<Integer> relayObservable = publishRelay
.doOnSubscribe(() -> {
Log.i("RxExperiments", "ReplayingShare->doOnSubscribe");
// Register to event here...
}).doOnUnsubscribe(() -> {
Log.i("RxExperiments", "ReplayingShare->doOnUnsubscribe");
// Un-register from event here...
})
.compose(ReplayingShare.instance());
/*
* Copyright (C) 2014 [email protected]
*
* 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
@miroslavign
miroslavign / LICENSE
Created March 14, 2017 21:38 — forked from sddamico/LICENSE
Exponential Backoff Transformer
Copyright (c) 2016 Stephen D'Amico
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE