feat: Add notifications activiy & button (only ui)
This commit is contained in:
parent
dcf6e98427
commit
49ca0f79a2
|
@ -16,6 +16,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.NeatCalendar"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".activities.NotificationsActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
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 NotificationsActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_notification)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import android.widget.ImageButton
|
|||
import androidx.fragment.app.Fragment
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.p_vacho.neat_calendar.R
|
||||
import com.p_vacho.neat_calendar.activities.NotificationsActivity
|
||||
import com.p_vacho.neat_calendar.activities.SettingsActivity
|
||||
|
||||
class MainBarFragment : Fragment() {
|
||||
|
@ -17,21 +18,20 @@ class MainBarFragment : Fragment() {
|
|||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for our new app settings bar
|
||||
return inflater.inflate(R.layout.fragment_main_bar, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Optionally set the center text programmatically if needed
|
||||
val titleText = view.findViewById<MaterialTextView>(R.id.appBarTitle)
|
||||
titleText.text = getString(R.string.app_name) // or "NeatCalendar"
|
||||
|
||||
// Handle settings icon click → open the SettingsActivity
|
||||
val settingsIcon = view.findViewById<ImageButton>(R.id.settingsIcon)
|
||||
settingsIcon.setOnClickListener {
|
||||
val btnSettings = view.findViewById<ImageButton>(R.id.btnSettings)
|
||||
btnSettings.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), SettingsActivity::class.java))
|
||||
}
|
||||
|
||||
val btnNotifications = view.findViewById<ImageButton>(R.id.btnNotifications)
|
||||
btnNotifications.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), NotificationsActivity::class.java))
|
||||
}
|
||||
}
|
||||
}
|
9
app/src/main/res/drawable/ic_notification_bell.xml
Normal file
9
app/src/main/res/drawable/ic_notification_bell.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M160,760v-80h80v-280q0,-83 50,-147.5T420,168v-28q0,-25 17.5,-42.5T480,80q25,0 42.5,17.5T540,140v28q80,20 130,84.5T720,400v280h80v80L160,760ZM480,460ZM480,880q-33,0 -56.5,-23.5T400,800h160q0,33 -23.5,56.5T480,880ZM320,680h320v-280q0,-66 -47,-113t-113,-47q-66,0 -113,47t-47,113v280Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
10
app/src/main/res/layout/activity_notification.xml
Normal file
10
app/src/main/res/layout/activity_notification.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.NotificationsActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -17,21 +17,40 @@
|
|||
android:textSize="20sp"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settingsIcon"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iconsContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<!-- Settings Icon -->
|
||||
<ImageButton
|
||||
android:id="@+id/settingsIcon"
|
||||
<!-- Layout for the icons on the right -->
|
||||
<LinearLayout
|
||||
android:id="@+id/iconsContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/open_app_settings"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:padding="8dp"
|
||||
app:tint="?attr/colorOnPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<!-- Notifications Icon -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnNotifications"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/open_notifications"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_notification_bell"
|
||||
android:padding="8dp"
|
||||
app:tint="?attr/colorOnPrimary" />
|
||||
|
||||
<!-- Settings Icon -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/open_app_settings"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:padding="8dp"
|
||||
app:tint="?attr/colorOnPrimary" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -46,4 +46,5 @@
|
|||
<string name="update_event">Update Event</string>
|
||||
<string name="leave_invited_event">Leave invited event</string>
|
||||
<string name="open_app_settings">Open Settings</string>
|
||||
<string name="open_notifications">Open Notifications</string>
|
||||
</resources>
|
Loading…
Reference in a new issue