diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9a53fa7..f51d844 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,6 +16,9 @@ android:supportsRtl="true" android:theme="@style/Theme.NeatCalendar" tools:targetApi="31"> + diff --git a/app/src/main/java/com/p_vacho/neat_calendar/activities/CategoriesActivity.kt b/app/src/main/java/com/p_vacho/neat_calendar/activities/CategoriesActivity.kt new file mode 100644 index 0000000..b76dce8 --- /dev/null +++ b/app/src/main/java/com/p_vacho/neat_calendar/activities/CategoriesActivity.kt @@ -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 + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/p_vacho/neat_calendar/activities/CreateEventActivity.kt b/app/src/main/java/com/p_vacho/neat_calendar/activities/CreateEventActivity.kt index 737ef03..653fbcb 100644 --- a/app/src/main/java/com/p_vacho/neat_calendar/activities/CreateEventActivity.kt +++ b/app/src/main/java/com/p_vacho/neat_calendar/activities/CreateEventActivity.kt @@ -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() + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_categories.xml b/app/src/main/res/layout/activity_categories.xml new file mode 100644 index 0000000..d01abd6 --- /dev/null +++ b/app/src/main/res/layout/activity_categories.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 631c067..612c4ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -74,4 +74,5 @@ Event Saved: %1$s Choose Event Color Select Time + Manage categories \ No newline at end of file