Loading app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +12 −1 Original line number Diff line number Diff line Loading @@ -189,9 +189,20 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra // Message bar val messageText: TextInputEditText = findViewById(R.id.detail_message_box) val messageSendButton: Button = findViewById(R.id.detail_message_send_button) messageSendButton.setOnClickListener { lifecycleScope.launch(Dispatchers.IO) { api.publish(subscriptionBaseUrl, subscriptionTopic, message = messageText.text.toString()) val message = messageText.text.toString() if (message.isNotEmpty()) { api.publish(subscriptionBaseUrl, subscriptionTopic, message = message) messageText.text?.clear() } else { runOnUiThread { Toast .makeText(this@DetailActivity, getString(R.string.detail_message_bar_empty_message), Toast.LENGTH_LONG) .show() } } } } Loading app/src/main/java/io/heckel/ntfy/ui/ShareActivity.kt +2 −10 Original line number Diff line number Diff line Loading @@ -88,17 +88,9 @@ class ShareActivity : AppCompatActivity() { errorImage = findViewById(R.id.share_error_image) errorImage.visibility = View.GONE val textWatcher = object : TextWatcher { override fun afterTextChanged(s: Editable?) { val textWatcher = AfterChangedTextWatcher { validateInput() } override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { // Nothing } override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { // Nothing } } contentText.addTextChangedListener(textWatcher) topicText.addTextChangedListener(textWatcher) baseUrlText.addTextChangedListener(textWatcher) Loading app/src/main/res/layout/activity_detail.xml +45 −13 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ style="@style/CardViewBackground" android:id="@+id/detail_notification_list_container" android:layout_width="match_parent" android:layout_height="0dp" android:visibility="visible" app:layout_constraintBottom_toTopOf="@id/detail_message_box" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="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"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/detail_notification_list" android:layout_width="match_parent" Loading Loading @@ -72,22 +71,49 @@ android:linksClickable="true" android:autoLink="web"/> </LinearLayout> <LinearLayout <androidx.constraintlayout.widget.ConstraintLayout style="@style/CardViewBackground" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/detail_message_bar" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginStart="3dp" android:layout_marginBottom="3dp" android:layout_marginEnd="3dp"> app:layout_constraintTop_toBottomOf="@+id/detail_notification_list_container"> <com.google.android.material.textfield.TextInputLayout style="@style/MessageInputBox" android:id="@+id/detail_message_box_layout" android:layout_width="0dp" android:layout_height="wrap_content" app:boxCornerRadiusBottomEnd="24dp" app:boxCornerRadiusTopEnd="24dp" app:boxCornerRadiusBottomStart="24dp" app:boxCornerRadiusTopStart="24dp" app:boxStrokeWidthFocused="0dp" app:boxStrokeWidth="0dp" app:boxBackgroundMode="filled" app:hintEnabled="false" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/detail_message_send_button" app:startIconDrawable="@drawable/ic_add_black_24dp" android:layout_marginStart="7dp" android:layout_marginBottom="1dp" android:layout_marginEnd="5dp"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/detail_message_box" android:layout_width="0dp" android:layout_height="48dp" android:hint="Type a message here" android:inputType="text|textNoSuggestions" android:gravity="start|top" android:layout_weight="1"/> android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" android:textColor="#000000" android:padding="3dp" android:textColorLink="#FFFFFF" android:hint="@string/detail_message_bar_hint" /> </com.google.android.material.textfield.TextInputLayout> <com.google.android.material.button.MaterialButton style="@style/Widget.MaterialComponents.Button.Icon" android:id="@+id/detail_message_send_button" Loading @@ -98,8 +124,14 @@ android:insetBottom="0dp" android:insetLeft="0dp" android:insetRight="0dp" app:icon="@drawable/ic_send_white_24dp"/> </LinearLayout> app:icon="@drawable/ic_send_white_24dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toEndOf="@id/detail_message_box_layout" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="7dp" android:layout_marginBottom="2dp" android:layout_marginTop="3dp"/> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ <string name="detail_item_download_info_download_failed_expired">download failed, link expired</string> <string name="detail_item_download_info_download_failed_expires_x">download failed, link expires %1$s</string> <!-- Detail activity: Message bar --> <string name="detail_message_bar_hint">Type a message here</string> <string name="detail_message_bar_empty_message">Type a message first</string> <!-- Detail activity: Action bar --> <string name="detail_menu_notifications_enabled">Notifications on</string> <string name="detail_menu_notifications_disabled_forever">Notifications muted</string> Loading app/src/main/res/values/styles.xml +5 −0 Original line number Diff line number Diff line Loading @@ -30,4 +30,9 @@ <item name="cornerFamily">rounded</item> <item name="cornerSize">5dp</item> </style> <style name="MessageInputBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"> <item name="boxBackgroundColor">@color/white</item> <item name="boxStrokeColor">@color/white</item> </style> </resources> Loading
app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +12 −1 Original line number Diff line number Diff line Loading @@ -189,9 +189,20 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra // Message bar val messageText: TextInputEditText = findViewById(R.id.detail_message_box) val messageSendButton: Button = findViewById(R.id.detail_message_send_button) messageSendButton.setOnClickListener { lifecycleScope.launch(Dispatchers.IO) { api.publish(subscriptionBaseUrl, subscriptionTopic, message = messageText.text.toString()) val message = messageText.text.toString() if (message.isNotEmpty()) { api.publish(subscriptionBaseUrl, subscriptionTopic, message = message) messageText.text?.clear() } else { runOnUiThread { Toast .makeText(this@DetailActivity, getString(R.string.detail_message_bar_empty_message), Toast.LENGTH_LONG) .show() } } } } Loading
app/src/main/java/io/heckel/ntfy/ui/ShareActivity.kt +2 −10 Original line number Diff line number Diff line Loading @@ -88,17 +88,9 @@ class ShareActivity : AppCompatActivity() { errorImage = findViewById(R.id.share_error_image) errorImage.visibility = View.GONE val textWatcher = object : TextWatcher { override fun afterTextChanged(s: Editable?) { val textWatcher = AfterChangedTextWatcher { validateInput() } override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { // Nothing } override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { // Nothing } } contentText.addTextChangedListener(textWatcher) topicText.addTextChangedListener(textWatcher) baseUrlText.addTextChangedListener(textWatcher) Loading
app/src/main/res/layout/activity_detail.xml +45 −13 Original line number Diff line number Diff line Loading @@ -11,8 +11,7 @@ style="@style/CardViewBackground" android:id="@+id/detail_notification_list_container" android:layout_width="match_parent" android:layout_height="0dp" android:visibility="visible" app:layout_constraintBottom_toTopOf="@id/detail_message_box" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="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"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/detail_notification_list" android:layout_width="match_parent" Loading Loading @@ -72,22 +71,49 @@ android:linksClickable="true" android:autoLink="web"/> </LinearLayout> <LinearLayout <androidx.constraintlayout.widget.ConstraintLayout style="@style/CardViewBackground" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/detail_message_bar" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginStart="3dp" android:layout_marginBottom="3dp" android:layout_marginEnd="3dp"> app:layout_constraintTop_toBottomOf="@+id/detail_notification_list_container"> <com.google.android.material.textfield.TextInputLayout style="@style/MessageInputBox" android:id="@+id/detail_message_box_layout" android:layout_width="0dp" android:layout_height="wrap_content" app:boxCornerRadiusBottomEnd="24dp" app:boxCornerRadiusTopEnd="24dp" app:boxCornerRadiusBottomStart="24dp" app:boxCornerRadiusTopStart="24dp" app:boxStrokeWidthFocused="0dp" app:boxStrokeWidth="0dp" app:boxBackgroundMode="filled" app:hintEnabled="false" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/detail_message_send_button" app:startIconDrawable="@drawable/ic_add_black_24dp" android:layout_marginStart="7dp" android:layout_marginBottom="1dp" android:layout_marginEnd="5dp"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/detail_message_box" android:layout_width="0dp" android:layout_height="48dp" android:hint="Type a message here" android:inputType="text|textNoSuggestions" android:gravity="start|top" android:layout_weight="1"/> android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" android:textColor="#000000" android:padding="3dp" android:textColorLink="#FFFFFF" android:hint="@string/detail_message_bar_hint" /> </com.google.android.material.textfield.TextInputLayout> <com.google.android.material.button.MaterialButton style="@style/Widget.MaterialComponents.Button.Icon" android:id="@+id/detail_message_send_button" Loading @@ -98,8 +124,14 @@ android:insetBottom="0dp" android:insetLeft="0dp" android:insetRight="0dp" app:icon="@drawable/ic_send_white_24dp"/> </LinearLayout> app:icon="@drawable/ic_send_white_24dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toEndOf="@id/detail_message_box_layout" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="7dp" android:layout_marginBottom="2dp" android:layout_marginTop="3dp"/> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,10 @@ <string name="detail_item_download_info_download_failed_expired">download failed, link expired</string> <string name="detail_item_download_info_download_failed_expires_x">download failed, link expires %1$s</string> <!-- Detail activity: Message bar --> <string name="detail_message_bar_hint">Type a message here</string> <string name="detail_message_bar_empty_message">Type a message first</string> <!-- Detail activity: Action bar --> <string name="detail_menu_notifications_enabled">Notifications on</string> <string name="detail_menu_notifications_disabled_forever">Notifications muted</string> Loading
app/src/main/res/values/styles.xml +5 −0 Original line number Diff line number Diff line Loading @@ -30,4 +30,9 @@ <item name="cornerFamily">rounded</item> <item name="cornerSize">5dp</item> </style> <style name="MessageInputBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"> <item name="boxBackgroundColor">@color/white</item> <item name="boxStrokeColor">@color/white</item> </style> </resources>