Archived
Added back buttons on all user-facing fragments that show when compact layout is used
This commit is contained in:
@@ -2,6 +2,7 @@ package com.denizk0461.weserplaner.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
@@ -10,6 +11,7 @@ import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.denizk0461.weserplaner.R
|
||||
import com.denizk0461.weserplaner.databinding.ActivityMainBinding
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
import com.denizk0461.weserplaner.viewmodel.MainViewModel
|
||||
|
||||
/**
|
||||
@@ -51,6 +53,11 @@ class MainActivity : FragmentActivity() {
|
||||
startActivity(Intent(this, IntroductionActivity::class.java))
|
||||
}
|
||||
|
||||
when (viewModel.preferenceAppLayout) {
|
||||
AppLayout.DEFAULT -> {
|
||||
// Ensure that the navigation bar is visible
|
||||
binding.navView.visibility = View.VISIBLE
|
||||
|
||||
// Set up bottom navigation view to navigate between fragments
|
||||
binding.navView.setupWithNavController(
|
||||
binding.navHostFragmentContentMain.getFragment<NavHostFragment>().findNavController()
|
||||
@@ -63,21 +70,30 @@ class MainActivity : FragmentActivity() {
|
||||
binding.navView.menu.findItem(R.id.exam_overview).isVisible = showBetaScreens
|
||||
binding.navView.menu.findItem(R.id.room_finder).isVisible = showBetaScreens
|
||||
|
||||
// Set up navigation component
|
||||
setNavigationGraph()
|
||||
// Set up navigation graph for the default layout
|
||||
(supportFragmentManager
|
||||
.findFragmentById(R.id.nav_host_fragment_content_main) as NavHostFragment)
|
||||
.setupDefaultNavigationGraph()
|
||||
}
|
||||
AppLayout.COMPACT -> {
|
||||
// Hide the navigation bar, as it is unnecessary in the compact layout
|
||||
binding.navView.visibility = View.GONE
|
||||
|
||||
// Set up navigation graph for the compact layout
|
||||
(supportFragmentManager
|
||||
.findFragmentById(R.id.nav_host_fragment_content_main) as NavHostFragment)
|
||||
.setupCompactNavigationGraph()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the navigation graph for the fragments. Also sets the start destination.
|
||||
* Sets the default navigation graph for the fragments. Also sets the start destination, as
|
||||
* specified by the user.
|
||||
*/
|
||||
private fun setNavigationGraph() {
|
||||
// Get nav host
|
||||
val navHostFragment = supportFragmentManager
|
||||
.findFragmentById(R.id.nav_host_fragment_content_main) as NavHostFragment
|
||||
|
||||
private fun NavHostFragment.setupDefaultNavigationGraph() {
|
||||
// Inflate new nav graph
|
||||
val navGraph = navHostFragment
|
||||
.navController.navInflater.inflate(R.navigation.nav_graph_detailed)
|
||||
val navGraph = this.navController.navInflater.inflate(R.navigation.nav_graph_default)
|
||||
|
||||
// Set the starting fragment for the app
|
||||
navGraph.setStartDestination(when (viewModel.preferenceLaunchFragment) {
|
||||
@@ -86,6 +102,17 @@ class MainActivity : FragmentActivity() {
|
||||
})
|
||||
|
||||
// Set the newly defined nav graph
|
||||
navHostFragment.navController.graph = navGraph
|
||||
this.navController.graph = navGraph
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the compact navigation graph for the fragments.
|
||||
*/
|
||||
private fun NavHostFragment.setupCompactNavigationGraph() {
|
||||
// Inflate new nav graph
|
||||
val navGraph = this.navController.navInflater.inflate(R.navigation.nav_graph_compact)
|
||||
|
||||
// Set the newly defined nav graph
|
||||
this.navController.graph = navGraph
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.denizk0461.weserplaner.values.SettingsPreferences
|
||||
import com.denizk0461.weserplaner.values.TaskOrder
|
||||
import com.denizk0461.weserplaner.model.*
|
||||
import com.denizk0461.weserplaner.values.AllergenPreferences
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
|
||||
/**
|
||||
* Repository objects that acts as a mediator between view models and the database to retrieve data
|
||||
@@ -396,12 +397,15 @@ class AppRepository(app: Application) {
|
||||
/**
|
||||
* This value determines which navigation graph will be used for app navigation.
|
||||
*/
|
||||
fun getAppLayout(): Int = getIntPreference(
|
||||
fun getAppLayout(): AppLayout = AppLayout.values()[getIntPreference(
|
||||
SettingsPreferences.APP_LAYOUT,
|
||||
)
|
||||
)]
|
||||
fun setAppLayout(newValue: Int) {
|
||||
setPreference(SettingsPreferences.APP_LAYOUT, newValue)
|
||||
}
|
||||
fun setAppLayout(newValue: AppLayout) {
|
||||
setPreference(SettingsPreferences.APP_LAYOUT, newValue.ordinal)
|
||||
}
|
||||
|
||||
/**
|
||||
* This value determines whether the user opts into submitting crash reports.
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.denizk0461.weserplaner.R
|
||||
import com.denizk0461.weserplaner.adapter.CanteenOfferPageAdapter
|
||||
@@ -19,6 +20,7 @@ import com.denizk0461.weserplaner.data.showSnackBar
|
||||
import com.denizk0461.weserplaner.databinding.FragmentCanteenBinding
|
||||
import com.denizk0461.weserplaner.values.DietaryPreferences
|
||||
import com.denizk0461.weserplaner.model.*
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
import com.denizk0461.weserplaner.values.TextSheetContentId
|
||||
import com.denizk0461.weserplaner.viewmodel.CanteenViewModel
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
@@ -50,6 +52,19 @@ class CanteenFragment : AppFragment<FragmentCanteenBinding>() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Set up back button, if required by the selected layout
|
||||
when (viewModel.preferenceAppLayout) {
|
||||
AppLayout.DEFAULT -> {
|
||||
binding.buttonNavigateBack.visibility = View.GONE
|
||||
}
|
||||
AppLayout.COMPACT -> {
|
||||
binding.buttonNavigateBack.visibility = View.VISIBLE
|
||||
binding.buttonNavigateBack.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_canteen_to_compact_overview)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set progress circle colours
|
||||
binding.swipeRefreshLayout.setRainbowProgressCircle()
|
||||
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
package com.denizk0461.weserplaner.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.denizk0461.weserplaner.R
|
||||
import com.denizk0461.weserplaner.databinding.FragmentCompactOverviewBinding
|
||||
|
||||
class CompactOverviewFragment : AppFragment<FragmentCompactOverviewBinding>() {
|
||||
|
||||
// Instantiate the view binding
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
_binding = FragmentCompactOverviewBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.buttonSettings.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_compact_overview_to_settings)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.denizk0461.weserplaner.R
|
||||
import com.denizk0461.weserplaner.activity.FetcherActivity
|
||||
@@ -14,6 +15,7 @@ import com.denizk0461.weserplaner.adapter.StudIPEventPageAdapter
|
||||
import com.denizk0461.weserplaner.data.showSnackBar
|
||||
import com.denizk0461.weserplaner.databinding.FragmentEventBinding
|
||||
import com.denizk0461.weserplaner.sheet.ScheduleUpdateSheet
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
import com.denizk0461.weserplaner.viewmodel.EventViewModel
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import java.util.*
|
||||
@@ -41,6 +43,19 @@ class EventFragment : AppFragment<FragmentEventBinding>() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Set up back button, if required by the selected layout
|
||||
when (viewModel.preferenceAppLayout) {
|
||||
AppLayout.DEFAULT -> {
|
||||
binding.buttonNavigateBack.visibility = View.GONE
|
||||
}
|
||||
AppLayout.COMPACT -> {
|
||||
binding.buttonNavigateBack.visibility = View.VISIBLE
|
||||
binding.buttonNavigateBack.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_schedule_to_compact_overview)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get localised weekday names
|
||||
weekdays = context.resources?.getStringArray(R.array.weekdays) ?: arrayOf()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.fragment.app.setFragmentResultListener
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.denizk0461.weserplaner.BuildConfig
|
||||
import com.denizk0461.weserplaner.R
|
||||
import com.denizk0461.weserplaner.activity.FetcherActivity
|
||||
@@ -23,6 +24,7 @@ import com.denizk0461.weserplaner.data.showToast
|
||||
import com.denizk0461.weserplaner.databinding.FragmentSettingsBinding
|
||||
import com.denizk0461.weserplaner.model.FormattedDate
|
||||
import com.denizk0461.weserplaner.sheet.AllergenConfigSheet
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
import com.denizk0461.weserplaner.viewmodel.SettingsViewModel
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.*
|
||||
@@ -56,6 +58,19 @@ class SettingsFragment : AppFragment<FragmentSettingsBinding>() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Set up back button, if required by the selected layout
|
||||
when (viewModel.preferenceAppLayout) {
|
||||
AppLayout.DEFAULT -> {
|
||||
binding.buttonNavigateBack.visibility = View.GONE
|
||||
}
|
||||
AppLayout.COMPACT -> {
|
||||
binding.buttonNavigateBack.visibility = View.VISIBLE
|
||||
binding.buttonNavigateBack.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_settings_to_compact_overview)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- schedule settings --- //
|
||||
|
||||
// Launch the Stud.IP schedule fetcher activity
|
||||
@@ -419,6 +434,14 @@ class SettingsFragment : AppFragment<FragmentSettingsBinding>() {
|
||||
viewModel.preferenceFirstLaunch = true
|
||||
showToast(context, "First launch flag cleared")
|
||||
}
|
||||
"LAYDEF" -> {
|
||||
viewModel.preferenceAppLayout = AppLayout.DEFAULT
|
||||
showToast(context, "App will use default layout")
|
||||
}
|
||||
"LAYCOM" -> {
|
||||
viewModel.preferenceAppLayout = AppLayout.COMPACT
|
||||
showToast(context, "App will use compact layout")
|
||||
}
|
||||
else -> showSnackBar(
|
||||
getString(R.string.settings_dev_codes_invalid)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.denizk0461.weserplaner.values
|
||||
|
||||
/**
|
||||
* This enum class represents the different layouts the app has to offer.
|
||||
*/
|
||||
enum class AppLayout {
|
||||
// Default app layout.
|
||||
DEFAULT,
|
||||
|
||||
// More compact app layout that attempts to prioritise relevant information.
|
||||
COMPACT,
|
||||
;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ enum class SettingsPreferences(val key: String) {
|
||||
BETA_SCREENS_ENABLED("beta_screens"),
|
||||
|
||||
/**
|
||||
* The user's app layout preference.
|
||||
* The user's app layout preference. Also see [com.denizk0461.weserplaner.values.AppLayout].
|
||||
*/
|
||||
APP_LAYOUT("app_layout"),
|
||||
;
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.denizk0461.weserplaner.data.StwParser
|
||||
import com.denizk0461.weserplaner.values.DietaryPreferences
|
||||
import com.denizk0461.weserplaner.model.*
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -88,4 +89,10 @@ class CanteenViewModel(app: Application) : AppViewModel(app) {
|
||||
var preferenceHasOpenedCanteen: Boolean
|
||||
get() = repo.getPreferenceHasOpenedCanteen()
|
||||
set(newValue) { repo.setPreferenceHasOpenedCanteen(newValue) }
|
||||
|
||||
/**
|
||||
* Determines which layout the user wants the app to use.
|
||||
*/
|
||||
val preferenceAppLayout: AppLayout
|
||||
get() = repo.getAppLayout()
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.denizk0461.weserplaner.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
|
||||
/**
|
||||
* View model for [com.denizk0461.weserplaner.fragment.EventFragment]
|
||||
@@ -22,4 +23,10 @@ class EventViewModel(app: Application) : AppViewModel(app) {
|
||||
*/
|
||||
val preferenceCurrentDay: Boolean
|
||||
get() = repo.getPreferenceCurrentDay()
|
||||
|
||||
/**
|
||||
* Determines which layout the user wants the app to use.
|
||||
*/
|
||||
val preferenceAppLayout: AppLayout
|
||||
get() = repo.getAppLayout()
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.denizk0461.weserplaner.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
|
||||
/**
|
||||
* View model for [com.denizk0461.weserplaner.activity.MainActivity]
|
||||
@@ -27,4 +28,10 @@ class MainViewModel(application: Application) : AppViewModel(application) {
|
||||
*/
|
||||
val preferenceFirstLaunch: Boolean
|
||||
get() = repo.getPreferenceFirstLaunch()
|
||||
|
||||
/**
|
||||
* Determines which layout the user wants the app to use.
|
||||
*/
|
||||
val preferenceAppLayout: AppLayout
|
||||
get() = repo.getAppLayout()
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.denizk0461.weserplaner.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.denizk0461.weserplaner.values.AppLayout
|
||||
|
||||
/**
|
||||
* View model for [com.denizk0461.weserplaner.fragment.SettingsFragment]
|
||||
@@ -86,7 +87,14 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
*/
|
||||
var preferenceFirstLaunch: Boolean
|
||||
get() = repo.getPreferenceFirstLaunch()
|
||||
set(value) { repo.setPreferenceFirstLaunch(value) }
|
||||
set(newValue) { repo.setPreferenceFirstLaunch(newValue) }
|
||||
|
||||
/**
|
||||
* Determines which layout the user wants the app to use.
|
||||
*/
|
||||
var preferenceAppLayout: AppLayout
|
||||
get() = repo.getAppLayout()
|
||||
set(newValue) { repo.setAppLayout(newValue) }
|
||||
|
||||
// --- functions for dev codes --- //
|
||||
|
||||
|
||||
@@ -21,8 +21,23 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp">
|
||||
android:layout_marginHorizontal="8dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:id="@+id/button_navigate_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
app:icon="@drawable/arrow_back"
|
||||
app:iconPadding="0dp"
|
||||
app:strokeColor="?attr/colorOutlineVariant"
|
||||
app:layout_constraintTop_toTopOf="@id/app_title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:iconTint="?attr/colorOnSurfaceVariant"
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:tooltipText="@string/fragment_button_back_to_overview_hint"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_title_bar"
|
||||
@@ -33,6 +48,7 @@
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:layout_goneMarginStart="8dp"
|
||||
app:fontFamily="@font/lato_blackitalic"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
@@ -42,7 +58,7 @@
|
||||
android:scrollHorizontally="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_navigate_back"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_opening_hours"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
||||
@@ -1,6 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/coordinator_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.EventFragment">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_scrollFlags="scroll">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_title_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="28sp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:fontFamily="@font/lato_blackitalic"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:scrollHorizontally="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_settings"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.Material3.Button.IconButton.Outlined"
|
||||
android:id="@+id/button_settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
app:icon="@drawable/settings"
|
||||
app:iconPadding="0dp"
|
||||
app:strokeColor="?attr/colorOutlineVariant"
|
||||
app:layout_constraintTop_toTopOf="@id/app_title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:iconTint="?attr/colorOnSurfaceVariant"
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:tooltipText="@string/compact_overview_button_settings_hint"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -16,10 +16,25 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
app:layout_scrollFlags="scroll">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:id="@+id/button_navigate_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
app:icon="@drawable/arrow_back"
|
||||
app:iconPadding="0dp"
|
||||
app:strokeColor="?attr/colorOutlineVariant"
|
||||
app:layout_constraintTop_toTopOf="@id/app_title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:iconTint="?attr/colorOnSurfaceVariant"
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:tooltipText="@string/fragment_button_back_to_overview_hint"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_title_bar"
|
||||
android:layout_width="0dp"
|
||||
@@ -29,6 +44,7 @@
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:layout_goneMarginStart="8dp"
|
||||
app:fontFamily="@font/lato_blackitalic"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
@@ -38,7 +54,7 @@
|
||||
android:scrollHorizontally="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_navigate_back"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_view_overview"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
||||
@@ -14,17 +14,45 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_title_bar"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
app:layout_scrollFlags="scroll">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.Material3.Button.IconButton"
|
||||
android:id="@+id/button_navigate_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:minWidth="0dp"
|
||||
app:icon="@drawable/arrow_back"
|
||||
app:iconPadding="0dp"
|
||||
app:strokeColor="?attr/colorOutlineVariant"
|
||||
app:layout_constraintTop_toTopOf="@id/app_title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/app_title_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:iconTint="?attr/colorOnSurfaceVariant"
|
||||
tools:ignore="UnusedAttribute"
|
||||
android:tooltipText="@string/fragment_button_back_to_overview_hint"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_title_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:fontFamily="@font/lato_blackitalic"
|
||||
android:text="@string/title_settings"
|
||||
android:textSize="28sp"
|
||||
app:layout_scrollFlags="scroll"
|
||||
android:textSize="28sp"/>
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_goneMarginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_navigate_back"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nav_graph_compact"
|
||||
app:startDestination="@id/schedule">
|
||||
app:startDestination="@id/compact_overview">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/compact_overview"
|
||||
@@ -26,16 +26,28 @@
|
||||
android:id="@+id/schedule"
|
||||
android:name="com.denizk0461.weserplaner.fragment.EventFragment"
|
||||
android:label="EventFragment"
|
||||
tools:layout="@layout/fragment_event"/>
|
||||
tools:layout="@layout/fragment_event">
|
||||
<action
|
||||
android:id="@+id/action_schedule_to_compact_overview"
|
||||
app:destination="@id/compact_overview" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/canteen"
|
||||
android:name="com.denizk0461.weserplaner.fragment.CanteenFragment"
|
||||
android:label="CanteenFragment"
|
||||
tools:layout="@layout/fragment_canteen"/>
|
||||
tools:layout="@layout/fragment_canteen">
|
||||
<action
|
||||
android:id="@+id/action_canteen_to_compact_overview"
|
||||
app:destination="@id/compact_overview" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/settings"
|
||||
android:name="com.denizk0461.weserplaner.fragment.SettingsFragment"
|
||||
android:label="SettingsFragment"
|
||||
tools:layout="@layout/fragment_settings"/>
|
||||
tools:layout="@layout/fragment_settings">
|
||||
<action
|
||||
android:id="@+id/action_settings_to_compact_overview"
|
||||
app:destination="@id/compact_overview" />
|
||||
</fragment>
|
||||
|
||||
</navigation>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<navigation 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/nav_graph_detailed"
|
||||
android:id="@+id/nav_graph_default"
|
||||
app:startDestination="@id/schedule">
|
||||
|
||||
<fragment
|
||||
@@ -30,6 +30,9 @@
|
||||
<string name="introduction_or">– oder –</string>
|
||||
<string name="introduction_button_continue">Gehe direkt zur App</string>
|
||||
|
||||
<string name="compact_overview_button_settings_hint">App-Einstellungen</string>
|
||||
<string name="fragment_button_back_to_overview_hint">Zurück zur Übersicht</string>
|
||||
|
||||
<string name="fetch_error_snack">Ein Fehler ist aufgetreten!</string>
|
||||
<string name="fetch_error_webpage_snack">Du musst deinen Stundenplan öffnen!</string>
|
||||
<string name="fetch_error_login_snack">Du musst dich zuerst einloggen!</string>
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
<string name="introduction_or">– or –</string>
|
||||
<string name="introduction_button_continue">Continue to the app</string>
|
||||
|
||||
<string name="compact_overview_button_settings_hint">App settings</string>
|
||||
<string name="fragment_button_back_to_overview_hint">Back to overview</string>
|
||||
|
||||
<string name="fetch_error_snack">Something went wrong!</string>
|
||||
<string name="fetch_error_webpage_snack">You must navigate to your schedule!</string>
|
||||
<string name="fetch_error_login_snack">You must log in first!</string>
|
||||
|
||||
Reference in New Issue
Block a user