Loading app/src/main/AndroidManifest.xml +1 −2 Original line number Diff line number Diff line Loading @@ -13,12 +13,11 @@ android:theme="@style/AppTheme"> <activity android:name="io.heckel.ntfy.ui.MainActivity" android:icon="@drawable/ntfy" android:label="@string/main_action_bar_label"> android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="io.heckel.ntfy.ui.DetailActivity" /> </application> </manifest> app/src/main/java/io/heckel/ntfy/data/ConnectionManager.kt +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ class ConnectionManager(private val repository: Repository) { } finally { conn.disconnect() } updateStatus(subscriptionId, Status.CONNECTING) updateStatus(subscriptionId, Status.RECONNECTING) println("Connection terminated: $topicUrl") } Loading app/src/main/java/io/heckel/ntfy/data/Models.kt +1 −1 Original line number Diff line number Diff line package io.heckel.ntfy.data enum class Status { CONNECTED, CONNECTING CONNECTED, CONNECTING, RECONNECTING } data class Subscription( Loading app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt +4 −4 Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ import androidx.fragment.app.DialogFragment import com.google.android.material.textfield.TextInputEditText import io.heckel.ntfy.R class AddFragment(private val listener: Listener) : DialogFragment() { interface Listener { fun onAddClicked(topic: String, baseUrl: String) class AddFragment(private val listener: AddSubscriptionListener) : DialogFragment() { interface AddSubscriptionListener { fun onAddSubscription(topic: String, baseUrl: String) } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { Loading @@ -34,7 +34,7 @@ class AddFragment(private val listener: Listener) : DialogFragment() { } else { getString(R.string.add_dialog_base_url_default) } listener.onAddClicked(topic, baseUrl) listener.onAddSubscription(topic, baseUrl) } .setNegativeButton(R.string.add_dialog_button_cancel) { _, _ -> dialog?.cancel() Loading app/src/main/java/io/heckel/ntfy/ui/DetailActivity.ktdeleted 100644 → 0 +0 −63 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.heckel.ntfy.ui import android.os.Bundle import android.widget.Button import android.widget.TextView import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import io.heckel.ntfy.R import io.heckel.ntfy.data.topicShortUrl class DetailActivity : AppCompatActivity() { private val subscriptionsViewModel by viewModels<SubscriptionsViewModel> { SubscriptionsViewModelFactory() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.detail_activity) var subscriptionId: Long? = null /* Connect variables to UI elements. */ val topicText: TextView = findViewById(R.id.topic_detail_url) val removeButton: Button = findViewById(R.id.remove_button) val bundle: Bundle? = intent.extras if (bundle != null) { subscriptionId = bundle.getLong(SUBSCRIPTION_ID) } // TODO This should probably fail hard if topicId is null /* If currentTopicId is not null, get corresponding topic and set name, image and description */ subscriptionId?.let { val subscription = subscriptionsViewModel.get(it) topicText.text = subscription?.let { s -> topicShortUrl(s) } removeButton.setOnClickListener { if (subscription != null) { subscriptionsViewModel.remove(subscription) } finish() } } } } Loading
app/src/main/AndroidManifest.xml +1 −2 Original line number Diff line number Diff line Loading @@ -13,12 +13,11 @@ android:theme="@style/AppTheme"> <activity android:name="io.heckel.ntfy.ui.MainActivity" android:icon="@drawable/ntfy" android:label="@string/main_action_bar_label"> android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="io.heckel.ntfy.ui.DetailActivity" /> </application> </manifest>
app/src/main/java/io/heckel/ntfy/data/ConnectionManager.kt +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ class ConnectionManager(private val repository: Repository) { } finally { conn.disconnect() } updateStatus(subscriptionId, Status.CONNECTING) updateStatus(subscriptionId, Status.RECONNECTING) println("Connection terminated: $topicUrl") } Loading
app/src/main/java/io/heckel/ntfy/data/Models.kt +1 −1 Original line number Diff line number Diff line package io.heckel.ntfy.data enum class Status { CONNECTED, CONNECTING CONNECTED, CONNECTING, RECONNECTING } data class Subscription( Loading
app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt +4 −4 Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ import androidx.fragment.app.DialogFragment import com.google.android.material.textfield.TextInputEditText import io.heckel.ntfy.R class AddFragment(private val listener: Listener) : DialogFragment() { interface Listener { fun onAddClicked(topic: String, baseUrl: String) class AddFragment(private val listener: AddSubscriptionListener) : DialogFragment() { interface AddSubscriptionListener { fun onAddSubscription(topic: String, baseUrl: String) } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { Loading @@ -34,7 +34,7 @@ class AddFragment(private val listener: Listener) : DialogFragment() { } else { getString(R.string.add_dialog_base_url_default) } listener.onAddClicked(topic, baseUrl) listener.onAddSubscription(topic, baseUrl) } .setNegativeButton(R.string.add_dialog_button_cancel) { _, _ -> dialog?.cancel() Loading
app/src/main/java/io/heckel/ntfy/ui/DetailActivity.ktdeleted 100644 → 0 +0 −63 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.heckel.ntfy.ui import android.os.Bundle import android.widget.Button import android.widget.TextView import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import io.heckel.ntfy.R import io.heckel.ntfy.data.topicShortUrl class DetailActivity : AppCompatActivity() { private val subscriptionsViewModel by viewModels<SubscriptionsViewModel> { SubscriptionsViewModelFactory() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.detail_activity) var subscriptionId: Long? = null /* Connect variables to UI elements. */ val topicText: TextView = findViewById(R.id.topic_detail_url) val removeButton: Button = findViewById(R.id.remove_button) val bundle: Bundle? = intent.extras if (bundle != null) { subscriptionId = bundle.getLong(SUBSCRIPTION_ID) } // TODO This should probably fail hard if topicId is null /* If currentTopicId is not null, get corresponding topic and set name, image and description */ subscriptionId?.let { val subscription = subscriptionsViewModel.get(it) topicText.text = subscription?.let { s -> topicShortUrl(s) } removeButton.setOnClickListener { if (subscription != null) { subscriptionsViewModel.remove(subscription) } finish() } } } }