Browse Source

ManojBranch

master
Manoj 2 years ago
parent
commit
9feec08f73
5 changed files with 68 additions and 26 deletions
  1. +1
    -2
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/ViewPagerActivity.kt
  2. +47
    -0
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/BaseFragment.kt
  3. +16
    -5
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/SignUpFragment.kt
  4. BIN
      app/src/main/res/drawable/signup.png
  5. +4
    -19
      app/src/main/res/layout/fragment_signup.xml

+ 1
- 2
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/ViewPagerActivity.kt View File

@ -73,8 +73,7 @@ class ViewPagerActivity : BaseActivity() {
})
binding.tvSkip.setOnClickListener {
intent = Intent(this@ViewPagerActivity, LoginActivity::class.java)
startActivity(intent)
stepFourApi()
}
}


+ 47
- 0
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/BaseFragment.kt View File

@ -0,0 +1,47 @@
package com.nivesh.production.niveshfd.partnerOnBoarding.ui.fragments1
import android.app.Activity
import android.content.Context
import androidx.fragment.app.Fragment
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
open class BaseFragment : Fragment() {
private lateinit var mActivity: Activity
override fun onAttach(context: Context) {
super.onAttach(context)
mActivity = context as BaseActivity
}
companion object {
fun addFragment(
activity: BaseActivity,
containerViewId: Int,
fragment: Fragment,
tag: String,
addToBackStack: Boolean
) {
val fragmentTransaction = activity.supportFragmentManager.beginTransaction()
fragmentTransaction.add(containerViewId, fragment, tag)
if (addToBackStack) {
fragmentTransaction.addToBackStack(tag)
}
fragmentTransaction.commit()
}
fun replaceFragment(
activity: BaseActivity,
containerViewId: Int,
fragment: Fragment,
tag: String,
addToBackStack: Boolean
) {
val fragmentTransaction = activity.supportFragmentManager.beginTransaction()
fragmentTransaction.replace(containerViewId, fragment, tag)
if (addToBackStack) {
fragmentTransaction.addToBackStack(tag)
}
fragmentTransaction.commit()
}
}
}

+ 16
- 5
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/SignUpFragment.kt View File

@ -2,19 +2,22 @@ package com.nivesh.production.niveshfd.partnerOnBoarding.ui.fragments1
import android.os.Bundle
import android.text.Editable
import android.text.InputFilter
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.databinding.FragmentSignupBinding
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
import com.nivesh.production.niveshfd.fd.util.Common
class SignUpFragment : Fragment() {
class SignUpFragment : BaseFragment() {
private var _binding: FragmentSignupBinding? = null
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View {
@ -28,6 +31,7 @@ class SignUpFragment : Fragment() {
}
private fun init() {
binding.edtMobileNumber.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(10))
binding.edtMobileNumber.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
@ -38,19 +42,26 @@ class SignUpFragment : Fragment() {
binding.btnSignUp.setOnClickListener {
if (validate()) {
replaceFragment(
activity as BaseActivity,
com.nivesh.production.niveshfd.R.id.signUpContainer,
OTPFragment(),
"OTP",
true
)
}
}
}
private fun validate(): Boolean {
return if (binding.edtMobileNumber.text.toString().isEmpty()) { // EditText
Common.commonErrorMethod(
binding.edtMobileNumber,
binding.tlMobileNumber,
getString(R.string.emptyMobileNumber)
getString(com.nivesh.production.niveshfd.R.string.emptyMobileNumber)
)
} else if (!Common.isIndianMobileNo(binding.edtMobileNumber.text.toString())) { // EditText
} else if (binding.edtMobileNumber.text?.length != 10) { // EditText
Common.commonErrorMethod(
binding.edtMobileNumber,
binding.tlMobileNumber,


BIN
app/src/main/res/drawable/signup.png View File

Before After
Width: 745  |  Height: 912  |  Size: 370 KiB

+ 4
- 19
app/src/main/res/layout/fragment_signup.xml View File

@ -6,27 +6,13 @@
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="400dp"
android:scaleType="fitXY"
android:contentDescription="@string/contentDescription"
android:scaleType="centerInside"
android:src="@drawable/hands"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/logoNivesh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_70"
android:padding="@dimen/margin_15"
android:scaleType="centerInside"
android:src="@drawable/nivesh"
android:src="@drawable/signup"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -109,7 +95,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tlMobileNumber" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Loading…
Cancel
Save

Powered by TurnKey Linux.