Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	BazaarPay/src/main/res/layout-land/fragment_national_id.xml
#	app/src/main/java/ir/cafebazaar/bazaarpay/sample/SamplePaymentActivity.kt
  • Loading branch information
Hamidreza committed Apr 8, 2023
2 parents ffb7b79 + 96cf3d5 commit 51edd27
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ir.cafebazaar.bazaarpay.screens.login.verify

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import ir.cafebazaar.bazaarpay.R
import android.util.AttributeSet
Expand Down Expand Up @@ -75,6 +76,11 @@ class OtpEditText : AppCompatEditText {
paint.color = textColors.defaultColor
var i = 0
while (i < mNumChars) {
if (i == textLength) {
mLinesPaint!!.color = resources.getColor(R.color.bazaarpay_app_brand_primary)
} else {
mLinesPaint!!.color = resources.getColor(R.color.bazaarpay_grey_60)
}
canvas.drawLine(
startX.toFloat(),
bottom.toFloat(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import android.text.InputType
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import androidx.activity.addCallback
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -124,6 +126,9 @@ internal class VerifyOtpFragment : Fragment() {
binding.proceedBtn.isEnabled = it?.length == 4 &&
viewModel.verifyCodeStateLiveData.value?.resourceState != ResourceState.Loading
}

binding.verificationCodeEditText.requestFocus()

}

override fun onActivityCreated(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
Expand All @@ -31,6 +32,7 @@ internal class DirectDebitNationalIdFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
_binding = FragmentNationalIdBinding.inflate(inflater, container, false)
return binding.root
}
Expand Down Expand Up @@ -83,6 +85,7 @@ internal class DirectDebitNationalIdFragment : Fragment() {
override fun onDestroyView() {
textWatcher?.let { binding.nationalIdEditText.removeTextChangedListener(it) }
textWatcher = null
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
super.onDestroyView()
_binding = null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class PaymentThankYouPageViewModel : ViewModel() {
SECOND_IN_MILLIS
) {
override fun onTick(millisUntilFinished: Long) {
val progressPercent = 100 - ((millisUntilFinished * 100) / (COUNT_DOWN_TIMER_SEC * SECOND_IN_MILLIS))
val progressPercent = 99 - ((millisUntilFinished * 100) / (COUNT_DOWN_TIMER_SEC * SECOND_IN_MILLIS))

_viewStateLiveData.value = Resource.loaded(
data = PaymentThankYouPageSuccessModel(
Expand Down
142 changes: 84 additions & 58 deletions BazaarPay/src/main/res/layout-land/fragment_national_id.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/bazaarpay_surface_color_0">

Expand Down Expand Up @@ -58,81 +57,108 @@

</com.google.android.material.appbar.AppBarLayout>

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/titleTextView"
style="@style/Bazaar.Text.Caption"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:layout_marginTop="@dimen/bazaarpay_default_margin"
android:text="@string/bazaarpay_national_id_title"
android:textColor="@color/bazaarpay_text_hint" />

<LinearLayout
android:id="@+id/warningBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bazaarpay_default_margin"
android:layout_marginBottom="@dimen/bazaarpay_default_margin_double"
android:background="@drawable/background_warning_radius_4"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:padding="@dimen/bazaarpay_default_margin"
android:visibility="visible">
app:layout_constraintTop_toBottomOf="@id/appBarLayout"
android:layout_marginTop="@dimen/bazaarpay_default_margin">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/errorTextView"
android:id="@+id/titleTextView"
style="@style/Bazaar.Text.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="@color/bazaarpay_grey_70"
android:layout_gravity="center"
android:text="@string/bazaarpay_national_id_hint"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:text="@string/bazaarpay_national_id_title"
android:textColor="@color/bazaarpay_text_hint"
tools:text="تا چند ثانیه‌ی دیگر خرید شما تکمیل و به برنامه مورد نظر برمی‌گردید." />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />

</LinearLayout>
<LinearLayout
android:id="@+id/warningBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bazaarpay_default_margin"
android:layout_marginBottom="@dimen/bazaarpay_default_margin_double"
android:background="@drawable/background_warning_radius_4"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:padding="@dimen/bazaarpay_default_margin"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/nationalIdInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleTextView">

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nationalIdInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:theme="@style/Bazaar.TextInput">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/errorTextView"
style="@style/Bazaar.Text.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="@color/bazaarpay_grey_70"
android:layout_gravity="center"
android:text="@string/bazaarpay_national_id_hint"
android:textColor="@color/bazaarpay_text_hint"
tools:text="تا چند ثانیه‌ی دیگر خرید شما تکمیل و به برنامه مورد نظر برمی‌گردید." />

</LinearLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nationalIdInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:layout_marginTop="@dimen/bazaarpay_default_margin"
android:theme="@style/Bazaar.TextInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/warningBox">

<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/nationalIdEditText"
style="@style/Bazaar.Text.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bazaarpay_enter_national_id"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="10"
android:singleLine="true">

<requestFocus />
</androidx.appcompat.widget.AppCompatEditText>
</com.google.android.material.textfield.TextInputLayout>

<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/nationalIdEditText"
style="@style/Bazaar.Text.Body"
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/descriptionTextView"
style="@style/Bazaar.Text.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bazaarpay_enter_national_id"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLength="10"
android:singleLine="true">

<requestFocus />
</androidx.appcompat.widget.AppCompatEditText>
</com.google.android.material.textfield.TextInputLayout>

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/descriptionTextView"
style="@style/Bazaar.Text.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:layout_marginTop="@dimen/bazaarpay_default_margin_half"
android:text="@string/bazaarpay_national_id_description"
android:textColor="@color/bazaarpay_text_hint"/>
android:textSize="10sp"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:layout_marginTop="@dimen/bazaarpay_default_margin_half"
android:text="@string/bazaarpay_national_id_description"
android:textColor="@color/bazaarpay_text_hint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/nationalIdInput" />

</androidx.constraintlayout.widget.ConstraintLayout>

<ir.cafebazaar.bazaarpay.widget.button.BazaarPayButton
android:id="@+id/acceptButton"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/bazaarpay_default_margin_double"
android:layout_marginTop="@dimen/bazaarpay_default_margin"
app:bazaarpayButtonTheme="contained"
app:bazaarpayButtonType="app"
app:sizeMode="large"
app:layout_constraintTop_toBottomOf="@id/content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:sizeMode="small"
app:text="@string/bazaarpay_submit_and_continue" />

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 0 additions & 2 deletions BazaarPay/src/main/res/layout/fragment_verify_otp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
style="@style/Bazaar.HorizontalDivider"
android:layout_width="0dp"
android:layout_margin="@dimen/bazaarpay_default_margin_double_half"
android:focusable="true"
android:focusableInTouchMode="true"
app:layout_constraintBottom_toTopOf="@id/editPhoneContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
2 changes: 1 addition & 1 deletion BazaarPay/src/main/res/layout/layout_edit_phone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
android:text="@string/bazaarpay_enter_edit_mobile"
tools:text="تغییر حساب کاربری" />

<ir.cafebazaar.bazaarpay.widget.RTLImageView
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="@dimen/bazaarpay_default_margin_half"
Expand Down

0 comments on commit 51edd27

Please sign in to comment.