square btn changed

This commit is contained in:
MooN 2025-11-19 12:13:17 +06:30
parent 65eb17e3b9
commit 749abb1455
11 changed files with 310 additions and 181 deletions

View File

@ -40,8 +40,20 @@ public class QRPayAdapter extends RecyclerView.Adapter<QRPayAdapter.ViewHolder>
return new ViewHolder(binding);
}
private final int[] colors = new int[]{
R.color.colorPrimary,
R.color.amber,
R.color.forestGreen
};
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
int colorRes = colors[position % colors.length];
holder.itemView.setBackgroundResource(colorRes);
QRPayItem item = items.get(position);
holder.binding.setText(item.title);
holder.binding.setIcon(item.icon);

View File

@ -42,7 +42,7 @@ public class QRPayFragment extends DataBindingFragment {
@Override
public void onResume() {
super.onResume();
setToolBarTitleWithBackIcon("MMQR");
setToolBarTitleWithBackIcon("MMQR PAY");
}
@Override

View File

@ -23,6 +23,7 @@ import com.utsmyanmar.baselib.fragment.DataBindingFragment;
import com.utsmyanmar.baselib.util.DataBindingConfig;
import com.utsmyanmar.paylibs.model.PayDetail;
import java.util.ArrayList;
import java.util.List;
@ -104,6 +105,9 @@ public class QRRefundFragment extends DataBindingFragment {
public void onCancel(){
safeNavigateToRouteId();
}
public void onSearch(){
searchById();
}
}
private void onRefundItemClicked(PayDetail payDetail) {
@ -112,4 +116,27 @@ public class QRRefundFragment extends DataBindingFragment {
routeId = R.id.action_qrRefundList_to_qrRefundDetail;
NavHostFragment.findNavController(this).navigate(routeId, bundle);
}
private void searchById(){
EditText editText = getView().findViewById(R.id.rnn_trace_id);
String keyword = editText.getText().toString().trim();
if(keyword.isEmpty()){
updateList(qrPayViewModel.getRefundableQrHistory().getValue());
return;
}
List<PayDetail> originalList = qrPayViewModel.getRefundableQrHistory().getValue();
if(originalList == null) return;
List<PayDetail> filteredList = new ArrayList<>();
for(PayDetail item: originalList){
if(item.getReferNo() != null && item.getReferNo().contains(keyword)){
filteredList.add(item);
}
}
updateList(filteredList);
}
}

View File

@ -136,14 +136,14 @@
<ImageView
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_marginBottom="6dp"
android:src="@drawable/ic_settlement"
app:tint="@color/colorPrimary"
android:layout_marginBottom="6dp" />
app:tint="@color/colorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_sale"
android:text="@string/menu_settlement"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textStyle="bold"
@ -186,7 +186,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_sale"
android:text="@string/menu_sign_on"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textStyle="bold"
@ -231,7 +231,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_sale"
android:text="@string/menu_transactions"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textStyle="bold"
@ -275,7 +275,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_sale"
android:text="@string/menu_qrpay"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textStyle="bold"

View File

@ -41,7 +41,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:spanCount="2"
app:spanCount="3"
bind:setAdapter="@{adapter}"
tools:itemCount="6"
tools:listitem="@layout/item_view_dashboard" />

View File

@ -14,12 +14,12 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
android:background="@color/colorBackground">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewFeatures"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clipToPadding="false"
android:nestedScrollingEnabled="false"
@ -29,7 +29,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:spanCount="2"
app:spanCount="3"
bind:setAdapter="@{adapter}"
tools:itemCount="3"
tools:listitem="@layout/item_qr_pay_button" />

View File

@ -15,6 +15,9 @@
<variable
name="manageViewModel"
type="com.utsmm.kbz.ui.management.ManagementViewModel" />
<variable
name="click"
type="com.utsmm.kbz.ui.qr_pay.QRRefundFragment.ClickEvent" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -23,75 +26,105 @@
android:background="@color/white">
<!-- SEARCH SECTION -->
<!-- <LinearLayout-->
<!-- android:id="@+id/searchSection"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- android:padding="16dp"-->
<!-- android:visibility="@{manageViewModel.reprintLayoutTopVisibility}"-->
<!-- app:layout_constraintTop_toBottomOf="@id/headerSection"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent">-->
<LinearLayout
android:id="@+id/refundSearchSection"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp"
android:gravity="center_vertical"
android:visibility="@{manageViewModel.reprintLayoutTopVisibility}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- &lt;!&ndash; Search Input Card &ndash;&gt;-->
<!-- <androidx.cardview.widget.CardView-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="56dp"-->
<!-- android:layout_weight="1"-->
<!-- android:layout_marginEnd="12dp"-->
<!-- app:cardCornerRadius="16dp"-->
<!-- app:cardElevation="0dp"-->
<!-- app:cardBackgroundColor="@color/white">-->
<!-- Search Card -->
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:layout_marginEnd="12dp"
app:cardCornerRadius="16dp"
app:cardElevation="0dp"
app:cardBackgroundColor="@color/white">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_margin="2dp"-->
<!-- android:background="@drawable/bg_edittext_primary_border"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal"-->
<!-- android:padding="16dp">-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:background="@drawable/bg_edittext_primary_border"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp">
<!-- <ImageView-->
<!-- android:layout_width="20dp"-->
<!-- android:layout_height="20dp"-->
<!-- android:layout_marginEnd="8dp"-->
<!-- android:src="@drawable/ic_txn_history"-->
<!-- app:tint="@color/colorPrimary"-->
<!-- android:alpha="0.6" />-->
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_txn_history"
app:tint="@color/colorPrimary"
android:alpha="0.6"/>
<!-- <EditText-->
<!-- android:id="@+id/et_rrn_trace"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@null"-->
<!-- android:hint="@string/txt_search_rrn_trace"-->
<!-- android:text="@={manageViewModel.txtRRNTrace}"-->
<!-- android:textColor="@color/colorPrimary"-->
<!-- android:textColorHint="@color/colorPrimary"-->
<!-- android:alpha="0.6"-->
<!-- android:textSize="15sp"-->
<!-- android:fontFamily="sans-serif"-->
<!-- android:inputType="number"-->
<!-- android:maxLength="12"-->
<!-- android:imeOptions="actionSearch"-->
<!-- android:singleLine="true"-->
<!-- tools:text="" />-->
<!-- </LinearLayout>-->
<!-- </androidx.cardview.widget.CardView>-->
<EditText
android:id="@+id/rnn_trace_id"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/txt_search_rrn_trace"
android:text="@={manageViewModel.txtRRNTrace}"
android:textColor="@color/colorPrimary"
android:textColorHint="@color/colorPrimary"
android:alpha="0.9"
android:textSize="14sp"
android:inputType="number"
android:singleLine="true"
android:imeOptions="actionSearch" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- SEARCH BUTTON -->
<androidx.cardview.widget.CardView
android:id="@+id/btnSearch"
android:onClick="@{() -> click.onSearch()}"
android:layout_width="80dp"
android:layout_height="52dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="8dp"
app:cardElevation="3dp"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search"
android:textSize="14sp"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<!-- </LinearLayout>-->
<!-- RECYCLER VIEW -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/qrRefundHistory"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingTop="4dp"
app:adapter="@{adapter}"
app:layout_constraintTop_toBottomOf="@id/refundSearchSection"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_qr_refund" />
<!-- Empty State Section -->
@ -99,15 +132,14 @@
android:id="@+id/emptyStateSectionRefund"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:orientation="vertical"
android:visibility="@{manageViewModel.reprintLayoutBtmVisibility}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<!-- Empty State Animation -->
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lav_no_trans"
android:layout_width="200dp"
@ -115,42 +147,25 @@
android:layout_marginBottom="24dp"
app:lottie_autoPlay="true"
app:lottie_fileName="lottie_no_trans.json"
app:lottie_loop="true" />
app:lottie_loop="true"/>
<!-- Empty State Icon (fallback) -->
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_txn_history"
app:tint="@color/colorPrimary"
android:alpha="0.3"
android:layout_marginBottom="24dp"
android:visibility="gone" />
<!-- Empty State Title -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_history"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="20sp"
android:textStyle="bold"
android:fontFamily="sans-serif-medium"
android:layout_marginBottom="8dp" />
android:textColor="@color/colorPrimary"
android:layout_marginBottom="8dp"/>
<!-- Empty State Description -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No transactions found for the selected criteria"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textColor="@color/colorPrimary"
android:alpha="0.7"
android:fontFamily="sans-serif"
android:paddingHorizontal="32dp" />
android:paddingHorizontal="32dp"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -13,52 +13,62 @@
name="icon"
type="Integer" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
>
<androidx.cardview.widget.CardView
android:id="@+id/btnItem"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_margin="8dp"
android:layout_width="0dp"
android:layout_height="0dp"
app:cardCornerRadius="20dp"
app:cardElevation="6dp"
android:layout_margin="6dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:background="@color/white"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="1:1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:id="@+id/btnIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginBottom="8dp"
app:srcUrl="@{icon}"
app:tint="@color/colorPrimary"
tools:tint="@color/colorPrimary"
tools:src="@drawable/ic_sale" />
tools:src="@drawable/ic_sale"
tools:tint="@color/colorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:fontFamily="@font/rubik_medium"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:text="@{text}"
android:gravity="center"
android:maxLines="2"
android:ellipsize="end" />
android:text="@{text}"
tools:text="button title"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:layout_margin="16dp"
android:layout_margin="8dp"
android:layout_marginVertical="6dp"
app:cardCornerRadius="12dp"
app:cardElevation="0dp"

View File

@ -5,8 +5,6 @@
<data>
<import type="com.utsmm.kbz.R"/>
<import type="com.utsmm.kbz.util.enums.FeaturesType" />
<variable
name="item"
type="com.utsmm.kbz.config.data.model.Features" />
@ -14,49 +12,54 @@
<androidx.cardview.widget.CardView
android:id="@+id/trans_card"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_margin="8dp"
app:cardCornerRadius="20dp"
app:cardElevation="6dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="6dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
app:cardCornerRadius="20dp"
app:cardElevation="6dp"
app:disableBtn="@{item.isActive}"
android:focusable="true">
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="1:1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/primary_card_bg"
android:padding="16dp">
android:orientation="vertical"
android:padding="16dp"
android:background="@color/white">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/btnIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginBottom="8dp"
app:srcUrl="@{item.drawable}"
app:tint="@color/white"
tools:tint="@color/white"
tools:src="@drawable/ic_sale" />
app:tint="@color/colorPrimary"
tools:src="@drawable/ic_sale"
tools:tint="@color/colorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/rubik_medium"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
android:textColor="@color/white"
android:text="@{item.name}"
tools:text="SALE"
android:gravity="center"
android:maxLines="2"
android:ellipsize="end" />
android:gravity="center"
android:text="@{item.name}"
tools:text="button title"
android:textAlignment="center"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</layout>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.utsmm.kbz.R"/>
<import type="com.utsmm.kbz.util.enums.FeaturesType" />
<variable
name="item"
type="com.utsmm.kbz.config.data.model.Features" />
</data>
<androidx.cardview.widget.CardView
android:id="@+id/trans_card"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_margin="8dp"
app:cardCornerRadius="20dp"
app:cardElevation="6dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
app:disableBtn="@{item.isActive}"
android:focusable="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/primary_card_bg"
android:padding="16dp">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="8dp"
app:srcUrl="@{item.drawable}"
app:tint="@color/white"
tools:tint="@color/white"
tools:src="@drawable/ic_sale" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/rubik_medium"
android:textSize="16sp"
android:textStyle="bold"
android:textAlignment="center"
android:textColor="@color/white"
android:text="@{item.name}"
tools:text="SALE"
android:gravity="center"
android:maxLines="2"
android:ellipsize="end" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</layout>