Skip to content

Instantly share code, notes, and snippets.

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initView()
viewModel.viewState.observe(viewLifecycleOwner, Observer { viewState ->
viewState?.run {
when (viewState) {
ViewState.SHOW_LOADING -> (activity as? BaseActivity<*, *>)?.showLoading()
ViewState.HIDE_LOADING -> (activity as? BaseActivity<*, *>)?.hideLoading()
else -> handleViewState(viewState)
}
public class NavigationManager<T extends BaseFragment> {
private FragmentManager fragmentManager;
private T currentFragment;
private int container;
public NavigationManager(FragmentManager fragmentManager, @IdRes int container) {
this.fragmentManager = fragmentManager;
this.container = container;
}
void callApi() {
disposable.add(apiService.callApi()
.doOnSubscribe(it -> {
// thông báo cho view hiển thị loading
})
.doFinally(() -> {
// thông báo cho view ẩn loading vì chúng ta đã call api xong
})
.subscribe(response -> {
// call api success
void callApi() {
disposable.add(apiService.callApi()
.doOnSubscribe(it -> {
// thông báo cho view hiển thị loading
mViewState.setValue(Define.ViewState.SHOW_LOADING)
})
.doFinally(() -> {
// thông báo cho view ẩn loading vì chúng ta đã call api xong
mViewState.setValue(Define.ViewState.HIDE_LOADING)
})
@PhamNgocPhi
PhamNgocPhi / share preference encrypt
Created March 24, 2020 09:31
share preference encrypt
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<string name="AUe8wKGJEA9SnCsAbR2ETqulaRl4eeqGq5YhJ030W62P">AXIkXQm2CRXfPWnnFE2dthggGhlFPHWyCDQN11gnviPCrs5IzFTlrS6OOM/Y</string>
<string name="__androidx_security_crypto_encrypted_prefs_key_keyset__">12a9017722f3e44243ca838952a99bd3cc754e89ee8a9c66671e2180c857abb032bedabffd1a4ef87b550e55e3ddb9b9b6ad76cdbf304380aee5b94b82b47f07903f037790d16aa09dad2a364efa063be87c78f2c4d9d63e636f2421015cfb5fc61c636791b06ce580385d51f57760fd735aeac34b1fd1eb867676a015c379469a9babb2ac73ed265e60941de9e6461bd61186028ba1efcfc08ecc092294918c22386f4689a38fd03581efc11a4408a181f3bd04123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e4165735369764b6579100118a181f3bd042001</string>
<string name="__androidx_security_crypto_encrypted_prefs_value_keyset__">128801f4a3e1da74479d2264acf96caf85623ec22c7e17533c29d5f7fe0fc9d7205e1640343869d2ed56fa40d21b065e18eccd7e1319f4b18927480d3e7007786cc9ed1f5e98f08c0586da368a9c4eb441bc00150f537cd6978f2
**Privacy Policy**
CÔNG TY CỔ PHẦN ĐẦU TƯ PHÁT TRIỂN CÔNG NGHỆ VÀ GIÁO DỤC EVI built the YoFun app as a Free app. This SERVICE is provided by CÔNG TY CỔ PHẦN ĐẦU TƯ PHÁT TRIỂN CÔNG NGHỆ VÀ GIÁO DỤC EVI at no cost and is intended for use as is.
This page is used to inform visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.
If you choose to use our Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that we collect is used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at YoFun unless otherwise defined in this Privacy Policy.