From 117febe41b42a2b3ed62c5a9fcba2f7e8523ecac Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Mon, 1 Nov 2021 12:12:36 -0400 Subject: [PATCH] Instructions on how to post --- .../java/io/heckel/ntfy/ui/DetailActivity.kt | 16 +- app/src/main/res/layout/detail_activity.xml | 26 +++ app/src/main/res/values/strings.xml | 3 + assets/launcher_full.svg | 181 +++--------------- 4 files changed, 72 insertions(+), 154 deletions(-) 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 37ae573..9e24152 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt @@ -3,10 +3,12 @@ package io.heckel.ntfy.ui import android.app.AlertDialog import android.content.Intent import android.os.Bundle +import android.text.Html import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.View +import android.widget.TextView import android.widget.Toast import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity @@ -41,7 +43,19 @@ class DetailActivity : AppCompatActivity() { // Set title val subscriptionBaseUrl = intent.getStringExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL) ?: return - title = topicShortUrl(subscriptionBaseUrl, subscriptionTopic) + val topicUrl = topicShortUrl(subscriptionBaseUrl, subscriptionTopic) + title = topicUrl + + // Set "how to instructions" + val howToExample: TextView = findViewById(R.id.detail_how_to_example) + howToExample.linksClickable = true + + val howToText = getString(R.string.detail_how_to_example, topicUrl) + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + howToExample.text = Html.fromHtml(howToText, Html.FROM_HTML_MODE_LEGACY) + } else { + howToExample.text = Html.fromHtml(howToText) + } // Update main list based on viewModel (& its datasource/livedata) val noEntriesText: View = findViewById(R.id.detail_no_notifications) diff --git a/app/src/main/res/layout/detail_activity.xml b/app/src/main/res/layout/detail_activity.xml index 477ddda..f2be1a6 100644 --- a/app/src/main/res/layout/detail_activity.xml +++ b/app/src/main/res/layout/detail_activity.xml @@ -36,6 +36,32 @@ android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:padding="10dp" android:gravity="center_horizontal" android:paddingStart="50dp" android:paddingEnd="50dp"/> + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4f226e7..009f7d1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -30,6 +30,9 @@ You haven\'t received any notifications for this topic yet. + To send notifications to this topic, simply PUT or POST to the topic URL. + $ curl -d \"Hi\" %1$s ]]> + For more detailed instructions, check out the ntfy.sh website and documentation. Do you really want to permanently delete this subscription and all its messages? Permanently delete Cancel diff --git a/assets/launcher_full.svg b/assets/launcher_full.svg index d8e5604..0993594 100644 --- a/assets/launcher_full.svg +++ b/assets/launcher_full.svg @@ -34,18 +34,6 @@ offset="1" id="stop28856" /> - - - - @@ -82,26 +70,6 @@ offset="1" id="stop841" /> - - - + gradientTransform="translate(3.1941667,-5.0234847)" /> - - - + + - - + style="display:inline" /> - - - - - - - - - + transform="matrix(1.676594,0,0,1.676594,-47.175732,-81.574619)"> - - - + d="m -29.394586,-30.646711 v 10.93008 h -3.240629 v 75.33081 h 11.515059 v 34.12815 h 85.1023 v -32.27349 h 1.50792 v -60.82832 h -3.2489 v -27.28723 z M -0.146759,-1e-6 h 50.417593 v 50.32974 H -0.146759 v -0.0139 H 22.067389 A 25.220409,25.220409 0 0 1 -0.146759,26.548769 v -2.57866 a 25.220409,25.220409 0 0 1 25.171073,-23.90396 25.220409,25.220409 0 0 1 25.04188,22.2405 V 0.044959 H -0.146759 Z m 50.212953,28.13162 a 25.220409,25.220409 0 0 1 -22.084437,22.18417 h 22.084437 z" />