Instructions; refine UI

This commit is contained in:
Philipp Heckel 2021-11-02 21:43:31 -04:00
parent cfbac10c5e
commit f3268deeda
5 changed files with 30 additions and 6 deletions

View file

@ -1,9 +1,9 @@
# ntfy Android App
This is the Android app for [ntfy](https://github.com/binwiederhier/ntfy) ([ntfy.sh](https://ntfy.sh)).
**It is very much work in progress. Also: I'm new to Android development, so I'm still learning.**
This is the Android app for [ntfy](https://github.com/binwiederhier/ntfy) ([ntfy.sh](https://ntfy.sh)).
## ...
...
## Current limitations
* The app on the Play store only works with ntfy.sh, not with other hosts, due to the fact that background services in
Android are pretty much impossible to implement.
## License
Made with ❤️ by [Philipp C. Heckel](https://heckel.io), distributed under the [Apache License 2.0](LICENSE).
@ -13,5 +13,6 @@ Thank you to these fantastic resources:
* [Just another Hacker News Android client](https://github.com/manoamaro/another-hacker-news-client) (MIT)
* [Android Room with a View](https://github.com/googlecodelabs/android-room-with-a-view/tree/kotlin) (Apache 2.0)
* [Firebase Messaging Example](https://github.com/firebase/quickstart-android/blob/7147f60451b3eeaaa05fc31208ffb67e2df73c3c/messaging/app/src/main/java/com/google/firebase/quickstart/fcm/kotlin/MyFirebaseMessagingService.kt) (Apache 2.0)
* [Designing a logo with Inkscape](https://www.youtube.com/watch?v=r2Kv61cd2P4)
Thanks to these projects for allowing me to copy-paste a lot.

View file

@ -88,6 +88,8 @@ class MainActivity : AppCompatActivity() {
val subscription = Subscription(id = Random.nextLong(), baseUrl = baseUrl, topic = topic, notifications = 0, lastActive = Date().time/1000)
viewModel.add(subscription)
FirebaseMessaging.getInstance().subscribeToTopic(topic) // FIXME ignores baseUrl
onSubscriptionItemClick(subscription) // Add to detail view after adding it
}
private fun onSubscriptionItemClick(subscription: Subscription) {

View file

@ -10,6 +10,7 @@
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:layout_marginTop="10dp"
android:background="?android:attr/selectableItemBackground"
app:layoutManager="LinearLayoutManager" android:visibility="gone"/>
<LinearLayout
@ -31,6 +32,24 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:padding="10dp" android:gravity="center_horizontal"
android:paddingStart="50dp" android:paddingEnd="50dp"/>
<TextView
android:text="@string/main_how_to_intro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/main_how_to_intro"
android:layout_marginTop="20dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"/>
<TextView
android:text="@string/main_how_to_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/main_how_to_link"
android:layout_marginTop="7dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:linksClickable="true"
android:autoLink="web"/>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton

View file

@ -1,4 +1,4 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/detail_menu_test" android:title="@string/detail_menu_test"/>
<item android:id="@+id/detail_menu_delete" android:title="@string/detail_menu_delete"/>
<item android:id="@+id/detail_menu_delete" android:title="@string/detail_menu_unsubscribe"/>
</menu>

View file

@ -20,6 +20,8 @@
<string name="main_item_status_text_not_one">%1$d notifications received</string>
<string name="main_add_button_description">Add subscription</string>
<string name="main_no_subscriptions_text">It looks like you don\'t have any subscriptions yet.</string>
<string name="main_how_to_intro">Click the button below to create or subscribe to a topic. After that, you can send messages via PUT or POST and you\'ll receive notifications on your phone.</string>
<string name="main_how_to_link">For more detailed instructions, check out the ntfy.sh website and documentation.</string>
<!-- Add dialog -->
<string name="add_dialog_title">Subscribe to topic</string>
@ -41,5 +43,5 @@
<!-- Detail activity: Action bar -->
<string name="detail_menu_test">Send test notification</string>
<string name="detail_menu_delete">Delete topic</string>
<string name="detail_menu_unsubscribe">Unsubscribe</string>
</resources>