Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Briar Mailbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
Briar Mailbox
Commits
18f07e27
Verified
Commit
18f07e27
authored
2 years ago
by
Sebastian
Browse files
Options
Downloads
Patches
Plain Diff
Rename bundle variable name and value
parent
15000777
No related branches found
No related tags found
1 merge request
!113
Reset UI to initial state with fresh lifecycle
Pipeline
#11663
passed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mailbox-android/src/main/java/org/briarproject/mailbox/android/ui/MainActivity.kt
+5
-7
5 additions, 7 deletions
.../java/org/briarproject/mailbox/android/ui/MainActivity.kt
with
5 additions
and
7 deletions
mailbox-android/src/main/java/org/briarproject/mailbox/android/ui/MainActivity.kt
+
5
−
7
View file @
18f07e27
...
...
@@ -64,7 +64,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
companion
object
{
private
val
LOG
=
getLogger
(
MainActivity
::
class
.
java
)
const
val
BUNDLE_LIFECYCLE_
BEYOND_NOT
_STARTED
=
"LIFECYCLE_
BEYOND_NOT
_STARTED"
const
val
BUNDLE_LIFECYCLE_
HAS
_STARTED
=
"LIFECYCLE_
HAS
_STARTED"
}
private
val
viewModel
:
MailboxViewModel
by
viewModels
()
...
...
@@ -84,8 +84,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
// Check if the app has been restored with a UI from an old lifecycle while the app has been
// restarted with a new process and lifecycle. In that case, go back to the init fragment.
if
(
savedInstanceState
!=
null
)
{
val
hadBeenStartedOnSave
=
savedInstanceState
.
getBoolean
(
BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED
)
val
hadBeenStartedOnSave
=
savedInstanceState
.
getBoolean
(
BUNDLE_LIFECYCLE_HAS_STARTED
)
if
(
viewModel
.
lifecycleState
.
value
==
NOT_STARTED
&&
hadBeenStartedOnSave
)
{
nav
.
navigate
(
actionGlobalInitFragment
())
}
...
...
@@ -144,9 +143,8 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
// in the background and gets restored from the recent app list after wiping and
// stopping has already completed. In this case onSaveInstanceState() has written
// true to the bundle.
val
savedBeyondNotStarted
=
savedInstanceState
.
getBoolean
(
BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED
)
if
(!
hasDb
&&
savedBeyondNotStarted
)
{
val
hadBeenStartedOnSave
=
savedInstanceState
.
getBoolean
(
BUNDLE_LIFECYCLE_HAS_STARTED
)
if
(!
hasDb
&&
hadBeenStartedOnSave
)
{
finish
()
startActivity
(
Intent
(
this
,
WipeCompleteActivity
::
class
.
java
))
return
...
...
@@ -170,7 +168,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
override
fun
onSaveInstanceState
(
outState
:
Bundle
)
{
super
.
onSaveInstanceState
(
outState
)
outState
.
putBoolean
(
BUNDLE_LIFECYCLE_
BEYOND_NOT
_STARTED
,
BUNDLE_LIFECYCLE_
HAS
_STARTED
,
viewModel
.
lifecycleState
.
value
!=
NOT_STARTED
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment