Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MobileManager
Project
Overview
Details
Activity
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
Wang Xu
MobileManager
Commits
1cbe43ca
Commit
1cbe43ca
authored
Apr 07, 2020
by
Baoxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: 临时出版本
parent
c875c4a1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
529 additions
and
75 deletions
+529
-75
build.gradle
Launcher3/build.gradle
+1
-0
select_date_select.xml
Launcher3/res/drawable/select_date_select.xml
+9
-0
activity_use_app.xml
Launcher3/res/layout/activity_use_app.xml
+54
-1
AppUseActivity.kt
.../com/android/launcher3/function/setting/AppUseActivity.kt
+97
-42
SettingActivity.kt
...com/android/launcher3/function/setting/SettingActivity.kt
+5
-1
build.gradle
lib_common/build.gradle
+2
-0
DialogUIUtils.java
...a/com/secspace/lib/common/dialog/other/DialogUIUtils.java
+0
-20
AppUseProgress.java
...com/secspace/lib/common/function/view/AppUseProgress.java
+4
-11
UseTimeProgress.java
...om/secspace/lib/common/function/view/UseTimeProgress.java
+357
-0
No files found.
Launcher3/build.gradle
View file @
1cbe43ca
...
@@ -149,6 +149,7 @@ dependencies {
...
@@ -149,6 +149,7 @@ dependencies {
implementation
"com.qmuiteam:qmui:1.3.0"
implementation
"com.qmuiteam:qmui:1.3.0"
implementation
"org.jetbrains.kotlin:kotlin-reflect:1.3.61"
implementation
"org.jetbrains.kotlin:kotlin-reflect:1.3.61"
// implementation 'com.dou361.dialogui:jjdxm-dialogui:1.0.2'
// implementation 'com.dou361.dialogui:jjdxm-dialogui:1.0.2'
implementation
'com.contrarywind:Android-PickerView:4.1.9'
}
}
...
...
Launcher3/res/drawable/select_date_select.xml
0 → 100644
View file @
1cbe43ca
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
android:width=
"1px"
android:color=
"#FFDFDFDF"
/>
<solid
android:color=
"#FFF2F2F2"
/>
<corners
android:radius=
"8dp"
/>
</shape>
\ No newline at end of file
Launcher3/res/layout/activity_use_app.xml
View file @
1cbe43ca
...
@@ -56,10 +56,63 @@
...
@@ -56,10 +56,63 @@
android:textSize=
"15sp"
/>
android:textSize=
"15sp"
/>
</LinearLayout>
</LinearLayout>
<com.secspace.lib.common.function.view.
Tim
eProgress
<com.secspace.lib.common.function.view.
AppUs
eProgress
android:id=
"@+id/time_progress"
android:id=
"@+id/time_progress"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@color/bg_white"
android:background=
"@color/bg_white"
android:padding=
"10dp"
/>
android:padding=
"10dp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_margin=
"10dp"
android:background=
"@drawable/select_date_select"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"48dp"
android:drawablePadding=
"10dp"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"选择日期"
android:textColor=
"#ACACAC"
android:textSize=
"15sp"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
android:background=
"#ACACAC"
/>
<TextView
android:id=
"@+id/tv_date_start"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"48dp"
android:gravity=
"center"
android:text=
"开始时间"
android:textColor=
"#ACACAC"
android:textSize=
"15sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:textColor=
"#ACACAC"
android:gravity=
"center"
android:text=
" — "
/>
<TextView
android:id=
"@+id/tv_date_end"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"48dp"
android:gravity=
"center"
android:text=
"结束时间"
android:textColor=
"#ACACAC"
android:textSize=
"15sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Launcher3/src/com/android/launcher3/function/setting/AppUseActivity.kt
View file @
1cbe43ca
This diff is collapsed.
Click to expand it.
Launcher3/src/com/android/launcher3/function/setting/SettingActivity.kt
View file @
1cbe43ca
...
@@ -10,6 +10,7 @@ import com.android.launcher3.BaseActivity
...
@@ -10,6 +10,7 @@ import com.android.launcher3.BaseActivity
import
com.android.launcher3.R
import
com.android.launcher3.R
import
com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
import
com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
import
com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView
import
com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView
import
com.secspace.lib.common.dialog.other.DialogUIUtils
import
com.secspace.lib.common.utils.*
import
com.secspace.lib.common.utils.*
import
kotlinx.android.synthetic.main.activity_setting.*
import
kotlinx.android.synthetic.main.activity_setting.*
...
@@ -56,7 +57,10 @@ class SettingActivity : BaseActivity() {
...
@@ -56,7 +57,10 @@ class SettingActivity : BaseActivity() {
dp2px
(
48f
))
dp2px
(
48f
))
QMUIGroupListView
.
newSection
(
mContext
)
QMUIGroupListView
.
newSection
(
mContext
)
.
addItemView
(
wlan
)
{
IntentUtil
.
startWifiSetting
(
mContext
)
}
.
addItemView
(
wlan
)
{
IntentUtil
.
startWifiSetting
(
mContext
)
}
.
addItemView
(
appUse
)
{
startActivity
(
Intent
(
mContext
,
AppUseActivity
::
class
.
java
))
}
.
addItemView
(
appUse
)
{
// startActivity(Intent(mContext, AppUseActivity::class.java))
DialogUIUtils
.
showToastCenter
(
"开发中"
)
}
.
addItemView
(
buy
)
{
startActivity
(
Intent
(
mContext
,
SettingBuyActivity
::
class
.
java
))
}
.
addItemView
(
buy
)
{
startActivity
(
Intent
(
mContext
,
SettingBuyActivity
::
class
.
java
))
}
.
addItemView
(
about
)
{
startActivity
(
Intent
(
mContext
,
SettingAboutActivity
::
class
.
java
))
}
.
addItemView
(
about
)
{
startActivity
(
Intent
(
mContext
,
SettingAboutActivity
::
class
.
java
))
}
.
addTo
(
grouplistview
)
.
addTo
(
grouplistview
)
...
...
lib_common/build.gradle
View file @
1cbe43ca
...
@@ -128,4 +128,5 @@ dependencies {
...
@@ -128,4 +128,5 @@ dependencies {
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
implementation
"com.qmuiteam:qmui:1.3.0"
implementation
"com.qmuiteam:qmui:1.3.0"
implementation
"org.reactivestreams:reactive-streams:1.0.2"
implementation
"org.reactivestreams:reactive-streams:1.0.2"
implementation
'com.contrarywind:Android-PickerView:4.1.9'
}
}
\ No newline at end of file
lib_common/src/main/java/com/secspace/lib/common/dialog/other/DialogUIUtils.java
View file @
1cbe43ca
...
@@ -13,26 +13,6 @@ import android.widget.Toast;
...
@@ -13,26 +13,6 @@ import android.widget.Toast;
import
com.secspace.lib.common.R
;
import
com.secspace.lib.common.R
;
/**
* ========================================
* <p>
* 版 权:dou361.com 版权所有 (C) 2015
* <p>
* 作 者:陈冠明
* <p>
* 个人网站:http://www.dou361.com
* <p>
* 版 本:1.0
* <p>
* 创建日期:2016/10/31 22:17
* <p>
* 描 述:一个对外UI管理容器工具类
* <p>
* <p>
* 修订历史:
* <p>
* ========================================
*/
public
class
DialogUIUtils
{
public
class
DialogUIUtils
{
/**
/**
...
...
lib_common/src/main/java/com/secspace/lib/common/function/view/
Tim
eProgress.java
→
lib_common/src/main/java/com/secspace/lib/common/function/view/
AppUs
eProgress.java
View file @
1cbe43ca
...
@@ -23,7 +23,7 @@ import java.util.List;
...
@@ -23,7 +23,7 @@ import java.util.List;
/**
/**
* 应用使用时间进度条
* 应用使用时间进度条
*/
*/
public
class
Tim
eProgress
extends
View
{
public
class
AppUs
eProgress
extends
View
{
private
List
<
UseAppEntity
>
useAppEntities
=
new
ArrayList
<>();
private
List
<
UseAppEntity
>
useAppEntities
=
new
ArrayList
<>();
private
Paint
bgPaint
;
private
Paint
bgPaint
;
...
@@ -32,7 +32,6 @@ public class TimeProgress extends View {
...
@@ -32,7 +32,6 @@ public class TimeProgress extends View {
private
int
mWidth
;
private
int
mWidth
;
private
int
mHeight
;
private
int
mHeight
;
private
List
<
Integer
>
times
=
new
ArrayList
<>();
private
List
<
Integer
>
paintColors
=
new
ArrayList
<>();
private
List
<
Integer
>
paintColors
=
new
ArrayList
<>();
private
float
allTime
=
0
F
;
private
float
allTime
=
0
F
;
private
float
animationValue
;
private
float
animationValue
;
...
@@ -88,25 +87,19 @@ public class TimeProgress extends View {
...
@@ -88,25 +87,19 @@ public class TimeProgress extends View {
private
int
paddingRight
;
private
int
paddingRight
;
private
int
paddingBottom
;
private
int
paddingBottom
;
public
Tim
eProgress
(
Context
context
)
{
public
AppUs
eProgress
(
Context
context
)
{
this
(
context
,
null
);
this
(
context
,
null
);
}
}
public
Tim
eProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
public
AppUs
eProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
this
(
context
,
attrs
,
0
);
this
(
context
,
attrs
,
0
);
}
}
public
Tim
eProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
public
AppUs
eProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
init
();
init
();
initPaint
();
initPaint
();
initTextPaint
();
initTextPaint
();
times
.
add
(
10
);
times
.
add
(
20
);
times
.
add
(
80
);
times
.
add
(
50
);
Comparator
<
Integer
>
reverseComparator
=
Collections
.
reverseOrder
();
Collections
.
sort
(
times
,
reverseComparator
);
paintColors
.
add
(
0xFF13A6FA
);
paintColors
.
add
(
0xFF13A6FA
);
paintColors
.
add
(
0xFF9BFA13
);
paintColors
.
add
(
0xFF9BFA13
);
paintColors
.
add
(
0xFFFAB613
);
paintColors
.
add
(
0xFFFAB613
);
...
...
lib_common/src/main/java/com/secspace/lib/common/function/view/UseTimeProgress.java
0 → 100644
View file @
1cbe43ca
package
com
.
secspace
.
lib
.
common
.
function
.
view
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Rect
;
import
android.graphics.RectF
;
import
android.support.annotation.Nullable
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.view.View
;
import
android.view.animation.LinearInterpolator
;
import
java.text.DecimalFormat
;
/**
* 应用使用时间
*/
public
class
UseTimeProgress
extends
View
{
private
Paint
bgPaint
;
private
Paint
progressPaint
;
private
Paint
textPaint
;
private
int
mWidth
;
private
int
mHeight
;
private
int
mViewHeight
;
/**
* 进度
*/
private
float
mProgress
;
//描述文字的高度
private
float
textHeight
;
//描述文字的高度
private
float
textWidth
;
/**
* 当前进度
*/
private
float
currentProgress
;
/**
* 进度动画
*/
private
ValueAnimator
progressAnimator
;
/**
* 动画执行时间
*/
private
int
duration
=
1000
;
/**
* 动画延时启动时间
*/
private
int
startDelay
=
500
;
/**
* 进度条画笔的宽度
*/
private
int
progressPaintWidth
;
private
int
progressHeight
;
/**
* 进度条距离提示框的高度
*/
private
int
progressMarginTop
;
/**
* 进度移动的距离
*/
private
float
moveDis
;
private
Rect
textRect
=
new
Rect
();
private
String
textString
=
"已售0%"
;
/**
* 百分比文字字体大小
*/
private
int
textPaintSize
;
/**
* 进度条背景颜色
*/
private
int
bgColor
=
0xFFeaeef0
;
/**
* 进度条颜色
*/
private
int
progressColor
=
0xFF13A6FA
;
private
RectF
bgRectF
=
new
RectF
();
private
RectF
progressRectF
=
new
RectF
();
/**
* 圆角矩形的圆角半径
*/
private
int
roundRectRadius
;
/**
* 进度监听回调
*/
private
ProgressListener
progressListener
;
public
UseTimeProgress
(
Context
context
)
{
this
(
context
,
null
);
}
public
UseTimeProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
this
(
context
,
attrs
,
0
);
}
public
UseTimeProgress
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
init
();
initPaint
();
initTextPaint
();
}
/**
* 初始化画笔宽度及view大小
*/
private
void
init
()
{
progressPaintWidth
=
dp2px
(
1
);
progressHeight
=
dp2px
(
3
);
roundRectRadius
=
dp2px
(
3
);
textPaintSize
=
sp2px
(
10
);
textHeight
=
dp2px
(
10
);
progressMarginTop
=
dp2px
(
4
);
//view真实的高度
mViewHeight
=
(
int
)
(
textHeight
+
progressMarginTop
+
progressPaintWidth
*
2
+
progressHeight
);
}
private
void
initPaint
()
{
bgPaint
=
getPaint
(
progressPaintWidth
,
bgColor
,
Paint
.
Style
.
FILL
);
progressPaint
=
getPaint
(
progressPaintWidth
,
progressColor
,
Paint
.
Style
.
FILL
);
}
/**
* 初始化文字画笔
*/
private
void
initTextPaint
()
{
textPaint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
textPaint
.
setTextSize
(
textPaintSize
);
textPaint
.
setColor
(
progressColor
);
textPaint
.
setTextAlign
(
Paint
.
Align
.
CENTER
);
textPaint
.
setAntiAlias
(
true
);
}
/**
* 统一处理paint
*
* @param strokeWidth 画笔宽度
* @param color 颜色
* @param style 风格
* @return paint
*/
private
Paint
getPaint
(
int
strokeWidth
,
int
color
,
Paint
.
Style
style
)
{
Paint
paint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
paint
.
setStrokeWidth
(
strokeWidth
);
paint
.
setColor
(
color
);
paint
.
setAntiAlias
(
true
);
paint
.
setStyle
(
style
);
return
paint
;
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
int
widthMode
=
MeasureSpec
.
getMode
(
widthMeasureSpec
);
int
width
=
MeasureSpec
.
getSize
(
widthMeasureSpec
);
int
heightMode
=
MeasureSpec
.
getMode
(
heightMeasureSpec
);
int
height
=
MeasureSpec
.
getSize
(
heightMeasureSpec
);
setMeasuredDimension
(
measureWidth
(
widthMode
,
width
),
measureHeight
(
heightMode
,
height
));
}
/**
* 测量宽度
*
* @param mode
* @param width
* @return
*/
private
int
measureWidth
(
int
mode
,
int
width
)
{
switch
(
mode
)
{
case
MeasureSpec
.
UNSPECIFIED
:
case
MeasureSpec
.
AT_MOST
:
break
;
case
MeasureSpec
.
EXACTLY
:
mWidth
=
width
;
break
;
}
return
mWidth
;
}
public
void
setWidth
(
int
width
){
mWidth
=
width
;
}
/**
* 测量高度
*
* @param mode
* @param height
* @return
*/
private
int
measureHeight
(
int
mode
,
int
height
)
{
switch
(
mode
)
{
case
MeasureSpec
.
UNSPECIFIED
:
case
MeasureSpec
.
AT_MOST
:
mHeight
=
mViewHeight
;
break
;
case
MeasureSpec
.
EXACTLY
:
mHeight
=
height
;
break
;
}
return
mHeight
;
}
@Override
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
//绘制文字
drawText
(
canvas
,
textString
);
//背景
drawBgProgress
(
canvas
);
//进度条
drawProgress
(
canvas
);
}
private
void
drawBgProgress
(
Canvas
canvas
)
{
bgRectF
.
left
=
0
;
bgRectF
.
top
=
textHeight
+
progressMarginTop
;
bgRectF
.
right
=
this
.
getMeasuredWidth
();
bgRectF
.
bottom
=
bgRectF
.
top
+
progressHeight
;
canvas
.
drawRoundRect
(
bgRectF
,
roundRectRadius
,
roundRectRadius
,
bgPaint
);
}
private
void
drawProgress
(
Canvas
canvas
)
{
progressRectF
.
left
=
0
;
progressRectF
.
top
=
textHeight
+
progressMarginTop
;
progressRectF
.
right
=
currentProgress
;
progressRectF
.
bottom
=
progressRectF
.
top
+
progressHeight
;
canvas
.
drawRoundRect
(
progressRectF
,
roundRectRadius
,
roundRectRadius
,
progressPaint
);
}
/**
* 绘制文字
*
* @param canvas 画布
*/
private
void
drawText
(
Canvas
canvas
,
String
textString
)
{
textRect
.
left
=
(
int
)
moveDis
;
textRect
.
top
=
0
;
textRect
.
right
=
(
int
)
(
textPaint
.
measureText
(
textString
)
+
moveDis
);
textRect
.
bottom
=
(
int
)
textHeight
;
Paint
.
FontMetricsInt
fontMetrics
=
textPaint
.
getFontMetricsInt
();
int
baseline
=
(
textRect
.
bottom
+
textRect
.
top
-
fontMetrics
.
bottom
-
fontMetrics
.
top
)
/
2
;
//文字绘制到整个布局的中心位置
canvas
.
drawText
(
textString
,
textRect
.
centerX
(),
baseline
,
textPaint
);
}
/**
* 进度移动动画 通过插值的方式改变移动的距离
*/
private
void
initAnimation
()
{
progressAnimator
=
ValueAnimator
.
ofFloat
(
0
,
mProgress
);
progressAnimator
.
setDuration
(
duration
);
progressAnimator
.
setStartDelay
(
startDelay
);
progressAnimator
.
setInterpolator
(
new
LinearInterpolator
());
progressAnimator
.
addUpdateListener
(
new
ValueAnimator
.
AnimatorUpdateListener
()
{
@Override
public
void
onAnimationUpdate
(
ValueAnimator
valueAnimator
)
{
float
value
=
(
float
)
valueAnimator
.
getAnimatedValue
();
textString
=
"已售"
+
formatNum
((
int
)
value
)
+
"%"
;
textWidth
=
textPaint
.
measureText
(
textString
);
currentProgress
=
value
*
mWidth
/
100
;
if
(
progressListener
!=
null
)
{
progressListener
.
currentProgressListener
(
value
);
}
//移动百分比提示框,只有当前进度到提示框中间位置之后开始移动,当进度框移动到最右边的时候停止移动,但是进度条还可以继续移动
if
(
currentProgress
>=
textWidth
&&
currentProgress
<=
mWidth
)
{
moveDis
=
currentProgress
-
textWidth
;
}
invalidate
();
}
});
if
(!
progressAnimator
.
isStarted
())
{
progressAnimator
.
start
();
}
}
/**
* 回调接口
*/
public
interface
ProgressListener
{
void
currentProgressListener
(
float
currentProgress
);
}
/**
* 回调监听事件
*
* @param listener
* @return
*/
public
UseTimeProgress
setProgressListener
(
ProgressListener
listener
)
{
progressListener
=
listener
;
return
this
;
}
public
UseTimeProgress
setProgress
(
float
progress
)
{
mProgress
=
progress
;
initAnimation
();
return
this
;
}
/**
* 格式化数字(保留一位小数)
*
* @param money
* @return
*/
public
static
String
formatNum
(
int
money
)
{
DecimalFormat
format
=
new
DecimalFormat
(
"0"
);
return
format
.
format
(
money
);
}
/**
* dp 2 px
*
* @param dpVal
*/
protected
int
dp2px
(
int
dpVal
)
{
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
dpVal
,
getResources
().
getDisplayMetrics
());
}
/**
* sp 2 px
*
* @param spVal
* @return
*/
protected
int
sp2px
(
int
spVal
)
{
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_SP
,
spVal
,
getResources
().
getDisplayMetrics
());
}
}
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