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
import com.google.firebase.auth.FirebaseAuth | |
data class AuthState(val state: Progress, | |
val auth: FirebaseAuth?) |
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
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.MutableLiveData | |
import android.arch.lifecycle.ViewModel | |
import android.text.TextUtils | |
import com.google.firebase.auth.FirebaseAuth | |
class SubViewModel : ViewModel(), FirebaseAuth.AuthStateListener{ | |
private val mAuth : FirebaseAuth = FirebaseAuth.getInstance() | |
private val _authLivedata : MutableLiveData<AuthState> = MutableLiveData() | |
val authLivedata : LiveData<AuthState> |
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
import android.app.ProgressDialog | |
import android.arch.lifecycle.Observer | |
import android.arch.lifecycle.ViewModelProviders | |
import android.databinding.DataBindingUtil | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.text.TextUtils | |
import android.view.View | |
import android.widget.Toast | |
import com.google.firebase.auth.FirebaseAuth |
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
import android.app.ProgressDialog | |
import android.databinding.DataBindingUtil | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.text.TextUtils | |
import android.view.View | |
import android.widget.Toast | |
import com.google.firebase.auth.FirebaseAuth | |
import com.nezspencer.testapp.databinding.ActivitySubBinding |
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
val list = mutableListOf<String>() | |
for (i in 1 .. 50) | |
list.add("Text name $i") | |
list[0] = "" //dummy data for header | |
list.add("") // dummy data for footer |
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
inner class ItemAdapter(private val list: MutableList<String>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
private val itemHeader = 20 | |
private val itemBody = 21 | |
private val itemFooter = 22 | |
override fun onCreateViewHolder(p0: ViewGroup, p1: Int): RecyclerView.ViewHolder { | |
return when(p1){ | |
itemHeader -> HeaderHolder(ItemHeaderBinding.inflate(LayoutInflater.from(p0.context), p0, false)) | |
itemBody -> BodyHolder(ItemNameBinding.inflate(LayoutInflater.from(p0.context), p0, false)) | |
else -> FooterHolder(ItemFooterBinding.inflate(LayoutInflater.from(p0.context), p0, false)) | |
} |
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"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
<LinearLayout | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<ImageView | |
android:id="@+id/iv_image" | |
android:layout_width="200dp" |
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"?> | |
<layout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:orientation="vertical" | |
android:layout_height="match_parent"> | |
<android.support.v7.widget.RecyclerView |
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"?> | |
<layout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<ScrollView android:layout_width="match_parent" | |
android:fillViewport="true" | |
android:padding="16dp" | |
android:layout_height="match_parent"> |