Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
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_vedio
Commits
b37af965
Commit
b37af965
authored
Aug 03, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
95c2af77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
134 deletions
+0
-134
build.gradle
video/app/build.gradle
+0
-4
MainActivity.kt
...ain/java/com/mints/helivideo/ui/activitys/MainActivity.kt
+0
-54
QRCodeUtil.java
...p/src/main/java/com/mints/helivideo/utils/QRCodeUtil.java
+0
-76
No files found.
video/app/build.gradle
View file @
b37af965
...
...
@@ -206,8 +206,6 @@ dependencies {
implementation
'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-26'
//banner
implementation
'io.github.youth5201314:banner:2.2.2'
// zxing
implementation
'com.king.zxing:zxing-lite:1.1.7-androidx'
// 动画库
implementation
'com.daimajia.easing:library:2.0@aar'
implementation
'com.daimajia.androidanimations:library:2.3@aar'
...
...
@@ -215,8 +213,6 @@ dependencies {
implementation
'com.github.open-android:RoundedImageView:v1.0.0'
// 光效
implementation
'io.supercharge:shimmerlayout:2.1.0'
// 悬浮窗
implementation
'com.github.princekin-f:EasyFloat:1.3.4'
implementation
'com.airbnb.android:lottie:3.4.0'
// 跑马灯
implementation
'com.sunfusheng:MarqueeView:1.4.1'
...
...
video/app/src/main/java/com/mints/helivideo/ui/activitys/MainActivity.kt
View file @
b37af965
...
...
@@ -5,17 +5,12 @@ import android.content.Intent
import
android.media.AudioManager
import
android.net.Uri
import
android.os.Bundle
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentTransaction
import
com.lzf.easyfloat.EasyFloat
import
com.lzf.easyfloat.anim.AppFloatDefaultAnimator
import
com.lzf.easyfloat.anim.DefaultAnimator
import
com.lzf.easyfloat.enums.SidePattern
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.R
import
com.mints.helivideo.common.AppConfig
...
...
@@ -85,55 +80,6 @@ class MainActivity : BaseActivity(), View.OnClickListener {
initEditView
()
// initEasyFloat()
}
private
fun
initEasyFloat
()
{
EasyFloat
.
with
(
this
)
// 设置浮窗xml布局文件,并可设置详细信息
.
setLayout
(
R
.
layout
.
float_app
)
{
it
.
findViewById
<
TextView
>(
R
.
id
.
tv_float
).
setOnClickListener
{
backPhoneDialog
()
}
}
// 设置吸附方式,共15种模式,详情参考SidePattern
.
setSidePattern
(
SidePattern
.
RESULT_HORIZONTAL
)
// 设置浮窗是否可拖拽,默认可拖拽
.
setDragEnable
(
true
)
// 系统浮窗是否包含EditText,仅针对系统浮窗,默认不包含
.
hasEditText
(
false
)
// 设置浮窗的对齐方式和坐标偏移量
.
setGravity
(
Gravity
.
END
or
Gravity
.
CENTER_VERTICAL
,
0
,
200
)
// 设置宽高是否充满父布局,直接在xml设置match_parent属性无效
.
setMatchParent
(
widthMatch
=
false
,
heightMatch
=
false
)
// 设置Activity浮窗的出入动画,可自定义,实现相应接口即可(策略模式),无需动画直接设置为null
.
setAnimator
(
DefaultAnimator
())
// 设置系统浮窗的出入动画,使用同上
.
setAppFloatAnimator
(
AppFloatDefaultAnimator
())
// 设置系统浮窗的不需要显示的页面
// 浮窗的一些状态回调,如:创建结果、显示、隐藏、销毁、touchEvent、拖拽过程、拖拽结束。
// ps:通过Kotlin DSL实现的回调,可以按需复写方法,用到哪个写哪个
.
registerCallback
{
createResult
{
isCreated
,
msg
,
view
->
}
show
{
}
hide
{
}
dismiss
{
}
touchEvent
{
view
,
motionEvent
->
}
// drag { view, motionEvent ->
// view.findViewById<TextView>(R.id.tv_float).apply {
// text = "我被拖拽..."
// setBackgroundResource(R.drawable.shape_banner_write)
// }
// }
dragEnd
{
it
.
findViewById
<
TextView
>(
R
.
id
.
tv_float
).
apply
{
text
=
"联系\n客服"
val
location
=
IntArray
(
2
)
getLocationOnScreen
(
location
)
setBackgroundResource
(
if
(
location
[
0
]
>
10
)
R
.
drawable
.
shape_phone_left
else
R
.
drawable
.
shape_phone_right
)
}
}
}
.
show
()
}
override
fun
isApplyKitKatTranslucency
():
Boolean
{
...
...
video/app/src/main/java/com/mints/helivideo/utils/QRCodeUtil.java
deleted
100644 → 0
View file @
95c2af77
package
com
.
mints
.
helivideo
.
utils
;
import
android.graphics.Bitmap
;
import
android.graphics.Matrix
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.WriterException
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
java.util.Hashtable
;
public
class
QRCodeUtil
{
/**
* 生成二维码
*
* @param text 需要生成二维码的文字、网址等
* @param size 需要生成二维码的大小()
* @return bitmap
*/
public
static
Bitmap
createQRCode
(
String
text
,
int
size
)
{
try
{
Hashtable
<
EncodeHintType
,
Object
>
hints
=
new
Hashtable
<>();
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
"utf-8"
);
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
L
);
hints
.
put
(
EncodeHintType
.
MARGIN
,
1
);
BitMatrix
bitMatrix
=
new
QRCodeWriter
().
encode
(
text
,
BarcodeFormat
.
QR_CODE
,
size
,
size
,
hints
);
int
[]
pixels
=
new
int
[
size
*
size
];
for
(
int
y
=
0
;
y
<
size
;
y
++)
{
for
(
int
x
=
0
;
x
<
size
;
x
++)
{
if
(
bitMatrix
.
get
(
x
,
y
))
{
pixels
[
y
*
size
+
x
]
=
0xff000000
;
}
else
{
pixels
[
y
*
size
+
x
]
=
0xffffffff
;
}
}
}
Bitmap
bitmap
=
Bitmap
.
createBitmap
(
size
,
size
,
Bitmap
.
Config
.
RGB_565
);
bitmap
.
setPixels
(
pixels
,
0
,
size
,
0
,
0
,
size
,
size
);
// Bitmap zoomBitmap = zoomBitmap(bitmap, size, size);
// bitmap.recycle();
return
bitmap
;
}
catch
(
WriterException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 图片缩放
*
* @param bitmap 对象
* @param w 要缩放的宽度
* @param h 要缩放的高度
* @return newBmp 新 Bitmap对象
*/
public
static
Bitmap
zoomBitmap
(
Bitmap
bitmap
,
int
w
,
int
h
)
{
int
width
=
bitmap
.
getWidth
();
int
height
=
bitmap
.
getHeight
();
Matrix
matrix
=
new
Matrix
();
float
scaleWidth
=
((
float
)
w
/
width
);
float
scaleHeight
=
((
float
)
h
/
height
);
matrix
.
postScale
(
scaleWidth
,
scaleHeight
);
Bitmap
newBmp
=
Bitmap
.
createBitmap
(
bitmap
,
0
,
0
,
width
,
height
,
matrix
,
true
);
return
newBmp
;
}
}
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