Implement 4_ANDROID_UI: Two-tier Frame Selector UI (RecyclerViews, Adapters, Real-time Overlay) with standardized resources (strings, colors, assets configurations)
This commit is contained in:
@@ -3,99 +3,136 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#121212">
|
||||
android:background="@color/theme_bg_dark">
|
||||
|
||||
<!-- Màn hình xem trước Camera -->
|
||||
<androidx.camera.view.PreviewView
|
||||
android:id="@+id/viewFinder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="3:4"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/controlPanel" />
|
||||
|
||||
<!-- Thanh công cụ trên đầu (Translucent Black Top Bar) -->
|
||||
<!-- ================= 1. TOP BAR CONTROL ================= -->
|
||||
<LinearLayout
|
||||
android:id="@+id/topBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="#80000000"
|
||||
android:background="@color/theme_bar_bg"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<!-- Nút Flash -->
|
||||
<Button
|
||||
android:id="@+id/btnFlash"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:backgroundTint="#2D2D2D"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="⚡ Off"
|
||||
android:backgroundTint="@color/theme_item_card_bg"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/flash_off"
|
||||
android:textSize="12sp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp" />
|
||||
|
||||
<!-- Nút Hẹn giờ -->
|
||||
<Button
|
||||
android:id="@+id/btnTimer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:backgroundTint="#2D2D2D"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="⏱️ Off"
|
||||
android:backgroundTint="@color/theme_item_card_bg"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/timer_off"
|
||||
android:textSize="12sp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp" />
|
||||
|
||||
<!-- Nút Đổi Camera -->
|
||||
<Button
|
||||
android:id="@+id/btnSwitchCamera"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:backgroundTint="#2D2D2D"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="🔄 Front"
|
||||
android:backgroundTint="@color/theme_item_card_bg"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/camera_front"
|
||||
android:textSize="12sp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Số đếm ngược khi hẹn giờ chụp -->
|
||||
<TextView
|
||||
android:id="@+id/txtTimerCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="100sp"
|
||||
android:textStyle="bold"
|
||||
android:shadowColor="#80000000"
|
||||
android:shadowDx="4"
|
||||
android:shadowDy="4"
|
||||
android:shadowRadius="10"
|
||||
android:visibility="gone"
|
||||
android:text="3"
|
||||
app:layout_constraintTop_toTopOf="@id/viewFinder"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewFinder"
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewFinder"
|
||||
app:layout_constraintRight_toRightOf="@id/viewFinder" />
|
||||
<!-- ================= 2. KHUNG FRAME CHÍNH (CAMERA + OVERLAY) ================= -->
|
||||
<FrameLayout
|
||||
android:id="@+id/cameraContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintDimensionRatio="3:4"
|
||||
app:layout_constraintTop_toBottomOf="@id/topBar"
|
||||
app:layout_constraintBottom_toTopOf="@id/timelineContainer">
|
||||
|
||||
<!-- Thanh chọn Zoom ngay trên bảng điều khiển -->
|
||||
<!-- Lớp đáy: Kính ngắm CameraX -->
|
||||
<androidx.camera.view.PreviewView
|
||||
android:id="@+id/viewFinder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- Lớp đè (Overlay): Hiển thị Khung hình PNG do người dùng chọn -->
|
||||
<ImageView
|
||||
android:id="@+id/imgFrameOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitCenter"
|
||||
android:contentDescription="Frame Overlay" />
|
||||
|
||||
<!-- Số đếm ngược khi hẹn giờ chụp -->
|
||||
<TextView
|
||||
android:id="@+id/txtTimerCountdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/theme_white"
|
||||
android:textSize="100sp"
|
||||
android:textStyle="bold"
|
||||
android:shadowColor="@color/theme_panel_dark"
|
||||
android:shadowDx="4"
|
||||
android:shadowDy="4"
|
||||
android:shadowRadius="10"
|
||||
android:visibility="gone"
|
||||
android:text="3" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- ================= 3. TIMELINE DANH SÁCH STACK FRAMES ================= -->
|
||||
<LinearLayout
|
||||
android:id="@+id/zoomBar"
|
||||
android:id="@+id/timelineContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@id/cameraContainer"
|
||||
app:layout_constraintBottom_toTopOf="@id/zoomControls">
|
||||
|
||||
<!-- TẦNG BỔ SUNG: RecyclerView hiển thị các mẫu khung con bên trong Stack -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvSubFrames"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="6dp"
|
||||
android:background="@color/theme_sub_bar_bg"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- TẦNG GỐC: Danh sách các Stack chủ đề lớn -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvFrameStacks"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- ================= 4. CỤM NÚT ĐIỀU KHIỂN ZOOM ================= -->
|
||||
<LinearLayout
|
||||
android:id="@+id/zoomControls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="#80000000"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/theme_sub_bar_bg"
|
||||
android:padding="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/timelineContainer"
|
||||
app:layout_constraintBottom_toTopOf="@id/controlPanel"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent">
|
||||
@@ -105,9 +142,9 @@
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginHorizontal="2dp"
|
||||
android:backgroundTint="#2D2D2D"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="0.5x"
|
||||
android:backgroundTint="@color/theme_item_card_bg"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/zoom_05x"
|
||||
android:textSize="10sp"
|
||||
android:padding="0dp"
|
||||
android:insetTop="0dp"
|
||||
@@ -118,9 +155,9 @@
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginHorizontal="2dp"
|
||||
android:backgroundTint="#FF9800"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="1x"
|
||||
android:backgroundTint="@color/theme_primary"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/zoom_1x"
|
||||
android:textSize="10sp"
|
||||
android:padding="0dp"
|
||||
android:insetTop="0dp"
|
||||
@@ -131,32 +168,32 @@
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginHorizontal="2dp"
|
||||
android:backgroundTint="#2D2D2D"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="3x"
|
||||
android:backgroundTint="@color/theme_item_card_bg"
|
||||
android:textColor="@color/theme_white"
|
||||
android:text="@string/zoom_3x"
|
||||
android:textSize="10sp"
|
||||
android:padding="0dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Bảng điều khiển phía dưới -->
|
||||
<!-- ================= 5. CONTROL PANEL CHỤP ẢNH ================= -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/controlPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:background="#000000"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/theme_panel_dark"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/zoomControls">
|
||||
|
||||
<!-- Nút chụp hình -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnCapture"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_camera"
|
||||
android:contentDescription="Capture Button" />
|
||||
android:background="@drawable/bg_capture_button"
|
||||
android:src="@drawable/ic_camera_white"
|
||||
android:contentDescription="@string/btn_capture_desc" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user