feat: Add (blank) categories activity & logic to enter it
This commit is contained in:
parent
275e65b9be
commit
6781410b87
|
@ -16,6 +16,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.NeatCalendar"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".activities.CategoriesActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activities.NotificationsActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.p_vacho.neat_calendar.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.p_vacho.neat_calendar.R
|
||||
|
||||
class CategoriesActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_categories)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
}
|
||||
}
|
||||
}
|
|
@ -265,6 +265,10 @@ class CreateEventActivity : AppCompatActivity() {
|
|||
.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNeutralButton(getString(R.string.manage_categories)) { dialog, _ ->
|
||||
navigateToCategoriesActivity()
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
builder.create().show()
|
||||
}
|
||||
|
@ -418,4 +422,19 @@ class CreateEventActivity : AppCompatActivity() {
|
|||
categoryViewSwitcher.displayedChild = 0 // Show RecyclerView
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to the Categories Activity, without closing this activity,
|
||||
* hence allowing the user to return back.
|
||||
*/
|
||||
private fun navigateToCategoriesActivity() {
|
||||
val intent = Intent(this, CategoriesActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// Re-fetch categories when returning (most likely from CategoriesActivity)
|
||||
fetchCategories()
|
||||
}
|
||||
}
|
10
app/src/main/res/layout/activity_categories.xml
Normal file
10
app/src/main/res/layout/activity_categories.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activities.CategoriesActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -74,4 +74,5 @@
|
|||
<string name="event_saved">Event Saved: %1$s</string>
|
||||
<string name="choose_event_color">Choose Event Color</string>
|
||||
<string name="select_time">Select Time</string>
|
||||
<string name="manage_categories">Manage categories</string>
|
||||
</resources>
|
Loading…
Reference in a new issue