Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Felix Foertsch
Cwa App Android
Commits
25382f8c
Unverified
Commit
25382f8c
authored
3 years ago
by
Mohamed Metwalli
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update DurationPicker.kt (#3190)
Co-authored-by:
Juraj Kusnier
<
jurajkusnier@users.noreply.github.com
>
parent
aaeb4996
No related branches found
Branches containing commit
Tags
v2.1.0-RC5
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/durationpicker/DurationPicker.kt
+9
-13
9 additions, 13 deletions
.../de/rki/coronawarnapp/ui/durationpicker/DurationPicker.kt
with
9 additions
and
13 deletions
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/durationpicker/DurationPicker.kt
+
9
−
13
View file @
25382f8c
package
de.rki.coronawarnapp.ui.durationpicker
package
de.rki.coronawarnapp.ui.durationpicker
import
android.os.Bundle
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
androidx.annotation.IntRange
import
androidx.annotation.IntRange
import
androidx.fragment.app.DialogFragment
import
androidx.fragment.app.DialogFragment
import
de.rki.coronawarnapp.R
import
de.rki.coronawarnapp.databinding.DurationPickerBinding
import
de.rki.coronawarnapp.databinding.DurationPickerBinding
import
de.rki.coronawarnapp.util.ui.viewBindingLazy
import
org.joda.time.Duration
import
org.joda.time.Duration
import
org.joda.time.format.PeriodFormatter
import
org.joda.time.format.PeriodFormatter
import
org.joda.time.format.PeriodFormatterBuilder
import
org.joda.time.format.PeriodFormatterBuilder
import
kotlin.math.max
import
kotlin.math.max
class
DurationPicker
:
DialogFragment
()
{
class
DurationPicker
:
DialogFragment
(
R
.
layout
.
duration_picker
)
{
fun
interface
OnChangeListener
{
fun
interface
OnChangeListener
{
fun
onChange
(
duration
:
Duration
)
fun
onChange
(
duration
:
Duration
)
...
@@ -23,32 +23,28 @@ class DurationPicker : DialogFragment() {
...
@@ -23,32 +23,28 @@ class DurationPicker : DialogFragment() {
private
val
title
by
lazy
{
requireArguments
().
getString
(
TITLE_KEY
).
orEmpty
()
}
private
val
title
by
lazy
{
requireArguments
().
getString
(
TITLE_KEY
).
orEmpty
()
}
private
val
minutesArray
by
lazy
{
requireArguments
().
getStringArray
(
MINUTES_KEY
).
orEmpty
()
}
private
val
minutesArray
by
lazy
{
requireArguments
().
getStringArray
(
MINUTES_KEY
).
orEmpty
()
}
private
val
binding
:
Lazy
<
DurationPickerBinding
>
=
lazy
{
DurationPickerBinding
.
inflate
(
layoutInflater
)
}
private
val
binding
:
DurationPickerBinding
by
viewBindingLazy
()
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
{
return
binding
.
value
.
root
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
super
.
onViewCreated
(
view
,
savedInstanceState
)
with
(
binding
.
value
.
hours
)
{
with
(
binding
.
hours
)
{
minValue
=
0
minValue
=
0
maxValue
=
hoursArray
.
size
-
1
maxValue
=
hoursArray
.
size
-
1
displayedValues
=
hoursArray
displayedValues
=
hoursArray
}
}
with
(
binding
.
value
.
minutes
)
{
with
(
binding
.
minutes
)
{
minValue
=
0
minValue
=
0
maxValue
=
minutesArray
.
size
-
1
maxValue
=
minutesArray
.
size
-
1
displayedValues
=
minutesArray
displayedValues
=
minutesArray
}
}
with
(
binding
.
value
.
title
)
{
with
(
binding
.
title
)
{
text
=
title
text
=
title
}
}
with
(
binding
.
value
)
{
with
(
binding
)
{
var
duration
=
requireArguments
().
getString
(
DURATION_KEY
)
!!
.
split
(
":"
).
toTypedArray
()
var
duration
=
requireArguments
().
getString
(
DURATION_KEY
)
!!
.
split
(
":"
).
toTypedArray
()
if
(
duration
.
size
<
2
)
duration
=
arrayOf
(
"00"
,
"00"
)
if
(
duration
.
size
<
2
)
duration
=
arrayOf
(
"00"
,
"00"
)
...
@@ -68,7 +64,7 @@ class DurationPicker : DialogFragment() {
...
@@ -68,7 +64,7 @@ class DurationPicker : DialogFragment() {
}
}
private
fun
getDuration
():
Duration
{
private
fun
getDuration
():
Duration
{
val
durationString
=
hoursArray
[
binding
.
value
.
hours
.
value
]
+
":"
+
minutesArray
[
binding
.
value
.
minutes
.
value
]
val
durationString
=
hoursArray
[
binding
.
hours
.
value
]
+
":"
+
minutesArray
[
binding
.
minutes
.
value
]
val
formatter
:
PeriodFormatter
=
PeriodFormatterBuilder
()
val
formatter
:
PeriodFormatter
=
PeriodFormatterBuilder
()
.
appendHours
()
.
appendHours
()
.
appendLiteral
(
":"
)
.
appendLiteral
(
":"
)
...
...
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