fragment_data_learning.xml 7.17 KB
Newer Older
1
<?xml version="1.0" encoding="utf-8"?>
2
<layout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
4
    xmlns:app="http://schemas.android.com/apk/res-auto">
5

6 7 8 9 10 11 12 13
    <data>
        <import type="android.view.View"/>
        <variable
            name="viewModel"
            type="com.wmdigit.setting.viewmodel.DataLearningViewModel" />
    </data>

    <FrameLayout
14 15
        android:layout_width="match_parent"
        android:layout_height="match_parent"
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
        tools:context=".fragment.DataLearningFragment">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/gl_v_46"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.46"/>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="@dimen/dp_0"
                android:layout_height="@dimen/dp_0"
                android:background="@color/black_272E3D"
                android:padding="@dimen/dp_10"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@+id/gl_v_46"
                app:layout_constraintBottom_toTopOf="@+id/keyboard">

                <TextView
                    android:id="@+id/tv_image_desc"
                    style="@style/text_base.content.white"
                    android:text="@string/please_select_correct_goods_for_every_rect"
                    app:layout_constraintStart_toStartOf="@+id/img_preview"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toTopOf="@+id/img_preview"/>
                
                <ImageView
                    android:id="@+id/img_preview"
                    android:layout_width="@dimen/dp_720"
                    android:layout_height="@dimen/dp_540"
                    android:adjustViewBounds="true"
53
                    android:background="@color/black"
54
                    android:layout_marginTop="@dimen/dp_10"
55
                    app:image="@{viewModel.frame}"
56 57 58 59 60 61 62 63 64
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/tv_image_desc"

                    />

                <TextView
                    android:id="@+id/tv_camera_status"
                    style="@style/text_base.content.white"
                    android:text="@string/camera_opening"
65
                    android:visibility="@{viewModel.cameraOpened ? View.INVISIBLE : View.VISIBLE}"
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
                    app:layout_constraintStart_toStartOf="@+id/img_preview"
                    app:layout_constraintTop_toTopOf="@+id/img_preview"
                    app:layout_constraintEnd_toEndOf="@+id/img_preview"
                    app:layout_constraintBottom_toBottomOf="@+id/img_preview"/>

            </androidx.constraintlayout.widget.ConstraintLayout>

            <!--商品列表-->
            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rv_products"
                android:layout_width="@dimen/dp_0"
                android:layout_height="@dimen/dp_0"
                android:layout_margin="@dimen/dp_5"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/gl_v_46"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"/>

            <!--空数据的图-->
            <ImageView
                android:id="@+id/img_empty"
                android:layout_width="@dimen/dp_300"
                android:layout_height="wrap_content"
                android:src="@drawable/img_no_data"
                android:visibility="@{viewModel.totalPage > 0 ? View.INVISIBLE : View.VISIBLE}"
                android:adjustViewBounds="true"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/gl_v_46"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toTopOf="@+id/tv_page"/>

            <!--暂无数据-->
            <TextView
                style="@style/text_base.content"
                android:text="@string/no_data"
                android:visibility="@{viewModel.totalPage > 0 ? View.INVISIBLE : View.VISIBLE}"
                android:textColor="@color/black_333b4b"
                android:textStyle="bold"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/gl_v_46"
                app:layout_constraintBottom_toBottomOf="@+id/img_empty"/>

            <!--键盘-->
            <com.wmdigit.common.view.keyboard.EnglishAndNumberKeyboard
                android:id="@+id/keyboard"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:keywords="@={viewModel.keywords}"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@+id/gl_v_46"/>

            <!--上一页-->
            <Button
                style="@style/button_base.w130"
                android:background="@{viewModel.currentPage > 1 ? @drawable/sel_rect_10_black_gray : @drawable/rect_10_gray}"
                android:text="@string/previous_page"
                android:layout_marginEnd="@dimen/dp_40"
                android:onClick="@{()->viewModel.previousPage()}"
                app:layout_constraintEnd_toStartOf="@+id/tv_page"
                app:layout_constraintBottom_toBottomOf="@+id/tv_page"
                app:layout_constraintTop_toTopOf="@+id/tv_page"
                />

            <!--当前页码-->
            <TextView
                android:id="@+id/tv_page"
                style="@style/text_base.content"
                android:text="@{String.format(@string/page_number, viewModel.currentPage, viewModel.totalPage)}"
                android:layout_marginBottom="@dimen/dp_34"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/gl_v_46"
                app:layout_constraintBottom_toBottomOf="parent"/>

            <!--下一页-->
            <Button
                style="@style/button_base.w130"
                android:text="@string/next_page"
                android:layout_marginStart="@dimen/dp_40"
                android:background="@{viewModel.currentPage &lt; viewModel.totalPage ? @drawable/sel_rect_10_black_gray : @drawable/rect_10_gray}"
                android:onClick="@{()->viewModel.nextPage()}"
                app:layout_constraintStart_toEndOf="@+id/tv_page"
                app:layout_constraintBottom_toBottomOf="@+id/tv_page"
                app:layout_constraintTop_toTopOf="@+id/tv_page"
                />

        </androidx.constraintlayout.widget.ConstraintLayout>
153

154 155
    </FrameLayout>
</layout>