Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
3898b813
Commit
3898b813
authored
Apr 25, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a default animation duration const variable.
parent
264b6a2e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
45 deletions
+52
-45
LoginOptionsFragment.kt
...id/authentication/loginoptions/ui/LoginOptionsFragment.kt
+52
-45
No files found.
app/src/main/java/chat/rocket/android/authentication/loginoptions/ui/LoginOptionsFragment.kt
View file @
3898b813
...
@@ -34,6 +34,7 @@ import chat.rocket.android.webview.sso.ui.ssoWebViewIntent
...
@@ -34,6 +34,7 @@ import chat.rocket.android.webview.sso.ui.ssoWebViewIntent
import
dagger.android.support.AndroidSupportInjection
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.fragment_authentication_login_options.*
import
kotlinx.android.synthetic.main.fragment_authentication_login_options.*
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
private
const
val
SERVER_NAME
=
"server_name"
private
const
val
SERVER_NAME
=
"server_name"
...
@@ -67,6 +68,8 @@ internal const val REQUEST_CODE_FOR_OAUTH = 1
...
@@ -67,6 +68,8 @@ internal const val REQUEST_CODE_FOR_OAUTH = 1
internal
const
val
REQUEST_CODE_FOR_CAS
=
2
internal
const
val
REQUEST_CODE_FOR_CAS
=
2
internal
const
val
REQUEST_CODE_FOR_SAML
=
3
internal
const
val
REQUEST_CODE_FOR_SAML
=
3
private
const
val
DEFAULT_ANIMATION_DURATION
=
400L
fun
newInstance
(
fun
newInstance
(
serverName
:
String
,
serverName
:
String
,
state
:
String
?
=
null
,
state
:
String
?
=
null
,
...
@@ -395,11 +398,11 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
...
@@ -395,11 +398,11 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
var
isAccountsCollapsed
=
true
var
isAccountsCollapsed
=
true
button_expand_collapse_accounts
.
setOnClickListener
{
button_expand_collapse_accounts
.
setOnClickListener
{
isAccountsCollapsed
=
if
(
isAccountsCollapsed
)
{
isAccountsCollapsed
=
if
(
isAccountsCollapsed
)
{
button_expand_collapse_accounts
.
rotateBy
(
180F
,
400
)
button_expand_collapse_accounts
.
rotateBy
(
180F
,
DEFAULT_ANIMATION_DURATION
)
expandAccountsView
()
expandAccountsView
()
false
false
}
else
{
}
else
{
button_expand_collapse_accounts
.
rotateBy
(
180F
,
400
)
button_expand_collapse_accounts
.
rotateBy
(
180F
,
DEFAULT_ANIMATION_DURATION
)
collapseAccountsView
()
collapseAccountsView
()
true
true
}
}
...
@@ -544,23 +547,25 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
...
@@ -544,23 +547,25 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
accounts_container
.
getChildAt
(
1
).
marginTop
accounts_container
.
getChildAt
(
1
).
marginTop
val
collapsedHeight
=
accounts_container
.
height
val
collapsedHeight
=
accounts_container
.
height
val
expandedHeight
=
collapsedHeight
+
optionHeight
*
buttons
.
size
val
expandedHeight
=
collapsedHeight
+
optionHeight
*
buttons
.
size
val
animation
=
ValueAnimator
.
ofInt
(
collapsedHeight
,
expandedHeight
)
animation
.
addUpdateListener
{
with
(
ValueAnimator
.
ofInt
(
collapsedHeight
,
expandedHeight
))
{
addUpdateListener
{
val
params
=
accounts_container
.
layoutParams
val
params
=
accounts_container
.
layoutParams
params
.
height
=
animation
.
animatedValue
as
Int
params
.
height
=
animatedValue
as
Int
accounts_container
.
layoutParams
=
params
accounts_container
.
layoutParams
=
params
}
}
animation
.
addListener
(
object
:
AnimatorListenerAdapter
()
{
addListener
(
object
:
AnimatorListenerAdapter
()
{
override
fun
onAnimationStart
(
animator
:
Animator
)
{
override
fun
onAnimationStart
(
animator
:
Animator
)
{
buttons
.
forEach
{
buttons
.
forEach
{
it
.
isVisible
=
true
it
.
isVisible
=
true
val
anim
=
AlphaAnimation
(
0.0f
,
1.0f
)
val
anim
=
AlphaAnimation
(
0.0f
,
1.0f
)
anim
.
duration
=
400
anim
.
duration
=
DEFAULT_ANIMATION_DURATION
it
.
startAnimation
(
anim
)
it
.
startAnimation
(
anim
)
}
}
}
}
})
})
animation
.
setDuration
(
400
).
start
()
setDuration
(
DEFAULT_ANIMATION_DURATION
).
start
()
}
}
}
private
fun
collapseAccountsView
()
{
private
fun
collapseAccountsView
()
{
...
@@ -572,20 +577,21 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
...
@@ -572,20 +577,21 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
accounts_container
.
getChildAt
(
1
).
marginTop
accounts_container
.
getChildAt
(
1
).
marginTop
val
expandedHeight
=
accounts_container
.
height
val
expandedHeight
=
accounts_container
.
height
val
collapsedHeight
=
expandedHeight
-
optionHeight
*
buttons
.
size
val
collapsedHeight
=
expandedHeight
-
optionHeight
*
buttons
.
size
val
animation
=
ValueAnimator
.
ofInt
(
expandedHeight
,
collapsedHeight
)
animation
.
addUpdateListener
{
with
(
ValueAnimator
.
ofInt
(
expandedHeight
,
collapsedHeight
))
{
addUpdateListener
{
val
params
=
accounts_container
.
layoutParams
val
params
=
accounts_container
.
layoutParams
params
.
height
=
animation
.
animatedValue
as
Int
params
.
height
=
animatedValue
as
Int
accounts_container
.
layoutParams
=
params
accounts_container
.
layoutParams
=
params
}
}
animation
.
addListener
(
object
:
AnimatorListenerAdapter
()
{
addListener
(
object
:
AnimatorListenerAdapter
()
{
override
fun
onAnimationStart
(
animator
:
Animator
)
{
override
fun
onAnimationStart
(
animator
:
Animator
)
{
buttons
.
forEach
{
buttons
.
forEach
{
val
anim
=
AlphaAnimation
(
1.0f
,
0.0f
)
val
anim
=
AlphaAnimation
(
1.0f
,
0.0f
)
anim
.
duration
=
400
anim
.
duration
=
DEFAULT_ANIMATION_DURATION
anim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
anim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
Timber
.
d
(
"Animation starts: $animation"
)
}
}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
...
@@ -593,13 +599,14 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
...
@@ -593,13 +599,14 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
}
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{
Timber
.
d
(
"Animation repeats: $animation"
)
}
}
})
})
it
.
startAnimation
(
anim
)
it
.
startAnimation
(
anim
)
}
}
}
}
})
})
animation
.
setDuration
(
400
).
start
()
setDuration
(
DEFAULT_ANIMATION_DURATION
).
start
()
}
}
}
}
}
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