Browse Source

added indicator code

PankajBranch^2
Hemant Khadase 2 years ago
parent
commit
307701d89a
13 changed files with 260 additions and 53 deletions
  1. +13
    -0
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/BasActivity.kt
  2. +27
    -0
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/SignUpActivity.kt
  3. +47
    -0
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/BaseFragment.kt
  4. +10
    -4
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/OTPFragment.kt
  5. +14
    -7
      app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/SignUpFragment.kt
  6. +7
    -0
      app/src/main/res/anim/slide_down.xml
  7. +4
    -0
      app/src/main/res/anim/slide_up.xml
  8. +10
    -4
      app/src/main/res/drawable/default_pager_dot.xml
  9. +4
    -4
      app/src/main/res/drawable/selected_pager_dot.xml
  10. +1
    -1
      app/src/main/res/drawable/tab_pager_selector.xml
  11. +109
    -33
      app/src/main/res/layout/fragment_otp.xml
  12. +7
    -0
      app/src/main/res/values-hi-rIN/strings.xml
  13. +7
    -0
      app/src/main/res/values/strings.xml

+ 13
- 0
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/BasActivity.kt View File

@ -0,0 +1,13 @@
package com.nivesh.production.niveshfd.partnerOnBoarding.ui.activities1
import android.app.Activity
import android.os.Bundle
class BasActivity : Activity() {
lateinit var mActivity : Activity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mActivity = this;
}
}

+ 27
- 0
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/activities1/SignUpActivity.kt View File

@ -1,6 +1,9 @@
package com.nivesh.production.niveshfd.partnerOnBoarding.ui.activities1
import android.os.Build
import android.os.Bundle
import android.window.OnBackInvokedDispatcher
import androidx.activity.OnBackPressedCallback
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.databinding.ActivitySignupBinding
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
@ -25,6 +28,30 @@ class SignUpActivity : BaseActivity() {
.commit()
}
@Deprecated("Deprecated in Java")
override fun onBackPressed() {
if (Build.VERSION.SDK_INT >= 33) {
onBackInvokedDispatcher.registerOnBackInvokedCallback(
OnBackInvokedDispatcher.PRIORITY_DEFAULT
) {
exitOnBackPressed()
}
} else {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
exitOnBackPressed()
}
})
}
}
private fun exitOnBackPressed() {
if (isTaskRoot) {
finish()
} else {
}
}
}

+ 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()
}
}
}

+ 10
- 4
app/src/main/java/com/nivesh/production/niveshfd/partnerOnBoarding/ui/fragments1/OTPFragment.kt View File

