Skip to content

Instantly share code, notes, and snippets.

🤙
Forever coding

Mitch Tabian mitchtabian

🤙
Forever coding
Block or report user

Report or block mitchtabian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DiffUtilCallback.kt
class BlogItemDiffCallback(
var oldBlogList: List<BlogPost>,
var newBlogList: List<BlogPost>
): DiffUtil.Callback() {
override fun areItemsTheSame(
oldItemPosition: Int,
newItemPosition: Int
): Boolean {
View Log.txt
System.out: DEBUG: ApiService: 98713473 // on App start
System.out: DEBUG: ApiService: 98713473 // Rotate
System.out: DEBUG: ApiService: 98713473 // Rotate
View TestLiveDataObject.kt
return object: LiveData<MainViewState>(){
override fun onActive() {
super.onActive()
val user = User(
email = "mitch@tabian.ca",
username = "mitch",
image = "https://cdn.open-api.xyz/open-api-static/static-random-images/logo_1080_1080.png"
)
value = MainViewState(
user = user
View TestLiveDataObject.kt
return object: LiveData<MainViewState>(){
override fun onActive() {
super.onActive()
val blogList: ArrayList<BlogPost> = ArrayList()
blogList.add(
BlogPost(
pk = 0,
title = "Vancouver PNE 2019",
body = "Here is Jess and I at the Vancouver PNE. We ate a lot of food.",
image = "https://cdn.open-api.xyz/open-api-static/static-blog-images/image8.jpg"
View ApiService.kt
interface ApiService {
@GET("android-code-test/feed.json")
fun getFeedItems(): Call<List<FeedItem>>
}
View activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true"
>
View MainActivity.kt
package com.codingwithmitch.coroutineexamples
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
class MainActivity : AppCompatActivity() {
View MainActivity.kt
package com.codingwithmitch.coroutineexamples
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.*
class MainActivity : AppCompatActivity() {
@mitchtabian
mitchtabian / update_success.json
Created Jul 16, 2019
https://<your-domain>/api/account/properties/update
View update_success.json
{
"response": "Account update success"
}
@mitchtabian
mitchtabian / account_properties.json
Last active Aug 3, 2019
https://<your-domain>/api/account/properties
View account_properties.json
{
"pk": 1,
"email": "mitch@tabian.ca",
"username": "mitch"
}
You can’t perform that action at this time.