ESPN's hidden API endpoints
Latest News: http://site.api.espn.com/apis/site/v2/sports/football/college-football/news
Latest Scores: http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard
| package com.filipkowicz.headeritemdecorator | |
| /* | |
| solution based on - based on Sevastyan answer on StackOverflow | |
| changes: | |
| - take to account views offsets | |
| - transformed to Kotlin | |
| - now works on viewHolders |
| package ***** | |
| import android.view.View | |
| import kotlin.properties.ReadWriteProperty | |
| import kotlin.reflect.KProperty | |
| /** | |
| * Copyright 6/24/2017 Fuad Balashov | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| package com.airbnb.epoxy | |
| import android.content.Context | |
| import android.graphics.Bitmap | |
| import android.support.annotation.IdRes | |
| import android.support.annotation.Px | |
| import android.support.v7.widget.RecyclerView | |
| import android.view.View | |
| import com.bumptech.glide.Glide | |
| import com.bumptech.glide.RequestBuilder |
Latest News: http://site.api.espn.com/apis/site/v2/sports/football/college-football/news
Latest Scores: http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard
| package kotterknife | |
| import android.app.Activity | |
| import android.app.Dialog | |
| import android.app.DialogFragment | |
| import android.app.Fragment | |
| import android.arch.lifecycle.Lifecycle | |
| import android.arch.lifecycle.LifecycleObserver | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.OnLifecycleEvent |
| // Dagger 1 example | |
| @Module( | |
| complete = false, | |
| library = true | |
| ) | |
| public final class ApiModule { | |
| @Provides | |
| @Singleton | |
| Retrofit provideRetrofit(Gson gson, Application app) { | |
| return new Retrofit.Builder() |
| import java.io.IOException; | |
| import java.lang.annotation.Annotation; | |
| import java.lang.reflect.Type; | |
| import io.reactivex.Completable; | |
| import io.reactivex.Observable; | |
| import io.reactivex.ObservableSource; | |
| import io.reactivex.Single; | |
| import io.reactivex.SingleSource; | |
| import io.reactivex.annotations.NonNull; |
| inline fun SharedPreferences.edit(changes: SharedPreferences.Editor.() -> SharedPreferences.Editor) { | |
| edit().changes().apply() | |
| } | |
| fun ImageView.tintSrc(@ColorRes colorRes: Int) { | |
| val drawable = DrawableCompat.wrap(drawable) | |
| DrawableCompat.setTint(drawable, ContextCompat.getColor(context, colorRes)) | |
| setImageDrawable(drawable) | |
| if (drawable is TintAwareDrawable) invalidate() // Because in this case setImageDrawable will not call invalidate() | |
| } |