Make compose view scrollable

This commit is contained in:
M66B 2018-10-17 12:07:40 +00:00
parent cda8b197d1
commit 8fec757c7e
2 changed files with 182 additions and 186 deletions

View File

@ -114,7 +114,6 @@ public class FragmentCompose extends FragmentEx {
private Group grpHeader; private Group grpHeader;
private Group grpAddresses; private Group grpAddresses;
private Group grpAttachments; private Group grpAttachments;
private Group grpMessage;
private AdapterAttachment adapter; private AdapterAttachment adapter;
@ -147,7 +146,6 @@ public class FragmentCompose extends FragmentEx {
grpHeader = view.findViewById(R.id.grpHeader); grpHeader = view.findViewById(R.id.grpHeader);
grpAddresses = view.findViewById(R.id.grpAddresses); grpAddresses = view.findViewById(R.id.grpAddresses);
grpAttachments = view.findViewById(R.id.grpAttachments); grpAttachments = view.findViewById(R.id.grpAttachments);
grpMessage = view.findViewById(R.id.grpMessage);
// Wire controls // Wire controls
@ -273,7 +271,8 @@ public class FragmentCompose extends FragmentEx {
grpHeader.setVisibility(View.GONE); grpHeader.setVisibility(View.GONE);
grpAddresses.setVisibility(View.GONE); grpAddresses.setVisibility(View.GONE);
grpAttachments.setVisibility(View.GONE); grpAttachments.setVisibility(View.GONE);
grpMessage.setVisibility(View.GONE); etBody.setVisibility(View.GONE);
bottom_navigation.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE); pbWait.setVisibility(View.VISIBLE);
getActivity().invalidateOptionsMenu(); getActivity().invalidateOptionsMenu();
@ -1043,7 +1042,8 @@ public class FragmentCompose extends FragmentEx {
pbWait.setVisibility(View.GONE); pbWait.setVisibility(View.GONE);
grpHeader.setVisibility(View.VISIBLE); grpHeader.setVisibility(View.VISIBLE);
grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE); grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE);
grpMessage.setVisibility(View.VISIBLE); etBody.setVisibility(View.VISIBLE);
bottom_navigation.setVisibility(View.VISIBLE);
DB db = DB.getInstance(getContext()); DB db = DB.getInstance(getContext());

View File

@ -4,6 +4,17 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner <Spinner
android:id="@+id/spFrom" android:id="@+id/spFrom"
android:layout_width="0dp" android:layout_width="0dp"
@ -17,8 +28,8 @@
android:id="@+id/ivIdentityAdd" android:id="@+id/ivIdentityAdd"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:src="@drawable/baseline_person_add_24" android:src="@drawable/baseline_person_add_24"
app:layout_constraintBottom_toBottomOf="@id/spFrom" app:layout_constraintBottom_toBottomOf="@id/spFrom"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -41,8 +52,8 @@
android:id="@+id/ivToAdd" android:id="@+id/ivToAdd"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:src="@drawable/baseline_person_24" android:src="@drawable/baseline_person_24"
app:layout_constraintBottom_toBottomOf="@id/etTo" app:layout_constraintBottom_toBottomOf="@id/etTo"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -66,8 +77,8 @@
android:id="@+id/ivCcAdd" android:id="@+id/ivCcAdd"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:src="@drawable/baseline_person_24" android:src="@drawable/baseline_person_24"
app:layout_constraintBottom_toBottomOf="@id/etCc" app:layout_constraintBottom_toBottomOf="@id/etCc"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -91,8 +102,8 @@
android:id="@+id/ivBccAdd" android:id="@+id/ivBccAdd"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:src="@drawable/baseline_person_24" android:src="@drawable/baseline_person_24"
app:layout_constraintBottom_toBottomOf="@id/etBcc" app:layout_constraintBottom_toBottomOf="@id/etBcc"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -103,8 +114,8 @@
android:id="@+id/etSubject" android:id="@+id/etSubject"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:hint="@string/title_subject" android:hint="@string/title_subject"
android:inputType="textEmailSubject|textCapSentences|textMultiLine" android:inputType="textEmailSubject|textCapSentences|textMultiLine"
android:singleLine="true" android:singleLine="true"
@ -126,14 +137,12 @@
android:id="@+id/rvAttachment" android:id="@+id/rvAttachment"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:layout_marginEnd="6dp"
android:scrollbarStyle="outsideOverlay" android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical" android:scrollbars="vertical"
app:layout_constrainedHeight="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="90dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" /> app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" />
@ -146,28 +155,39 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rvAttachment" /> app:layout_constraintTop_toBottomOf="@+id/rvAttachment" />
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="6dp"
android:fillViewport="true"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparator">
<EditText <EditText
android:id="@+id/etBody" android:id="@+id/etBody"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:background="@null" android:background="@null"
android:fontFamily="monospace" android:fontFamily="monospace"
android:gravity="top" android:gravity="top"
android:hint="@string/title_body_hint" android:hint="@string/title_body_hint"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:textAppearance="@style/TextAppearance.AppCompat.Small" /> android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparator" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpHeader"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="spFrom,ivIdentityAdd,etTo,ivToAdd,etSubject,vSeparator" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAddresses"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="etCc,ivCcAdd,etBcc,ivBccAdd" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAttachments"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="vSeparatorAttachments,rvAttachment" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
@ -193,28 +213,4 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpHeader"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="spFrom,ivIdentityAdd,etTo,ivToAdd,etSubject,vSeparator" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAddresses"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="etCc,ivCcAdd,etBcc,ivBccAdd" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAttachments"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="vSeparatorAttachments,rvAttachment" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpMessage"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="scroll,bottom_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>