test Misha_Like gif to payment page, fix mainLogo in amount, add dynamic text to cashier

This commit is contained in:
ahmeddatexpay 2025-09-02 14:17:10 +03:00
parent e443f7b452
commit 4fc39800ab
9 changed files with 79 additions and 44 deletions

View File

@ -70,16 +70,21 @@ public class CashierFragment extends BaseFragment<FragmentCashierBinding, Cashie
public void initData() {
super.initData();
// Request focus immediately
if (etAmountInput != null) {
etAmountInput.requestFocus();
}
// Setup amount input field
setupAmountInput();
}
private void setupAmountInput() {
// Find the EditText in layout
etAmountInput = binding.getRoot().findViewById(R.id.etAmountInput);
// Make EditText invisible but still focusable
if (etAmountInput != null) {
// Request focus
etAmountInput.requestFocus();
// Add text watcher to update amount in real-time
etAmountInput.addTextChangedListener(new TextWatcher() {
@ -130,6 +135,8 @@ public class CashierFragment extends BaseFragment<FragmentCashierBinding, Cashie
return false;
}
});
// etAmountInput.setVisibility(View.I);
}
}
@ -162,7 +169,7 @@ public class CashierFragment extends BaseFragment<FragmentCashierBinding, Cashie
viewModel.sendMessage(paymentDataM20.toString());
// Reset input field
etAmountInput.setText("");
// etAmountInput.setText("");
} catch (Exception e) {
Log.e("CashierFragment", "Error creating JSON", e);

View File

@ -37,7 +37,9 @@ public class CashierViewModel extends BaseAppViewModel {
return paymentInfo;
}
public ObservableField<String> amount = new ObservableField<>("0.00");
public ObservableField<String> currencyCode = new ObservableField<>("RUB");
public ObservableField<String> currencyCode = new ObservableField<>("");
public ObservableField<String> instructionText = new ObservableField<>(" ");
private final MutableLiveData<PaymentStatus> paymentStatus = new MutableLiveData<>(PaymentStatus.WAITING);
public LiveData<PaymentStatus> getPaymentStatus() {
return paymentStatus;
@ -53,6 +55,7 @@ public class CashierViewModel extends BaseAppViewModel {
super(application);
mContext = application.getApplicationContext();
initializePrinter();
instructionText.set("Введите сумму для оплаты на PIN-пад");
}
private void initializePrinter() {
@ -206,7 +209,7 @@ public class CashierViewModel extends BaseAppViewModel {
public void sendMessage(String message) {
try {
sendWebSocketMessage(message);
instructionText.set("Ожидание оплаты с пин-пада");
} catch (Exception e) {
Log.e(TAG, "Error sending WebSocket message", e);
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:type="linear"
android:angle="275"
android:startColor="#6125CE"
android:endColor="#D399FF" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 MiB

View File

@ -111,14 +111,14 @@
android:id="@+id/iv_status"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@{viewModel.isSuccess ? @drawable/ic_check_circle : @drawable/ic_error_circle}"
android:src="@{viewModel.isSuccess ? @drawable/ic_check_circle : null}"
android:layout_marginEnd="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transaction_result"
android:textColor="@{viewModel.isSuccess ? @color/green : @color/red}"
android:textColor="@{viewModel.isSuccess ? @color/green : @color/black}"
android:textSize="24sp"/>
</LinearLayout>

View File

@ -20,10 +20,11 @@
<!-- Real-time amount display -->
<TextView
android:id="@+id/realTimeAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{viewModel.amount + ` ` + viewModel.currencyCode}"
android:textSize="24sp"
android:textSize="34sp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_marginTop="16dp"
@ -32,11 +33,13 @@
<EditText
android:id="@+id/etAmountInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="1dp"
android:inputType="numberDecimal"
android:hint="Enter amount"
android:hint=" "
android:imeOptions="actionDone"
android:maxLines="1"/>
android:maxLines="1"
android:textColor="@color/white"
android:visibility="visible"/>
<!-- Waiting State -->
<LinearLayout
@ -48,12 +51,14 @@
android:visibility="@{viewModel.paymentStatus == PaymentStatus.WAITING ? View.VISIBLE : View.GONE}">
<TextView
android:id="@+id/text_instruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter amount for pinpad M50 to pay"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:gravity="center"
android:text="@{viewModel.instructionText}"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center" />
android:textStyle="bold" />
</LinearLayout>
<!-- Success State -->
@ -74,11 +79,13 @@
<!-- android:gravity="center" />-->
<Button
android:id="@+id/printButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Print Receipt"
android:text="Печатать чек еще раз"
android:padding="10dp"
android:onClick="@{() -> viewModel.printReceipt()}"
android:layout_marginTop="16dp" />
android:layout_marginTop="26dp" />
</LinearLayout>
<!-- Failed State -->

View File

@ -6,7 +6,6 @@
<variable
name="viewModel"
type="com.dspread.pos.ui.home.HomeViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -14,12 +13,25 @@
android:layout_height="match_parent"
android:background="@color/keyboard_background">
<LinearLayout
android:id="@+id/LogoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="6dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
app:layout_constraintBottom_toTopOf="@id/txt_amount_container"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/logoImage"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scaleType="fitCenter"
@ -28,15 +40,15 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</LinearLayout>
<!-- 金额显示区域 -->
<!-- 金额显示区域 -->
<LinearLayout
android:id="@+id/txt_amount_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingRight="20dp"
app:layout_constraintTop_toBottomOf="@id/logoImage"
app:layout_constraintTop_toBottomOf="@id/LogoContainer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:orientation="horizontal"

View File

@ -16,9 +16,6 @@
<!-- android:text="@{viewModel.status}"-->
<!-- binding:onClickCommand="@{viewModel.actionCommand}"-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -26,9 +23,7 @@
android:padding="16dp"
android:gravity="center"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintHorizontal_chainStyle="packed"
>
app:layout_constraintHorizontal_chainStyle="packed">
<!-- Top Section: Logo -->
<LinearLayout
@ -37,18 +32,11 @@
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/gridLayout"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/ivLogo"

View File

@ -11,7 +11,8 @@
<!-- Use FrameLayout as root to contain both camera overlay and main content -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<!-- Main Content -->
<LinearLayout
@ -26,13 +27,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_300"
android:paddingTop="10dp"
android:scaleType="fitCenter"
android:src="@drawable/melberry_char_purple" />
android:gravity="center"
android:layout_marginTop="-60dp">
<pl.droidsonroids.gif.GifImageView
android:layout_width="348dp"
android:layout_height="480dp"
android:padding="35dp"
android:scaleType="centerCrop"
android:src="@drawable/mishka_like" />
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_300"-->
<!-- android:paddingTop="10dp"-->
<!-- android:scaleType="fitCenter"-->
<!-- android:src="@drawable/melberry_char_purple" />-->
</LinearLayout>
<!-- Amount and currency section -->