Skip to content

Instantly share code, notes, and snippets.

Avatar

AskFortricks.com raviyadav4875

View GitHub Profile
@raviyadav4875
raviyadav4875 / ReqSuccessAndErrorListener.java
Last active Jul 9, 2018
Handle Api call success and error listener.
View ReqSuccessAndErrorListener.java
/**
* Success listener to handle the movie listing
* process after api returns the movie list
*
* @return
*/
private Response.Listener<String> ReqSuccessListener() {
return new Response.Listener<String>() {
public void onResponse(String response) {
View addOnScrollListener.java
/**
* For Adding Load more functionality
*
*/
rvMoviesList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0) {
visibleItemCount = recyclerView.getChildCount();
View CallApi.java
private void callGetTopRatedMoviesApi() {
/**
* Checking internet connection before api call.
* Very important always take care.
*/
if (!Utils.isNetworkAvailable(this)) {
Toast.makeText(this,
"No internet ..Please connect to internet and start app again",
View MovieListingActivity.java
package com.askfortrciks.volleywithgsondemo.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
View WebApiRequest.java
package com.askfortrciks.volleywithgsondemo.volley;
import com.android.volley.AuthFailureError;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
@raviyadav4875
raviyadav4875 / Dependencies.kt
Created Feb 28, 2018
buildSrc/src/main/java/Dependencies.kt
View Dependencies.kt
object Versions {
val kotlin = "1.1.51"
val support_lib = "27.0.2"
val retrofit = "2.3.0"
val rxjava = "2.1.9"
val min_sdk = 21
val target_sdk = 26
val compile_sdk = 26
val version_code = 1
val version_name = "1.0"
@raviyadav4875
raviyadav4875 / build.gradle.kts
Created Feb 28, 2018
buildSrc/build.gradle.kts
View build.gradle.kts
plugins {
`kotlin-dsl`
}
View Updated module_one->build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation libs.support_appcompat_v7
implementation libs.picasso
implementation libs.recyclerview
implementation libs.cardview
implementation libs.design
}
View build.gradle
ext {
versions = [
support_lib: "27.0.2",
utilities: "2.3.0",
picasso: "2.1.9"
]
libs = [
support_appcompat_v7: "com.android.support:appcompat-v7:${versions.support_lib}",
utilities :"com.matthew-tamlin:android-utilities:${versions.utilities}",
picasso: "com.squareup.picasso:picasso:${versions.picasso}"
@raviyadav4875
raviyadav4875 / Module_two
Last active Feb 23, 2018
Module Library
View Module_two
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.matthew-tamlin:android-utilities:1.3.1'
}