diff --git a/app/src/main/java/com/example/bdkipoc/MainActivity.java b/app/src/main/java/com/example/bdkipoc/MainActivity.java
index aa699c0..d6e5c58 100644
--- a/app/src/main/java/com/example/bdkipoc/MainActivity.java
+++ b/app/src/main/java/com/example/bdkipoc/MainActivity.java
@@ -2,31 +2,64 @@ package com.example.bdkipoc;
import android.content.Intent;
import android.os.Bundle;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
import android.widget.Toast;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.WindowManager;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
+import com.google.android.material.button.MaterialButton;
+
public class MainActivity extends AppCompatActivity {
+ private boolean isExpanded = false;
+ private CardView cardBantuan, cardInfoToko;
+ private MaterialButton btnLainnya;
+
@Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus) {
+ getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+ }
+}
protected void onCreate(Bundle savedInstanceState) {
+ // Enable hardware acceleration for smoother scrolling
+ getWindow().setFlags(
+ WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
+ WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
+ );
+
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
- // Ganti findViewById(R.id.main) dengan findViewById(R.id.merchant_card)
- // atau root layout yang ada di XML
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
+ // Initialize views
+ cardBantuan = findViewById(R.id.card_bantuan);
+ cardInfoToko = findViewById(R.id.card_info_toko);
+ btnLainnya = findViewById(R.id.btn_lainnya);
+
// Setup menu listeners
setupMenuListeners();
}
@@ -42,40 +75,72 @@ public class MainActivity extends AppCompatActivity {
R.id.card_cetak_ulang,
R.id.card_refund,
R.id.card_settlement,
- R.id.card_histori
+ R.id.card_histori,
+ R.id.card_bantuan,
+ R.id.card_info_toko
};
- // Cara 1: Menggunakan loop dengan if-else
for (int cardId : cardIds) {
CardView cardView = findViewById(cardId);
cardView.setOnClickListener(v -> {
if (cardId == R.id.card_kartu_kredit) {
- // Arahkan ke PaymentActivity untuk Transfer
startActivity(new Intent(MainActivity.this, PaymentActivity.class));
} else if (cardId == R.id.card_kartu_debit) {
Toast.makeText(this, "Kartu Debit Diklik", Toast.LENGTH_SHORT).show();
} else if (cardId == R.id.card_qris) {
- // Arahkan ke TransactionActivity untuk QRIS
startActivity(new Intent(MainActivity.this, TransactionActivity.class));
- } else if (cardId == R.id.card_transfer) {
- Toast.makeText(this, "Transfer Diklik", Toast.LENGTH_SHORT).show();
- } else if (cardId == R.id.card_uang_elektronik) {
- Toast.makeText(this, "Uang Elektronik Diklik", Toast.LENGTH_SHORT).show();
- } else if (cardId == R.id.card_cetak_ulang) {
- Toast.makeText(this, "Cetak Ulang Diklik", Toast.LENGTH_SHORT).show();
- } else if (cardId == R.id.card_refund) {
- Toast.makeText(this, "Refund Diklik", Toast.LENGTH_SHORT).show();
- } else if (cardId == R.id.card_settlement) {
- Toast.makeText(this, "Settlement Diklik", Toast.LENGTH_SHORT).show();
- } else if (cardId == R.id.card_histori) {
- Toast.makeText(this, "Histori Diklik", Toast.LENGTH_SHORT).show();
+ } else if (cardId == R.id.card_bantuan) {
+ Toast.makeText(this, "Bantuan Diklik", Toast.LENGTH_SHORT).show();
+ } else if (cardId == R.id.card_info_toko) {
+ Toast.makeText(this, "Info Toko Diklik", Toast.LENGTH_SHORT).show();
+ } else {
+ // Simplified version - just show the card ID
+ Toast.makeText(this, "Menu Diklik: " + cardId, Toast.LENGTH_SHORT).show();
}
});
}
- // Lainnya button listener
- findViewById(R.id.btn_lainnya).setOnClickListener(v ->
- Toast.makeText(this, "Lainnya Diklik", Toast.LENGTH_SHORT).show()
- );
+ btnLainnya.setOnClickListener(v -> {
+ isExpanded = !isExpanded;
+
+ if (isExpanded) {
+ // Show additional menus with animation
+ cardBantuan.setVisibility(View.VISIBLE);
+ cardInfoToko.setVisibility(View.VISIBLE);
+ cardBantuan.setAlpha(0f);
+ cardInfoToko.setAlpha(0f);
+
+ cardBantuan.animate()
+ .alpha(1f)
+ .setDuration(300)
+ .setInterpolator(new AccelerateDecelerateInterpolator())
+ .start();
+
+ cardInfoToko.animate()
+ .alpha(1f)
+ .setDuration(300)
+ .setInterpolator(new AccelerateDecelerateInterpolator())
+ .start();
+
+ btnLainnya.setText("Tampilkan Lebih Sedikit");
+ } else {
+ // Hide additional menus with animation
+ cardBantuan.animate()
+ .alpha(0f)
+ .setDuration(300)
+ .setInterpolator(new AccelerateDecelerateInterpolator())
+ .withEndAction(() -> cardBantuan.setVisibility(View.GONE))
+ .start();
+
+ cardInfoToko.animate()
+ .alpha(0f)
+ .setDuration(300)
+ .setInterpolator(new AccelerateDecelerateInterpolator())
+ .withEndAction(() -> cardInfoToko.setVisibility(View.GONE))
+ .start();
+
+ btnLainnya.setText("Lainnya");
+ }
+ });
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3c8fa2d..6e244f8 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,485 +1,568 @@
-
+ android:fillViewport="true"
+ android:overScrollMode="never"
+ android:scrollbars="none"
+ android:background="#FFFFFF">
-
-
+ android:layout_height="match_parent"
+ android:background="#FFFFFF"
+ tools:context=".MainActivity">
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
+ android:layout_margin="16dp"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="4dp"
+ app:layout_constraintTop_toBottomOf="@id/status_bar_background">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:src="@drawable/ic_qr_code"
+ android:tint="@android:color/white"/>
-
+ android:layout_weight="1"
+ android:layout_marginStart="16dp"
+ android:orientation="vertical">
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file