@ -11,9 +11,10 @@ import android.widget.EditText
import androidx.fragment.app.Fragment
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.databinding.FragmentOtpBinding
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
import com.nivesh.production.niveshfd.fd.util.Common
class OTPFragment : Fragment() {
class OTPFragment : BaseFragment() {
private var _binding: FragmentOtpBinding? = null
private val binding get() = _binding!!
@ -44,12 +45,16 @@ class OTPFragment : Fragment() {
binding.edtOTP5.setOnKeyListener(GenericKeyEvent(binding.edtOTP5, binding.edtOTP4))
binding.edtOTP6.setOnKeyListener(GenericKeyEvent(binding.edtOTP6, binding.edtOTP5))
binding.txtDigit.text = getString(R.string.sixDigitOTP).plus(" ").plus("+91.00000.00000")
binding.txtDigit.text = getString(R.string.sixDigitOTP).plus(" ").plus("0000000000")
binding.btnContinue.setOnClickListener {
if (validate()) {
binding.txtResendOTP.setOnClickListener{
}
binding.btnSubmit.setOnClickListener {
if (validate()) {
addFragment(activity as BaseActivity, R.id.signUpContainer,OTPFragment(),"", true)
}
}
}
@ -146,4 +151,5 @@ class OTPFragment : Fragment() {
}
}

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

@ -6,15 +6,16 @@ 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.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 {
@ -38,13 +39,18 @@ class SignUpFragment : Fragment() {
binding.btnSignUp.setOnClickListener {
if (validate()) {
activity?.supportFragmentManager?.beginTransaction()
?.add(com.nivesh.production.niveshfd.R.id.signUpContainer, OTPFragment())
?.commit()
addFragment(
activity as BaseActivity,
com.nivesh.production.niveshfd.R.id.signUpContainer,
OTPFragment(),
"",
true
)
}
}
}
private fun validate(): Boolean {
return if (binding.edtMobileNumber.text.toString().isEmpty()) { // EditText
Common.commonErrorMethod(
@ -52,13 +58,13 @@ class SignUpFragment : Fragment() {
binding.tlMobileNumber,
getString(com.nivesh.production.niveshfd.R.string.emptyMobileNumber)
)
} else if (binding.edtMobileNumber.text?.length != 10) { // EditText
} else if (binding.edtMobileNumber.text?.length != 10) { // EditText
Common.commonErrorMethod(
binding.edtMobileNumber,
binding.tlMobileNumber,
getString(com.nivesh.production.niveshfd.R.string.inValidMobileNumber)
)
}else if (!Common.isIndianMobileNo(binding.edtMobileNumber.text.toString())) { // EditText
} else if (!Common.isIndianMobileNo(binding.edtMobileNumber.text.toString())) { // EditText
Common.commonErrorMethod(
binding.edtMobileNumber,
binding.tlMobileNumber,
@ -69,4 +75,5 @@ class SignUpFragment : Fragment() {
}
}
}

+ 7
- 0
app/src/main/res/anim/slide_down.xml View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="1000"
android:fromYDelta="0"
android:toYDelta="100%" />
</set>

+ 4
- 0
app/src/main/res/anim/slide_up.xml View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="50%p" android:toYDelta="0%p"
android:duration="@android:integer/config_longAnimTime"/>

+ 10
- 4
app/src/main/res/drawable/default_pager_dot.xml View File

@ -5,9 +5,15 @@
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="@dimen/margin_10"
android:thickness="@dimen/margin_2"
android:useLevel="false">
<solid android:color="@color/greyColor2"/>
<size android:width="@dimen/margin_5"
android:height="@dimen/margin_5"/>
<stroke
android:width="1dp"
android:color="@color/red"/>
<solid android:color="@color/white"/>
</shape>
</item>
</layer-list>
</item>
</layer-list>

+ 4
- 4
app/src/main/res/drawable/selected_pager_dot.xml View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="@dimen/margin_10"
android:thickness="@dimen/margin_8"
android:useLevel="false">
<solid android:color="@color/red"/>
<solid android:color="@color/red" />
</shape>
</item>
</layer-list>

+ 1
- 1
app/src/main/res/drawable/tab_pager_selector.xml View File

@ -2,6 +2,6 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/selected_pager_dot"
android:state_selected="true"/>
android:state_selected="true" />
<item android:drawable="@drawable/default_pager_dot"/>
</selector>

+ 109
- 33
app/src/main/res/layout/fragment_otp.xml View File

@ -7,12 +7,11 @@
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btnContinue"
android:layout_marginTop="@dimen/margin_150"
android:layout_marginStart="@dimen/margin_15"
android:layout_marginEnd="@dimen/margin_15"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/margin_15"
android:layout_marginTop="@dimen/margin_150"
android:layout_marginEnd="@dimen/margin_15"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
@ -21,7 +20,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_5"
android:text="We sent a code to your mobile number"
android:text="@string/mobNoText"
android:textColor="@color/black"
android:textSize="@dimen/text_size_20"
android:textStyle="bold"
@ -35,29 +34,50 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginTop="@dimen/margin_5"
android:text="@string/sixDigitOTP"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtSignUp" />
<TextView
android:id="@+id/txtChangeNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginTop="@dimen/margin_5"
android:gravity="end"
android:text="@string/txtChange"
android:textColor="@color/blue1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtDigit" />
<TextView
android:id="@+id/txtCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginTop="@dimen/margin_5"
android:text="@string/code"
android:textColor="@color/black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtChangeNumber" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/otpLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtDigit"
android:id="@+id/otpLayout">
app:layout_constraintTop_toBottomOf="@+id/txtCode">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP1"
android:layout_marginStart="@dimen/margin_10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:layout_marginStart="@dimen/margin_10"
android:padding="@dimen/margin_1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP1"
@ -69,14 +89,15 @@
tool:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP2"
app:layout_constraintStart_toEndOf="@+id/tlOTP1"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:padding="@dimen/margin_1"
app:layout_constraintStart_toEndOf="@+id/tlOTP1"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP2"
@ -88,14 +109,15 @@
tool:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP3"
app:layout_constraintStart_toEndOf="@+id/tlOTP2"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:padding="@dimen/margin_1"
app:layout_constraintStart_toEndOf="@+id/tlOTP2"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP3"
@ -107,14 +129,15 @@
tool:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP4"
app:layout_constraintStart_toEndOf="@+id/tlOTP3"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:padding="@dimen/margin_1"
app:layout_constraintStart_toEndOf="@+id/tlOTP3"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP4"
@ -126,14 +149,15 @@
tool:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP5"
app:layout_constraintStart_toEndOf="@+id/tlOTP4"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:padding="@dimen/margin_1"
app:layout_constraintStart_toEndOf="@+id/tlOTP4"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP5"
@ -144,14 +168,15 @@
tool:ignore="TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tlOTP6"
app:layout_constraintStart_toEndOf="@+id/tlOTP5"
app:layout_constraintTop_toTopOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_1">
android:padding="@dimen/margin_1"
app:layout_constraintStart_toEndOf="@+id/tlOTP5"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtOTP6"
@ -165,22 +190,73 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/txtTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_5"
android:layout_marginEnd="@dimen/margin_25"
android:gravity="end"
android:text="(00:30)"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/otpLayout" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSignUp"
app:cornerRadius="@dimen/margin_15"
android:theme="@style/Theme.NormalLogin"
android:id="@+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_30"
android:layout_marginTop="@dimen/margin_30"
android:layout_marginTop="@dimen/margin_50"
android:layout_marginEnd="@dimen/margin_30"
android:text="@string/continueText"
android:text="@string/submit"
android:textColor="@color/white"
android:backgroundTint="@color/red"
app:cornerRadius="@dimen/margin_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/otpLayout" />
<TextView
android:id="@+id/txtTimerText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginTop="@dimen/margin_40"
android:gravity="center"
android:text="@string/secondsTimer"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnSubmit" />
<TextView
android:id="@+id/txtDidNotGetOTP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_50"
android:layout_marginTop="@dimen/margin_15"
android:text="@string/didNotGetOTP"
android:textColor="@color/black"
android:textSize="@dimen/text_size_16"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtTimerText" />
<TextView
android:id="@+id/txtResendOTP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_15"
android:text="@string/resendOTP"
android:textColor="@color/blue1"
android:textSize="@dimen/text_size_16"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/txtDidNotGetOTP"
app:layout_constraintTop_toBottomOf="@id/txtTimerText" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

+ 7
- 0
app/src/main/res/values-hi-rIN/strings.xml View File

@ -295,6 +295,13 @@
<string name="onlyAlphabets">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
<string name="invalidOTP">Please enter valid OTP</string>
<string name="sixDigitOTP">Enter the 6-digit verification code sent to</string>
<string name="submit">SUBMIT</string>
<string name="secondsTimer">This session will end in 30 seconds.</string>
<string name="didNotGetOTP">Didn\'t get the OTP</string>
<string name="resendOTP">RESEND OTP</string>
<string name="mobNoText">We sent a code to your mobile number</string>
<string name="txtChange">Change</string>
<string name="code">Code</string>
</resources>

+ 7
- 0
app/src/main/res/values/strings.xml View File

@ -302,6 +302,13 @@
<string name="onlyAlphabets">abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
<string name="invalidOTP">Please enter valid OTP</string>
<string name="sixDigitOTP">Enter the 6-digit verification code sent to</string>
<string name="submit">SUBMIT</string>
<string name="secondsTimer">This session will end in 30 seconds.</string>
<string name="didNotGetOTP">Didn\'t get the OTP</string>
<string name="resendOTP">RESEND OTP</string>
<string name="mobNoText">We sent a code to your mobile number</string>
<string name="txtChange">Change</string>
<string name="code">Code</string>
</resources>

Loading…
Cancel
Save

Powered by TurnKey Linux.