This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation deps.retrofit | |
implementation deps.retrofitGson | |
implementation deps.dagger | |
implementation 'com.google.guava:guava:23.0-android' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation deps.retrofit | |
implementation deps.retrofitGson | |
implementation deps.dagger | |
implementation deps.guava | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface RetroDogApi { | |
@GET("/dogs/{doggoName}") | |
Flowable<Dog> getDoggo(@Path("doggoName") String doggoName); | |
} | |
interface DogApi { | |
Flowable<Dog> getDoggo(String doggoName); | |
} | |
class DogClient(val urlA: String, val urlB: String): DogApi { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface RetroDogApi { | |
@GET("/dogs/{doggoName}") | |
Flowable<Dog> getDoggo(@Path("doggoName") String doggoName); | |
} | |
interface DogApi { | |
Flowable<Dog> getDoggo(String doggoName); | |
} | |
interface UrlInfoApi { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class DoggoStash( | |
val leash: Leash, | |
val waterBowl: WaterBowl, | |
val bed: Bed) | |
fun proceedOnRoadTrip(doggoStash: DoggoStash) { | |
getDoggoLeashedUp(doggoStash.leash) | |
packupWaterBowl(doggoStash.waterBowl) | |
setupBedInBackSeat(doggoStash.bed) | |
startDriving() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TreatFactory { | |
fun getTreats(): Treats | |
} | |
class Petco: TreatFactory { | |
fun getTreats(): Treats { | |
// Details of how to get to Petco, | |
// what aisle the treats are on, | |
// what treats they carry that doggo | |
// likes, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TreatFactory { | |
fun getTreats(): Treats | |
} | |
class PetsMart: TreatFactory { | |
fun getTreats(): Treats { | |
// Petsmart details | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpacesItemDecoration(private val space: Int, private val span: Int) : RecyclerView.ItemDecoration() { | |
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { | |
val position = parent.getChildAdapterPosition(view) | |
val lastPosition = parent.adapter.itemCount - 1 | |
val bottomRow = (lastPosition - position) < span | |
val rightColumn = (position % span) == (span - 1) | |
/** | |
* |A----B----C| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using https://medium.com/@orhanobut/android-and-typography-101-5f06722dd611 for reference | |
// Update with https://github.com/suragch/AndroidFontMetrics/blob/master/app/src/main/java/net/studymongolian/fontmetrics/FontMetricsView.java | |
// Need to take into account multiple lines | |
public class LinesView extends FrameLayout { | |
private static final Paint | |
RED_PAINT = new Paint(Color.RED), | |
BLUE_PAINT = new Paint(Color.BLUE), | |
GREEN_PAINT = new Paint(Color.GREEN), | |
PURPLE_PAINT = new Paint(Color.MAGENTA); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<network-security-config> | |
<debug-overrides> | |
<trust-anchors> | |
<certificates src="system" /> | |
<certificates src="user" /> | |
</trust-anchors> | |
</debug-overrides> | |
</network-security-config> |