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
0505771a
Commit
0505771a
authored
Sep 08, 2020
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页布局
parent
08ce734b
Changes
55
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
1439 additions
and
126 deletions
+1439
-126
AndroidManifest.xml
cleaner/app/src/main/AndroidManifest.xml
+4
-4
App.kt
cleaner/app/src/main/java/com/mints/cleaner/App.kt
+31
-20
Constant.kt
cleaner/app/src/main/java/com/mints/cleaner/Constant.kt
+18
-0
InitAppService.kt
...ner/app/src/main/java/com/mints/cleaner/InitAppService.kt
+71
-0
CleanAdapter.kt
...main/java/com/mints/cleaner/adapter/clean/CleanAdapter.kt
+66
-0
CleanMultiItem.kt
...in/java/com/mints/cleaner/adapter/clean/CleanMultiItem.kt
+33
-0
KoinModule.kt
cleaner/app/src/main/java/com/mints/cleaner/di/KoinModule.kt
+4
-0
OkHttpInterceptor.kt
...om/mints/cleaner/model/api/intercept/OkHttpInterceptor.kt
+1
-0
HeaderTitle.kt
...src/main/java/com/mints/cleaner/model/bean/HeaderTitle.kt
+12
-0
Title.kt
...r/app/src/main/java/com/mints/cleaner/model/bean/Title.kt
+3
-0
MainRepository.kt
...java/com/mints/cleaner/model/repository/MainRepository.kt
+7
-0
MainFragment.kt
...er/app/src/main/java/com/mints/cleaner/ui/MainFragment.kt
+1
-7
HomeFragment.kt
...p/src/main/java/com/mints/cleaner/ui/home/HomeFragment.kt
+103
-8
MainActivity.kt
...p/src/main/java/com/mints/cleaner/ui/main/MainActivity.kt
+27
-0
MainViewModel.kt
.../src/main/java/com/mints/cleaner/ui/main/MainViewModel.kt
+9
-0
MyFragment.kt
...r/app/src/main/java/com/mints/cleaner/ui/my/MyFragment.kt
+0
-26
SplashActivity.kt
...c/main/java/com/mints/cleaner/ui/splash/SplashActivity.kt
+1
-1
MiscUtil.java
...er/app/src/main/java/com/mints/cleaner/util/MiscUtil.java
+83
-0
SystemUtils.kt
...r/app/src/main/java/com/mints/cleaner/util/SystemUtils.kt
+33
-0
AutoHeightGv.kt
...pp/src/main/java/com/mints/cleaner/widget/AutoHeightGv.kt
+21
-0
CircleProgress.java
...rc/main/java/com/mints/cleaner/widget/CircleProgress.java
+414
-0
btn_circle.xml
cleaner/app/src/main/res/drawable/btn_circle.xml
+5
-0
activity_login.xml
cleaner/app/src/main/res/layout/activity_login.xml
+3
-5
activity_main.xml
cleaner/app/src/main/res/layout/activity_main.xml
+19
-0
activity_splash.xml
cleaner/app/src/main/res/layout/activity_splash.xml
+3
-4
fragment_clean.xml
cleaner/app/src/main/res/layout/fragment_clean.xml
+36
-0
fragment_home.xml
cleaner/app/src/main/res/layout/fragment_home.xml
+0
-16
fragment_my.xml
cleaner/app/src/main/res/layout/fragment_my.xml
+0
-16
header_bar.xml
cleaner/app/src/main/res/layout/header_bar.xml
+51
-0
home_footer.xml
cleaner/app/src/main/res/layout/home_footer.xml
+9
-0
item_clean_bottom.xml
cleaner/app/src/main/res/layout/item_clean_bottom.xml
+51
-0
item_clean_mid.xml
cleaner/app/src/main/res/layout/item_clean_mid.xml
+19
-0
item_clean_top.xml
cleaner/app/src/main/res/layout/item_clean_top.xml
+91
-0
item_gv_clean.xml
cleaner/app/src/main/res/layout/item_gv_clean.xml
+21
-0
title_bar.xml
cleaner/app/src/main/res/layout/title_bar.xml
+71
-0
title_layout.xml
cleaner/app/src/main/res/layout/title_layout.xml
+31
-0
bottom_nav_menu.xml
cleaner/app/src/main/res/menu/bottom_nav_menu.xml
+1
-7
ic_launcher.xml
cleaner/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+0
-5
ic_launcher_round.xml
.../app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+0
-5
ic_launcher.png
cleaner/app/src/main/res/mipmap-hdpi/ic_launcher.png
+0
-0
ic_launcher_round.png
cleaner/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
+0
-0
ic_launcher.png
cleaner/app/src/main/res/mipmap-mdpi/ic_launcher.png
+0
-0
ic_launcher_round.png
cleaner/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
+0
-0
ic_activity_arrow.png
cleaner/app/src/main/res/mipmap-xhdpi/ic_activity_arrow.png
+0
-0
ic_left_arrow.png
cleaner/app/src/main/res/mipmap-xhdpi/ic_left_arrow.png
+0
-0
ic_activity_arrow.png
cleaner/app/src/main/res/mipmap-xxhdpi/ic_activity_arrow.png
+0
-0
ic_launcher.png
cleaner/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+0
-0
ic_launcher_round.png
...ner/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
+0
-0
attrs.xml
cleaner/app/src/main/res/values/attrs.xml
+32
-0
colors.xml
cleaner/app/src/main/res/values/colors.xml
+14
-1
strings.xml
cleaner/app/src/main/res/values/strings.xml
+15
-0
styles.xml
cleaner/app/src/main/res/values/styles.xml
+12
-0
BaseAppCompatActivity.kt
...rc/main/java/com/mints/core/base/BaseAppCompatActivity.kt
+0
-1
BaseVMFragment.kt
.../core/src/main/java/com/mints/core/base/BaseVMFragment.kt
+2
-0
BindingToolbar.kt
...re/src/main/java/com/mints/core/binding/BindingToolbar.kt
+11
-0
No files found.
cleaner/app/src/main/AndroidManifest.xml
View file @
0505771a
...
@@ -3,15 +3,15 @@
...
@@ -3,15 +3,15 @@
package=
"com.mints.cleaner"
>
package=
"com.mints.cleaner"
>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
<application
android:name=
".App"
android:name=
".App"
android:allowBackup=
"true"
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:networkSecurityConfig=
"@xml/network_security_config"
android:networkSecurityConfig=
"@xml/network_security_config"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
android:name=
"android.max_aspect"
android:name=
"android.max_aspect"
android:value=
"2.4"
/>
android:value=
"2.4"
/>
<activity
android:name=
".ui.login.LoginActivity"
/>
<activity
android:name=
".ui.login.LoginActivity"
/>
<activity
android:name=
".ui.SplashActivity"
/>
<activity
android:name=
".ui.
splash.
SplashActivity"
/>
<activity
android:name=
".ui.NavigationActivity"
>
<activity
android:name=
".ui.NavigationActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
cleaner/app/src/main/java/com/mints/cleaner/App.kt
View file @
0505771a
...
@@ -3,11 +3,11 @@ package com.mints.cleaner
...
@@ -3,11 +3,11 @@ package com.mints.cleaner
import
android.app.Application
import
android.app.Application
import
android.content.Context
import
android.content.Context
import
com.mints.cleaner.di.appModule
import
com.mints.cleaner.di.appModule
import
com.mints.cleaner.util.SystemUtils
import
com.mints.cleaner.util.lifecycle.LifeManager
import
com.mints.cleaner.util.lifecycle.LifeManager
import
com.orhanobut.logger.AndroidLogAdapter
import
com.mints.core.design_width
import
com.orhanobut.logger.FormatStrategy
import
com.mints.core.util.RudenessScreenHelperKt
import
com.orhanobut.logger.Logger
import
com.mints.core.util.SmartBarUtils
import
com.orhanobut.logger.PrettyFormatStrategy
import
org.koin.android.ext.koin.androidContext
import
org.koin.android.ext.koin.androidContext
import
org.koin.core.context.startKoin
import
org.koin.core.context.startKoin
import
kotlin.properties.Delegates
import
kotlin.properties.Delegates
...
@@ -22,23 +22,37 @@ class App : Application() {
...
@@ -22,23 +22,37 @@ class App : Application() {
super
.
onCreate
()
super
.
onCreate
()
CONTEXT
=
applicationContext
CONTEXT
=
applicationContext
initThridConfig
()
// 初始化koin model
initStartKoin
()
// 生命周期
LifeManager
().
install
(
this
)
initThirdConfig
()
}
}
/**
/**
* 加载第三方配置
* 加载第三方配置
*/
*/
private
fun
initTh
ri
dConfig
()
{
private
fun
initTh
ir
dConfig
()
{
// 初始化koin model
// 屏幕适配
initStartKoin
()
initRudenessScreen
()
// 自定义logger
initLogger
()
// 生命周期
// 生命周期
LifeManager
().
install
(
this
)
LifeManager
().
install
(
this
)
// 子线程初始化三方SDK
val
processName
=
SystemUtils
.
getProcessName
(
this
,
android
.
os
.
Process
.
myPid
())
if
(
processName
!=
null
)
{
// 判断onCreate方法执行是否在当前应用的application上
val
defaultProcess
:
Boolean
=
processName
==
"com.mints.cleaner"
if
(
defaultProcess
)
{
InitAppService
.
start
(
this
)
//初始化数据
}
}
}
}
/**
/**
...
@@ -52,15 +66,12 @@ class App : Application() {
...
@@ -52,15 +66,12 @@ class App : Application() {
}
}
/**
/**
*
自定义logger
*
机型适配
*/
*/
private
fun
initLogger
()
{
private
fun
initRudenessScreen
()
{
val
formatStrategy
:
FormatStrategy
=
PrettyFormatStrategy
.
newBuilder
()
val
hasSmartBar
:
Boolean
=
SmartBarUtils
.
hasSmartBar
(
this
)
.
showThreadInfo
(
false
)
//是否选择显示线程信息,默认为true
design_width
=
if
(
hasSmartBar
)
800F
else
750F
.
methodCount
(
0
)
//方法数显示多少行,默认2行
RudenessScreenHelperKt
(
this
,
design_width
).
activate
()
.
methodOffset
(
7
)
//隐藏方法内部调用到偏移量,默认5
.
tag
(
"mints---network"
)
//自定义TAG全部标签,默认PRETTY_LOGGER
.
build
()
Logger
.
addLogAdapter
(
AndroidLogAdapter
(
formatStrategy
))
}
}
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/Constant.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner
object
Constant
{
// 圆形进度配置
const
val
ANTI_ALIAS
=
true
const
val
DEFAULT_SIZE
=
150
const
val
DEFAULT_START_ANGLE
=
270
const
val
DEFAULT_SWEEP_ANGLE
=
360
const
val
DEFAULT_ANIM_TIME
=
1000
const
val
DEFAULT_MAX_VALUE
=
100
const
val
DEFAULT_VALUE
=
50
const
val
DEFAULT_HINT_SIZE
=
15
const
val
DEFAULT_UNIT_SIZE
=
30
const
val
DEFAULT_VALUE_SIZE
=
15
const
val
DEFAULT_ARC_WIDTH
=
15
const
val
DEFAULT_WAVE_HEIGHT
=
40
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/InitAppService.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner
import
android.app.IntentService
import
android.content.Context
import
android.content.Intent
import
android.util.Log
import
com.orhanobut.logger.AndroidLogAdapter
import
com.orhanobut.logger.FormatStrategy
import
com.orhanobut.logger.Logger
import
com.orhanobut.logger.PrettyFormatStrategy
class
InitAppService
:
IntentService
(
"InitializeService"
)
{
companion
object
{
const
val
ACTION_INIT
=
"initApplication"
const
val
TAG
=
"InitAppService"
var
IS_DEBUG
=
BuildConfig
.
LOG_DEBUG
/**
* 开启intentService
*/
fun
start
(
context
:
Context
)
{
val
intent
=
Intent
(
context
,
InitAppService
::
class
.
java
)
intent
.
action
=
ACTION_INIT
context
.
startService
(
intent
)
}
}
var
isInit
:
Boolean
=
false
override
fun
onHandleIntent
(
intent
:
Intent
?)
{
if
(
isInit
)
return
intent
?.
let
{
val
action
=
intent
.
action
if
(
ACTION_INIT
==
action
)
{
Log
.
d
(
TAG
,
"onHandleIntent"
)
initApplication
()
isInit
=
false
}
}
}
/**
* 子线程进行初始化SDK操作
*/
private
fun
initApplication
()
{
// 自定义logger
initLogger
()
}
/**
* 自定义logger
*/
private
fun
initLogger
()
{
if
(
IS_DEBUG
)
{
val
formatStrategy
:
FormatStrategy
=
PrettyFormatStrategy
.
newBuilder
()
.
showThreadInfo
(
false
)
//是否选择显示线程信息,默认为true
.
methodCount
(
0
)
//方法数显示多少行,默认2行
.
methodOffset
(
7
)
//隐藏方法内部调用到偏移量,默认5
.
tag
(
"mints---network"
)
//自定义TAG全部标签,默认PRETTY_LOGGER
.
build
()
Logger
.
addLogAdapter
(
AndroidLogAdapter
(
formatStrategy
))
}
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/adapter/clean/CleanAdapter.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.adapter.clean
import
android.widget.GridView
import
android.widget.SimpleAdapter
import
com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import
com.chad.library.adapter.base.BaseViewHolder
import
com.mints.cleaner.R
class
CleanAdapter
:
BaseMultiItemQuickAdapter
<
CleanMultiItem
,
BaseViewHolder
>
{
private
val
names
=
arrayOf
(
"手机加速"
,
"微信清理"
,
"QQ清理"
,
"软件管理"
,
"相册清理"
,
"视频清理"
)
constructor
(
data
:
List
<
CleanMultiItem
>)
:
super
(
data
)
{
addItemType
(
CleanMultiItem
.
ITEM_TOP
,
R
.
layout
.
item_clean_top
)
addItemType
(
CleanMultiItem
.
ITEM_MID
,
R
.
layout
.
item_clean_mid
)
addItemType
(
CleanMultiItem
.
ITEM_BOTTOM
,
R
.
layout
.
item_clean_bottom
)
}
override
fun
convert
(
helper
:
BaseViewHolder
,
item
:
CleanMultiItem
?)
{
when
(
helper
.
itemViewType
)
{
CleanMultiItem
.
ITEM_TOP
->
{
helper
.
addOnClickListener
(
R
.
id
.
btn_clean
)
}
CleanMultiItem
.
ITEM_MID
->
{
val
listitem
:
MutableList
<
Map
<
String
,
Any
>>
=
ArrayList
()
for
(
i
in
names
.
indices
)
{
val
item
:
MutableMap
<
String
,
Any
>
=
HashMap
()
item
[
"item_gv_text"
]
=
names
[
i
]
listitem
.
add
(
item
)
}
val
gridView
=
helper
.
getView
<
GridView
>(
R
.
id
.
gv_clean
)
val
simpleAdapter
=
SimpleAdapter
(
gridView
.
context
,
listitem
,
R
.
layout
.
item_gv_clean
,
arrayOf
(
"item_gv_text"
),
intArrayOf
(
R
.
id
.
item_gv_text
)
)
gridView
.
adapter
=
simpleAdapter
gridView
.
setOnItemClickListener
{
_
,
_
,
position
,
_
->
onGridViewItemClickListener
?.
let
{
it
.
onGridViewItemClick
(
position
)
}
}
}
CleanMultiItem
.
ITEM_BOTTOM
->
{
}
}
}
private
var
onGridViewItemClickListener
:
OnGridViewItemClickListener
?
=
null
fun
setOnGridViewItemClickListener
(
listener
:
OnGridViewItemClickListener
?)
{
onGridViewItemClickListener
=
listener
}
interface
OnGridViewItemClickListener
{
fun
onGridViewItemClick
(
position
:
Int
)
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/adapter/clean/CleanMultiItem.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.adapter.clean
import
com.chad.library.adapter.base.entity.MultiItemEntity
class
CleanMultiItem
:
MultiItemEntity
{
private
var
itemType
:
Int
=
0
private
var
itemIndex
:
Int
=
0
constructor
(
itemType
:
Int
)
{
this
.
itemType
=
itemType
}
constructor
(
itemType
:
Int
,
itemIndex
:
Int
)
{
this
.
itemType
=
itemType
this
.
itemIndex
=
itemIndex
}
companion
object
{
// 头布局
const
val
ITEM_TOP
=
0
x00000001
// 中间布局
const
val
ITEM_MID
=
0
x00000002
// 尾布局
const
val
ITEM_BOTTOM
=
0
x00000003
}
override
fun
getItemType
():
Int
{
return
itemType
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/di/KoinModule.kt
View file @
0505771a
...
@@ -3,7 +3,9 @@ package com.mints.cleaner.di
...
@@ -3,7 +3,9 @@ package com.mints.cleaner.di
import
com.mints.cleaner.model.api.ApiService
import
com.mints.cleaner.model.api.ApiService
import
com.mints.cleaner.model.api.client.RetrofitClient
import
com.mints.cleaner.model.api.client.RetrofitClient
import
com.mints.cleaner.model.repository.LoginRepository
import
com.mints.cleaner.model.repository.LoginRepository
import
com.mints.cleaner.model.repository.MainRepository
import
com.mints.cleaner.ui.login.LoginViewModel
import
com.mints.cleaner.ui.login.LoginViewModel
import
com.mints.cleaner.ui.main.MainViewModel
import
org.koin.androidx.viewmodel.dsl.viewModel
import
org.koin.androidx.viewmodel.dsl.viewModel
import
org.koin.dsl.module
import
org.koin.dsl.module
...
@@ -11,12 +13,14 @@ import org.koin.dsl.module
...
@@ -11,12 +13,14 @@ import org.koin.dsl.module
val
viewModelModule
=
module
{
val
viewModelModule
=
module
{
viewModel
{
LoginViewModel
(
get
())
}
viewModel
{
LoginViewModel
(
get
())
}
viewModel
{
MainViewModel
(
get
())
}
}
}
val
repositoryModule
=
module
{
val
repositoryModule
=
module
{
single
{
RetrofitClient
.
getService
(
single
{
RetrofitClient
.
getService
(
ApiService
::
class
.
java
)
}
ApiService
::
class
.
java
)
}
single
{
LoginRepository
(
get
())
}
single
{
LoginRepository
(
get
())
}
single
{
MainRepository
(
get
())
}
}
}
val
appModule
=
listOf
(
viewModelModule
,
repositoryModule
)
val
appModule
=
listOf
(
viewModelModule
,
repositoryModule
)
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/model/api/intercept/OkHttpInterceptor.kt
View file @
0505771a
...
@@ -22,6 +22,7 @@ import java.nio.charset.Charset
...
@@ -22,6 +22,7 @@ import java.nio.charset.Charset
class
OkHttpInterceptor
(
aesKey
:
String
)
:
Interceptor
{
class
OkHttpInterceptor
(
aesKey
:
String
)
:
Interceptor
{
private
var
aesKey
=
""
private
var
aesKey
=
""
init
{
init
{
this
.
aesKey
=
aesKey
this
.
aesKey
=
aesKey
}
}
...
...
cleaner/app/src/main/java/com/mints/cleaner/model/bean/HeaderTitle.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.model.bean
data class
HeaderTitle
(
// 标题内容
val
title
:
Int
,
// 返回箭头是否显示
val
backArrowVisible
:
Int
,
// 右边图标
val
rightIcon
:
Int
,
// 背景颜色
val
background
:
Int
)
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/model/bean/Title.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.model.bean
class
Title
(
val
title
:
Int
,
val
icon
:
Int
,
val
action
:
()
->
Unit
)
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/model/repository/MainRepository.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.model.repository
import
com.mints.cleaner.model.api.ApiService
import
com.mints.cleaner.model.api.client.BaseRepository
class
MainRepository
(
val
service
:
ApiService
)
:
BaseRepository
()
{
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/ui/MainFragment.kt
View file @
0505771a
...
@@ -5,7 +5,6 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
...
@@ -5,7 +5,6 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.mints.cleaner.R
import
com.mints.cleaner.R
import
com.mints.cleaner.ui.home.HomeFragment
import
com.mints.cleaner.ui.home.HomeFragment
import
com.mints.cleaner.ui.my.MyFragment
import
com.mints.cleaner.ui.news.NewsFragment
import
com.mints.cleaner.ui.news.NewsFragment
import
com.mints.core.base.BaseFragment
import
com.mints.core.base.BaseFragment
import
kotlinx.android.synthetic.main.activity_bottom_navigation.*
import
kotlinx.android.synthetic.main.activity_bottom_navigation.*
...
@@ -13,18 +12,16 @@ import kotlinx.android.synthetic.main.activity_bottom_navigation.*
...
@@ -13,18 +12,16 @@ import kotlinx.android.synthetic.main.activity_bottom_navigation.*
/**
/**
* 这是首页 Tab
* 这是首页 Tab
*/
*/
class
MainFragment
:
BaseFragment
()
{
class
MainFragment
:
BaseFragment
()
{
private
val
fragmentList
=
arrayListOf
<
Fragment
>()
private
val
fragmentList
=
arrayListOf
<
Fragment
>()
private
val
homeFragment
by
lazy
{
HomeFragment
()
}
//首页
private
val
homeFragment
by
lazy
{
HomeFragment
()
}
//首页
private
val
newsFragment
by
lazy
{
NewsFragment
()
}
//新闻
private
val
newsFragment
by
lazy
{
NewsFragment
()
}
//新闻
private
val
myFragment
by
lazy
{
MyFragment
()
}
//我的
init
{
init
{
fragmentList
.
run
{
fragmentList
.
run
{
add
(
homeFragment
)
add
(
homeFragment
)
add
(
newsFragment
)
add
(
newsFragment
)
add
(
myFragment
)
}
}
}
}
...
@@ -46,9 +43,6 @@ class MainFragment: BaseFragment() {
...
@@ -46,9 +43,6 @@ class MainFragment: BaseFragment() {
R
.
id
.
wifi
->
{
R
.
id
.
wifi
->
{
switchFragment
(
1
)
switchFragment
(
1
)
}
}
R
.
id
.
my
->
{
switchFragment
(
2
)
}
}
}
true
true
}
}
...
...
cleaner/app/src/main/java/com/mints/cleaner/ui/home/HomeFragment.kt
View file @
0505771a
package
com.mints.cleaner.ui.home
package
com.mints.cleaner.ui.home
import
android.graphics.Color
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.Toast
import
com.mints.cleaner.R
import
com.mints.cleaner.R
import
com.mints.cleaner.util.LogUtil
import
com.mints.cleaner.adapter.clean.CleanAdapter
import
com.mints.core.base.BaseFragment
import
com.mints.cleaner.adapter.clean.CleanMultiItem
import
com.mints.cleaner.databinding.FragmentCleanBinding
import
com.mints.cleaner.model.bean.HeaderTitle
import
com.mints.cleaner.ui.main.MainViewModel
import
com.mints.core.base.BaseVMFragment
import
com.mints.ktx.ext.toast
import
org.koin.androidx.viewmodel.ext.android.viewModel
/**
/**
* 主页面
* 主页面
*/
*/
class
HomeFragment
:
BaseFragment
()
{
class
HomeFragment
:
BaseVMFragment
<
FragmentCleanBinding
>(
R
.
layout
.
fragment_clean
)
{
override
fun
getLayoutResId
()=
R
.
layout
.
fragment_home
private
val
mainViewModel
by
viewModel
<
MainViewModel
>()
private
val
cleanAdapter
by
lazy
{
CleanAdapter
(
multiItemList
)
}
private
val
multiItemList
=
arrayListOf
(
CleanMultiItem
(
CleanMultiItem
.
ITEM_TOP
),
CleanMultiItem
(
CleanMultiItem
.
ITEM_MID
),
CleanMultiItem
(
CleanMultiItem
.
ITEM_BOTTOM
,
0
),
CleanMultiItem
(
CleanMultiItem
.
ITEM_BOTTOM
,
1
),
CleanMultiItem
(
CleanMultiItem
.
ITEM_BOTTOM
,
2
),
CleanMultiItem
(
CleanMultiItem
.
ITEM_BOTTOM
,
3
)
)
override
fun
initView
()
{
override
fun
initView
()
{
LogUtil
.
e
(
"HomeFragment"
,
"initView"
)
binding
.
run
{
viewModel
=
mainViewModel
adapter
=
cleanAdapter
title
=
HeaderTitle
(
R
.
string
.
app_name
,
View
.
GONE
,
R
.
mipmap
.
ic_activity_arrow
,
R
.
color
.
theme
)
}
initRecyclerView
()
}
private
fun
initRecyclerView
()
{
cleanAdapter
.
run
{
addFooterView
(
LayoutInflater
.
from
(
activity
).
inflate
(
R
.
layout
.
home_footer
,
null
))
// 一键清理
setOnItemChildClickListener
{
adapter
,
view
,
position
->
// 一键清理
activity
?.
let
{
toast
(
it
,
"一键清理"
,
Toast
.
LENGTH_SHORT
)
}
}
// 竖向功能点击事件
setOnItemClickListener
{
_
,
_
,
position
->
when
(
position
)
{
2
->
{
// 文件清理
activity
?.
let
{
toast
(
it
,
"文件清理"
,
Toast
.
LENGTH_SHORT
)
}
}
3
->
{
// 音乐清理
activity
?.
let
{
toast
(
it
,
"音乐清理"
,
Toast
.
LENGTH_SHORT
)
}
}
4
->
{
// 安装包清理
activity
?.
let
{
toast
(
it
,
"安装包清理"
,
Toast
.
LENGTH_SHORT
)
}
}
5
->
{
// 压缩包清理
activity
?.
let
{
toast
(
it
,
"压缩包清理"
,
Toast
.
LENGTH_SHORT
)
}
}
}
}
// 网格布局功能点击事件
setOnGridViewItemClickListener
(
object
:
CleanAdapter
.
OnGridViewItemClickListener
{
override
fun
onGridViewItemClick
(
position
:
Int
)
{
when
(
position
)
{
0
->
{
activity
?.
let
{
toast
(
it
,
"0"
,
Toast
.
LENGTH_SHORT
)
}
}
1
->
{
activity
?.
let
{
toast
(
it
,
"1"
,
Toast
.
LENGTH_SHORT
)
}
}
2
->
{
activity
?.
let
{
toast
(
it
,
"2"
,
Toast
.
LENGTH_SHORT
)
}
}
3
->
{
activity
?.
let
{
toast
(
it
,
"3"
,
Toast
.
LENGTH_SHORT
)
}
}
4
->
{
activity
?.
let
{
toast
(
it
,
"4"
,
Toast
.
LENGTH_SHORT
)
}
}
5
->
{
activity
?.
let
{
toast
(
it
,
"5"
,
Toast
.
LENGTH_SHORT
)
}
}
}
}
})
}
}
}
override
fun
initData
()
{
override
fun
initData
()
{
}
}
override
fun
onResume
()
{
override
fun
startObserve
()
{
super
.
onResume
()
LogUtil
.
e
(
"HomeFragment"
,
"onResume"
)
}
}
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/ui/main/MainActivity.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.ui.main
import
com.mints.cleaner.R
import
com.mints.cleaner.databinding.ActivityMainBinding
import
com.mints.core.base.BaseVMActivity
import
org.koin.androidx.viewmodel.ext.android.viewModel
class
MainActivity
:
BaseVMActivity
()
{
private
val
mainViewModel
by
viewModel
<
MainViewModel
>()
private
val
binding
by
binding
<
ActivityMainBinding
>(
R
.
layout
.
activity_main
)
override
fun
initView
()
{
binding
.
run
{
viewModel
=
mainViewModel
}
}
override
fun
initData
()
{
}
override
fun
startObserve
()
{
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/ui/main/MainViewModel.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.ui.main
import
com.mints.cleaner.model.repository.MainRepository
import
com.mints.core.base.BaseViewModel
class
MainViewModel
(
val
repository
:
MainRepository
)
:
BaseViewModel
()
{
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/ui/my/MyFragment.kt
deleted
100644 → 0
View file @
08ce734b
package
com.mints.cleaner.ui.my
import
com.mints.cleaner.R
import
com.mints.cleaner.util.LogUtil
import
com.mints.core.base.BaseFragment
/**
* 我的页面
*/
class
MyFragment
:
BaseFragment
(){
override
fun
getLayoutResId
()=
R
.
layout
.
fragment_my
override
fun
initView
()
{
LogUtil
.
e
(
"MyFragment"
,
"initView"
)
}
override
fun
initData
()
{
}
override
fun
onResume
()
{
super
.
onResume
()
LogUtil
.
e
(
"MyFragment"
,
"onResume"
)
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/ui/SplashActivity.kt
→
cleaner/app/src/main/java/com/mints/cleaner/ui/
splash/
SplashActivity.kt
View file @
0505771a
package
com.mints.cleaner.ui
package
com.mints.cleaner.ui
.splash
import
com.mints.cleaner.R
import
com.mints.cleaner.R
import
com.mints.core.base.BaseActivity
import
com.mints.core.base.BaseActivity
...
...
cleaner/app/src/main/java/com/mints/cleaner/util/MiscUtil.java
0 → 100755
View file @
0505771a
package
com
.
mints
.
cleaner
.
util
;
import
android.content.Context
;
import
android.graphics.Paint
;
import
android.view.View
;
/**
* Created by littlejie on 2017/2/22.
*/
public
class
MiscUtil
{
/**
* 测量 View
*
* @param measureSpec
* @param defaultSize View 的默认大小
* @return
*/
public
static
int
measure
(
int
measureSpec
,
int
defaultSize
)
{
int
result
=
defaultSize
;
int
specMode
=
View
.
MeasureSpec
.
getMode
(
measureSpec
);
int
specSize
=
View
.
MeasureSpec
.
getSize
(
measureSpec
);
if
(
specMode
==
View
.
MeasureSpec
.
EXACTLY
)
{
result
=
specSize
;
}
else
if
(
specMode
==
View
.
MeasureSpec
.
AT_MOST
)
{
result
=
Math
.
min
(
result
,
specSize
);
}
return
result
;
}
/**
* dip 转换成px
*
* @param dip
* @return
*/
public
static
int
dipToPx
(
Context
context
,
float
dip
)
{
float
density
=
context
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dip
*
density
+
0.5f
*
(
dip
>=
0
?
1
:
-
1
));
}
/**
* 获取数值精度格式化字符串
*
* @param precision
* @return
*/
public
static
String
getPrecisionFormat
(
int
precision
)
{
return
"%."
+
precision
+
"f"
;
}
/**
* 反转数组
*
* @param arrays
* @param <T>
* @return
*/
public
static
<
T
>
T
[]
reverse
(
T
[]
arrays
)
{
if
(
arrays
==
null
)
{
return
null
;
}
int
length
=
arrays
.
length
;
for
(
int
i
=
0
;
i
<
length
/
2
;
i
++)
{
T
t
=
arrays
[
i
];
arrays
[
i
]
=
arrays
[
length
-
i
-
1
];
arrays
[
length
-
i
-
1
]
=
t
;
}
return
arrays
;
}
/**
* 测量文字高度
* @param paint
* @return
*/
public
static
float
measureTextHeight
(
Paint
paint
)
{
Paint
.
FontMetrics
fontMetrics
=
paint
.
getFontMetrics
();
return
(
Math
.
abs
(
fontMetrics
.
ascent
)
-
fontMetrics
.
descent
);
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/util/SystemUtils.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.util
import
android.app.ActivityManager
import
android.content.Context
object
SystemUtils
{
/**
* 该方法必须在Activity或Service类内调用,一般情况下,可以在Activity的onCreate()方法中调用。
* 由于应用每启动一个新的进程,就会调用一次Application的onCreate()方法,而个推SDK是一个独立的进程
* ,因此如果在Application的onCreate()中调用intialize接口,会导致SDK初始化在一个应用中多次调用,
* 所以不建议在Application继承类中调用个推SDK初始化接口。
* 解释一下,每个[Android](http://lib.csdn.net/base/android "Android知识库")应用都要运行在一个虚拟机上,
* ”个推“采用Service和后台服务器通信进行通信,于是和原本的Activity就形成了多进程。
* 一个前台的应用进程,一个service后台进程,每个进程对应一个application对象,所以当应用配置了多个进程的时候,
* application对象的onCreate方法就会执行多次,所以为了保证只初始化一次,
* 就必须做出区分的处理的(“个推”中提到的在Activity或Service中初始,这种做法个人认为也是存在多次初始化的风险的);
* 进程名是通过Manifest.xml中的"android:process"属性设置的,因此可以在application的onCreate方法中通过pid获取processName,
* 再做进一步的判断(跟android:process的值进行判断)使得相关初始化代码仅执行一次。
*/
fun
getProcessName
(
cxt
:
Context
,
pid
:
Int
):
String
?
{
val
am
:
ActivityManager
=
cxt
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
val
runningApps
:
List
<
ActivityManager
.
RunningAppProcessInfo
>
=
am
.
runningAppProcesses
?:
return
null
for
(
procInfo
in
runningApps
)
{
if
(
procInfo
.
pid
===
pid
)
{
return
procInfo
.
processName
}
}
return
null
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/widget/AutoHeightGv.kt
0 → 100644
View file @
0505771a
package
com.mints.cleaner.widget
import
android.content.Context
import
android.util.AttributeSet
import
android.widget.GridView
class
AutoHeightGv
:
GridView
{
constructor
(
context
:
Context
,
attrs
:
AttributeSet
,
defStyle
:
Int
)
:
super
(
context
,
attrs
,
defStyle
)
constructor
(
context
:
Context
,
attrs
:
AttributeSet
)
:
super
(
context
,
attrs
)
constructor
(
context
:
Context
):
super
(
context
)
override
fun
onMeasure
(
widthMeasureSpec
:
Int
,
heightMeasureSpec
:
Int
)
{
val
expandSpec
=
MeasureSpec
.
makeMeasureSpec
(
Int
.
MAX_VALUE
shr
2
,
MeasureSpec
.
AT_MOST
)
super
.
onMeasure
(
widthMeasureSpec
,
expandSpec
)
}
}
\ No newline at end of file
cleaner/app/src/main/java/com/mints/cleaner/widget/CircleProgress.java
0 → 100755
View file @
0505771a
package
com
.
mints
.
cleaner
.
widget
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.Point
;
import
android.graphics.RectF
;
import
android.graphics.SweepGradient
;
import
android.text.TextPaint
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.core.content.ContextCompat
;
import
com.mints.cleaner.Constant
;
import
com.mints.cleaner.R
;
import
com.mints.cleaner.util.MiscUtil
;
/**
* 圆形进度条
*/
public
class
CircleProgress
extends
View
{
private
static
final
String
TAG
=
CircleProgress
.
class
.
getSimpleName
();
private
Context
mContext
;
//默认大小
private
int
mDefaultSize
;
//是否开启抗锯齿
private
boolean
antiAlias
;
//绘制提示
private
TextPaint
mHintPaint
;
private
CharSequence
mHint
;
private
int
mHintColor
;
private
float
mHintSize
;
private
float
mHintOffset
;
//绘制单位
private
TextPaint
mUnitPaint
;
private
CharSequence
mUnit
;
private
int
mUnitColor
;
private
float
mUnitSize
;
private
float
mUnitOffset
;
//绘制数值
private
TextPaint
mValuePaint
;
private
float
mValue
;
private
float
mMaxValue
;
private
float
mValueOffset
;
private
int
mPrecision
;
private
String
mPrecisionFormat
;
private
int
mValueColor
;
private
float
mValueSize
;
//绘制圆弧
private
Paint
mArcPaint
;
private
float
mArcWidth
;
private
float
mStartAngle
,
mSweepAngle
;
private
RectF
mRectF
;
//渐变的颜色是360度,如果只显示270,那么则会缺失部分颜色
private
SweepGradient
mSweepGradient
;
// private int[] mGradientColors = {Color.GREEN, Color.GREEN, Color.GREEN};
private
int
[]
mGradientColors
=
{};
//当前进度,[0.0f,1.0f]
private
float
mPercent
;
//动画时间
private
long
mAnimTime
;
//属性动画
private
ValueAnimator
mAnimator
;
//绘制背景圆弧
private
Paint
mBgArcPaint
;
private
int
mBgArcColor
;
private
float
mBgArcWidth
;
//圆心坐标,半径
private
Point
mCenterPoint
;
private
float
mRadius
;
private
float
mTextOffsetPercentInRadius
;
public
CircleProgress
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
init
(
context
,
attrs
);
}
private
void
init
(
Context
context
,
AttributeSet
attrs
)
{
mContext
=
context
;
mDefaultSize
=
MiscUtil
.
dipToPx
(
mContext
,
150
);
mAnimator
=
new
ValueAnimator
();
mRectF
=
new
RectF
();
mCenterPoint
=
new
Point
();
initAttrs
(
attrs
);
initPaint
();
setValue
(
mValue
);
}
private
void
initAttrs
(
AttributeSet
attrs
)
{
TypedArray
typedArray
=
mContext
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
CircleProgressBar
);
antiAlias
=
typedArray
.
getBoolean
(
R
.
styleable
.
CircleProgressBar_antiAlias
,
Constant
.
ANTI_ALIAS
);
mHint
=
typedArray
.
getString
(
R
.
styleable
.
CircleProgressBar_hint
);
mHintColor
=
typedArray
.
getColor
(
R
.
styleable
.
CircleProgressBar_hintColor
,
Color
.
BLACK
);
mHintSize
=
typedArray
.
getDimension
(
R
.
styleable
.
CircleProgressBar_hintSize
,
Constant
.
DEFAULT_HINT_SIZE
);
mValue
=
typedArray
.
getFloat
(
R
.
styleable
.
CircleProgressBar_value
,
Constant
.
DEFAULT_VALUE
);
mMaxValue
=
typedArray
.
getFloat
(
R
.
styleable
.
CircleProgressBar_maxValue
,
Constant
.
DEFAULT_MAX_VALUE
);
//内容数值精度格式
mPrecision
=
typedArray
.
getInt
(
R
.
styleable
.
CircleProgressBar_precision
,
0
);
mPrecisionFormat
=
MiscUtil
.
getPrecisionFormat
(
mPrecision
);
mValueColor
=
typedArray
.
getColor
(
R
.
styleable
.
CircleProgressBar_valueColor
,
Color
.
BLACK
);
mValueSize
=
typedArray
.
getDimension
(
R
.
styleable
.
CircleProgressBar_valueSize
,
Constant
.
DEFAULT_VALUE_SIZE
);
mUnit
=
typedArray
.
getString
(
R
.
styleable
.
CircleProgressBar_unit
);
mUnitColor
=
typedArray
.
getColor
(
R
.
styleable
.
CircleProgressBar_unitColor
,
Color
.
BLACK
);
mUnitSize
=
typedArray
.
getDimension
(
R
.
styleable
.
CircleProgressBar_unitSize
,
Constant
.
DEFAULT_UNIT_SIZE
);
mArcWidth
=
typedArray
.
getDimension
(
R
.
styleable
.
CircleProgressBar_arcWidth
,
Constant
.
DEFAULT_ARC_WIDTH
);
mStartAngle
=
typedArray
.
getFloat
(
R
.
styleable
.
CircleProgressBar_startAngle
,
Constant
.
DEFAULT_START_ANGLE
);
mSweepAngle
=
typedArray
.
getFloat
(
R
.
styleable
.
CircleProgressBar_sweepAngle
,
Constant
.
DEFAULT_SWEEP_ANGLE
);
mBgArcColor
=
typedArray
.
getColor
(
R
.
styleable
.
CircleProgressBar_bgArcColor
,
Color
.
WHITE
);
mBgArcWidth
=
typedArray
.
getDimension
(
R
.
styleable
.
CircleProgressBar_bgArcWidth
,
Constant
.
DEFAULT_ARC_WIDTH
);
mTextOffsetPercentInRadius
=
typedArray
.
getFloat
(
R
.
styleable
.
CircleProgressBar_textOffsetPercentInRadius
,
0.33f
);
//mPercent = typedArray.getFloat(R.styleable.CircleProgressBar_percent, 0);
mAnimTime
=
typedArray
.
getInt
(
R
.
styleable
.
CircleProgressBar_animTime
,
Constant
.
DEFAULT_ANIM_TIME
);
// int gradientArcColors = typedArray.getResourceId(R.styleable.CircleProgressBar_arcColors, 0);
// if (gradientArcColors != 0) {
// try {
// int[] gradientColors = getResources().getIntArray(gradientArcColors);
// if (gradientColors.length == 0) {//如果渐变色为数组为0,则尝试以单色读取色值
// int color = getResources().getColor(gradientArcColors);
// mGradientColors = new int[2];
// mGradientColors[0] = color;
// mGradientColors[1] = color;
// } else if (gradientColors.length == 1) {//如果渐变数组只有一种颜色,默认设为两种相同颜色
// mGradientColors = new int[2];
// mGradientColors[0] = gradientColors[0];
// mGradientColors[1] = gradientColors[0];
// } else {
// mGradientColors = gradientColors;
// }
// } catch (Resources.NotFoundException e) {
// throw new Resources.NotFoundException("the give resource not found.");
// }
// }
int
waterColor
=
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
water_color
);
mGradientColors
=
new
int
[]{
waterColor
,
waterColor
,
waterColor
};
typedArray
.
recycle
();
}
private
void
initPaint
()
{
// mHintPaint = new TextPaint();
// // 设置抗锯齿,会消耗较大资源,绘制图形速度会变慢。
// mHintPaint.setAntiAlias(antiAlias);
// // 设置绘制文字大小
// mHintPaint.setTextSize(mHintSize);
// // 设置画笔颜色
// mHintPaint.setColor(mHintColor);
// // 从中间向两边绘制,不需要再次计算文字
// mHintPaint.setTextAlign(Paint.Align.CENTER);
// mValuePaint = new TextPaint();
// mValuePaint.setAntiAlias(antiAlias);
// mValuePaint.setTextSize(mValueSize);
// mValuePaint.setColor(mValueColor);
// // 设置Typeface对象,即字体风格,包括粗体,斜体以及衬线体,非衬线体等
// mValuePaint.setTypeface(Typeface.DEFAULT_BOLD);
// mValuePaint.setTextAlign(Paint.Align.CENTER);
// mUnitPaint = new TextPaint();
// mUnitPaint.setAntiAlias(antiAlias);
// mUnitPaint.setTextSize(mUnitSize);
// mUnitPaint.setColor(mUnitColor);
// mUnitPaint.setTextAlign(Paint.Align.CENTER);
mArcPaint
=
new
Paint
();
mArcPaint
.
setAntiAlias
(
antiAlias
);
// 设置画笔的样式,为FILL,FILL_OR_STROKE,或STROKE
mArcPaint
.
setStyle
(
Paint
.
Style
.
STROKE
);
// 设置画笔粗细
mArcPaint
.
setStrokeWidth
(
mArcWidth
);
// 当画笔样式为STROKE或FILL_OR_STROKE时,设置笔刷的图形样式,如圆形样式
// Cap.ROUND,或方形样式 Cap.SQUARE
mArcPaint
.
setStrokeCap
(
Paint
.
Cap
.
ROUND
);
mBgArcPaint
=
new
Paint
();
mBgArcPaint
.
setAntiAlias
(
antiAlias
);
mBgArcPaint
.
setColor
(
mBgArcColor
);
mBgArcPaint
.
setStyle
(
Paint
.
Style
.
STROKE
);
mBgArcPaint
.
setStrokeWidth
(
mBgArcWidth
);
mBgArcPaint
.
setStrokeCap
(
Paint
.
Cap
.
ROUND
);
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
);
setMeasuredDimension
(
MiscUtil
.
measure
(
widthMeasureSpec
,
mDefaultSize
),
MiscUtil
.
measure
(
heightMeasureSpec
,
mDefaultSize
));
}
@Override
protected
void
onSizeChanged
(
int
w
,
int
h
,
int
oldw
,
int
oldh
)
{
super
.
onSizeChanged
(
w
,
h
,
oldw
,
oldh
);
//求圆弧和背景圆弧的最大宽度
float
maxArcWidth
=
Math
.
max
(
mArcWidth
,
mBgArcWidth
);
//求最小值作为实际值
int
minSize
=
Math
.
min
(
w
-
getPaddingLeft
()
-
getPaddingRight
()
-
2
*
(
int
)
maxArcWidth
,
h
-
getPaddingTop
()
-
getPaddingBottom
()
-
2
*
(
int
)
maxArcWidth
);
//减去圆弧的宽度,否则会造成部分圆弧绘制在外围
mRadius
=
minSize
/
2
;
//获取圆的相关参数
mCenterPoint
.
x
=
w
/
2
;
mCenterPoint
.
y
=
h
/
2
;
//绘制圆弧的边界
mRectF
.
left
=
mCenterPoint
.
x
-
mRadius
-
maxArcWidth
/
2
;
mRectF
.
top
=
mCenterPoint
.
y
-
mRadius
-
maxArcWidth
/
2
;
mRectF
.
right
=
mCenterPoint
.
x
+
mRadius
+
maxArcWidth
/
2
;
mRectF
.
bottom
=
mCenterPoint
.
y
+
mRadius
+
maxArcWidth
/
2
;
//计算文字绘制时的 baseline
//由于文字的baseline、descent、ascent等属性只与textSize和typeface有关,所以此时可以直接计算
//若value、hint、unit由同一个画笔绘制或者需要动态设置文字的大小,则需要在每次更新后再次计算
// mValueOffset = mCenterPoint.y + getBaselineOffsetFromY(mValuePaint);
// mHintOffset = mCenterPoint.y - mRadius * mTextOffsetPercentInRadius + getBaselineOffsetFromY(mHintPaint);
// mUnitOffset = mCenterPoint.y + mRadius * mTextOffsetPercentInRadius + getBaselineOffsetFromY(mUnitPaint);
updateArcPaint
();
// Log.d(TAG, "onSizeChanged: 控件大小 = " + "(" + w + ", " + h + ")"
// + "圆心坐标 = " + mCenterPoint.toString()
// + ";圆半径 = " + mRadius
// + ";圆的外接矩形 = " + mRectF.toString());
}
private
float
getBaselineOffsetFromY
(
Paint
paint
)
{
return
MiscUtil
.
measureTextHeight
(
paint
)
/
2
;
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
// drawText(canvas);
drawArc
(
canvas
);
}
/**
* 绘制内容文字
*
* @param canvas
*/
private
void
drawText
(
Canvas
canvas
)
{
// 计算文字宽度,由于Paint已设置为居中绘制,故此处不需要重新计算
// float textWidth = mValuePaint.measureText(mValue.toString());
// float x = mCenterPoint.x - textWidth / 2;
canvas
.
drawText
(
String
.
format
(
mPrecisionFormat
,
mValue
),
mCenterPoint
.
x
,
mValueOffset
,
mValuePaint
);
if
(
mHint
!=
null
)
{
canvas
.
drawText
(
mHint
.
toString
(),
mCenterPoint
.
x
,
mHintOffset
,
mHintPaint
);
}
if
(
mUnit
!=
null
)
{
canvas
.
drawText
(
mUnit
.
toString
(),
mCenterPoint
.
x
,
mUnitOffset
,
mUnitPaint
);
}
}
private
void
drawArc
(
Canvas
canvas
)
{
// 绘制背景圆弧
// 从进度圆弧结束的地方开始重新绘制,优化性能
canvas
.
save
();
float
currentAngle
=
mSweepAngle
*
mPercent
;
canvas
.
rotate
(
mStartAngle
,
mCenterPoint
.
x
,
mCenterPoint
.
y
);
canvas
.
drawArc
(
mRectF
,
currentAngle
,
mSweepAngle
-
currentAngle
+
2
,
false
,
mBgArcPaint
);
// 第一个参数 oval 为 RectF 类型,即圆弧显示区域
// startAngle 和 sweepAngle 均为 float 类型,分别表示圆弧起始角度和圆弧度数
// 3点钟方向为0度,顺时针递增
// 如果 startAngle < 0 或者 > 360,则相当于 startAngle % 360
// useCenter:如果为True时,在绘制圆弧时将圆心包括在内,通常用来绘制扇形
canvas
.
drawArc
(
mRectF
,
2
,
currentAngle
,
false
,
mArcPaint
);
canvas
.
restore
();
}
/**
* 更新圆弧画笔
*/
private
void
updateArcPaint
()
{
// 设置渐变
mSweepGradient
=
new
SweepGradient
(
mCenterPoint
.
x
,
mCenterPoint
.
y
,
mGradientColors
,
null
);
mArcPaint
.
setShader
(
mSweepGradient
);
}
public
boolean
isAntiAlias
()
{
return
antiAlias
;
}
public
CharSequence
getHint
()
{
return
mHint
;
}
public
void
setHint
(
CharSequence
hint
)
{
mHint
=
hint
;
}
public
CharSequence
getUnit
()
{
return
mUnit
;
}
public
void
setUnit
(
CharSequence
unit
)
{
mUnit
=
unit
;
}
public
float
getValue
()
{
return
mValue
;
}
/**
* 设置当前值
*
* @param value
*/
public
void
setValue
(
float
value
)
{
if
(
value
>
mMaxValue
)
{
value
=
mMaxValue
;
}
float
start
=
mPercent
;
float
end
=
value
/
mMaxValue
;
startAnimator
(
start
,
end
,
mAnimTime
);
}
private
void
startAnimator
(
float
start
,
float
end
,
long
animTime
)
{
mAnimator
=
ValueAnimator
.
ofFloat
(
start
,
end
);
mAnimator
.
setDuration
(
animTime
);
mAnimator
.
addUpdateListener
(
new
ValueAnimator
.
AnimatorUpdateListener
()
{
@Override
public
void
onAnimationUpdate
(
ValueAnimator
animation
)
{
mPercent
=
(
float
)
animation
.
getAnimatedValue
();
mValue
=
mPercent
*
mMaxValue
;
invalidate
();
}
});
mAnimator
.
start
();
}
/**
* 获取最大值
*
* @return
*/
public
float
getMaxValue
()
{
return
mMaxValue
;
}
/**
* 设置最大值
*
* @param maxValue
*/
public
void
setMaxValue
(
float
maxValue
)
{
mMaxValue
=
maxValue
;
}
/**
* 获取精度
*
* @return
*/
public
int
getPrecision
()
{
return
mPrecision
;
}
public
void
setPrecision
(
int
precision
)
{
mPrecision
=
precision
;
mPrecisionFormat
=
MiscUtil
.
getPrecisionFormat
(
precision
);
}
public
int
[]
getGradientColors
()
{
return
mGradientColors
;
}
/**
* 设置渐变
*
* @param gradientColors
*/
public
void
setGradientColors
(
int
[]
gradientColors
)
{
mGradientColors
=
gradientColors
;
updateArcPaint
();
}
public
long
getAnimTime
()
{
return
mAnimTime
;
}
public
void
setAnimTime
(
long
animTime
)
{
mAnimTime
=
animTime
;
}
/**
* 重置
*/
public
void
reset
()
{
startAnimator
(
mPercent
,
0.0f
,
1000L
);
}
@Override
protected
void
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
();
//释放资源
}
}
cleaner/app/src/main/res/drawable/btn_circle.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"1000dp"
/>
<solid
android:color=
"@color/white"
/>
</shape>
\ No newline at end of file
cleaner/app/src/main/res/layout/activity_login.xml
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
xmlns:binding=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<data>
...
@@ -17,10 +15,10 @@
...
@@ -17,10 +15,10 @@
<Button
<Button
android:id=
"@+id/btn_getdata"
android:id=
"@+id/btn_getdata"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:
text=
"getData
"
android:
layout_height=
"wrap_content
"
android:layout_centerInParent=
"true"
android:layout_centerInParent=
"true"
android:onClick=
"@{()->viewModel.getRotationChart()}"
android:onClick=
"@{()->viewModel.getRotationChart()}"
android:
layout_height=
"wrap_content"
/>
android:
text=
"getData"
/>
</RelativeLayout>
</RelativeLayout>
...
...
cleaner/app/src/main/res/layout/activity_main.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.cleaner.ui.main.MainViewModel"
/>
</data>
<FrameLayout
android:id=
"@+id/fragment_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</FrameLayout>
</layout>
cleaner/app/src/main/res/layout/activity_splash.xml
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorPrimary"
android:background=
"@color/colorPrimary"
tools:context=
"com.mints.cleaner.ui.SplashActivity"
>
tools:context=
"com.mints.cleaner.ui.
splash.
SplashActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
\ No newline at end of file
cleaner/app/src/main/res/layout/fragment_clean.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.cleaner.ui.main.MainViewModel"
/>
<variable
name=
"adapter"
type=
"androidx.recyclerview.widget.RecyclerView.Adapter"
/>
<variable
name=
"title"
type=
"com.mints.cleaner.model.bean.HeaderTitle"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<include
layout=
"@layout/header_bar"
app:title=
"@{title}"
/>
<androidx.recyclerview.widget.RecyclerView
adapter=
"@{adapter}"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
/>
</LinearLayout>
</layout>
\ No newline at end of file
cleaner/app/src/main/res/layout/fragment_home.xml
deleted
100644 → 0
View file @
08ce734b
<?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"
>
<TextView
android:id=
"@+id/tv_home_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"fragment_home"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/fragment_my.xml
deleted
100644 → 0
View file @
08ce734b
<?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"
>
<TextView
android:id=
"@+id/tv_home_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"fragment_my"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/header_bar.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"title"
type=
"com.mints.cleaner.model.bean.HeaderTitle"
/>
</data>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
android:background=
"@{title.background}"
>
<ImageView
android:id=
"@+id/iv_header_left"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"40dp"
android:scaleType=
"center"
android:src=
"@mipmap/ic_activity_arrow"
android:visibility=
"@{title.backArrowVisible}"
/>
<TextView
android:id=
"@+id/tv_activity_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"40dp"
android:layout_toEndOf=
"@id/iv_header_left"
android:text=
"@{title.title}"
android:textColor=
"@color/product_net_text"
android:textSize=
"18sp"
/>
<ImageView
android:id=
"@+id/iv_header_right"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_marginTop=
"40dp"
android:layout_marginEnd=
"20dp"
android:scaleType=
"center"
android:src=
"@{title.rightIcon}"
/>
<View
style=
"@style/line_3"
android:layout_alignParentBottom=
"true"
/>
</RelativeLayout>
</layout>
\ No newline at end of file
cleaner/app/src/main/res/layout/home_footer.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:paddingTop=
"50dp"
android:paddingBottom=
"50dp"
android:text=
"@string/file_clean_info"
android:textSize=
"20sp"
/>
\ No newline at end of file
cleaner/app/src/main/res/layout/item_clean_bottom.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"20dp"
android:paddingTop=
"20dp"
android:paddingEnd=
"20dp"
>
<ImageView
android:id=
"@+id/iv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"10dp"
android:src=
"@mipmap/ic_launcher"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toEndOf=
"@id/iv"
android:text=
"@string/file_clean"
android:textColor=
"@color/black"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_title"
android:layout_toEndOf=
"@id/iv"
android:text=
"@string/file_clean_info"
android:textColor=
"@color/black"
android:textSize=
"18sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_below=
"@id/iv"
android:layout_marginTop=
"20dp"
android:background=
"@color/gray_01"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:text=
">"
android:textSize=
"30sp"
/>
</RelativeLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/item_clean_mid.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<com.mints.cleaner.widget.AutoHeightGv
android:id=
"@+id/gv_clean"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:columnWidth=
"90dp"
android:numColumns=
"3"
android:scrollbars=
"none"
android:stretchMode=
"columnWidth"
/>
<View
style=
"@style/line_2"
android:layout_marginTop=
"20dp"
/>
</LinearLayout>
cleaner/app/src/main/res/layout/item_clean_top.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=
"wrap_content"
android:background=
"@color/colorAccent"
android:paddingTop=
"20dp"
android:paddingBottom=
"20dp"
>
<com.mints.cleaner.widget.CircleProgress
android:id=
"@+id/cp_wifi"
android:layout_width=
"200dp"
android:layout_height=
"200dp"
android:layout_centerHorizontal=
"true"
app:antiAlias=
"true"
app:arcWidth=
"14dp"
app:bgArcColor=
"#E8E8E8"
app:bgArcWidth=
"14dp"
app:maxValue=
"16"
app:startAngle=
"135"
app:sweepAngle=
"270"
app:value=
"0"
/>
<Button
android:id=
"@+id/btn_clean"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/cp_wifi"
android:layout_centerHorizontal=
"true"
android:background=
"@drawable/btn_circle"
android:paddingStart=
"30dp"
android:paddingEnd=
"30dp"
android:text=
"@string/boost_with_one_click"
android:textSize=
"18sp"
/>
<TextView
android:id=
"@+id/tv_wifi_intensity"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/btn_clean"
android:layout_marginTop=
"10dp"
android:layout_toStartOf=
"@id/line"
android:gravity=
"center"
android:text=
"@string/wifi_intensity_normal"
android:textColor=
"@color/white"
/>
<TextView
android:id=
"@+id/tv_wifi_intensity_field"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_wifi_intensity"
android:layout_marginTop=
"10dp"
android:layout_toStartOf=
"@id/line"
android:gravity=
"center"
android:text=
"@string/wifi_intensity_field"
android:textColor=
"@color/white"
/>
<View
android:id=
"@+id/line"
android:layout_width=
"1dp"
android:layout_height=
"20dp"
android:layout_below=
"@id/btn_clean"
android:layout_centerHorizontal=
"true"
android:layout_marginStart=
"50dp"
android:layout_marginTop=
"26dp"
android:layout_marginEnd=
"50dp"
android:background=
"@color/white"
/>
<TextView
android:id=
"@+id/tv_wifi_speed"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/btn_clean"
android:layout_marginTop=
"10dp"
android:layout_toEndOf=
"@id/line"
android:gravity=
"center"
android:text=
"@string/wifi_intensity_normal"
android:textColor=
"@color/white"
/>
<TextView
android:id=
"@+id/tv_wifi_speed_field"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_wifi_intensity"
android:layout_marginTop=
"10dp"
android:layout_toEndOf=
"@id/line"
android:gravity=
"center"
android:text=
"@string/wifi_speed_field"
android:textColor=
"@color/white"
/>
</RelativeLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/item_gv_clean.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/item_gv_img"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:src=
"@mipmap/ic_launcher"
/>
<TextView
android:id=
"@+id/item_gv_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:text=
"手机加速"
/>
</LinearLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/title_bar.xml
0 → 100755
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/status_bg"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/header"
android:layout_width=
"fill_parent"
android:layout_height=
"38dp"
android:gravity=
"center_vertical"
>
<ImageView
android:id=
"@+id/left_btn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
android:background=
"@null"
android:paddingBottom=
"10dp"
android:paddingLeft=
"15dp"
android:paddingRight=
"15dp"
android:paddingTop=
"10dp"
android:src=
"@mipmap/ic_left_arrow"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLength=
"10"
android:textColor=
"@color/white"
android:textSize=
"16sp"
/>
<ImageView
android:id=
"@+id/arrow"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:padding=
"10dip"
android:visibility=
"gone"
/>
</LinearLayout>
<ImageView
android:id=
"@+id/right_btn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"8dp"
android:background=
"@null"
/>
<TextView
android:id=
"@+id/new_message"
android:layout_width=
"20dip"
android:layout_height=
"20dip"
android:layout_alignParentRight=
"true"
android:gravity=
"center"
android:textColor=
"#ffffff"
android:visibility=
"gone"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
cleaner/app/src/main/res/layout/title_layout.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"title"
type=
"com.mints.cleaner.model.bean.Title"
/>
</data>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"?attr/colorPrimary"
android:paddingTop=
"20dp"
>
<com.google.android.material.appbar.MaterialToolbar
android:id=
"@+id/mToolbar"
icon=
"@{title.icon}"
navigationClick=
"@{title.action}"
title=
"@{title.title}"
android:layout_width=
"match_parent"
android:layout_height=
"?actionBarSize"
android:theme=
"@style/ThemeOverlay.MaterialComponents.ActionBar"
app:popupTheme=
"@style/ThemeOverlay.MaterialComponents.Light"
app:titleTextColor=
"@color/white"
/>
</FrameLayout>
</layout>
cleaner/app/src/main/res/menu/bottom_nav_menu.xml
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
<item
android:id=
"@+id/home"
android:id=
"@+id/home"
...
@@ -11,9 +10,4 @@
...
@@ -11,9 +10,4 @@
android:id=
"@+id/wifi"
android:id=
"@+id/wifi"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@mipmap/ic_launcher"
android:title=
"@string/wifi"
/>
android:title=
"@string/wifi"
/>
<item
android:id=
"@+id/my"
android:icon=
"@mipmap/ic_launcher"
android:title=
"@string/my"
/>
</menu>
</menu>
cleaner/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted
100644 → 0
View file @
08ce734b
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<background
android:drawable=
"@drawable/ic_launcher_background"
/>
<foreground
android:drawable=
"@drawable/ic_launcher_foreground"
/>
</adaptive-icon>
\ No newline at end of file
cleaner/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted
100644 → 0
View file @
08ce734b
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<background
android:drawable=
"@drawable/ic_launcher_background"
/>
<foreground
android:drawable=
"@drawable/ic_launcher_foreground"
/>
</adaptive-icon>
\ No newline at end of file
cleaner/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted
100644 → 0
View file @
08ce734b
3.51 KB
cleaner/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted
100644 → 0
View file @
08ce734b
5.21 KB
cleaner/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted
100644 → 0
View file @
08ce734b
2.57 KB
cleaner/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted
100644 → 0
View file @
08ce734b
3.31 KB
cleaner/app/src/main/res/mipmap-xhdpi/ic_activity_arrow.png
0 → 100644
View file @
0505771a
331 Bytes
cleaner/app/src/main/res/mipmap-xhdpi/ic_left_arrow.png
0 → 100644
View file @
0505771a
2.16 KB
cleaner/app/src/main/res/mipmap-xxhdpi/ic_activity_arrow.png
0 → 100644
View file @
0505771a
457 Bytes
cleaner/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted
100644 → 0
View file @
08ce734b
10.4 KB
cleaner/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted
100644 → 0
View file @
08ce734b
16.2 KB
cleaner/app/src/main/res/values/attrs.xml
0 → 100644
View file @
0505771a
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 圆形进度条 -->
<declare-styleable
name=
"CircleProgressBar"
>
<attr
name=
"antiAlias"
format=
"boolean"
/>
<attr
name=
"startAngle"
format=
"integer"
/>
<attr
name=
"sweepAngle"
format=
"integer"
/>
<attr
name=
"animTime"
format=
"integer"
/>
<attr
name=
"maxValue"
format=
"integer"
/>
<attr
name=
"value"
format=
"integer"
/>
<attr
name=
"precision"
format=
"dimension"
/>
<attr
name=
"valueSize"
format=
"dimension"
/>
<attr
name=
"valueColor"
format=
"color"
/>
<attr
name=
"textOffsetPercentInRadius"
format=
"dimension"
/>
<!-- 绘制内容相应的提示语 -->
<attr
name=
"hint"
format=
"string"
/>
<attr
name=
"hintSize"
format=
"dimension"
/>
<attr
name=
"hintColor"
format=
"color"
/>
<!-- 绘制内容的单位 -->
<attr
name=
"unit"
format=
"dimension"
/>
<attr
name=
"unitSize"
format=
"dimension"
/>
<attr
name=
"unitColor"
format=
"color"
/>
<!-- 圆弧宽度 -->
<attr
name=
"arcWidth"
format=
"dimension"
/>
<attr
name=
"arcColors"
format=
"color"
/>
<!-- 背景圆弧颜色 -->
<attr
name=
"bgArcColor"
format=
"color"
/>
<!-- 背景圆弧宽度 -->
<attr
name=
"bgArcWidth"
format=
"dimension"
/>
</declare-styleable>
</resources>
\ No newline at end of file
cleaner/app/src/main/res/values/colors.xml
View file @
0505771a
...
@@ -4,7 +4,20 @@
...
@@ -4,7 +4,20 @@
<color
name=
"colorPrimaryDark"
>
#3700B3
</color>
<color
name=
"colorPrimaryDark"
>
#3700B3
</color>
<color
name=
"colorAccent"
>
#03DAC5
</color>
<color
name=
"colorAccent"
>
#03DAC5
</color>
<color
name=
"white"
>
#FFFFFF
</color>
<color
name=
"water_color"
>
#7EE2FF
</color>
<color
name=
"theme"
>
#6200EE
</color>
<color
name=
"theme"
>
#6200EE
</color>
<color
name=
"white"
>
#ffffff
</color>
<color
name=
"black"
>
#000000
</color>
<color
name=
"black"
>
#000000
</color>
<color
name=
"gray"
>
#999999
</color>
<color
name=
"gray_01"
>
#F5F5F5
</color>
<color
name=
"gray_02"
>
#E8E8F0
</color>
<color
name=
"status_bg"
>
#002444
</color>
<color
name=
"product_net_text"
>
#121B32
</color>
<color
name=
"product_text"
>
#172B54
</color>
</resources>
</resources>
\ No newline at end of file
cleaner/app/src/main/res/values/strings.xml
View file @
0505771a
...
@@ -10,7 +10,22 @@
...
@@ -10,7 +10,22 @@
<string
name=
"brvah_load_failed"
>
加载失败,请点我重试
</string>
<string
name=
"brvah_load_failed"
>
加载失败,请点我重试
</string>
<string
name=
"brvah_loading"
>
正在加载中...
</string>
<string
name=
"brvah_loading"
>
正在加载中...
</string>
<string
name=
"wifi_intensity_normal"
>
一般
</string>
<string
name=
"wifi_intensity_field"
>
信号强度
</string>
<string
name=
"wifi_speed_field"
>
网络速度
</string>
<string
name=
"boost_with_one_click"
>
一键加速
</string>
<string
name=
"home"
>
首页
</string>
<string
name=
"home"
>
首页
</string>
<string
name=
"wifi"
>
wifi
</string>
<string
name=
"wifi"
>
wifi
</string>
<string
name=
"my"
>
我的
</string>
<string
name=
"my"
>
我的
</string>
<string
name=
"file_clean"
>
文件清理
</string>
<string
name=
"music_clean"
>
音乐清理
</string>
<string
name=
"zip_clean"
>
压缩包清理
</string>
<string
name=
"file_clean_info"
>
释放更多空间
</string>
<string
name=
"music_clean_info"
>
清理不喜欢的音乐
</string>
<string
name=
"zip_clean_info"
>
清理无用的压缩包
</string>
</resources>
</resources>
\ No newline at end of file
cleaner/app/src/main/res/values/styles.xml
View file @
0505771a
...
@@ -12,4 +12,16 @@
...
@@ -12,4 +12,16 @@
<item
name=
"color"
>
@color/white
</item>
<item
name=
"color"
>
@color/white
</item>
</style>
</style>
<style
name=
"line_2"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
20px
</item>
<item
name=
"android:background"
>
@color/gray_02
</item>
</style>
<style
name=
"line_3"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
1px
</item>
<item
name=
"android:background"
>
@color/gray_02
</item>
</style>
</resources>
</resources>
\ No newline at end of file
cleaner/core/src/main/java/com/mints/core/base/BaseAppCompatActivity.kt
View file @
0505771a
...
@@ -91,7 +91,6 @@ abstract class BaseAppCompatActivity : TransitionActivity() {
...
@@ -91,7 +91,6 @@ abstract class BaseAppCompatActivity : TransitionActivity() {
mScreenWidth
=
widthPixels
mScreenWidth
=
widthPixels
}
}
}
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
...
...
cleaner/core/src/main/java/com/mints/core/base/BaseVMFragment.kt
View file @
0505771a
...
@@ -46,4 +46,6 @@ abstract class BaseVMFragment<T : ViewDataBinding>(@LayoutRes val layoutId: Int)
...
@@ -46,4 +46,6 @@ abstract class BaseVMFragment<T : ViewDataBinding>(@LayoutRes val layoutId: Int)
abstract
fun
initView
()
abstract
fun
initView
()
abstract
fun
initData
()
abstract
fun
initData
()
abstract
fun
startObserve
()
abstract
fun
startObserve
()
override
fun
toggleIsBack2Left
()
=
false
}
}
\ No newline at end of file
cleaner/core/src/main/java/com/mints/core/binding/BindingToolbar.kt
0 → 100644
View file @
0505771a
package
com.mints.core.binding
import
androidx.appcompat.widget.Toolbar
import
androidx.databinding.BindingAdapter
@BindingAdapter
(
"title"
,
"icon"
,
"navigationClick"
,
requireAll
=
false
)
fun
Toolbar
.
init
(
titleResId
:
Int
,
iconResId
:
Int
,
action
:
()
->
Unit
)
{
setTitle
(
titleResId
)
setNavigationIcon
(
iconResId
)
setNavigationOnClickListener
{
action
()
}
}
\ 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