Working resizing and such

This commit is contained in:
Philipp Heckel 2022-11-25 11:40:58 -05:00
parent 1a828e505e
commit c6f414813e
4 changed files with 75 additions and 55 deletions

View file

@ -38,6 +38,7 @@
<activity <activity
android:name=".ui.DetailActivity" android:name=".ui.DetailActivity"
android:parentActivityName=".ui.MainActivity" android:parentActivityName=".ui.MainActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true"> android:exported="true">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"

View file

@ -194,8 +194,16 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
val message = messageText.text.toString() val message = messageText.text.toString()
if (message.isNotEmpty()) { if (message.isNotEmpty()) {
try {
api.publish(subscriptionBaseUrl, subscriptionTopic, message = message) api.publish(subscriptionBaseUrl, subscriptionTopic, message = message)
messageText.text?.clear() messageText.text?.clear()
} catch (e: Exception) {
runOnUiThread {
Toast
.makeText(this@DetailActivity, getString(R.string.detail_test_message_error, e.message), Toast.LENGTH_LONG)
.show()
}
}
} else { } else {
runOnUiThread { runOnUiThread {
Toast Toast

View file

@ -11,7 +11,7 @@
style="@style/CardViewBackground" style="@style/CardViewBackground"
android:id="@+id/detail_notification_list_container" android:id="@+id/detail_notification_list_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:visibility="visible" app:layout_constraintBottom_toTopOf="@id/detail_message_bar" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_height="0dp"> android:visibility="gone" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_height="0dp" app:layout_constraintBottom_toTopOf="@id/detail_message_bar" app:layout_constraintVertical_bias="0.0">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/detail_notification_list" android:id="@+id/detail_notification_list"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -25,13 +25,18 @@
app:layoutManager="LinearLayoutManager"/> app:layoutManager="LinearLayoutManager"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/detail_no_notifications"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:visibility="visible" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@id/detail_message_bar" app:layout_constraintVertical_bias="1.0">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/detail_no_notifications" app:layout_constraintBottom_toBottomOf="parent" android:id="@+id/detail_no_notifications_inner" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:visibility="gone">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_sms_gray_48dp" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_sms_gray_48dp"
@ -71,20 +76,21 @@
android:linksClickable="true" android:linksClickable="true"
android:autoLink="web"/> android:autoLink="web"/>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
style="@style/CardViewBackground" style="@style/CardViewBackground"
android:layout_height="wrap_content" android:layout_height="54dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/detail_message_bar" android:id="@+id/detail_message_bar"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_notification_list_container"> app:layout_constraintVertical_weight="1" app:layout_constraintTop_toBottomOf="@+id/detail_no_notifications" app:layout_constraintVertical_bias="1.0">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/MessageInputBox" style="@style/MessageInputLayout"
android:id="@+id/detail_message_box_layout" android:id="@+id/detail_message_box_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="48dp"
app:boxCornerRadiusBottomEnd="24dp" app:boxCornerRadiusBottomEnd="24dp"
app:boxCornerRadiusTopEnd="24dp" app:boxCornerRadiusTopEnd="24dp"
app:boxCornerRadiusBottomStart="24dp" app:boxCornerRadiusBottomStart="24dp"
@ -97,18 +103,18 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/detail_message_send_button" app:layout_constraintEnd_toStartOf="@id/detail_message_send_button"
app:startIconDrawable="@drawable/ic_add_black_24dp"
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
android:layout_marginBottom="1dp" android:layout_marginBottom="4dp"
android:layout_marginEnd="5dp"> android:layout_marginEnd="5dp" android:layout_marginTop="4dp">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/detail_message_box" android:id="@+id/detail_message_box"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:inputType="text" android:inputType="text"
android:textColor="#000000" android:textColor="#000000"
android:padding="3dp" style="@style/MessageInputText"
android:padding="2dp"
android:textColorLink="#FFFFFF" android:textColorLink="#FFFFFF"
android:hint="@string/detail_message_bar_hint" android:hint="@string/detail_message_bar_hint"
/> />

View file

@ -31,8 +31,13 @@
<item name="cornerSize">5dp</item> <item name="cornerSize">5dp</item>
</style> </style>
<style name="MessageInputBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"> <style name="MessageInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<item name="boxBackgroundColor">@color/white</item> <item name="boxBackgroundColor">@color/white</item>
<item name="boxStrokeColor">@color/white</item> <item name="boxStrokeColor">@color/white</item>
<item name="hintTextColor">@color/black_700b</item>
</style>
<style name="MessageInputText" parent="Widget.AppCompat.EditText">
<item name="android:textSize">18sp</item>
</style> </style>
</resources> </resources>