diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt index 4fc9ec7..64ff127 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt @@ -13,6 +13,7 @@ import android.view.ActionMode import android.view.Menu import android.view.MenuItem import android.view.View +import android.widget.Button import android.widget.TextView import android.widget.Toast import androidx.activity.viewModels @@ -23,6 +24,7 @@ import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.google.android.material.snackbar.Snackbar +import com.google.android.material.textfield.TextInputEditText import io.heckel.ntfy.BuildConfig import io.heckel.ntfy.R import io.heckel.ntfy.app.Application @@ -184,6 +186,15 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra howToExample.text = Html.fromHtml(howToText) } + // 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()) + } + } + // Swipe to refresh mainListContainer = findViewById(R.id.detail_notification_list_container) mainListContainer.setOnRefreshListener { refresh() } diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml index 67a2df3..79a045c 100644 --- a/app/src/main/res/layout/activity_detail.xml +++ b/app/src/main/res/layout/activity_detail.xml @@ -11,8 +11,8 @@ style="@style/CardViewBackground" android:id="@+id/detail_notification_list_container" android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="gone"> + 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"> + app:layout_constraintEnd_toEndOf="parent" android:visibility="gone"> + + + + +