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
fa8f5a64
Commit
fa8f5a64
authored
Sep 07, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加加载框
parent
75a7604c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
176 additions
and
21 deletions
+176
-21
BaseView.java
...src/main/java/com/mints/helivideo/mvp/views/BaseView.java
+7
-0
BaseActivity.java
...a/com/mints/helivideo/ui/activitys/base/BaseActivity.java
+20
-0
MyFragment.kt
...c/main/java/com/mints/helivideo/ui/fragment/MyFragment.kt
+4
-0
BaseFragment.java
...va/com/mints/helivideo/ui/fragment/base/BaseFragment.java
+20
-0
LoadingDialog.java
...in/java/com/mints/helivideo/ui/widgets/LoadingDialog.java
+59
-21
ic_loading.gif
video/app/src/main/res/drawable/ic_loading.gif
+0
-0
ic_loading_dot.gif
video/app/src/main/res/drawable/ic_loading_dot.gif
+0
-0
shape_bg_transparent.xml
video/app/src/main/res/drawable/shape_bg_transparent.xml
+5
-0
layout_custom_progress_dialog_view.xml
...rc/main/res/layout/layout_custom_progress_dialog_view.xml
+57
-0
dimens.xml
video/app/src/main/res/values/dimens.xml
+4
-0
No files found.
video/app/src/main/java/com/mints/helivideo/mvp/views/BaseView.java
View file @
fa8f5a64
...
@@ -24,6 +24,13 @@ public interface BaseView {
...
@@ -24,6 +24,13 @@ public interface BaseView {
*/
*/
void
showLoading
(
String
msg
);
void
showLoading
(
String
msg
);
/**
* show loading message
*
* @param msg
*/
void
showLoading
(
String
msg
,
boolean
isShowLoadingImg
);
/**
/**
* hide loading
* hide loading
*/
*/
...
...
video/app/src/main/java/com/mints/helivideo/ui/activitys/base/BaseActivity.java
View file @
fa8f5a64
...
@@ -163,6 +163,26 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
...
@@ -163,6 +163,26 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
}
}
}
}
/**
* 显示加载进度条(自定义message)
*
* @param message _
*/
@Override
public
void
showLoading
(
String
message
,
boolean
isShowLoadingImg
)
{
if
(!
this
.
isFinishing
()
&&
this
.
getWindow
()
!=
null
)
{
if
(
progressDialog
==
null
)
{
progressDialog
=
new
LoadingDialog
(
this
);
progressDialog
.
setLoadText
(
message
);
}
progressDialog
.
setShowLoadingImg
(
isShowLoadingImg
);
progressDialog
.
show
();
setProgressOnTouchOutside
(
false
);
setProgressNoDismiss
();
}
}
/**
/**
* 设置Progress是否手触消失
* 设置Progress是否手触消失
*
*
...
...
video/app/src/main/java/com/mints/helivideo/ui/fragment/MyFragment.kt
View file @
fa8f5a64
...
@@ -279,18 +279,22 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
...
@@ -279,18 +279,22 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
override
fun
adFail
()
{
override
fun
adFail
()
{
if
(
canFail
)
return
if
(
canFail
)
return
showLoading
(
"正在获取视频"
,
false
)
NoPreAdManager
.
loadVideoAd
(
NoPreAdManager
.
loadVideoAd
(
requireActivity
(),
requireActivity
(),
carrierType
,
object
:
AdStatusListener
{
carrierType
,
object
:
AdStatusListener
{
override
fun
adFail
()
{
override
fun
adFail
()
{
carrierType
=
Constant
.
CARRIERTYPE_NINE
carrierType
=
Constant
.
CARRIERTYPE_NINE
hideLoading
()
showToast
(
"广告太火爆了,请稍候再试"
)
showToast
(
"广告太火爆了,请稍候再试"
)
}
}
override
fun
adSuccess
()
{
override
fun
adSuccess
()
{
hideLoading
()
}
}
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
hideLoading
()
vo
?.
let
{
vo
?.
let
{
myPresenter
.
unlock
(
vo
)
myPresenter
.
unlock
(
vo
)
}
}
...
...
video/app/src/main/java/com/mints/helivideo/ui/fragment/base/BaseFragment.java
View file @
fa8f5a64
...
@@ -91,6 +91,26 @@ public abstract class BaseFragment extends BaseAppFragment {
...
@@ -91,6 +91,26 @@ public abstract class BaseFragment extends BaseAppFragment {
}
}
}
}
/**
* 显示加载进度条(自定义message)
*
* @param message _
*/
public
void
showLoading
(
String
message
,
boolean
isShowLoadingImg
)
{
// ExtKt.showLoadingExt(this, message);
if
(
getActivity
()
!=
null
&&
!
getActivity
().
isFinishing
()
&&
getActivity
().
getWindow
()
!=
null
&&
!
getActivity
().
isFinishing
())
{
if
(
progressDialog
==
null
)
{
progressDialog
=
new
LoadingDialog
(
getActivity
());
progressDialog
.
setLoadText
(
message
);
}
progressDialog
.
setShowLoadingImg
(
isShowLoadingImg
);
progressDialog
.
show
();
setProgressOnTouchOutside
(
false
);
setProgressNoDismiss
();
}
}
/**
/**
* 消失加载进度条
* 消失加载进度条
*/
*/
...
...
video/app/src/main/java/com/mints/helivideo/ui/widgets/LoadingDialog.java
View file @
fa8f5a64
package
com
.
mints
.
helivideo
.
ui
.
widgets
;
package
com
.
mints
.
helivideo
.
ui
.
widgets
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager.LayoutParams
;
import
android.view.WindowManager.LayoutParams
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.ProgressBar
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.R
;
import
com.mints.helivideo.utils.BubbleUtils
;
import
com.mints.library.utils.GlideUtils
;
/**
/**
* 描述:加载中dialog
* 描述:加载中dialog
...
@@ -20,29 +27,30 @@ import com.mints.helivideo.R;
...
@@ -20,29 +27,30 @@ import com.mints.helivideo.R;
* 时间:2017/10/10 17:51
* 时间:2017/10/10 17:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcuiguang@cashbang.cn
*/
*/
public
class
LoadingDialog
extends
Base
Dialog
{
public
class
LoadingDialog
extends
Dialog
{
private
Context
mContext
;
private
final
ImageView
img
;
private
LayoutInflater
inflater
;
private
final
LinearLayout
container
;
private
LayoutParams
lp
;
private
final
TextView
tv
;
private
TextView
loadtext
;
private
final
TextView
tv2
;
private
LinearLayout
loading_ll
;
private
final
ImageView
ivDot
;
private
final
LinearLayout
ll
;
public
LoadingDialog
(
Context
context
)
{
public
LoadingDialog
(
Context
context
)
{
super
(
context
,
R
.
style
.
dialog
);
super
(
context
,
R
.
style
.
dialog
);
this
.
mContext
=
context
;
LayoutInflater
inflater
=
(
LayoutInflater
)
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
)
;
inflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
container
=
(
LinearLayout
)
inflater
.
inflate
(
R
.
layout
.
layout_custom_progress_dialog_view
,
null
);
View
layout
=
inflater
.
inflate
(
R
.
layout
.
loadingdialog
,
null
);
img
=
container
.
findViewById
(
R
.
id
.
ivProgress
);
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>
22
)
{
//android 6.0替换clip的加载动画
tv
=
container
.
findViewById
(
R
.
id
.
loading_tips
);
final
Drawable
drawable
=
ContextCompat
.
getDrawable
(
mContext
,
R
.
drawable
.
ufo_loading_refresh
);
tv2
=
container
.
findViewById
(
R
.
id
.
loading_waiting
);
ProgressBar
loading_bar
=
(
ProgressBar
)
layout
.
findViewById
(
R
.
id
.
loading_bar
);
ivDot
=
container
.
findViewById
(
R
.
id
.
iv_dot
);
loading_bar
.
setIndeterminateDrawable
(
drawable
);
ll
=
container
.
findViewById
(
R
.
id
.
ll_container
);
}
loadtext
=
(
TextView
)
layout
.
findViewById
(
R
.
id
.
loading_text
);
GlideUtils
.
INSTANCE
.
loadImageViewGif
(
context
,
R
.
drawable
.
ic_loading
,
img
);
loading_ll
=
(
LinearLayout
)
layout
.
findViewById
(
R
.
id
.
loading_ll
);
setContentView
(
layout
);
setContentView
(
container
);
// 设置window属性
// 设置window属性
lp
=
getWindow
().
getAttributes
();
LayoutParams
lp
=
getWindow
().
getAttributes
();
lp
.
gravity
=
Gravity
.
CENTER
;
lp
.
gravity
=
Gravity
.
CENTER
;
lp
.
dimAmount
=
0
;
// 去背景遮盖
lp
.
dimAmount
=
0
;
// 去背景遮盖
// lp.alpha = 1.0f;//透明效果
// lp.alpha = 1.0f;//透明效果
...
@@ -56,10 +64,40 @@ public class LoadingDialog extends BaseDialog {
...
@@ -56,10 +64,40 @@ public class LoadingDialog extends BaseDialog {
*/
*/
public
void
setLoadText
(
String
content
)
{
public
void
setLoadText
(
String
content
)
{
if
(
TextUtils
.
isEmpty
(
content
))
{
if
(
TextUtils
.
isEmpty
(
content
))
{
loading_ll
.
setVisibility
(
View
.
GONE
);
tv
.
setVisibility
(
View
.
GONE
);
}
else
{
tv
.
setVisibility
(
View
.
VISIBLE
);
tv
.
setText
(
content
);
}
}
/**
* 是否显示图片
*/
public
void
setShowLoadingImg
(
boolean
showLoadingImg
)
{
if
(
showLoadingImg
)
{
img
.
setVisibility
(
View
.
VISIBLE
);
ll
.
setVisibility
(
View
.
GONE
);
tv
.
setTypeface
(
Typeface
.
defaultFromStyle
(
Typeface
.
NORMAL
));
int
dimen
=
getContext
().
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
font_size_14
);
tv
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
dimen
);
container
.
setBackgroundColor
(
Color
.
TRANSPARENT
);
}
else
{
}
else
{
loading_ll
.
setVisibility
(
View
.
VISIBLE
);
img
.
setVisibility
(
View
.
GONE
);
loadtext
.
setText
(
content
);
ll
.
setVisibility
(
View
.
VISIBLE
);
GlideUtils
.
INSTANCE
.
loadImageViewGif
(
getContext
(),
R
.
drawable
.
ic_loading_dot
,
ivDot
);
int
paddingTB
=
BubbleUtils
.
dp2px
(
30
);
int
paddingSE
=
BubbleUtils
.
dp2px
(
10
);
tv
.
setPadding
(
paddingSE
,
paddingTB
,
paddingSE
,
0
);
tv
.
setTypeface
(
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
));
int
dimen
=
getContext
().
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
font_size_30
);
tv
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
dimen
);
tv2
.
setTypeface
(
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
));
tv2
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
dimen
);
container
.
setBackground
(
ContextCompat
.
getDrawable
(
getContext
(),
R
.
drawable
.
shape_bg_transparent
));
}
}
}
}
...
...
video/app/src/main/res/drawable/ic_loading.gif
0 → 100644
View file @
fa8f5a64
66.8 KB
video/app/src/main/res/drawable/ic_loading_dot.gif
0 → 100644
View file @
fa8f5a64
2.03 KB
video/app/src/main/res/drawable/shape_bg_transparent.xml
0 → 100644
View file @
fa8f5a64
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"10dp"
/>
<solid
android:color=
"#B0000000"
/>
</shape>
\ No newline at end of file
video/app/src/main/res/layout/layout_custom_progress_dialog_view.xml
0 → 100644
View file @
fa8f5a64
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:paddingBottom=
"10dp"
>
<ImageView
android:id=
"@+id/ivProgress"
android:layout_width=
"120dp"
android:layout_height=
"120dp"
android:layout_gravity=
"center"
android:scaleType=
"fitXY"
android:src=
"@drawable/ic_loading"
/>
<TextView
android:id=
"@+id/loading_tips"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:gravity=
"center"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
android:text=
"加载中..."
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
<LinearLayout
android:id=
"@+id/ll_container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"30dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:visibility=
"gone"
>
<TextView
android:id=
"@+id/loading_waiting"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"请稍候"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
<ImageView
android:id=
"@+id/iv_dot"
android:layout_width=
"wrap_content"
android:layout_height=
"12dp"
android:layout_marginTop=
"2dp"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
video/app/src/main/res/values/dimens.xml
View file @
fa8f5a64
...
@@ -24,5 +24,9 @@
...
@@ -24,5 +24,9 @@
<!--inner category-->
<!--inner category-->
<!--inner category-->
<!--inner category-->
<!--inner category-->
<!--inner category-->
<!-- 字体 -->
<dimen
name=
"font_size_14"
>
14sp
</dimen>
<dimen
name=
"font_size_16"
>
16sp
</dimen>
<dimen
name=
"font_size_30"
>
30sp
</dimen>
</resources>
</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