Skip to content

Instantly share code, notes, and snippets.

@yccheok
Created August 8, 2025 18:25
Show Gist options
  • Save yccheok/973d496914695fc9fd2bf1d2f2fc1548 to your computer and use it in GitHub Desktop.
Save yccheok/973d496914695fc9fd2bf1d2f2fc1548 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:id="@+id/dummy_frame_layout"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0px"
android:layout_height="0px" />
<LinearLayout
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:id="@+id/top_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:paddingBottom="12dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<!-- https://stackoverflow.com/q/56278746/72437 -->
<TextView
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintEnd_toStartOf="@+id/sticky_image_view"
app:layout_constraintRight_toLeftOf="@+id/sticky_image_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constrainedWidth="true"
android:id="@+id/label_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:textColor="?attr/secondaryTextColor"
android:textSize="14sp" />
<ImageView
app:layout_constraintLeft_toRightOf="@+id/label_text_view"
app:layout_constraintStart_toEndOf="@+id/label_text_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/sticky_image_view"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:tint="?attr/greyIconColor" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="horizontal">
<ImageView
android:id="@+id/pin_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:adjustViewBounds="true"
android:scaleType="fitEnd"
android:src="?attr/smallPinIcon" />
<ImageView
android:id="@+id/locked_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:adjustViewBounds="true"
android:scaleType="fitEnd" />
<ImageView
android:id="@+id/reminder_repeat_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:adjustViewBounds="true"
android:scaleType="fitEnd" />
<ImageView
android:id="@+id/reminder_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="4dp"
android:paddingRight="4dp"
android:adjustViewBounds="true"
android:scaleType="fitEnd" />
<TextView
android:id="@+id/date_time_text_view"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/frame_layout"
app:layout_constraintTop_toBottomOf="@+id/top_linear_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@+id/bottom_frame_layout"
android:layout_width="match_parent"
android:layout_height="0dp">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.yocto.wenote.attachment.CollageView
android:id="@+id/collage_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-1dp"
android:layout_marginRight="1dp"
android:layout_marginLeft="1dp"
android:layout_marginBottom="11dp"
app:imageViewClickable="true"
app:margin="1dp" />
<LinearLayout
android:id="@+id/recording_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="16dp" />
<com.yocto.wenote.note.LinedFrameLayout
android:id="@+id/lined_frame_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<!--
It is important to use wrap_content for LinedEditText, to ensure scrolling
will be performed by scroll view, not edit text.
-->
<com.yocto.wenote.note.LinedEditText
android:id="@+id/body_edit_text"
android:gravity="top"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:scrollbars="vertical"
android:textSize="18sp"
android:singleLine="false"
android:lineSpacingMultiplier="1.4"
android:inputType="textMultiLine|textCapSentences"
android:textCursorDrawable="?attr/shorterCursor" />
<!-- https://stackoverflow.com/q/54075706/72437 -->
<TextView
android:breakStrategy="simple"
android:textIsSelectable="true"
android:textColor="@android:color/transparent"
android:visibility="gone"
android:id="@+id/double_tap_to_edit_text_view"
android:gravity="top"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:scrollbars="vertical"
android:textSize="18sp"
android:singleLine="false"
android:lineSpacingMultiplier="1.4" />
</com.yocto.wenote.note.LinedFrameLayout>
</LinearLayout>
</ScrollView>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_gravity="bottom"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/add_attachment_bottom_sheet" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/bottom_frame_layout"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary">
<!-- Use ?attr/appBarLayoutTheme to control the button pressed effect -->
<LinearLayout
android:id="@+id/bottom_linear_layout"
android:divider="?attr/verticalDividerForBottomLinearLayout"
android:dividerPadding="8dp"
android:showDividers="middle"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:theme="?attr/appBarLayoutTheme">
<HorizontalScrollView
android:requiresFadingEdge="horizontal"
android:overScrollMode="ifContentScrolls"
android:scrollbars="none"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="48dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/color_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/colorIcon" />
<ImageButton
android:id="@+id/label_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/labelIcon" />
<ImageButton
android:id="@+id/reminder_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/reminderIcon" />
<ImageButton
android:id="@+id/attachment_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/attachmentIcon" />
<ImageButton
android:id="@+id/undo_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/undoIcon" />
<ImageButton
android:id="@+id/redo_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/redoIcon" />
</LinearLayout>
</HorizontalScrollView>
<ImageButton
android:id="@+id/confirm_image_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/actionBarItemBackground"
android:src="?attr/confirmIcon" />
</LinearLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment