Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_cleaner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
android
android_cleaner
Commits
11202e0a
Commit
11202e0a
authored
Sep 11, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 清理动画
parent
9faec8a2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
234 additions
and
27 deletions
+234
-27
AndroidManifest.xml
cleaner/app/src/main/AndroidManifest.xml
+1
-2
MultiCleanActivity.kt
...ava/com/mints/cleaner/ui/multiClean/MultiCleanActivity.kt
+7
-1
CleanLoadingView.kt
...rc/main/java/com/mints/cleaner/widget/CleanLoadingView.kt
+139
-0
activity_multi_clean.xml
cleaner/app/src/main/res/layout/activity_multi_clean.xml
+39
-24
view_clean_loading.xml
cleaner/app/src/main/res/layout/view_clean_loading.xml
+46
-0
ic_clean_loading.png
cleaner/app/src/main/res/mipmap-xhdpi/ic_clean_loading.png
+0
-0
strings.xml
cleaner/app/src/main/res/values/strings.xml
+2
-0
No files found.
cleaner/app/src/main/AndroidManifest.xml
View file @
11202e0a
...
...
@@ -19,8 +19,7 @@
<activity
android:name=
".ui.albumClean.AlbumCleanActivity"
/>
<activity
android:name=
".ui.multiClean.MultiCleanActivity"
android:launchMode=
"singleTop"
>
android:name=
".ui.multiClean.MultiCleanActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
cleaner/app/src/main/java/com/mints/cleaner/ui/multiClean/MultiCleanActivity.kt
View file @
11202e0a
...
...
@@ -62,6 +62,8 @@ class MultiCleanActivity : BaseVMActivity(), MultiCleanAdapter.OnImageSelectList
)
}
clv_loading
.
showLoading
()
initRecyclerView
()
btn_clean
.
setOnClickListener
{
...
...
@@ -77,7 +79,6 @@ class MultiCleanActivity : BaseVMActivity(), MultiCleanAdapter.OnImageSelectList
multiAdapter
.
cleanSelectImage
()
multiAdapter
.
notifyDataSetChanged
()
}
}
private
fun
initRecyclerView
()
{
...
...
@@ -108,6 +109,11 @@ class MultiCleanActivity : BaseVMActivity(), MultiCleanAdapter.OnImageSelectList
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
clv_loading
.
hideLoading
()
}
override
fun
onImageSelect
(
selectCount
:
Int
)
{
// 改变 删除按钮数据
updateBtnText
(
selectCount
)
...
...
cleaner/app/src/main/java/com/mints/cleaner/widget/CleanLoadingView.kt
0 → 100755
View file @
11202e0a
package
com.mints.cleaner.widget
import
android.animation.AnimatorSet
import
android.animation.ValueAnimator
import
android.annotation.SuppressLint
import
android.content.Context
import
android.util.AttributeSet
import
android.view.LayoutInflater
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.LinearInterpolator
import
android.view.animation.RotateAnimation
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.TextView
import
com.mints.cleaner.R
/**
* 清理界面-加载中
*/
class
CleanLoadingView
:
LinearLayout
{
// 时间单位 1000=1秒
private
val
TIME_INTERVAL
:
Long
=
1000
// 默认展示时间1.5秒
private
val
DEFAULT_LOAD_TIME
:
Long
=
1500
private
var
tvLoadingProgress
:
TextView
?
=
null
private
var
ivLoading
:
ImageView
?
=
null
private
var
set
:
AnimatorSet
?
=
null
private
var
animator
:
ValueAnimator
?
=
null
private
var
circleAnimator
:
Animation
?
=
null
constructor
(
context
:
Context
)
:
super
(
context
)
{
init
()
}
constructor
(
context
:
Context
,
attrs
:
AttributeSet
)
:
super
(
context
,
attrs
)
{
init
()
}
constructor
(
context
:
Context
,
attrs
:
AttributeSet
,
defStyleAttr
:
Int
)
:
super
(
context
,
attrs
,
defStyleAttr
)
{
init
()
}
private
fun
init
()
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
view_clean_loading
,
this
)
tvLoadingProgress
=
view
.
findViewById
(
R
.
id
.
tv_loading_progress
)
ivLoading
=
view
.
findViewById
(
R
.
id
.
iv_loading
)
}
/**
* 显示加载框
*
* 默认1.5秒
*/
fun
showLoading
()
{
start
(
DEFAULT_LOAD_TIME
)
}
/**
* 显示加载框
*
* 指定时间 time - 1s
*/
fun
showLoading
(
time
:
Long
)
{
start
(
time
*
TIME_INTERVAL
)
}
/**
* 隐藏
*/
fun
hideLoading
()
{
this
.
visibility
=
View
.
GONE
if
(
animator
!=
null
)
{
animator
!!
.
cancel
()
animator
!!
.
removeAllListeners
()
animator
=
null
}
if
(
set
!=
null
)
{
set
!!
.
cancel
()
set
=
null
}
if
(
circleAnimator
!=
null
)
{
circleAnimator
!!
.
cancel
()
circleAnimator
=
null
}
}
@SuppressLint
(
"ObjectAnimatorBinding"
)
private
fun
start
(
time
:
Long
)
{
if
(
circleAnimator
==
null
)
{
circleAnimator
=
RotateAnimation
(
0f
,
359f
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
,
Animation
.
RELATIVE_TO_SELF
,
0.5f
)
}
circleAnimator
?.
let
{
it
.
interpolator
=
LinearInterpolator
()
it
.
duration
=
500
it
.
repeatCount
=
-
1
it
.
fillAfter
=
false
ivLoading
?.
startAnimation
(
it
)
}
// 根据传入的time计算1-100的时间进度
if
(
animator
==
null
)
{
animator
=
ValueAnimator
.
ofInt
(
0
,
101
)
}
animator
?.
addUpdateListener
{
valueAnimator
->
tvLoadingProgress
?.
text
=
valueAnimator
.
getAnimatedValue
().
toString
()
+
"%"
// 101目的->防止隐藏时显示进度为99
if
(
valueAnimator
.
getAnimatedValue
()
==
101
)
{
hideLoading
()
}
}
if
(
set
==
null
)
{
set
=
AnimatorSet
()
}
set
?.
let
{
it
.
playTogether
(
animator
)
it
.
duration
=
time
it
.
start
()
}
}
}
\ No newline at end of file
cleaner/app/src/main/res/layout/activity_multi_clean.xml
View file @
11202e0a
...
...
@@ -19,6 +19,15 @@
layout=
"@layout/clean_header_bar"
app:title=
"@{title}"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerview_multi"
android:layout_width=
"match_parent"
...
...
@@ -47,7 +56,13 @@
android:textSize=
"18sp"
/>
</LinearLayout>
</LinearLayout>
<com.mints.cleaner.widget.CleanLoadingView
android:id=
"@+id/clv_loading"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</FrameLayout>
</LinearLayout>
...
...
cleaner/app/src/main/res/layout/view_clean_loading.xml
0 → 100644
View file @
11202e0a
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/theme"
>
<FrameLayout
android:id=
"@+id/fl_loading_root"
android:layout_width=
"200dp"
android:layout_height=
"200dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_loading"
android:layout_width=
"200dp"
android:layout_height=
"200dp"
android:background=
"@mipmap/ic_clean_loading"
>
</ImageView>
<TextView
android:id=
"@+id/tv_loading_progress"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"0%"
android:textColor=
"@color/white"
android:textSize=
"18sp"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"30dp"
android:text=
"@string/empty_text"
android:textColor=
"@color/white"
android:textSize=
"18sp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/fl_loading_root"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
cleaner/app/src/main/res/mipmap-xhdpi/ic_clean_loading.png
0 → 100644
View file @
11202e0a
11 KB
cleaner/app/src/main/res/values/strings.xml
View file @
11202e0a
...
...
@@ -41,4 +41,6 @@
<string
name=
"selector_all_image"
>
全部图片
</string>
<string
name=
"empty_text"
>
正在扫描...
</string>
</resources>
\ No newline at end of file
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