Skip to content

Instantly share code, notes, and snippets.

taskObservable.subscribe(new Observer<Task>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Task task) { // run on main thread
Log.d(TAG, "onNext: : " + task.getDescription());
}
Observable<Task> taskObservable = Observable // create a new Observable object
.fromIterable(DataSource.createTasksList()) // apply 'fromIterable' operator
.subscribeOn(Schedulers.io()) // designate worker thread (background)
.observeOn(AndroidSchedulers.mainThread()); // designate observer thread (main thread)
@sagarpatel288
sagarpatel288 / shadow.xml
Created February 19, 2019 15:09 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"

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>
@sagarpatel288
sagarpatel288 / LetterSpacingTextView.java
Created October 24, 2018 17:17 — forked from SyllaJay/LetterSpacingTextView.java
Android TextView, that allows changing the letter spacing of the text. @author: Pedro Barros
/**
* Text view that allows changing the letter spacing of the text.
*
* @author Pedro Barros (pedrobarros.dev at gmail.com)
* @since May 7, 2013
*/
public static class LetterSpacingTextView extends TextView {
private float spacing = Spacing.NORMAL;
private CharSequence originalText = "";
@sagarpatel288
sagarpatel288 / sampleREADME.md
Created October 23, 2018 01:47 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
@sagarpatel288
sagarpatel288 / max_height_linear_layout.txt
Created July 27, 2018 07:28 — forked from dominicthomas/max_height_linear_layout.txt
Enables you to set a max height for a linear layout while also using wrap content.. this means the layout will be collapsable but also have height constraints!
public class MaxHeightLinearLayout extends LinearLayout {
private int maxHeightDp;
public MaxHeightLinearLayout(Context context) {
super(context);
}
public MaxHeightLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@sagarpatel288
sagarpatel288 / README-Template.md
Created June 13, 2018 01:15 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@sagarpatel288
sagarpatel288 / app-module-build.gradle
Created June 10, 2018 12:59 — forked from segunfamisa/app-module-build.gradle
Using gradle extra properties to manage Android dependency versioning
// app module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.segunfamisa.gradleextraproperties"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion