EPForumL/androidApp

View on GitHub
app/src/main/res/layout/fragment_new_question.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/new_question_scrollview"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="16dp">

        <!-- Title -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/ask_a_new_question"
            android:textSize="24sp" />

        <!-- Subject Selection -->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/select_subject_of_new_question" />

        <Spinner
            android:id="@+id/subject_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:entries="@array/subject_options"
            android:minHeight="48dp"
            android:prompt="@string/subject_prompt" />

        <!-- Title Input -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/new_question_title" />

        <EditText
            android:id="@+id/question_title_edittext"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:autofillHints="Question title"
            android:inputType="text"
            android:maxLines="1"
            android:minHeight="48dp"
            android:padding="8dp"
            tools:ignore="LabelFor" />

        <!-- Question Details Input -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/new_question_details" />

        <ImageButton
            android:id="@+id/show_latex_button"
            android:layout_width="50dp"
            android:layout_height="20dp"
            android:layout_marginVertical="4dp"
            android:layout_marginStart="4dp"
            android:scaleType="fitCenter"
            android:padding="4dp"
            android:background="@drawable/round_corner"
            android:layout_gravity="start"
            android:contentDescription="@string/latex_button_description"
            app:srcCompat="@drawable/latex_logo"
            app:tint="@color/textColor" />

        <EditText
            android:id="@+id/question_details_edittext"
            android:layout_width="match_parent"
            android:layout_height="57dp"
            android:autofillHints="Question body"
            android:inputType="textMultiLine"
            android:maxLines="10"
            android:minLines="5"
            tools:ignore="LabelFor" />

        <!-- Anonymous Switch -->

        <Button
            android:id="@+id/play_note_button"
            android:layout_width="257dp"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:background="@drawable/button_bg"
            android:drawableStart="@drawable/ic_microphone"
            android:drawablePadding="8dp"
            android:text="@string/play_voice_note" />


        <Button
            android:id="@+id/voice_note_button"
            android:layout_width="257dp"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:background="@drawable/button_bg"
            android:drawableStart="@drawable/ic_microphone"
            android:drawablePadding="8dp"
            android:text="@string/record_voice_note" />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/post_new_question_anonymously" />

        <Switch
            android:id="@+id/anonymous_switch"
            android:layout_width="100dp"
            android:layout_height="60dp"
            android:padding="8dp"
            tools:ignore="UseSwitchCompatOrMaterialXml" />


        <TextView
            android:id="@+id/textView6"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:text="@string/add_content" />

        <TextView
            android:id="@+id/image_uri"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/no_image_selected_yet" />

        <Button
            android:id="@+id/takeImage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/take_picture" />

        <androidx.camera.view.PreviewView
                android:id="@+id/previewView"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"/>

        <Button
            android:id="@+id/btn_submit"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/submit_new_question"/>

    </LinearLayout>
</ScrollView>