Cleanup
This commit is contained in:
parent
bcc1a1368e
commit
ffa013c7b0
@ -18,8 +18,6 @@ class LogIn : AppCompatActivity() {
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
|
||||
// supportActionBar?.hide()
|
||||
|
||||
mAuth = FirebaseAuth.getInstance()
|
||||
|
||||
binding.logInBtn.setOnClickListener{
|
||||
|
@ -33,7 +33,6 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
userList = ArrayList()
|
||||
adapter = UserAdapter()
|
||||
// adapter.submitList(userList)
|
||||
|
||||
binding.userRecyclerView.layoutManager = LinearLayoutManager(this)
|
||||
binding.userRecyclerView.adapter = adapter
|
||||
@ -49,10 +48,6 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onDataChange(snapshot: DataSnapshot) {
|
||||
|
||||
userList.clear()
|
||||
// for(postSnapshot in snapshot.children){
|
||||
// val currentUser = postSnapshot.getValue(User::class.java)
|
||||
// userList.add(currentUser!!)
|
||||
// }
|
||||
snapshot.children.forEach {
|
||||
val currentUser = it.getValue(User::class.java)
|
||||
userList.add(currentUser!!)
|
||||
@ -60,7 +55,6 @@ class MainActivity : AppCompatActivity() {
|
||||
userList.removeAll(
|
||||
userList.filter{it.uid == mAuth.currentUser?.uid}.toSet()
|
||||
)
|
||||
// userList.removeIf{it.uid == mAuth.currentUser?.uid}
|
||||
adapter.submitList(userList)
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import com.lsm.chatapplication.databinding.ActivitySignUpBinding
|
||||
class SignUp : AppCompatActivity() {
|
||||
private lateinit var binding: ActivitySignUpBinding
|
||||
private lateinit var mAuth: FirebaseAuth
|
||||
// private lateinit var mDbRef: DatabaseReference
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@ -22,10 +21,8 @@ class SignUp : AppCompatActivity() {
|
||||
val view = binding.root
|
||||
setContentView(view)
|
||||
|
||||
// supportActionBar?.hide()
|
||||
|
||||
mAuth = FirebaseAuth.getInstance()
|
||||
// mDbRef = Firebase.database("https://chatapplication-4eb49-default-rtdb.europe-west1.firebasedatabase.app/").reference
|
||||
|
||||
binding.signUpBtn.setOnClickListener{
|
||||
val usrName = binding.edtUserName.text.toString()
|
||||
@ -42,15 +39,12 @@ class SignUp : AppCompatActivity() {
|
||||
mAuth.createUserWithEmailAndPassword(email, password)
|
||||
.addOnCompleteListener(this) { task ->
|
||||
if (task.isSuccessful) {
|
||||
// Jumping to home
|
||||
addUserToDatabase(name, email, mAuth.currentUser?.uid!!)
|
||||
val intent = Intent(this@SignUp,MainActivity::class.java)
|
||||
finish()
|
||||
startActivity(intent)
|
||||
} else {
|
||||
// Account creation error message
|
||||
Toast.makeText(this@SignUp,task.exception?.toString(),Toast.LENGTH_LONG).show()
|
||||
//Toast.makeText(this@SignUp,"Some error occurred",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,25 +10,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.firebase.auth.FirebaseAuth
|
||||
import com.lsm.chatapplication.databinding.UserLayoutBinding
|
||||
|
||||
//class UserAdapter(val userList: ArrayList<User>):
|
||||
// RecyclerView.Adapter<UserAdapter.UserViewHolder>() {
|
||||
//
|
||||
// class UserViewHolder(val binding: UserLayoutBinding): RecyclerView.ViewHolder(binding.root)
|
||||
//
|
||||
// override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UserViewHolder {
|
||||
// return UserViewHolder(UserLayoutBinding.inflate(LayoutInflater.from(parent.context), parent, false))
|
||||
// }
|
||||
//
|
||||
// override fun onBindViewHolder(holder: UserViewHolder, position: Int) {
|
||||
// val currentUser = userList[position]
|
||||
// holder.binding.userName.text = currentUser.name
|
||||
// holder.binding.itemView
|
||||
// }
|
||||
//
|
||||
// override fun getItemCount(): Int {
|
||||
// return userList.size
|
||||
// }
|
||||
//}
|
||||
class UserAdapter():
|
||||
ListAdapter<User,UserAdapter.UserViewHolder>(TaskDiffCallBack()){
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user