Skip to content

Instantly share code, notes, and snippets.

View perusudroid's full-sized avatar
💭
Do what you love

Perusudroid perusudroid

💭
Do what you love
  • Bangalore
View GitHub Profile
@perusudroid
perusudroid / build.gradle
Created December 31, 2017 08:42
Room gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: '../versions.gradle'
addRepos(repositories)
allprojects { repositories { maven { url 'https://jitpack.io' } } }
dependencies {
classpath deps.android_gradle_plugin
@perusudroid
perusudroid / build.gradle
Created December 31, 2017 08:22
app/build.gradle
dependencies {
// Support libraries
implementation deps.constraint_layout
implementation deps.support.app_compat
compile deps.support.app_compat
compile deps.support.v4
compile deps.support.design
// Architecture components
compile deps.lifecycle.runtime
@perusudroid
perusudroid / MainActivity.java
Created December 27, 2017 12:38
Using module / library in application
package com.perusudroid.sampleretro;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.perusudroid.rxretro.IResponseListener;
import com.perusudroid.rxretro.RXRetro;
import com.perusudroid.sampleretro.dto.request.PostInput;
import com.perusudroid.sampleretro.dto.response.get.GetSample;
@perusudroid
perusudroid / build.gradle
Created December 27, 2017 12:35
Application's build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.perusudroid.sampleretro"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
package com.perusudroid.rxretro;
/**
* Created by perusu on 13/12/17.
*/
public class Constants {
interface httpcodes{
int STATUS_OK = 200;
@perusudroid
perusudroid / build.gradle
Last active December 27, 2017 12:28
module build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
@perusudroid
perusudroid / RXRetro.java
Created December 27, 2017 12:24
Library file
package com.perusudroid.rxretro;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import okhttp3.ResponseBody;
@perusudroid
perusudroid / build.gradle
Created December 27, 2017 12:20
application gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.perusudroid.sampleretro"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
@perusudroid
perusudroid / RXRetro.java
Created December 27, 2017 12:05
Handling HTTP response code in Retrofit with RX-Java
@Override
public void onNext(Response<ResponseBody> paramResponse) {
Log.d(TAG, "RESPONSE CODE - " + paramResponse.raw().code());
Log.d(TAG, "RAW RESPONSE - " + paramResponse.raw());
Object localObject = paramResponse.body();
String str = null;
if (localObject != null) {
str = getStringFromByte(getByteStream(paramResponse.body()));