Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
IBMS
/
nativeview
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
92a44089
authored
Feb 23, 2022
by
huangzhicong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
当清空网址跳转时,清空记录的地址
parent
9072aa05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
app/src/main/java/com/maxrocky/nativeview/fragment/StartFragment.kt
+8
-1
No files found.
app/src/main/java/com/maxrocky/nativeview/fragment/StartFragment.kt
View file @
92a44089
...
@@ -46,15 +46,22 @@ class StartFragment : Fragment() {
...
@@ -46,15 +46,22 @@ class StartFragment : Fragment() {
}
}
button
.
setOnClickListener
{
button
.
setOnClickListener
{
val
storageKey
=
stringPreferencesKey
(
STORAGE_URL
)
val
url
=
urlEditText
.
text
.
trim
().
toString
()
val
url
=
urlEditText
.
text
.
trim
().
toString
()
if
(
url
.
isEmpty
())
{
if
(
url
.
isEmpty
())
{
runBlocking
{
context
?.
dataStore
?.
edit
{
if
(
it
.
contains
(
storageKey
))
{
it
.
remove
(
storageKey
)
}
}
}
findNavController
().
navigate
(
findNavController
().
navigate
(
R
.
id
.
action_startFragment_to_mainFragment
,
R
.
id
.
action_startFragment_to_mainFragment
,
MainFragment
.
createStartBundle
()
MainFragment
.
createStartBundle
()
)
)
return
@setOnClickListener
return
@setOnClickListener
}
}
val
storageKey
=
stringPreferencesKey
(
STORAGE_URL
)
runBlocking
{
runBlocking
{
context
?.
dataStore
?.
edit
{
it
[
storageKey
]
=
url
}
context
?.
dataStore
?.
edit
{
it
[
storageKey
]
=
url
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment