feat: Add (blank) settings activit & bar showing it
This commit is contained in:
parent
86f4e66215
commit
336b15e030
|
@ -16,6 +16,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.NeatCalendar"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activities.CreateEventActivity"
|
||||
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 SettingsActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_settings)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.p_vacho.neat_calendar.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
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.SettingsActivity
|
||||
|
||||
class AppSettingsBarFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for our new app settings bar
|
||||
return inflater.inflate(R.layout.fragment_app_settings_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 {
|
||||
startActivity(Intent(requireContext(), SettingsActivity::class.java))
|
||||
}
|
||||
}
|
||||
}
|
9
app/src/main/res/drawable/ic_settings.xml
Normal file
9
app/src/main/res/drawable/ic_settings.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="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880L370,880ZM440,800h79l14,-106q31,-8 57.5,-23.5T639,633l99,41 39,-68 -86,-65q5,-14 7,-29.5t2,-31.5q0,-16 -2,-31.5t-7,-29.5l86,-65 -39,-68 -99,42q-22,-23 -48.5,-38.5T533,266l-13,-106h-79l-14,106q-31,8 -57.5,23.5T321,327l-99,-41 -39,68 86,64q-5,15 -7,30t-2,32q0,16 2,31t7,30l-86,65 39,68 99,-42q22,23 48.5,38.5T427,694l13,106ZM482,620q58,0 99,-41t41,-99q0,-58 -41,-99t-99,-41q-59,0 -99.5,41T342,480q0,58 40.5,99t99.5,41ZM480,480Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
|
@ -7,6 +7,17 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".activities.CalendarActivity">
|
||||
|
||||
<!-- Include Server Settings Bar -->
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/settingsBarFragment"
|
||||
android:name="com.p_vacho.neat_calendar.fragments.AppSettingsBarFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:layout="@layout/fragment_app_settings_bar" />
|
||||
|
||||
<!-- Previous Month Button -->
|
||||
<ImageButton
|
||||
android:id="@+id/btnPreviousMonth"
|
||||
|
@ -16,7 +27,7 @@
|
|||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_arrow_left"
|
||||
app:tint="?android:attr/textColorPrimary"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/settingsBarFragment"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvMonthYear"
|
||||
android:contentDescription="@string/previous_month" />
|
||||
|
@ -31,7 +42,7 @@
|
|||
android:text=""
|
||||
tools:text="January 2024"
|
||||
android:textAppearance="?attr/textAppearanceHeadline6"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/settingsBarFragment"
|
||||
app:layout_constraintStart_toEndOf="@id/btnPreviousMonth"
|
||||
app:layout_constraintEnd_toStartOf="@id/btnNextMonth" />
|
||||
|
||||
|
@ -44,7 +55,7 @@
|
|||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
app:tint="?android:attr/textColorPrimary"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/settingsBarFragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvMonthYear"
|
||||
android:contentDescription="@string/next_month" />
|
||||
|
|
10
app/src/main/res/layout/activity_settings.xml
Normal file
10
app/src/main/res/layout/activity_settings.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.SettingsActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
37
app/src/main/res/layout/fragment_app_settings_bar.xml
Normal file
37
app/src/main/res/layout/fragment_app_settings_bar.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:padding="8dp">
|
||||
|
||||
<!-- Center Title -->
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/appBarTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settingsIcon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<!-- Settings Icon -->
|
||||
<ImageButton
|
||||
android:id="@+id/settingsIcon"
|
||||
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="@android:color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -45,4 +45,5 @@
|
|||
<string name="add_category">Add category</string>
|
||||
<string name="update_event">Update Event</string>
|
||||
<string name="leave_invited_event">Leave invited event</string>
|
||||
<string name="open_app_settings">Open Settings</string>
|
||||
</resources>
|
Loading…
Reference in a new issue