backup bantuan activity with api
This commit is contained in:
parent
88069c0b56
commit
44225f1d67
@ -3,44 +3,142 @@ package com.example.bdkipoc.bantuan;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.example.bdkipoc.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class BantuanActivity extends AppCompatActivity {
|
||||
|
||||
// Tab components
|
||||
private LinearLayout tabUmum, tabRiwayat;
|
||||
private TextView textUmum, textRiwayat;
|
||||
private View contentUmum, contentRiwayat;
|
||||
|
||||
// Content containers
|
||||
private ScrollView contentUmum, contentRiwayat;
|
||||
private LinearLayout riwayatContainer;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
// Bottom buttons
|
||||
private LinearLayout btnForm, btnWhatsApp;
|
||||
private LinearLayout backNavigation;
|
||||
|
||||
// Current active tab
|
||||
private boolean isUmumTabActive = true;
|
||||
|
||||
// API and data
|
||||
private List<TicketData> ticketList = new ArrayList<>();
|
||||
private ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
private Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
// Data model class
|
||||
public static class TicketData {
|
||||
public String createdAt;
|
||||
public String ticketCode;
|
||||
public String issueName;
|
||||
public String status;
|
||||
|
||||
public TicketData(String createdAt, String ticketCode, String issueName, String status) {
|
||||
this.createdAt = createdAt;
|
||||
this.ticketCode = ticketCode;
|
||||
this.issueName = issueName;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
android.util.Log.d("BantuanActivity", "=== onCreate START ===");
|
||||
|
||||
setContentView(R.layout.activity_bantuan);
|
||||
|
||||
// Debug network and system info
|
||||
checkNetworkConnection();
|
||||
|
||||
// Default tampilkan tab Umum
|
||||
setContentView(R.layout.activity_bantuan_umum);
|
||||
initViews();
|
||||
setupListeners();
|
||||
|
||||
// Set default tab (Umum) as active
|
||||
showUmumTab();
|
||||
|
||||
// Debug layout hierarchy
|
||||
debugLayoutHierarchy();
|
||||
|
||||
// Test basic HTTP connectivity
|
||||
testSimpleHttpConnection();
|
||||
|
||||
// Load ticket data from API
|
||||
android.util.Log.d("BantuanActivity", "Starting API call...");
|
||||
loadTicketData();
|
||||
|
||||
android.util.Log.d("BantuanActivity", "=== onCreate END ===");
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
tabUmum = findViewById(R.id.tab_umum);
|
||||
tabRiwayat = findViewById(R.id.tab_riwayat);
|
||||
textUmum = findViewById(R.id.text_umum);
|
||||
textRiwayat = findViewById(R.id.text_riwayat);
|
||||
|
||||
btnForm = findViewById(R.id.btn_form);
|
||||
btnWhatsApp = findViewById(R.id.btn_whatsapp);
|
||||
|
||||
// Back navigation dari component_appbar
|
||||
backNavigation = findViewById(R.id.back_navigation);
|
||||
try {
|
||||
// Tab components
|
||||
tabUmum = findViewById(R.id.tab_umum);
|
||||
tabRiwayat = findViewById(R.id.tab_riwayat);
|
||||
textUmum = findViewById(R.id.text_umum);
|
||||
textRiwayat = findViewById(R.id.text_riwayat);
|
||||
|
||||
// Content containers
|
||||
contentUmum = findViewById(R.id.content_umum);
|
||||
contentRiwayat = findViewById(R.id.content_riwayat);
|
||||
|
||||
// Create dynamic container for riwayat content
|
||||
if (contentRiwayat != null) {
|
||||
View child = contentRiwayat.getChildAt(0);
|
||||
if (child instanceof LinearLayout) {
|
||||
riwayatContainer = (LinearLayout) child;
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom buttons
|
||||
btnForm = findViewById(R.id.btn_form);
|
||||
btnWhatsApp = findViewById(R.id.btn_whatsapp);
|
||||
|
||||
// Back navigation dari component_appbar
|
||||
backNavigation = findViewById(R.id.back_navigation);
|
||||
|
||||
// Create progress bar programmatically
|
||||
progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleSmall);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
// Debug: Log which views are null
|
||||
android.util.Log.d("BantuanActivity", "tabUmum: " + (tabUmum != null));
|
||||
android.util.Log.d("BantuanActivity", "tabRiwayat: " + (tabRiwayat != null));
|
||||
android.util.Log.d("BantuanActivity", "contentUmum: " + (contentUmum != null));
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat: " + (contentRiwayat != null));
|
||||
android.util.Log.d("BantuanActivity", "riwayatContainer: " + (riwayatContainer != null));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.util.Log.e("BantuanActivity", "Error in initViews: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
@ -50,56 +148,745 @@ public class BantuanActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
// Tab listeners
|
||||
tabUmum.setOnClickListener(v -> showUmumTab());
|
||||
tabRiwayat.setOnClickListener(v -> showRiwayatTab());
|
||||
if (tabUmum != null) {
|
||||
tabUmum.setOnClickListener(v -> showUmumTab());
|
||||
}
|
||||
if (tabRiwayat != null) {
|
||||
tabRiwayat.setOnClickListener(v -> showRiwayatTab());
|
||||
}
|
||||
|
||||
// Button listeners
|
||||
btnForm.setOnClickListener(v -> {
|
||||
setContentView(R.layout.activity_bantuan_form);
|
||||
setupFormView();
|
||||
});
|
||||
if (btnForm != null) {
|
||||
btnForm.setOnClickListener(v -> {
|
||||
try {
|
||||
// Handle form bantuan - untuk sementara bisa tampilkan toast atau dialog
|
||||
android.widget.Toast.makeText(this, "Form Bantuan akan segera tersedia", android.widget.Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.widget.Toast.makeText(this, "Error: " + e.getMessage(), android.widget.Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
btnWhatsApp.setOnClickListener(v -> {
|
||||
// Handle WhatsApp CS
|
||||
});
|
||||
if (btnWhatsApp != null) {
|
||||
btnWhatsApp.setOnClickListener(v -> {
|
||||
try {
|
||||
// Handle WhatsApp CS - bisa buka aplikasi WhatsApp atau web
|
||||
openWhatsAppCS();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.widget.Toast.makeText(this, "Error membuka WhatsApp: " + e.getMessage(), android.widget.Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showUmumTab() {
|
||||
setContentView(R.layout.activity_bantuan_umum);
|
||||
initViews();
|
||||
setupListeners();
|
||||
|
||||
// Update tab appearance menggunakan drawable yang sudah dibuat
|
||||
tabUmum.setBackgroundResource(R.drawable.tab_active_bg);
|
||||
textUmum.setTextColor(ContextCompat.getColor(this, android.R.color.white));
|
||||
|
||||
tabRiwayat.setBackgroundResource(R.drawable.tab_inactive_bg);
|
||||
textRiwayat.setTextColor(Color.parseColor("#DE0701"));
|
||||
try {
|
||||
if (isUmumTabActive) return; // Avoid unnecessary operations
|
||||
|
||||
isUmumTabActive = true;
|
||||
|
||||
// Update content visibility
|
||||
if (contentUmum != null) {
|
||||
contentUmum.setVisibility(View.VISIBLE);
|
||||
android.util.Log.d("BantuanActivity", "contentUmum set to VISIBLE");
|
||||
}
|
||||
if (contentRiwayat != null) {
|
||||
contentRiwayat.setVisibility(View.GONE);
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat set to GONE");
|
||||
}
|
||||
|
||||
// Update tab appearance
|
||||
updateTabAppearance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.util.Log.e("BantuanActivity", "Error in showUmumTab: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void showRiwayatTab() {
|
||||
setContentView(R.layout.activity_bantuan_riwayat);
|
||||
initViews();
|
||||
setupListeners();
|
||||
|
||||
// Update tab appearance menggunakan drawable yang sudah dibuat
|
||||
tabRiwayat.setBackgroundResource(R.drawable.tab_active_bg);
|
||||
textRiwayat.setTextColor(ContextCompat.getColor(this, android.R.color.white));
|
||||
|
||||
tabUmum.setBackgroundResource(R.drawable.tab_inactive_bg);
|
||||
textUmum.setTextColor(Color.parseColor("#DE0701"));
|
||||
}
|
||||
|
||||
private void setupFormView() {
|
||||
Button btnKirim = findViewById(R.id.btn_kirim);
|
||||
LinearLayout btnBack = findViewById(R.id.back_navigation);
|
||||
|
||||
if (btnBack != null) {
|
||||
btnBack.setOnClickListener(v -> showUmumTab());
|
||||
try {
|
||||
android.util.Log.d("BantuanActivity", "=== showRiwayatTab called ===");
|
||||
|
||||
if (!isUmumTabActive) {
|
||||
android.util.Log.d("BantuanActivity", "Already on riwayat tab, skipping");
|
||||
return; // Avoid unnecessary operations
|
||||
}
|
||||
|
||||
isUmumTabActive = false;
|
||||
android.util.Log.d("BantuanActivity", "Switching to riwayat tab");
|
||||
|
||||
// Update content visibility
|
||||
if (contentUmum != null) {
|
||||
contentUmum.setVisibility(View.GONE);
|
||||
android.util.Log.d("BantuanActivity", "contentUmum set to GONE");
|
||||
}
|
||||
if (contentRiwayat != null) {
|
||||
contentRiwayat.setVisibility(View.VISIBLE);
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat set to VISIBLE");
|
||||
}
|
||||
|
||||
// Update tab appearance
|
||||
updateTabAppearance();
|
||||
|
||||
// Debug current state
|
||||
debugLayoutHierarchy();
|
||||
|
||||
// Populate riwayat content if data is available
|
||||
if (!ticketList.isEmpty()) {
|
||||
android.util.Log.d("BantuanActivity", "Ticket data available (" + ticketList.size() + " items), populating content");
|
||||
populateRiwayatContent();
|
||||
} else {
|
||||
android.util.Log.w("BantuanActivity", "No ticket data available yet");
|
||||
// Show loading or empty message
|
||||
if (riwayatContainer != null) {
|
||||
riwayatContainer.removeAllViews();
|
||||
TextView loadingText = new TextView(this);
|
||||
loadingText.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
loadingText.setText("Memuat data...");
|
||||
loadingText.setTextSize(16);
|
||||
loadingText.setGravity(android.view.Gravity.CENTER);
|
||||
loadingText.setPadding(dpToPx(16), dpToPx(32), dpToPx(16), dpToPx(32));
|
||||
loadingText.setTextColor(ContextCompat.getColor(this, android.R.color.darker_gray));
|
||||
riwayatContainer.addView(loadingText);
|
||||
android.util.Log.d("BantuanActivity", "Loading message added to riwayat container");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.util.Log.e("BantuanActivity", "Error in showRiwayatTab: " + e.getMessage());
|
||||
}
|
||||
|
||||
btnKirim.setOnClickListener(v -> {
|
||||
// Handle form submission
|
||||
android.util.Log.d("BantuanActivity", "=== showRiwayatTab completed ===");
|
||||
}
|
||||
|
||||
private void updateTabAppearance() {
|
||||
try {
|
||||
if (isUmumTabActive) {
|
||||
// Umum tab active
|
||||
if (tabUmum != null) {
|
||||
tabUmum.setBackgroundResource(R.drawable.tab_active_bg);
|
||||
}
|
||||
if (textUmum != null) {
|
||||
textUmum.setTextColor(ContextCompat.getColor(this, android.R.color.white));
|
||||
}
|
||||
|
||||
// Riwayat tab inactive
|
||||
if (tabRiwayat != null) {
|
||||
tabRiwayat.setBackgroundResource(R.drawable.tab_inactive_bg);
|
||||
}
|
||||
if (textRiwayat != null) {
|
||||
textRiwayat.setTextColor(Color.parseColor("#DE0701"));
|
||||
}
|
||||
} else {
|
||||
// Riwayat tab active
|
||||
if (tabRiwayat != null) {
|
||||
tabRiwayat.setBackgroundResource(R.drawable.tab_active_bg);
|
||||
}
|
||||
if (textRiwayat != null) {
|
||||
textRiwayat.setTextColor(ContextCompat.getColor(this, android.R.color.white));
|
||||
}
|
||||
|
||||
// Umum tab inactive
|
||||
if (tabUmum != null) {
|
||||
tabUmum.setBackgroundResource(R.drawable.tab_inactive_bg);
|
||||
}
|
||||
if (textUmum != null) {
|
||||
textUmum.setTextColor(Color.parseColor("#DE0701"));
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "Tab appearance updated. isUmumTabActive: " + isUmumTabActive);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.util.Log.e("BantuanActivity", "Error in updateTabAppearance: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTicketData() {
|
||||
android.util.Log.d("BantuanActivity", "=== START loadTicketData ===");
|
||||
showLoading(true);
|
||||
|
||||
executor.execute(() -> {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
String apiUrl = "https://be-edc.msvc.app/tickets?page=0&limit=10&sortOrder=ASC&sortColumn=ticket_code";
|
||||
android.util.Log.d("BantuanActivity", "API URL: " + apiUrl);
|
||||
|
||||
URL url = new URL(apiUrl);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// Set connection properties
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("User-Agent", "Android-App/1.0");
|
||||
connection.setConnectTimeout(15000); // Increase timeout
|
||||
connection.setReadTimeout(15000);
|
||||
connection.setDoInput(true);
|
||||
|
||||
android.util.Log.d("BantuanActivity", "Connection configured, attempting to connect...");
|
||||
|
||||
// Check if we can connect
|
||||
connection.connect();
|
||||
android.util.Log.d("BantuanActivity", "Connection established");
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
String responseMessage = connection.getResponseMessage();
|
||||
android.util.Log.d("BantuanActivity", "API Response Code: " + responseCode);
|
||||
android.util.Log.d("BantuanActivity", "API Response Message: " + responseMessage);
|
||||
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
android.util.Log.d("BantuanActivity", "Reading response...");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
StringBuilder response = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
reader.close();
|
||||
|
||||
String responseString = response.toString();
|
||||
android.util.Log.d("BantuanActivity", "Response Length: " + responseString.length());
|
||||
android.util.Log.d("BantuanActivity", "Response Preview: " +
|
||||
(responseString.length() > 200 ? responseString.substring(0, 200) + "..." : responseString));
|
||||
|
||||
// Parse JSON response
|
||||
parseTicketData(responseString);
|
||||
|
||||
} else {
|
||||
// Log error response body
|
||||
try {
|
||||
BufferedReader errorReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
|
||||
StringBuilder errorResponse = new StringBuilder();
|
||||
String errorLine;
|
||||
while ((errorLine = errorReader.readLine()) != null) {
|
||||
errorResponse.append(errorLine);
|
||||
}
|
||||
errorReader.close();
|
||||
android.util.Log.e("BantuanActivity", "Error Response Body: " + errorResponse.toString());
|
||||
} catch (Exception errorEx) {
|
||||
android.util.Log.e("BantuanActivity", "Cannot read error response: " + errorEx.getMessage());
|
||||
}
|
||||
|
||||
android.util.Log.e("BantuanActivity", "API Error: " + responseCode + " - " + responseMessage);
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Gagal memuat data riwayat: " + responseCode, android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
}
|
||||
|
||||
} catch (java.net.UnknownHostException e) {
|
||||
android.util.Log.e("BantuanActivity", "Network Error - Unknown Host: " + e.getMessage());
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Tidak dapat terhubung ke server. Periksa koneksi internet.", android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} catch (java.net.SocketTimeoutException e) {
|
||||
android.util.Log.e("BantuanActivity", "Network Error - Timeout: " + e.getMessage());
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Koneksi timeout. Coba lagi.", android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} catch (java.net.ConnectException e) {
|
||||
android.util.Log.e("BantuanActivity", "Network Error - Connection Failed: " + e.getMessage());
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Gagal terhubung ke server.", android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} catch (java.io.IOException e) {
|
||||
android.util.Log.e("BantuanActivity", "IO Error: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Error IO: " + e.getMessage(), android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "General Error: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Error: " + e.getMessage(), android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
android.util.Log.d("BantuanActivity", "Connection disconnected");
|
||||
}
|
||||
android.util.Log.d("BantuanActivity", "=== END loadTicketData ===");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseTicketData(String jsonResponse) {
|
||||
try {
|
||||
android.util.Log.d("BantuanActivity", "=== START parseTicketData ===");
|
||||
android.util.Log.d("BantuanActivity", "JSON Response received, length: " + jsonResponse.length());
|
||||
|
||||
if (jsonResponse == null || jsonResponse.trim().isEmpty()) {
|
||||
android.util.Log.e("BantuanActivity", "JSON Response is null or empty");
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Response kosong dari server", android.widget.Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
android.util.Log.d("BantuanActivity", "JSON parsed successfully");
|
||||
|
||||
// Check if response has results
|
||||
if (!jsonObject.has("results")) {
|
||||
android.util.Log.e("BantuanActivity", "JSON does not contain 'results' field");
|
||||
android.util.Log.d("BantuanActivity", "Available keys: " + jsonObject.keys().toString());
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Format response tidak valid", android.widget.Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject results = jsonObject.getJSONObject("results");
|
||||
android.util.Log.d("BantuanActivity", "Results object extracted");
|
||||
|
||||
// Check if results has data
|
||||
if (!results.has("data")) {
|
||||
android.util.Log.e("BantuanActivity", "Results does not contain 'data' field");
|
||||
android.util.Log.d("BantuanActivity", "Available keys in results: " + results.keys().toString());
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Data tidak ditemukan dalam response", android.widget.Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
JSONArray dataArray = results.getJSONArray("data");
|
||||
android.util.Log.d("BantuanActivity", "Data array extracted, length: " + dataArray.length());
|
||||
|
||||
List<TicketData> newTicketList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < dataArray.length(); i++) {
|
||||
try {
|
||||
JSONObject ticket = dataArray.getJSONObject(i);
|
||||
android.util.Log.d("BantuanActivity", "Processing ticket " + (i+1) + "/" + dataArray.length());
|
||||
|
||||
// Extract required fields with null checks
|
||||
String createdAt = ticket.optString("createdAt", "");
|
||||
String ticketCode = ticket.optString("ticket_code", "");
|
||||
String status = ticket.optString("status", "");
|
||||
|
||||
android.util.Log.d("BantuanActivity", "Ticket " + (i+1) + " - createdAt: " + createdAt + ", ticket_code: " + ticketCode + ", status: " + status);
|
||||
|
||||
// Get issue name with null check
|
||||
String issueName = "";
|
||||
if (ticket.has("issue") && !ticket.isNull("issue")) {
|
||||
JSONObject issue = ticket.getJSONObject("issue");
|
||||
issueName = issue.optString("name", "Tidak ada keterangan");
|
||||
android.util.Log.d("BantuanActivity", "Ticket " + (i+1) + " - issue name: " + issueName);
|
||||
} else {
|
||||
android.util.Log.w("BantuanActivity", "Ticket " + (i+1) + " - issue field is missing or null");
|
||||
issueName = "Tidak ada keterangan";
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
if (createdAt.isEmpty() || ticketCode.isEmpty()) {
|
||||
android.util.Log.w("BantuanActivity", "Ticket " + (i+1) + " - skipping due to missing required fields");
|
||||
continue;
|
||||
}
|
||||
|
||||
newTicketList.add(new TicketData(createdAt, ticketCode, issueName, status));
|
||||
android.util.Log.d("BantuanActivity", "Ticket " + (i+1) + " added successfully");
|
||||
|
||||
} catch (Exception ticketException) {
|
||||
android.util.Log.e("BantuanActivity", "Error processing ticket " + (i+1) + ": " + ticketException.getMessage());
|
||||
ticketException.printStackTrace();
|
||||
// Continue with next ticket
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "Successfully processed " + newTicketList.size() + " tickets out of " + dataArray.length());
|
||||
|
||||
// Update UI on main thread
|
||||
mainHandler.post(() -> {
|
||||
try {
|
||||
android.util.Log.d("BantuanActivity", "Updating UI with ticket data...");
|
||||
ticketList.clear();
|
||||
ticketList.addAll(newTicketList);
|
||||
showLoading(false);
|
||||
|
||||
// If currently on riwayat tab, update the content
|
||||
if (!isUmumTabActive) {
|
||||
android.util.Log.d("BantuanActivity", "Currently on riwayat tab, populating content...");
|
||||
populateRiwayatContent();
|
||||
} else {
|
||||
android.util.Log.d("BantuanActivity", "Currently on umum tab, data loaded and ready");
|
||||
}
|
||||
|
||||
android.widget.Toast.makeText(this, "Data riwayat berhasil dimuat (" + ticketList.size() + " item)", android.widget.Toast.LENGTH_SHORT).show();
|
||||
android.util.Log.d("BantuanActivity", "UI update completed successfully");
|
||||
|
||||
} catch (Exception uiException) {
|
||||
android.util.Log.e("BantuanActivity", "Error updating UI: " + uiException.getMessage());
|
||||
uiException.printStackTrace();
|
||||
android.widget.Toast.makeText(this, "Error updating UI: " + uiException.getMessage(), android.widget.Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (org.json.JSONException jsonException) {
|
||||
android.util.Log.e("BantuanActivity", "JSON Parsing Error: " + jsonException.getMessage());
|
||||
android.util.Log.e("BantuanActivity", "Invalid JSON received: " + (jsonResponse.length() > 500 ? jsonResponse.substring(0, 500) + "..." : jsonResponse));
|
||||
jsonException.printStackTrace();
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Error parsing JSON: " + jsonException.getMessage(), android.widget.Toast.LENGTH_LONG).show();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "General parsing error: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
mainHandler.post(() -> {
|
||||
showLoading(false);
|
||||
android.widget.Toast.makeText(this, "Error parsing data: " + e.getMessage(), android.widget.Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
} finally {
|
||||
android.util.Log.d("BantuanActivity", "=== END parseTicketData ===");
|
||||
}
|
||||
}
|
||||
|
||||
private void populateRiwayatContent() {
|
||||
android.util.Log.d("BantuanActivity", "=== START populateRiwayatContent ===");
|
||||
|
||||
if (riwayatContainer == null) {
|
||||
android.util.Log.e("BantuanActivity", "riwayatContainer is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ticketList.isEmpty()) {
|
||||
android.util.Log.w("BantuanActivity", "ticketList is empty!");
|
||||
// Show empty state message
|
||||
riwayatContainer.removeAllViews();
|
||||
|
||||
TextView emptyText = new TextView(this);
|
||||
emptyText.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
emptyText.setText("Belum ada data riwayat");
|
||||
emptyText.setTextSize(16);
|
||||
emptyText.setGravity(android.view.Gravity.CENTER);
|
||||
emptyText.setPadding(dpToPx(16), dpToPx(32), dpToPx(16), dpToPx(32));
|
||||
emptyText.setTextColor(ContextCompat.getColor(this, android.R.color.darker_gray));
|
||||
|
||||
riwayatContainer.addView(emptyText);
|
||||
android.util.Log.d("BantuanActivity", "Empty state message added");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
android.util.Log.d("BantuanActivity", "Clearing existing content...");
|
||||
// Clear existing content
|
||||
riwayatContainer.removeAllViews();
|
||||
|
||||
android.util.Log.d("BantuanActivity", "Creating " + ticketList.size() + " history items...");
|
||||
|
||||
for (int i = 0; i < ticketList.size(); i++) {
|
||||
TicketData ticket = ticketList.get(i);
|
||||
android.util.Log.d("BantuanActivity", "Creating item " + (i+1) + ": " + ticket.ticketCode);
|
||||
|
||||
// Create history item layout
|
||||
LinearLayout historyItem = createHistoryItem(ticket);
|
||||
if (historyItem != null) {
|
||||
riwayatContainer.addView(historyItem);
|
||||
android.util.Log.d("BantuanActivity", "Item " + (i+1) + " added successfully");
|
||||
|
||||
// Add separator (except for last item)
|
||||
if (i < ticketList.size() - 1) {
|
||||
View separator = new View(this);
|
||||
separator.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
1
|
||||
));
|
||||
separator.setBackgroundColor(Color.parseColor("#e0e0e0"));
|
||||
riwayatContainer.addView(separator);
|
||||
android.util.Log.d("BantuanActivity", "Separator " + (i+1) + " added");
|
||||
}
|
||||
} else {
|
||||
android.util.Log.e("BantuanActivity", "Failed to create item " + (i+1));
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "All items created successfully. Total children in container: " + riwayatContainer.getChildCount());
|
||||
|
||||
// Force layout refresh
|
||||
riwayatContainer.requestLayout();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
android.util.Log.e("BantuanActivity", "Error populating riwayat content: " + e.getMessage());
|
||||
|
||||
// Show error message in UI
|
||||
riwayatContainer.removeAllViews();
|
||||
TextView errorText = new TextView(this);
|
||||
errorText.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
errorText.setText("Error menampilkan data: " + e.getMessage());
|
||||
errorText.setTextSize(14);
|
||||
errorText.setGravity(android.view.Gravity.CENTER);
|
||||
errorText.setPadding(dpToPx(16), dpToPx(32), dpToPx(16), dpToPx(32));
|
||||
errorText.setTextColor(ContextCompat.getColor(this, android.R.color.holo_red_dark));
|
||||
riwayatContainer.addView(errorText);
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "=== END populateRiwayatContent ===");
|
||||
}
|
||||
|
||||
private LinearLayout createHistoryItem(TicketData ticket) {
|
||||
try {
|
||||
android.util.Log.d("BantuanActivity", "Creating history item for ticket: " + ticket.ticketCode);
|
||||
|
||||
LinearLayout mainLayout = new LinearLayout(this);
|
||||
mainLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
mainLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
mainLayout.setPadding(dpToPx(16), dpToPx(16), dpToPx(16), dpToPx(16));
|
||||
mainLayout.setBackgroundColor(Color.WHITE);
|
||||
|
||||
// Header layout (date and status)
|
||||
LinearLayout headerLayout = new LinearLayout(this);
|
||||
headerLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
headerLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
// Date TextView
|
||||
TextView dateText = new TextView(this);
|
||||
LinearLayout.LayoutParams dateParams = new LinearLayout.LayoutParams(
|
||||
0, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f
|
||||
);
|
||||
dateText.setLayoutParams(dateParams);
|
||||
String formattedDate = formatDate(ticket.createdAt);
|
||||
dateText.setText(formattedDate);
|
||||
dateText.setTextSize(16);
|
||||
dateText.setTypeface(null, android.graphics.Typeface.BOLD);
|
||||
android.util.Log.d("BantuanActivity", "Date formatted: " + ticket.createdAt + " -> " + formattedDate);
|
||||
|
||||
// Status TextView
|
||||
TextView statusText = new TextView(this);
|
||||
statusText.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
String formattedStatus = formatStatus(ticket.status);
|
||||
int statusColor = getStatusColor(ticket.status);
|
||||
statusText.setText(formattedStatus);
|
||||
statusText.setTextSize(14);
|
||||
statusText.setTextColor(statusColor);
|
||||
android.util.Log.d("BantuanActivity", "Status formatted: " + ticket.status + " -> " + formattedStatus);
|
||||
|
||||
headerLayout.addView(dateText);
|
||||
headerLayout.addView(statusText);
|
||||
|
||||
// Ticket code TextView
|
||||
TextView ticketCodeText = new TextView(this);
|
||||
LinearLayout.LayoutParams ticketParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
ticketParams.setMargins(0, dpToPx(4), 0, 0);
|
||||
ticketCodeText.setLayoutParams(ticketParams);
|
||||
ticketCodeText.setText("Nomor tiket: " + ticket.ticketCode);
|
||||
ticketCodeText.setTextSize(14);
|
||||
ticketCodeText.setTextColor(ContextCompat.getColor(this, android.R.color.darker_gray));
|
||||
|
||||
// Issue name TextView
|
||||
TextView issueText = new TextView(this);
|
||||
LinearLayout.LayoutParams issueParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
issueParams.setMargins(0, dpToPx(8), 0, 0);
|
||||
issueText.setLayoutParams(issueParams);
|
||||
issueText.setText(ticket.issueName);
|
||||
issueText.setTextSize(16);
|
||||
|
||||
mainLayout.addView(headerLayout);
|
||||
mainLayout.addView(ticketCodeText);
|
||||
mainLayout.addView(issueText);
|
||||
|
||||
android.util.Log.d("BantuanActivity", "History item created successfully for: " + ticket.ticketCode);
|
||||
return mainLayout;
|
||||
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "Error creating history item for ticket " + ticket.ticketCode + ": " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String formatDate(String isoDate) {
|
||||
try {
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
|
||||
Date date = inputFormat.parse(isoDate);
|
||||
return outputFormat.format(date);
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "Error formatting date: " + e.getMessage());
|
||||
return isoDate.substring(0, 10); // fallback to YYYY-MM-DD
|
||||
}
|
||||
}
|
||||
|
||||
private String formatStatus(String status) {
|
||||
switch (status.toLowerCase()) {
|
||||
case "new":
|
||||
return "Pengajuan";
|
||||
case "on_progres":
|
||||
return "Proses";
|
||||
case "done":
|
||||
return "Selesai";
|
||||
case "cancel":
|
||||
return "Cancel";
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
private int getStatusColor(String status) {
|
||||
switch (status.toLowerCase()) {
|
||||
case "new":
|
||||
return ContextCompat.getColor(this, android.R.color.holo_blue_light);
|
||||
case "on_progres":
|
||||
return ContextCompat.getColor(this, android.R.color.holo_orange_light);
|
||||
case "done":
|
||||
return ContextCompat.getColor(this, android.R.color.holo_green_dark);
|
||||
case "cancel":
|
||||
return ContextCompat.getColor(this, android.R.color.holo_red_dark);
|
||||
default:
|
||||
return ContextCompat.getColor(this, android.R.color.black);
|
||||
}
|
||||
}
|
||||
|
||||
private int dpToPx(int dp) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
return Math.round(dp * density);
|
||||
}
|
||||
|
||||
private void showLoading(boolean show) {
|
||||
android.util.Log.d("BantuanActivity", "Loading state: " + show);
|
||||
// You can implement a loading indicator here if needed
|
||||
// For example, you can show/hide a progress bar
|
||||
}
|
||||
|
||||
// Debug helper methods
|
||||
private void checkNetworkConnection() {
|
||||
try {
|
||||
android.net.ConnectivityManager cm = (android.net.ConnectivityManager) getSystemService(android.content.Context.CONNECTIVITY_SERVICE);
|
||||
android.net.NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
||||
android.util.Log.d("BantuanActivity", "Network connected: " + isConnected);
|
||||
|
||||
if (activeNetwork != null) {
|
||||
android.util.Log.d("BantuanActivity", "Network type: " + activeNetwork.getTypeName());
|
||||
android.util.Log.d("BantuanActivity", "Network subtype: " + activeNetwork.getSubtypeName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "Error checking network: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void testSimpleHttpConnection() {
|
||||
android.util.Log.d("BantuanActivity", "Testing simple HTTP connection...");
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
java.net.URL url = new java.net.URL("https://httpbin.org/get");
|
||||
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(5000);
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
android.util.Log.d("BantuanActivity", "Test connection response: " + responseCode);
|
||||
connection.disconnect();
|
||||
|
||||
if (responseCode == 200) {
|
||||
android.util.Log.d("BantuanActivity", "Basic HTTP connection works fine");
|
||||
} else {
|
||||
android.util.Log.w("BantuanActivity", "Basic HTTP connection returned: " + responseCode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
android.util.Log.e("BantuanActivity", "Test connection failed: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void debugLayoutHierarchy() {
|
||||
android.util.Log.d("BantuanActivity", "=== Layout Debug Info ===");
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat: " + (contentRiwayat != null ? "OK" : "NULL"));
|
||||
|
||||
if (contentRiwayat != null) {
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat visibility: " + contentRiwayat.getVisibility());
|
||||
android.util.Log.d("BantuanActivity", "contentRiwayat childCount: " + contentRiwayat.getChildCount());
|
||||
|
||||
if (contentRiwayat.getChildCount() > 0) {
|
||||
android.view.View child = contentRiwayat.getChildAt(0);
|
||||
android.util.Log.d("BantuanActivity", "First child type: " + child.getClass().getSimpleName());
|
||||
|
||||
if (child instanceof LinearLayout) {
|
||||
LinearLayout childLinear = (LinearLayout) child;
|
||||
android.util.Log.d("BantuanActivity", "Child LinearLayout childCount: " + childLinear.getChildCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "riwayatContainer: " + (riwayatContainer != null ? "OK" : "NULL"));
|
||||
if (riwayatContainer != null) {
|
||||
android.util.Log.d("BantuanActivity", "riwayatContainer childCount: " + riwayatContainer.getChildCount());
|
||||
}
|
||||
|
||||
android.util.Log.d("BantuanActivity", "ticketList size: " + ticketList.size());
|
||||
android.util.Log.d("BantuanActivity", "isUmumTabActive: " + isUmumTabActive);
|
||||
android.util.Log.d("BantuanActivity", "=========================");
|
||||
}
|
||||
|
||||
private void openWhatsAppCS() {
|
||||
// Implementasi untuk membuka WhatsApp CS
|
||||
// Contoh: buka WhatsApp dengan nomor tertentu
|
||||
try {
|
||||
String phoneNumber = "+6281234567890"; // Ganti dengan nomor CS yang sesuai
|
||||
String message = "Halo, saya butuh bantuan terkait Payvora PRO";
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(android.net.Uri.parse("https://wa.me/" + phoneNumber + "?text=" +
|
||||
android.net.Uri.encode(message)));
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
// Fallback jika WhatsApp tidak terinstall
|
||||
// Bisa tampilkan dialog atau buka browser
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (executor != null && !executor.isShutdown()) {
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
518
app/src/main/res/layout/activity_bantuan.xml
Normal file
518
app/src/main/res/layout/activity_bantuan.xml
Normal file
@ -0,0 +1,518 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<!-- Custom AppBar -->
|
||||
<include layout="@layout/component_appbar" />
|
||||
|
||||
<!-- Main Card Container -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="480dp"
|
||||
android:layout_marginTop="-80dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<!-- Logo Section with Tabs -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="94.149dp"
|
||||
android:layout_height="38.248dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginLeft="10.9dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:src="@drawable/ic_logo_icon"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:contentDescription="Payvora PRO Logo"/>
|
||||
|
||||
<!-- Tabs -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tab_umum"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:background="@drawable/tab_active_bg"
|
||||
android:layout_marginEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_umum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Umum"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tab_riwayat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_inactive_bg"
|
||||
android:gravity="center"
|
||||
android:padding="12dp"
|
||||
android:layout_marginStart="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_riwayat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Riwayat"
|
||||
android:textColor="#DE0701"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<!-- Content Umum (Static help content) -->
|
||||
<ScrollView
|
||||
android:id="@+id/content_umum"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="16dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Help Items -->
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Transaksi gagal tapi saldo terpotong"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="QRIS tidak terbaca"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="EDC tidak merespon / hang"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Gagal cetak struk"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara Reset EDC"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara Hubungkan ke WiFi"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara pembayaran kartu (debit/kredit)"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara Refund Transaksi QRIS"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara melakukan Settlement"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara membatalkan transaksi (void)"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e0e0e0"/>
|
||||
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cara melihat riwayat transaksi"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lihat Solusi"
|
||||
android:textColor="@android:color/holo_blue_light"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- Content Riwayat (Dynamic content from API) -->
|
||||
<ScrollView
|
||||
android:id="@+id/content_riwayat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Dynamic content will be added here programmatically -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- Bottom Buttons -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- Tombol Isi Form -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_form"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/border_button_red">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Isi Form Bantuan"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#DE0701"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Tombol WhatsApp -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_whatsapp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/border_button_red"
|
||||
android:paddingHorizontal="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_whatsapp"
|
||||
android:contentDescription="WhatsApp Icon"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="WhatsApp CS"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#DE0701"
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user