From ffa013c7b0cd6419a145ffb79070cc8a8a023564 Mon Sep 17 00:00:00 2001 From: tonywesoly Date: Fri, 28 Oct 2022 02:58:58 +0200 Subject: [PATCH] Cleanup --- .../java/com/lsm/chatapplication/LogIn.kt | 2 -- .../com/lsm/chatapplication/MainActivity.kt | 6 ------ .../java/com/lsm/chatapplication/SignUp.kt | 6 ------ .../com/lsm/chatapplication/UserAdapter.kt | 19 ------------------- 4 files changed, 33 deletions(-) diff --git a/app/src/main/java/com/lsm/chatapplication/LogIn.kt b/app/src/main/java/com/lsm/chatapplication/LogIn.kt index 0b4bae5..b1df7a0 100644 --- a/app/src/main/java/com/lsm/chatapplication/LogIn.kt +++ b/app/src/main/java/com/lsm/chatapplication/LogIn.kt @@ -18,8 +18,6 @@ class LogIn : AppCompatActivity() { val view = binding.root setContentView(view) -// supportActionBar?.hide() - mAuth = FirebaseAuth.getInstance() binding.logInBtn.setOnClickListener{ diff --git a/app/src/main/java/com/lsm/chatapplication/MainActivity.kt b/app/src/main/java/com/lsm/chatapplication/MainActivity.kt index a192ab0..795f93f 100644 --- a/app/src/main/java/com/lsm/chatapplication/MainActivity.kt +++ b/app/src/main/java/com/lsm/chatapplication/MainActivity.kt @@ -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) } diff --git a/app/src/main/java/com/lsm/chatapplication/SignUp.kt b/app/src/main/java/com/lsm/chatapplication/SignUp.kt index f4944f3..4630cce 100644 --- a/app/src/main/java/com/lsm/chatapplication/SignUp.kt +++ b/app/src/main/java/com/lsm/chatapplication/SignUp.kt @@ -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() } } } diff --git a/app/src/main/java/com/lsm/chatapplication/UserAdapter.kt b/app/src/main/java/com/lsm/chatapplication/UserAdapter.kt index 0b5d4aa..cd7e9da 100644 --- a/app/src/main/java/com/lsm/chatapplication/UserAdapter.kt +++ b/app/src/main/java/com/lsm/chatapplication/UserAdapter.kt @@ -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): -// RecyclerView.Adapter() { -// -// 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(TaskDiffCallBack()){