From 87275580697eb5df651a3418c0a490b330faa822 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Thu, 28 Oct 2021 08:28:22 -0400 Subject: [PATCH] More styling --- app/src/main/AndroidManifest.xml | 4 +- .../java/io/heckel/ntfy/ui/AddFragment.kt | 4 +- .../java/io/heckel/ntfy/ui/DetailActivity.kt | 2 +- .../java/io/heckel/ntfy/ui/MainActivity.kt | 6 +- .../io/heckel/ntfy/ui/SubscriptionsAdapter.kt | 2 +- ...agment_add.xml => add_dialog_fragment.xml} | 2 +- app/src/main/res/layout/add_topic_layout.xml | 67 ------------------- ...etail_activity.xml => detail_activity.xml} | 0 .../{activity_main.xml => main_activity.xml} | 0 ...{topic_item.xml => main_fragment_item.xml} | 12 ---- app/src/main/res/menu/menu.xml | 4 +- app/src/main/res/values/strings.xml | 28 ++++---- 12 files changed, 26 insertions(+), 105 deletions(-) rename app/src/main/res/layout/{fragment_add.xml => add_dialog_fragment.xml} (97%) delete mode 100644 app/src/main/res/layout/add_topic_layout.xml rename app/src/main/res/layout/{topic_detail_activity.xml => detail_activity.xml} (100%) rename app/src/main/res/layout/{activity_main.xml => main_activity.xml} (100%) rename app/src/main/res/layout/{topic_item.xml => main_fragment_item.xml} (59%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 11eb72c..958e4cb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,7 +11,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt index 69e0022..5ae9148 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/AddFragment.kt @@ -19,7 +19,7 @@ class AddFragment(private val listener: Listener) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return activity?.let { // Build root view - val view = requireActivity().layoutInflater.inflate(R.layout.fragment_add, null) + val view = requireActivity().layoutInflater.inflate(R.layout.add_dialog_fragment, null) val topicNameText = view.findViewById(R.id.add_dialog_topic_text) as TextInputEditText val baseUrlText = view.findViewById(R.id.add_dialog_base_url_text) as TextInputEditText val useAnotherServerCheckbox = view.findViewById(R.id.add_dialog_use_another_server_checkbox) as CheckBox @@ -72,7 +72,7 @@ class AddFragment(private val listener: Listener) : DialogFragment() { } topicNameText.addTextChangedListener(textWatcher) baseUrlText.addTextChangedListener(textWatcher) - useAnotherServerCheckbox.setOnCheckedChangeListener { buttonView, isChecked -> + useAnotherServerCheckbox.setOnCheckedChangeListener { _, isChecked -> if (isChecked) baseUrlText.visibility = View.VISIBLE else baseUrlText.visibility = View.GONE validateInput() 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 19a9613..c084353 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt @@ -31,7 +31,7 @@ class DetailActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.topic_detail_activity) + setContentView(R.layout.detail_activity) var subscriptionId: Long? = null diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt index 16f5797..26bd4c1 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt @@ -31,7 +31,7 @@ class MainActivity : AppCompatActivity(), AddFragment.Listener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) + setContentView(R.layout.main_activity) // Floating action button ("+") val fab: View = findViewById(R.id.fab) @@ -63,11 +63,11 @@ class MainActivity : AppCompatActivity(), AddFragment.Listener { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.menu_action_source -> { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.menu_source_url)))) + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.main_menu_source_url)))) true } R.id.menu_action_website -> { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.menu_website_url)))) + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.main_menu_website_url)))) true } else -> super.onOptionsItemSelected(item) diff --git a/app/src/main/java/io/heckel/ntfy/ui/SubscriptionsAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/SubscriptionsAdapter.kt index 42ea2b2..4e5680c 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/SubscriptionsAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/SubscriptionsAdapter.kt @@ -51,7 +51,7 @@ class TopicsAdapter(private val onClick: (Subscription) -> Unit) : /* Creates and inflates view and return TopicViewHolder. */ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TopicViewHolder { val view = LayoutInflater.from(parent.context) - .inflate(R.layout.topic_item, parent, false) + .inflate(R.layout.main_fragment_item, parent, false) return TopicViewHolder(view, onClick) } diff --git a/app/src/main/res/layout/fragment_add.xml b/app/src/main/res/layout/add_dialog_fragment.xml similarity index 97% rename from app/src/main/res/layout/fragment_add.xml rename to app/src/main/res/layout/add_dialog_fragment.xml index 4ed6fc8..d37bc9e 100644 --- a/app/src/main/res/layout/fragment_add.xml +++ b/app/src/main/res/layout/add_dialog_fragment.xml @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - - - - -