layouting cetak ulang
This commit is contained in:
parent
6f78b6df3f
commit
edb1c6d09b
@ -102,7 +102,7 @@ public class ReprintActivity extends AppCompatActivity implements ReprintAdapter
|
||||
initViews();
|
||||
|
||||
// Setup toolbar
|
||||
setupToolbar();
|
||||
setupAppbar();
|
||||
|
||||
// Setup RecyclerView
|
||||
setupRecyclerView();
|
||||
@ -144,19 +144,18 @@ public class ReprintActivity extends AppCompatActivity implements ReprintAdapter
|
||||
StyleHelper.applyPaginationButtonStyle(btnLastPage, this, false);
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
// Hide default title since we're using custom layout
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
private void setupAppbar() {
|
||||
// Setup back navigation click listener
|
||||
LinearLayout backNavigation = findViewById(R.id.back_navigation);
|
||||
if (backNavigation != null) {
|
||||
backNavigation.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
// Setup custom back button
|
||||
ImageView backButton = findViewById(R.id.backButton);
|
||||
backButton.setOnClickListener(v -> finish());
|
||||
// Alternative: You can also set click listener on the back arrow directly
|
||||
ImageView backArrow = findViewById(R.id.backArrow);
|
||||
if (backArrow != null) {
|
||||
backArrow.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
|
||||
private void setupRecyclerView() {
|
||||
@ -615,7 +614,7 @@ public class ReprintActivity extends AppCompatActivity implements ReprintAdapter
|
||||
int apiPage = pageToLoad - 1; // API uses 0-based indexing
|
||||
|
||||
String urlString = "https://be-edc.msvc.app/transactions?page=" + apiPage +
|
||||
"&limit=" + itemsPerPage + "&sortOrder=DESC&from_date=" + fromDate + "&to_date=" + toDate + "&location_id=0&merchant_id=0&tid=73001500&mid=71000026521&sortColumn=created_at";
|
||||
"&limit=" + itemsPerPage + "&sortOrder=DESC&from_date=" + fromDate + "&to_date=" + toDate + "&location_id=0&merchant_id=0&tid=&mid=&sortColumn=created_at";
|
||||
|
||||
Log.d("ReprintActivity", "🔍 Fetching transactions page " + pageToLoad +
|
||||
" (API page " + apiPage + ") with limit " + itemsPerPage + " - SORT: DESC by created_at" +
|
||||
@ -1169,15 +1168,6 @@ public class ReprintActivity extends AppCompatActivity implements ReprintAdapter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
// Transaction model class
|
||||
static class Transaction {
|
||||
int id;
|
||||
|
@ -4,301 +4,198 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp">
|
||||
|
||||
<!-- Status Bar Background -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:background="#F44336" />
|
||||
|
||||
<!-- Main Toolbar -->
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:background="#F44336"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetLeft="0dp">
|
||||
|
||||
<!-- Custom toolbar content -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<!-- Back Button -->
|
||||
<ImageView
|
||||
android:id="@+id/backButton"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_menu_revert"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:padding="4dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:rotation="180" />
|
||||
|
||||
<!-- Title -->
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cetak Ulang Struk"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="normal"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<!-- Title Section (outside toolbar) -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cetak Ulang Struk"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="inter-bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
<!-- Include the component appbar -->
|
||||
<include layout="@layout/component_appbar" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#f8f9fa"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
android:background="@android:color/white"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_marginTop="50dp">
|
||||
|
||||
<!-- Search and Filter Section -->
|
||||
<!-- Title Section -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cetak Ulang Struk"
|
||||
android:textSize="20sp"
|
||||
android:textColor="#333333"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="16dp" />
|
||||
|
||||
<!-- Search and Filter Container -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:weightSum="10">
|
||||
|
||||
<!-- Search Bar -->
|
||||
<!-- Search Container (Ratio 8) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/searchContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="44dp"
|
||||
android:layout_weight="8"
|
||||
android:background="@android:drawable/edit_text"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@android:drawable/ic_menu_search"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:alpha="0.5" />
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:layout_marginEnd="8dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchEditText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="Search"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Cari dengan nomor struk..."
|
||||
android:textColorHint="#999999"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:gravity="center_vertical" />
|
||||
android:imeOptions="actionSearch" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Filter Button -->
|
||||
<!-- Filter Button (Ratio 2) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/filterButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_weight="2"
|
||||
android:background="@android:drawable/btn_default"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:minWidth="120dp">
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@android:drawable/ic_menu_my_calendar"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:alpha="0.5" />
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"
|
||||
android:tint="#666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/filterButtonText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Filter"
|
||||
android:textSize="14sp"
|
||||
android:layout_weight="1"
|
||||
android:text=""
|
||||
android:textColor="#666666"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center" />
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Table Header -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="#f5f5f5"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:text="Nomor Struk"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#666666" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Amount"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#666666"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Action"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#666666"
|
||||
android:gravity="center" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<!-- RecyclerView for transactions -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#ffffff"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="8dp" />
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
<!-- Progress Bar -->
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- Pagination Controls -->
|
||||
<LinearLayout
|
||||
android:id="@+id/paginationControls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center"
|
||||
android:elevation="4dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="2dp">
|
||||
android:visibility="gone">
|
||||
|
||||
<!-- First Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnFirstPage"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@android:drawable/ic_media_previous"
|
||||
android:contentDescription="First Page"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<!-- Previous Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnPrevPage"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@android:drawable/ic_media_rew"
|
||||
android:contentDescription="Previous Page"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:scaleType="centerInside"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<!-- Page Numbers Container -->
|
||||
<!-- Navigation Controls -->
|
||||
<LinearLayout
|
||||
android:id="@+id/pageNumbersContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:minHeight="48dp" />
|
||||
android:gravity="center">
|
||||
|
||||
<!-- Next Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnNextPage"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@android:drawable/ic_media_ff"
|
||||
android:contentDescription="Next Page"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="centerInside"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless" />
|
||||
<!-- First Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnFirstPage"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@android:drawable/btn_default"
|
||||
android:src="@android:drawable/ic_media_previous"
|
||||
android:contentDescription="First Page"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<!-- Last Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnLastPage"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@android:drawable/ic_media_next"
|
||||
android:contentDescription="Last Page"
|
||||
android:layout_marginStart="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless" />
|
||||
<!-- Previous Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnPrevPage"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@android:drawable/btn_default"
|
||||
android:src="@android:drawable/ic_media_rew"
|
||||
android:contentDescription="Previous Page"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<!-- Page Numbers Container -->
|
||||
<LinearLayout
|
||||
android:id="@+id/pageNumbersContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<!-- Next Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnNextPage"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@android:drawable/btn_default"
|
||||
android:src="@android:drawable/ic_media_ff"
|
||||
android:contentDescription="Next Page"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<!-- Last Page Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnLastPage"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@android:drawable/btn_default"
|
||||
android:src="@android:drawable/ic_media_next"
|
||||
android:contentDescription="Last Page"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user