diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8836e28..df6f285 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -68,11 +68,11 @@
android:exported="false" />
fullHistoryData = new ArrayList<>();
private String API_URL;
+ private String SUMMARY_API_URL;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -57,17 +60,18 @@ public class HistoryActivity extends AppCompatActivity {
setupRecyclerView();
buildApiUrl();
fetchApiData();
+ fetchSummaryData(); // Add this line to fetch summary data
setupClickListeners();
}
private void buildApiUrl() {
// Option 1: Get today's date (current implementation)
- // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
- // String todayDate = dateFormat.format(new Date());
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
+ String todayDate = dateFormat.format(new Date());
// Option 2: Set specific date (uncomment and modify if needed)
- String specificDate = "2025-06-27"; // Format: yyyy-MM-dd
- String todayDate = specificDate;
+ // String specificDate = "2025-06-27"; // Format: yyyy-MM-dd
+ // String todayDate = specificDate;
// Option 3: Set date using Calendar for specific date
// Calendar calendar = Calendar.getInstance();
@@ -77,6 +81,10 @@ public class HistoryActivity extends AppCompatActivity {
// Build API URL with date as both from_date and to_date, and limit=10
API_URL = "https://be-edc.msvc.app/transactions?page=0&limit=10&sortOrder=DESC&from_date="
+ todayDate + "&to_date=" + todayDate + "&location_id=0&merchant_id=0&tid=&mid=&sortColumn=id";
+
+ // Build Summary API URL for getting total amount and transaction count
+ SUMMARY_API_URL = "https://be-edc.msvc.app/transactions/list?from_date="
+ + todayDate + "&to_date=" + todayDate + "&location_id=0&merchant_id=0";
}
private void initViews() {
@@ -108,7 +116,7 @@ public class HistoryActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
try {
- Intent intent = new Intent(HistoryActivity.this, HistoryDetailActivity.class);
+ Intent intent = new Intent(HistoryActivity.this, HistoryListActivity.class);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
@@ -125,14 +133,15 @@ public class HistoryActivity extends AppCompatActivity {
new ApiTask().execute(API_URL);
}
+ private void fetchSummaryData() {
+ new SummaryApiTask().execute(SUMMARY_API_URL);
+ }
+
private void processApiData(JSONArray dataArray) {
try {
historyList.clear();
fullHistoryData.clear(); // Clear static data
- final long[] totalAmountArray = {0};
- final int[] totalTransactionsArray = {0};
-
for (int i = 0; i < dataArray.length(); i++) {
JSONObject item = dataArray.getJSONObject(i);
@@ -164,15 +173,11 @@ public class HistoryActivity extends AppCompatActivity {
// Add to both lists (since we're limiting to 10 in API call)
historyList.add(historyItem);
fullHistoryData.add(historyItem);
-
- totalAmountArray[0] += (long) amountValue;
- totalTransactionsArray[0]++;
}
runOnUiThread(new Runnable() {
@Override
public void run() {
- updateSummary(totalAmountArray[0], totalTransactionsArray[0]);
adapter.notifyDataSetChanged();
}
});
@@ -189,6 +194,51 @@ public class HistoryActivity extends AppCompatActivity {
}
}
+ private void processSummaryData(JSONArray dataArray) {
+ try {
+ long totalAmount = 0;
+ int totalTransactions = 0;
+
+ for (int i = 0; i < dataArray.length(); i++) {
+ JSONObject item = dataArray.getJSONObject(i);
+
+ String amount = item.getString("amount");
+
+ // Parse amount safely
+ double amountValue = 0;
+ try {
+ amountValue = Double.parseDouble(amount);
+ } catch (NumberFormatException e) {
+ amountValue = 0;
+ }
+
+ totalAmount += (long) amountValue;
+ totalTransactions++;
+ }
+
+ final long finalTotalAmount = totalAmount;
+ final int finalTotalTransactions = totalTransactions;
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ updateSummary(finalTotalAmount, finalTotalTransactions);
+ }
+ });
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(HistoryActivity.this, "Error parsing summary data", Toast.LENGTH_SHORT).show();
+ // Set default values if summary fails
+ updateSummary(0, 0);
+ }
+ });
+ }
+ }
+
private void updateSummary(long totalAmount, int totalTransactions) {
tvTotalAmount.setText("RP " + formatCurrency(totalAmount));
tvTotalTransactions.setText(String.valueOf(totalTransactions));
@@ -234,12 +284,16 @@ public class HistoryActivity extends AppCompatActivity {
private String formatChannelName(String channelCode) {
switch (channelCode) {
- case "DEBIT":
+ case "DEBIT_CARD":
return "Debit";
+ case "CREDIT_CARD":
+ return "Kredit";
case "QRIS":
return "QRIS";
+ case "E_MONEY":
+ return "E-Money";
case "OTHER":
- return "Kredit";
+ return "Lainnya";
default:
return channelCode.substring(0, 1).toUpperCase() +
channelCode.substring(1).toLowerCase();
@@ -280,7 +334,7 @@ public class HistoryActivity extends AppCompatActivity {
return new ArrayList<>(fullHistoryData);
}
- // AsyncTask for API call
+ // AsyncTask for main API call (transaction list with limit)
private class ApiTask extends AsyncTask {
@Override
protected String doInBackground(String... urls) {
@@ -333,6 +387,59 @@ public class HistoryActivity extends AppCompatActivity {
}
}
}
+
+ // AsyncTask for summary API call (all transactions for totals)
+ private class SummaryApiTask extends AsyncTask {
+ @Override
+ protected String doInBackground(String... urls) {
+ try {
+ URL url = new URL(urls[0]);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(10000);
+ connection.setReadTimeout(10000);
+
+ int responseCode = connection.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ StringBuilder response = new StringBuilder();
+ String line;
+
+ while ((line = reader.readLine()) != null) {
+ response.append(line);
+ }
+ reader.close();
+ return response.toString();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(String result) {
+ if (result != null) {
+ try {
+ JSONObject jsonResponse = new JSONObject(result);
+ if (jsonResponse.getInt("status") == 200) {
+ JSONArray dataArray = jsonResponse.getJSONArray("data");
+ processSummaryData(dataArray);
+ } else {
+ Toast.makeText(HistoryActivity.this, "Summary API Error", Toast.LENGTH_SHORT).show();
+ updateSummary(0, 0);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ Toast.makeText(HistoryActivity.this, "Summary JSON Parse Error", Toast.LENGTH_SHORT).show();
+ updateSummary(0, 0);
+ }
+ } else {
+ Toast.makeText(HistoryActivity.this, "Summary Network Error", Toast.LENGTH_SHORT).show();
+ updateSummary(0, 0);
+ }
+ }
+ }
}
// HistoryItem class - enhanced with more fields
diff --git a/app/src/main/java/com/example/bdkipoc/histori/HistoryDetailActivity.java b/app/src/main/java/com/example/bdkipoc/histori/HistoryDetailActivity.java
deleted file mode 100644
index 1bc6cec..0000000
--- a/app/src/main/java/com/example/bdkipoc/histori/HistoryDetailActivity.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.example.bdkipoc;
-
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-public class HistoryDetailActivity extends AppCompatActivity {
-
- private RecyclerView recyclerView;
- private HistoryDetailAdapter adapter;
- private List detailList;
- private ImageView btnBack;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_history_detail);
-
- initViews();
- setupRecyclerView();
- loadData();
- setupClickListeners();
- }
-
- private void initViews() {
- recyclerView = findViewById(R.id.recycler_view);
- btnBack = findViewById(R.id.btn_back);
- detailList = new ArrayList<>();
- }
-
- private void setupRecyclerView() {
- adapter = new HistoryDetailAdapter(detailList);
- recyclerView.setLayoutManager(new LinearLayoutManager(this));
- recyclerView.setAdapter(adapter);
- }
-
- private void setupClickListeners() {
- btnBack.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
- }
-
- private void loadData() {
- try {
- // Get data from HistoryActivity
- List fullData = HistoryActivity.getFullHistoryData();
-
- if (fullData != null && !fullData.isEmpty()) {
- detailList.clear();
- detailList.addAll(fullData);
- adapter.notifyDataSetChanged();
- } else {
- loadSampleDetailData();
- }
- } catch (Exception e) {
- e.printStackTrace();
- loadSampleDetailData();
- }
- }
-
- private void loadSampleDetailData() {
- detailList.clear();
-
- // Create sample detail data
- HistoryItem[] sampleData = {
- new HistoryItem("03:44", "11-05-2025", 2018619, "Kredit", "FAILED", "197870"),
- new HistoryItem("03:10", "12-05-2025", 3974866, "QRIS", "SUCCESS", "053059"),
- new HistoryItem("15:17", "13-05-2025", 2418167, "QRIS", "FAILED", "668320"),
- new HistoryItem("12:09", "11-05-2025", 3429230, "Debit", "FAILED", "454790"),
- new HistoryItem("08:39", "10-05-2025", 4656447, "QRIS", "FAILED", "454248"),
- new HistoryItem("00:35", "12-05-2025", 3507704, "QRIS", "FAILED", "301644"),
- new HistoryItem("22:43", "13-05-2025", 4277904, "Debit", "SUCCESS", "388709"),
- new HistoryItem("18:16", "11-05-2025", 4456904, "Debit", "FAILED", "986861"),
- new HistoryItem("12:51", "10-05-2025", 3027953, "Kredit", "SUCCESS", "771339"),
- new HistoryItem("19:50", "14-05-2025", 4399035, "QRIS", "FAILED", "103478")
- };
-
- for (HistoryItem item : sampleData) {
- detailList.add(item);
- }
-
- adapter.notifyDataSetChanged();
- }
-}
-
-// HistoryDetailAdapter class - simplified for stability
-class HistoryDetailAdapter extends RecyclerView.Adapter {
-
- private List detailList;
-
- public HistoryDetailAdapter(List detailList) {
- this.detailList = detailList;
- }
-
- @NonNull
- @Override
- public DetailViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.item_history_detail, parent, false);
- return new DetailViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull DetailViewHolder holder, int position) {
- HistoryItem item = detailList.get(position);
-
- try {
- holder.tvReferenceId.setText("Ref: " + item.getReferenceId());
- holder.tvAmount.setText("Rp. " + formatCurrency(item.getAmount()));
- holder.tvChannel.setText(item.getChannelName());
- holder.tvMerchant.setText("TEST MERCHANT");
- holder.tvTime.setText(formatDateTime(item.getTime(), item.getDate()));
- holder.tvIssuer.setText("BANK MANDIRI");
-
- // Set status color
- String status = item.getStatus();
- if ("SUCCESS".equals(status)) {
- holder.tvStatus.setText("Berhasil");
- holder.tvStatus.setTextColor(0xFF4CAF50); // Green
- } else if ("FAILED".equals(status)) {
- holder.tvStatus.setText("Gagal");
- holder.tvStatus.setTextColor(0xFFF44336); // Red
- } else {
- holder.tvStatus.setText("Tertunda");
- holder.tvStatus.setTextColor(0xFFFF9800); // Orange
- }
- } catch (Exception e) {
- e.printStackTrace();
- // Set default values if error occurs
- holder.tvReferenceId.setText("Ref: " + position);
- holder.tvAmount.setText("Rp. 0");
- holder.tvChannel.setText("Unknown");
- holder.tvMerchant.setText("TEST MERCHANT");
- holder.tvTime.setText("00:00, 01-01-2025");
- holder.tvIssuer.setText("UNKNOWN");
- holder.tvStatus.setText("Tidak Diketahui");
- holder.tvStatus.setTextColor(0xFF666666);
- }
- }
-
- @Override
- public int getItemCount() {
- return detailList != null ? detailList.size() : 0;
- }
-
- private String formatCurrency(long amount) {
- try {
- NumberFormat formatter = NumberFormat.getNumberInstance(new Locale("id", "ID"));
- return formatter.format(amount);
- } catch (Exception e) {
- return String.valueOf(amount);
- }
- }
-
- private String formatDateTime(String time, String date) {
- try {
- return time + ", " + date;
- } catch (Exception e) {
- return "00:00, 01-01-2025";
- }
- }
-
- static class DetailViewHolder extends RecyclerView.ViewHolder {
- TextView tvReferenceId;
- TextView tvAmount;
- TextView tvChannel;
- TextView tvMerchant;
- TextView tvTime;
- TextView tvIssuer;
- TextView tvStatus;
-
- public DetailViewHolder(@NonNull View itemView) {
- super(itemView);
- try {
- tvReferenceId = itemView.findViewById(R.id.tv_reference_id);
- tvAmount = itemView.findViewById(R.id.tv_amount);
- tvChannel = itemView.findViewById(R.id.tv_channel);
- tvMerchant = itemView.findViewById(R.id.tv_merchant);
- tvTime = itemView.findViewById(R.id.tv_time);
- tvIssuer = itemView.findViewById(R.id.tv_issuer);
- tvStatus = itemView.findViewById(R.id.tv_status);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/bdkipoc/histori/HistoryListActivity.java b/app/src/main/java/com/example/bdkipoc/histori/HistoryListActivity.java
new file mode 100644
index 0000000..721713b
--- /dev/null
+++ b/app/src/main/java/com/example/bdkipoc/histori/HistoryListActivity.java
@@ -0,0 +1,337 @@
+package com.example.bdkipoc.histori;
+
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.example.bdkipoc.R;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+public class HistoryListActivity extends AppCompatActivity {
+
+ private RecyclerView rvHistory;
+ private TextView tvEmpty;
+ private HistoryListAdapter adapter;
+ private List transactionList = new ArrayList<>();
+ private String API_URL;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_history_list);
+
+ // Initialize views
+ rvHistory = findViewById(R.id.rv_history);
+ tvEmpty = findViewById(R.id.tv_empty);
+
+ // Set up RecyclerView
+ adapter = new HistoryListAdapter(transactionList);
+ rvHistory.setLayoutManager(new LinearLayoutManager(this));
+ rvHistory.setAdapter(adapter);
+
+ // Set up app bar
+ setupAppBar();
+
+ // Build API URL and load data
+ buildApiUrl();
+ fetchTransactionData();
+ }
+
+ private void buildApiUrl() {
+ // Get current date in yyyy-MM-dd format
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
+ String currentDate = dateFormat.format(new Date());
+
+ // Option 2: Set specific date (uncomment and modify if needed)
+ // String specificDate = "2025-06-27"; // Format: yyyy-MM-dd
+ // String currentDate = specificDate;
+
+ // Build API URL with current date as both from_date and to_date
+ API_URL = "https://be-edc.msvc.app/transactions/list?from_date=" + currentDate +
+ "&to_date=" + currentDate + "&location_id=0&merchant_id=0";
+ }
+
+ private void setupAppBar() {
+ LinearLayout backNavigation = findViewById(R.id.back_navigation);
+ TextView appbarTitle = findViewById(R.id.appbarTitle);
+
+ appbarTitle.setText("Kembali");
+
+ backNavigation.setOnClickListener(v -> onBackPressed());
+ }
+
+ private void fetchTransactionData() {
+ new FetchTransactionsTask().execute(API_URL);
+ }
+
+ private void updateTransactionList(List transactions) {
+ transactionList.clear();
+ if (transactions != null && !transactions.isEmpty()) {
+ transactionList.addAll(transactions);
+ tvEmpty.setVisibility(View.GONE);
+ rvHistory.setVisibility(View.VISIBLE);
+ } else {
+ tvEmpty.setVisibility(View.VISIBLE);
+ rvHistory.setVisibility(View.GONE);
+ }
+ adapter.notifyDataSetChanged();
+ }
+
+ // AsyncTask to fetch transactions from API
+ private class FetchTransactionsTask extends AsyncTask {
+ @Override
+ protected String doInBackground(String... urls) {
+ try {
+ URL url = new URL(urls[0]);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(10000);
+ connection.setReadTimeout(10000);
+
+ int responseCode = connection.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ StringBuilder response = new StringBuilder();
+ String line;
+
+ while ((line = reader.readLine()) != null) {
+ response.append(line);
+ }
+ reader.close();
+ return response.toString();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(String result) {
+ if (result != null) {
+ try {
+ JSONObject jsonResponse = new JSONObject(result);
+ if (jsonResponse.getInt("status") == 200) {
+ JSONArray dataArray = jsonResponse.getJSONArray("data");
+ List transactions = parseTransactions(dataArray);
+ updateTransactionList(transactions);
+ } else {
+ showError("API Error: " + jsonResponse.getString("message"));
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ showError("Error parsing data");
+ }
+ } else {
+ showError("Network error");
+ }
+ }
+ }
+
+ private List parseTransactions(JSONArray dataArray) throws JSONException {
+ List transactions = new ArrayList<>();
+ for (int i = 0; i < dataArray.length(); i++) {
+ JSONObject item = dataArray.getJSONObject(i);
+ try {
+ Transaction transaction = new Transaction(
+ item.getString("transaction_date"),
+ item.getString("amount"),
+ item.getString("channel_code"),
+ item.getString("status")
+ );
+ transactions.add(transaction);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // Urutkan dari terbaru ke terlama
+ transactions.sort((t1, t2) -> {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
+ Date d1 = sdf.parse(t1.getDateTime());
+ Date d2 = sdf.parse(t2.getDateTime());
+ return d2.compareTo(d1); // terbaru di atas
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return 0;
+ }
+ });
+
+ return transactions;
+ }
+
+ private void showError(String message) {
+ Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
+ tvEmpty.setVisibility(View.VISIBLE);
+ rvHistory.setVisibility(View.GONE);
+ }
+
+ // Transaction model class
+ public static class Transaction {
+ private final String dateTime;
+ private final String amount;
+ private final String channel;
+ private final String status;
+
+ public Transaction(String dateTime, String amount, String channel, String status) throws ParseException {
+ this.dateTime = dateTime;
+ this.amount = amount;
+ this.channel = channel;
+ this.status = status;
+ }
+
+ public String getDateTime() {
+ return dateTime;
+ }
+
+ public String getAmount() {
+ return amount;
+ }
+
+ public String getChannel() {
+ return channel;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+ }
+
+ // Adapter class
+ public class HistoryListAdapter extends RecyclerView.Adapter {
+
+ private final List transactions;
+
+ public HistoryListAdapter(List transactions) {
+ this.transactions = transactions;
+ }
+
+ @Override
+ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.item_history_list, parent, false);
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(ViewHolder holder, int position) {
+ Transaction transaction = transactions.get(position);
+
+ // Format date
+ SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
+ SimpleDateFormat outputFormat = new SimpleDateFormat("HH:mm, dd MMM yyyy", Locale.getDefault());
+ try {
+ Date date = inputFormat.parse(transaction.getDateTime());
+ holder.tvTime.setText(outputFormat.format(date));
+ } catch (ParseException e) {
+ holder.tvTime.setText(transaction.getDateTime());
+ e.printStackTrace();
+ }
+
+ // Format amount
+ holder.tvAmount.setText(String.format(Locale.getDefault(), "Rp. %s", transaction.getAmount()));
+
+ // Set channel and status
+ holder.tvChannel.setText(formatChannelName(transaction.getChannel()));
+ holder.tvStatus.setText(formatStatusText(transaction.getStatus()));
+
+ // Set status color
+ int statusColor = Color.parseColor("#000000"); // default black
+ if ("SUCCESS".equalsIgnoreCase(transaction.getStatus())) {
+ statusColor = Color.parseColor("#4CAF50"); // green
+ } else if ("FAILED".equalsIgnoreCase(transaction.getStatus())) {
+ statusColor = Color.parseColor("#F44336"); // red
+ } else if ("INIT".equalsIgnoreCase(transaction.getStatus())) {
+ statusColor = Color.parseColor("#FF9800"); // orange
+ }
+ holder.tvStatus.setTextColor(statusColor);
+ }
+
+ @Override
+ public int getItemCount() {
+ return transactions.size();
+ }
+
+ private String formatChannelName(String channelCode) {
+ switch (channelCode) {
+ case "E_MONEY":
+ return "E-Money";
+ case "QRIS":
+ return "QRIS";
+ case "CREDIT_CARD":
+ return "Kredit";
+ case "DEBIT_CARD":
+ return "Debit";
+ default:
+ return channelCode;
+ }
+ }
+
+ private String formatStatusText(String status) {
+ switch (status) {
+ case "SUCCESS":
+ return "Berhasil";
+ case "FAILED":
+ return "Gagal";
+ case "INIT":
+ return "Tertunda";
+ default:
+ return status;
+ }
+ }
+
+ public class ViewHolder extends RecyclerView.ViewHolder {
+ public final TextView tvTime;
+ public final TextView tvAmount;
+ public final TextView tvChannel;
+ public final TextView tvStatus;
+
+ public ViewHolder(View view) {
+ super(view);
+ tvTime = view.findViewById(R.id.tv_time);
+ tvAmount = view.findViewById(R.id.tv_amount);
+ tvChannel = view.findViewById(R.id.tv_channel);
+ tvStatus = view.findViewById(R.id.tv_status);
+
+ // Set click listener if needed
+ view.setOnClickListener(v -> {
+ int position = getAdapterPosition();
+ if (position != RecyclerView.NO_POSITION) {
+ Transaction transaction = transactions.get(position);
+ // TODO: Handle item click, maybe open detail activity
+ // Intent intent = new Intent(HistoryListActivity.this, HistoryDetailActivity.class);
+ // Pass transaction data to detail activity
+ // startActivity(intent);
+ }
+ });
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_history.xml b/app/src/main/res/layout/activity_history.xml
index 520d37b..b6afdec 100644
--- a/app/src/main/res/layout/activity_history.xml
+++ b/app/src/main/res/layout/activity_history.xml
@@ -18,7 +18,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="-70dp"
android:layout_marginEnd="16dp"
- android:layout_marginBottom="11dp"
+ android:layout_marginBottom="5dp"
app:cardCornerRadius="16dp"
app:cardElevation="6dp">
diff --git a/app/src/main/res/layout/activity_history_detail.xml b/app/src/main/res/layout/activity_history_detail.xml
deleted file mode 100644
index 7531923..0000000
--- a/app/src/main/res/layout/activity_history_detail.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_history_list.xml b/app/src/main/res/layout/activity_history_list.xml
new file mode 100644
index 0000000..2b3f624
--- /dev/null
+++ b/app/src/main/res/layout/activity_history_list.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/component_appbar_small.xml b/app/src/main/res/layout/component_appbar_small.xml
new file mode 100644
index 0000000..1c510af
--- /dev/null
+++ b/app/src/main/res/layout/component_appbar_small.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_history_detail.xml b/app/src/main/res/layout/item_history_detail.xml
deleted file mode 100644
index 0f845de..0000000
--- a/app/src/main/res/layout/item_history_detail.xml
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_history_list.xml b/app/src/main/res/layout/item_history_list.xml
new file mode 100644
index 0000000..cbe196f
--- /dev/null
+++ b/app/src/main/res/layout/item_history_list.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+