Archived
Moved first launch preference out of EventFragment.kt to be moved into the newly created tutorial/introductory screen IntroductionActivity.kt
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
package com.denizk0461.weserplaner.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.denizk0461.weserplaner.databinding.ActivityIntroductionBinding
|
||||||
|
|
||||||
|
class IntroductionActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private lateinit var binding: ActivityIntroductionBinding
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
// Inflate view binding and bind to this activity
|
||||||
|
binding = ActivityIntroductionBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.denizk0461.weserplaner.activity
|
package com.denizk0461.weserplaner.activity
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
@@ -34,6 +35,16 @@ class MainActivity : FragmentActivity() {
|
|||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the user is launching the app for the first time in order to show a
|
||||||
|
* tutorial. This value will be changed to 'false' upon completing the tutorial, thus not
|
||||||
|
* requiring any changes to the value here.
|
||||||
|
*/
|
||||||
|
if (true/*viewModel.preferenceFirstLaunch*/) {
|
||||||
|
// Launch the tutorial activity
|
||||||
|
startActivity(Intent(this, IntroductionActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
// Set up bottom navigation view to navigate between fragments
|
// Set up bottom navigation view to navigate between fragments
|
||||||
binding.navView.setupWithNavController(
|
binding.navView.setupWithNavController(
|
||||||
binding.navHostFragmentContentMain.getFragment<NavHostFragment>().findNavController()
|
binding.navHostFragmentContentMain.getFragment<NavHostFragment>().findNavController()
|
||||||
|
|||||||
@@ -119,12 +119,6 @@ class EventFragment : AppFragment<FragmentEventBinding>() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the user a little message if they're opening the app for the first time
|
|
||||||
if (viewModel.preferenceFirstLaunch) {
|
|
||||||
// Remember that the app has been launched before
|
|
||||||
viewModel.preferenceFirstLaunch = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -410,6 +410,10 @@ class SettingsFragment : AppFragment<FragmentSettingsBinding>() {
|
|||||||
viewModel.nukeEverything()
|
viewModel.nukeEverything()
|
||||||
showToast(context, "Nuked everything")
|
showToast(context, "Nuked everything")
|
||||||
}
|
}
|
||||||
|
"NFIRST" -> { // set first launch preference to true
|
||||||
|
viewModel.preferenceFirstLaunch = true
|
||||||
|
showToast(context, "First launch flag cleared")
|
||||||
|
}
|
||||||
else -> showSnackBar(
|
else -> showSnackBar(
|
||||||
getString(R.string.settings_dev_codes_invalid)
|
getString(R.string.settings_dev_codes_invalid)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,11 +22,4 @@ class EventViewModel(app: Application) : AppViewModel(app) {
|
|||||||
*/
|
*/
|
||||||
val preferenceCurrentDay: Boolean
|
val preferenceCurrentDay: Boolean
|
||||||
get() = repo.getPreferenceCurrentDay()
|
get() = repo.getPreferenceCurrentDay()
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the user is launching the app for the first time.
|
|
||||||
*/
|
|
||||||
var preferenceFirstLaunch: Boolean
|
|
||||||
get() = repo.getPreferenceFirstLaunch()
|
|
||||||
set(value) { repo.setPreferenceFirstLaunch(value) }
|
|
||||||
}
|
}
|
||||||
@@ -21,4 +21,10 @@ class MainViewModel(application: Application) : AppViewModel(application) {
|
|||||||
*/
|
*/
|
||||||
val preferenceBetaScreensEnabled: Boolean
|
val preferenceBetaScreensEnabled: Boolean
|
||||||
get() = repo.getPreferenceBetaScreensEnabled()
|
get() = repo.getPreferenceBetaScreensEnabled()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the user is launching the app for the first time.
|
||||||
|
*/
|
||||||
|
val preferenceFirstLaunch: Boolean
|
||||||
|
get() = repo.getPreferenceFirstLaunch()
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,13 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
|||||||
get() = repo.getPreferenceBetaScreensEnabled()
|
get() = repo.getPreferenceBetaScreensEnabled()
|
||||||
set(newValue) { repo.setPreferenceBetaScreensEnabled(newValue) }
|
set(newValue) { repo.setPreferenceBetaScreensEnabled(newValue) }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the user is launching the app for the first time.
|
||||||
|
*/
|
||||||
|
var preferenceFirstLaunch: Boolean
|
||||||
|
get() = repo.getPreferenceFirstLaunch()
|
||||||
|
set(value) { repo.setPreferenceFirstLaunch(value) }
|
||||||
|
|
||||||
// --- functions for dev codes --- //
|
// --- functions for dev codes --- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user