diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f667943..7c8dfdd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools" package="de.netalic.peacock"> @@ -11,9 +11,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" - android:name="de.netalic.MyApp"> - + android:name="de.netalic.MyApp" + tools:ignore="GoogleAppIndexingWarning"> + diff --git a/app/src/main/java/de/netalic/peacock/MainActivity.kt b/app/src/main/java/de/netalic/peacock/MainActivity.kt index 5dc56a9..5a77f95 100644 --- a/app/src/main/java/de/netalic/peacock/MainActivity.kt +++ b/app/src/main/java/de/netalic/peacock/MainActivity.kt @@ -13,4 +13,5 @@ class MainActivity : AppCompatActivity() { supportFragmentManager.beginTransaction().add(R.id.frameLayout_mainActivity_fragmentContainer, CodeVerificationFragment()).commit() } + } diff --git a/app/src/main/java/de/netalic/peacock/ui/base/BaseFragment.kt b/app/src/main/java/de/netalic/peacock/ui/base/BaseFragment.kt index 2253e08..62c74ae 100644 --- a/app/src/main/java/de/netalic/peacock/ui/base/BaseFragment.kt +++ b/app/src/main/java/de/netalic/peacock/ui/base/BaseFragment.kt @@ -7,11 +7,13 @@ import androidx.fragment.app.Fragment abstract class BaseFragment : Fragment() { abstract fun initUiListener() + abstract fun initUiComponent() override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initUiListener() + initUiComponent() } } \ No newline at end of file diff --git a/app/src/main/java/de/netalic/peacock/ui/base/BaseViewModel.kt b/app/src/main/java/de/netalic/peacock/ui/base/BaseViewModel.kt index 0d888d5..6f5d5d8 100644 --- a/app/src/main/java/de/netalic/peacock/ui/base/BaseViewModel.kt +++ b/app/src/main/java/de/netalic/peacock/ui/base/BaseViewModel.kt @@ -5,10 +5,11 @@ import io.reactivex.disposables.CompositeDisposable open class BaseViewModel:ViewModel() { - var mCompositDisposable=CompositeDisposable() + var mCompositeDisposable=CompositeDisposable() override fun onCleared() { super.onCleared() + mCompositeDisposable.clear() } } \ No newline at end of file diff --git a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt index 9c99290..cc11a1b 100644 --- a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt +++ b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt @@ -10,10 +10,10 @@ import android.view.ViewGroup import androidx.core.content.ContextCompat import androidx.lifecycle.Observer import de.netalic.peacock.R - import de.netalic.peacock.data.model.Status import de.netalic.peacock.data.model.User import de.netalic.peacock.ui.base.BaseFragment +import de.netalic.peacock.ui.util.CommonUtils import kotlinx.android.synthetic.main.fragment_codeverification.* import org.koin.android.viewmodel.ext.android.viewModel import java.util.concurrent.TimeUnit @@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit class CodeVerificationFragment : BaseFragment() { - companion object { var sTimer = 30000 @@ -33,22 +32,20 @@ class CodeVerificationFragment : BaseFragment() { private val mCodeVerificationViewModel: CodeVerificationViewModel by viewModel() - private val mImageView by lazy { imageView_codeVerification_icon } - private val mTextViewPhoneNumber by lazy { textView_codeVerification_phoneNumber } private val mPinEntryEditText by lazy { pinEntryEditText_codeVerification_setPin } private val mButton by lazy { button_codeVerification_continue } private val mTextViewTimer by lazy { textView_codeVerification_resendTime } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - mView = inflater.inflate(de.netalic.peacock.R.layout.fragment_codeverification, container, false) + mView = inflater.inflate(R.layout.fragment_codeverification, container, false) return mView } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - observeViewModel() + setTimer() disableButton() @@ -84,6 +81,7 @@ class CodeVerificationFragment : BaseFragment() { if (p0!!.length == 6) { enableButton() + CommonUtils.hideSoftKeyboard(requireActivity()) } else { disableButton() } @@ -92,6 +90,12 @@ class CodeVerificationFragment : BaseFragment() { } + override fun initUiComponent() { + + observeViewModel() + + } + private fun bind() { mCodeVerificationViewModel.bind( diff --git a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt index 488e0bc..181f9e7 100644 --- a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt +++ b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt @@ -56,7 +56,7 @@ class CodeVerificationViewModel(private val userRepository: UserRepository) : Ba }) - mCompositDisposable.add(disposable) + mCompositeDisposable.add(disposable) } } \ No newline at end of file diff --git a/app/src/main/java/de/netalic/peacock/ui/util/CommonUtil.kt b/app/src/main/java/de/netalic/peacock/ui/util/CommonUtil.kt new file mode 100644 index 0000000..6c0343c --- /dev/null +++ b/app/src/main/java/de/netalic/peacock/ui/util/CommonUtil.kt @@ -0,0 +1,17 @@ +package de.netalic.peacock.ui.util + +import android.app.Activity +import android.view.inputmethod.InputMethodManager +import androidx.fragment.app.FragmentActivity + +object CommonUtils { + + fun hideSoftKeyboard(activity: FragmentActivity) { + val inputMethodManager = activity.getSystemService( + Activity.INPUT_METHOD_SERVICE + ) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow( + activity.currentFocus!!.windowToken, 0 + ) + } +} \ No newline at end of file