ソースを参照

Added textarea box for notes field

sirekanyan 8 年 前
コミット
04db76f2d2

+ 9 - 0
app/src/main/res/drawable/ic_comment_gray.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#CCCCCC"
+        android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
+</vector>

+ 19 - 0
app/src/main/res/drawable/text_area_background.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_focused="true">
+        <shape>
+            <corners android:radius="4dp"/>
+            <stroke
+                android:width="2dp"
+                android:color="@color/colorAccent"/>
+        </shape>
+    </item>
+    <item>
+        <shape>
+            <corners android:radius="4dp"/>
+            <stroke
+                android:width="1dp"
+                android:color="@color/colorAccent"/>
+        </shape>
+    </item>
+</selector>

+ 22 - 22
app/src/main/res/layout/book_edit.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
@@ -16,7 +17,7 @@
             android:id="@+id/toolbar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            app:title="@string/book_add_title" />
+            app:title="@string/book_add_title"/>
 
     </android.support.design.widget.AppBarLayout>
 
@@ -44,7 +45,7 @@
                     android:layout_height="wrap_content"
                     android:hint="@string/book_hint_title"
                     android:inputType="textCapSentences"
-                    tools:text="Два капитана" />
+                    tools:text="Два капитана"/>
 
             </android.support.design.widget.TextInputLayout>
 
@@ -63,7 +64,7 @@
                     android:layout_height="wrap_content"
                     android:hint="@string/book_hint_author"
                     android:inputType="textCapWords"
-                    tools:text="Вениамин Каверин" />
+                    tools:text="Вениамин Каверин"/>
 
             </android.support.design.widget.TextInputLayout>
 
@@ -79,7 +80,7 @@
                 app:layout_constraintRight_toRightOf="parent"
                 app:layout_constraintTop_toTopOf="@id/book_title_input"
                 tools:background="@color/colorAccent"
-                tools:visibility="visible" />
+                tools:visibility="visible"/>
 
             <android.support.design.widget.TextInputLayout
                 android:id="@+id/bookYearInput"
@@ -99,7 +100,7 @@
                     android:layout_height="wrap_content"
                     android:hint="@string/book_hint_year"
                     android:inputType="number"
-                    tools:text="2012" />
+                    tools:text="2012"/>
 
             </android.support.design.widget.TextInputLayout>
 
@@ -119,7 +120,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/book_hint_month"
-                    android:inputType="number" />
+                    android:inputType="number"/>
 
             </android.support.design.widget.TextInputLayout>
 
@@ -139,7 +140,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/book_hint_day"
-                    android:inputType="number" />
+                    android:inputType="number"/>
 
             </android.support.design.widget.TextInputLayout>
 
@@ -153,24 +154,23 @@
                 android:text="@string/book_read_checkbox"
                 android:textSize="16sp"
                 app:layout_constraintTop_toBottomOf="@id/bookYearInput"
-                tools:checked="true" />
+                tools:checked="true"/>
 
-            <android.support.design.widget.TextInputLayout
-                android:id="@+id/notes_text_input"
+            <android.support.v7.widget.AppCompatEditText
+                android:id="@+id/notesTextArea"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_margin="16dp"
-                app:layout_constraintTop_toBottomOf="@id/readCheckbox">
-
-                <EditText
-                    android:id="@+id/notesTextArea"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:hint="@string/book_hint_notes"
-                    android:inputType="textCapSentences"
-                    tools:text="Неистово плюсую" />
-
-            </android.support.design.widget.TextInputLayout>
+                android:background="@drawable/text_area_background"
+                android:drawableEnd="@drawable/ic_comment_gray"
+                android:drawablePadding="16dp"
+                android:hint="@string/book_hint_notes"
+                android:inputType="textCapSentences|textMultiLine"
+                android:minLines="2"
+                android:padding="16dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintTop_toBottomOf="@id/readCheckbox"
+                tools:text="Неистово плюсую"/>
 
         </android.support.constraint.ConstraintLayout>