Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
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
1
Merge Requests
1
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
杨秀秀
HBHAndroid
Commits
fc82e7ef
Commit
fc82e7ef
authored
Feb 27, 2024
by
小费同学阿
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消费者端
版本更新fixd
parent
b88817c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
65 deletions
+80
-65
BaseActivity.java
.../src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java
+24
-27
BaseFragment.java
.../src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java
+25
-22
CommTextDialog.kt
...src/main/java/com/xx/xxviewlibrary/comm/CommTextDialog.kt
+31
-16
No files found.
mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseActivity.java
View file @
fc82e7ef
...
@@ -56,7 +56,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
...
@@ -56,7 +56,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
private
int
viewModelId
;
private
int
viewModelId
;
private
MaterialDialog
dialog
;
private
MaterialDialog
dialog
;
/*空值情况*/
private
NUllDialog
nullDialog
;
private
NUllDialog
nullDialog
;
@Override
@Override
...
@@ -133,7 +132,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
...
@@ -133,7 +132,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
**/
**/
//注册ViewModel与View的契约UI回调事件
//注册ViewModel与View的契约UI回调事件
protected
void
registorUIChangeLiveDataCallBack
()
{
protected
void
registorUIChangeLiveDataCallBack
()
{
//加载对话框显示
//加载对话框显示
viewModel
.
getUC
().
getShowDialogEventNoTouch
().
observe
(
this
,
new
Observer
<
String
>()
{
viewModel
.
getUC
().
getShowDialogEventNoTouch
().
observe
(
this
,
new
Observer
<
String
>()
{
@Override
@Override
...
@@ -234,8 +232,30 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
...
@@ -234,8 +232,30 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
}
}
/**
/**
* =====================================================================禁止返回
* 触发禁用返回键
**/
*/
public
void
showNoTouchDialog
(
String
title
)
{
if
(
StringUtils
.
isEmpty
(
title
))
{
if
(
nullDialog
!=
null
)
{
nullDialog
.
show
();
}
else
{
nullDialog
=
new
NUllDialog
(
this
);
nullDialog
.
show
();
}
}
else
{
if
(
dialog
!=
null
)
{
dialog
=
dialog
.
getBuilder
().
title
(
title
).
build
();
dialog
.
show
();
}
else
{
MaterialDialog
.
Builder
builder
=
MaterialDialogUtils
.
showIndeterminateProgressNoTouchDialog
(
this
,
title
,
true
);
dialog
=
builder
.
show
();
}
}
}
/**
* =====================================================================禁止返回
**/
//注册ViewModel与View的契约UI回调事件
//注册ViewModel与View的契约UI回调事件
protected
void
registorUIChangeLiveDataCallBackNoTouch
()
{
protected
void
registorUIChangeLiveDataCallBackNoTouch
()
{
//加载对话框消失
//加载对话框消失
...
@@ -366,29 +386,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
...
@@ -366,29 +386,6 @@ public abstract class BaseActivity<V extends ViewDataBinding, VM extends BaseVie
}
}
/**
* 触发禁用返回键
*/
public
void
showNoTouchDialog
(
String
title
)
{
if
(
StringUtils
.
isEmpty
(
title
))
{
if
(
nullDialog
!=
null
)
{
nullDialog
.
show
();
}
else
{
nullDialog
=
new
NUllDialog
(
this
);
nullDialog
.
show
();
}
}
else
{
if
(
dialog
!=
null
)
{
dialog
=
dialog
.
getBuilder
().
title
(
title
).
build
();
dialog
.
show
();
}
else
{
MaterialDialog
.
Builder
builder
=
MaterialDialogUtils
.
showIndeterminateProgressNoTouchDialog
(
this
,
title
,
true
);
dialog
=
builder
.
show
();
}
}
}
public
void
showCommTextDialog
(
RefuseDialogBean
bean
,
CommTextDialog
.
onAcceptCallBack
callBack
)
{
public
void
showCommTextDialog
(
RefuseDialogBean
bean
,
CommTextDialog
.
onAcceptCallBack
callBack
)
{
CommTextDialog
textDialog
=
new
CommTextDialog
(
this
,
bean
,
callBack
);
CommTextDialog
textDialog
=
new
CommTextDialog
(
this
,
bean
,
callBack
);
...
...
mvvmhabit/src/main/java/me/goldze/mvvmhabit/base/BaseFragment.java
View file @
fc82e7ef
...
@@ -50,8 +50,9 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
...
@@ -50,8 +50,9 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
protected
VM
viewModel
;
protected
VM
viewModel
;
private
int
viewModelId
;
private
int
viewModelId
;
private
MaterialDialog
dialog
;
private
MaterialDialog
dialog
;
/*空值情况*/
private
NUllDialog
nullDialog
;
private
NUllDialog
nullDialog
;
Fragment
f
=
this
;
Fragment
f
=
this
;
@Override
@Override
...
@@ -141,7 +142,6 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
...
@@ -141,7 +142,6 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
protected
void
registorUIChangeLiveDataCallBack
()
{
protected
void
registorUIChangeLiveDataCallBack
()
{
//加载对话框显示
//加载对话框显示
//加载对话框显示
viewModel
.
getUC
().
getShowDialogEventNoTouch
().
observe
(
this
,
new
Observer
<
String
>()
{
viewModel
.
getUC
().
getShowDialogEventNoTouch
().
observe
(
this
,
new
Observer
<
String
>()
{
@Override
@Override
...
@@ -221,26 +221,6 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
...
@@ -221,26 +221,6 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
});
});
}
}
public
void
showCommTextDialog
(
RefuseDialogBean
bean
,
CommTextDialog
.
onAcceptCallBack
callBack
)
{
CommTextDialog
textDialog
=
new
CommTextDialog
(
getContext
(),
bean
,
callBack
);
textDialog
.
show
();
}
public
void
startPhoto
(
boolean
hasCamera
,
SelectCallback
callback
)
{
EasyPhotos
.
createAlbum
(
this
,
hasCamera
,
false
,
GlideEngine
.
getInstance
()).
setCount
(
1
)
.
setFileProviderAuthority
(
getAppProcessName
(
getContext
())
+
".fileProvider"
)
.
start
(
callback
);
}
public
void
showDialog
(
String
title
)
{
if
(
dialog
!=
null
)
{
dialog
=
dialog
.
getBuilder
().
title
(
title
).
build
();
dialog
.
show
();
}
else
{
MaterialDialog
.
Builder
builder
=
MaterialDialogUtils
.
showIndeterminateProgressDialog
(
getActivity
(),
title
,
true
);
dialog
=
builder
.
show
();
}
}
/**
/**
* 触发禁用返回键
* 触发禁用返回键
*/
*/
...
@@ -264,6 +244,29 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
...
@@ -264,6 +244,29 @@ public abstract class BaseFragment<V extends ViewDataBinding, VM extends BaseVie
}
}
public
void
showCommTextDialog
(
RefuseDialogBean
bean
,
CommTextDialog
.
onAcceptCallBack
callBack
)
{
CommTextDialog
textDialog
=
new
CommTextDialog
(
getContext
(),
bean
,
callBack
);
textDialog
.
show
();
}
public
void
startPhoto
(
boolean
hasCamera
,
SelectCallback
callback
)
{
EasyPhotos
.
createAlbum
(
this
,
hasCamera
,
false
,
GlideEngine
.
getInstance
()).
setCount
(
1
)
.
setFileProviderAuthority
(
getAppProcessName
(
getContext
())
+
".fileProvider"
)
.
start
(
callback
);
}
public
void
showDialog
(
String
title
)
{
if
(
dialog
!=
null
)
{
dialog
=
dialog
.
getBuilder
().
title
(
title
).
build
();
dialog
.
show
();
}
else
{
MaterialDialog
.
Builder
builder
=
MaterialDialogUtils
.
showIndeterminateProgressDialog
(
getActivity
(),
title
,
true
);
dialog
=
builder
.
show
();
}
}
public
void
dismissDialog
()
{
public
void
dismissDialog
()
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
dialog
.
dismiss
();
dialog
.
dismiss
();
...
...
xxviewlibrary/src/main/java/com/xx/xxviewlibrary/comm/CommTextDialog.kt
View file @
fc82e7ef
package
com.xx.xxviewlibrary.comm
package
com.xx.xxviewlibrary.comm
import
android.content.Context
import
android.content.Context
import
android.content.DialogInterface
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.Gravity
import
android.view.View
import
android.view.View
...
@@ -10,33 +11,47 @@ import com.xx.xxviewlibrary.base.xxBaseDialog
...
@@ -10,33 +11,47 @@ import com.xx.xxviewlibrary.base.xxBaseDialog
import
com.xx.xxviewlibrary.databinding.DialogCommTextBinding
import
com.xx.xxviewlibrary.databinding.DialogCommTextBinding
import
me.jessyan.autosize.utils.AutoSizeUtils
import
me.jessyan.autosize.utils.AutoSizeUtils
class
CommTextDialog
(
context
:
Context
,
var
bean
:
RefuseDialogBean
,
var
callback
:
onAcceptCallBack
):
xxBaseDialog
<
DialogCommTextBinding
>(
context
)
{
class
CommTextDialog
(
context
:
Context
,
var
bean
:
RefuseDialogBean
,
var
callback
:
onAcceptCallBack
)
:
xxBaseDialog
<
DialogCommTextBinding
>(
context
)
{
var
dismissBack
:
Boolean
=
true
;
override
fun
InitView
():
DialogSet
{
override
fun
InitView
():
DialogSet
{
return
DialogSet
(
R
.
layout
.
dialog_comm_text
,
false
,
return
DialogSet
(
Gravity
.
CENTER_HORIZONTAL
or
Gravity
.
CENTER_VERTICAL
,
true
,
AutoSizeUtils
.
dp2px
(
context
,
285.0F
),
R
.
layout
.
dialog_comm_text
,
WindowManager
.
LayoutParams
.
WRAP_CONTENT
)
false
,
Gravity
.
CENTER_HORIZONTAL
or
Gravity
.
CENTER_VERTICAL
,
true
,
AutoSizeUtils
.
dp2px
(
context
,
285.0F
),
WindowManager
.
LayoutParams
.
WRAP_CONTENT
)
}
}
override
fun
InitData
()
{
override
fun
InitData
()
{
binding
.
model
=
bean
binding
.
model
=
bean
binding
.
dialog
=
this
binding
.
dialog
=
this
/*关闭弹窗监听事件,使其手机返回上一级功能和取消功能一致*/
/* if (TextUtils.isEmpty(bean.refuseTxt))
setOnDismissListener
{
{
if
(
dismissBack
)
{
binding.btnRefuse.visibility=View.GONE
/*调用取消功能*/
}*/
callback
.
refuseBack
()
}
}
/* if (TextUtils.isEmpty(bean.refuseTxt))
{
binding.btnRefuse.visibility=View.GONE
}*/
}
}
fun
refuseClick
(
view
:
View
)
fun
refuseClick
(
view
:
View
)
{
{
callback
.
refuseBack
()
callback
.
refuseBack
()
dismissBack
=
false
dismiss
()
dismiss
()
}
}
fun
acceptClick
(
view
:
View
)
fun
acceptClick
(
view
:
View
)
{
{
callback
.
acceptBack
()
callback
.
acceptBack
()
dismissBack
=
false
dismiss
()
dismiss
()
}
}
...
@@ -44,4 +59,4 @@ class CommTextDialog(context: Context, var bean : RefuseDialogBean, var callback
...
@@ -44,4 +59,4 @@ class CommTextDialog(context: Context, var bean : RefuseDialogBean, var callback
fun
acceptBack
()
fun
acceptBack
()
fun
refuseBack
()
fun
refuseBack
()
}
}
}
}
\ 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