Skip to content

Lq dung#5

Open
S4ltF1sh wants to merge 10 commits intomasterfrom
LQDung
Open

Lq dung#5
S4ltF1sh wants to merge 10 commits intomasterfrom
LQDung

Conversation

@S4ltF1sh
Copy link
Collaborator

No description provided.

Copy link
Owner

@Sudo248 Sudo248 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check lại code, có thể phản hồi bằng cách cmt bên dưới mỗi cmt của anh.

//setContentView(R.layout.activity_login)

binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Không cần thiết phải dùng bingding nếu đơn giản chỉ cần set view


binding.tvBtnLogOut.setOnClickListener {
finish()
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nên tách hàm riêng, có thể dùng with(binding) hoặc binding.apply

android:layout_weight="0.4" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/tv_btn_logOut"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? id ... vừa là tv vừa là btn?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tại là em custome cái textview thành thực hiện chức năng như 1 button nên em nghĩ là ký hiệu kiểu đó sẽ tường mình hơn ạ ;-;, nếu trong trường hợp custom như vậy thì nên đặt là gì ạ anh?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<androidx.appcompat.widget.AppCompatButton> em dùng cái này thì id phải là btnLogOut


</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout> No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check lại các id và cách bố trí layout

S4ltF1sh added 2 commits July 28, 2022 04:21
chia sẻ dữ liệu các user giữa 2 Fragment và LoginActivity bằng ViewModel
Copy link
Owner

@Sudo248 Sudo248 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em nên chọn 1 convention đặt tên id view cho mình thôi đừng dùng lẫn lộn cả 2.


class LoginActivity : AppCompatActivity(), LogInFragment.GetUsersListListener,
SignUpFragment.UpdateUsersListListener {
private val loginModel: LoginModel by viewModels()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewModel != Model nhé


startActivity(intent)

activity?.finish()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Biết dùng activity để finish mà k biết biết dùng activity để lấy dữ liệu từ activity cha à?

import androidx.lifecycle.ViewModel
import com.sudo.androidd20.data.User

class LoginModel : ViewModel() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kế thừa ViewModel nhưng lại đặt tên là Model??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants