Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
8f3643b6
Commit
8f3643b6
authored
Nov 03, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道组件kotlin化,异常处理
parent
9e3d311b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
262 deletions
+201
-262
ChannelInfoBean.java
.../main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
+0
-59
ChannelInfoBean.kt
...rc/main/java/com/miya/fastcashier/bean/ChannelInfoBean.kt
+23
-0
PathAdapter.java
...ain/java/com/miya/fastcashier/ui/adapter/PathAdapter.java
+0
-200
PathAdapter.kt
.../main/java/com/miya/fastcashier/ui/adapter/PathAdapter.kt
+175
-0
ChannelManageKit.kt
...java/com/miya/fastcashier/util/manage/ChannelManageKit.kt
+3
-3
No files found.
app/src/main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
deleted
100644 → 0
View file @
9e3d311b
package
com
.
miya
.
fastcashier
.
bean
;
import
com.fastcashier.lib_common.base.BaseBean
;
import
java.util.List
;
/**
* 类描述:渠道配置信息
* 创建人:zpxiang
* 创建时间:
* 修改人:
* 修改时间:
*/
public
class
ChannelInfoBean
extends
BaseBean
{
/**
* ChannelId : 1
* ChannelName : 匡威
* ChannelNameEn : converse
* ChannelAccountArray : ["6011","6013","6014","6017","6021"]
*/
private
String
ChannelId
;
private
String
ChannelName
;
private
String
ChannelNameEn
;
private
List
<
String
>
ChannelAccountArray
;
public
void
setChannelId
(
String
channelId
)
{
ChannelId
=
channelId
;
}
public
String
getChannelId
()
{
return
ChannelId
;
}
public
String
getChannelName
()
{
return
ChannelName
;
}
public
void
setChannelName
(
String
channelName
)
{
ChannelName
=
channelName
;
}
public
String
getChannelNameEn
()
{
return
ChannelNameEn
;
}
public
void
setChannelNameEn
(
String
channelNameEn
)
{
ChannelNameEn
=
channelNameEn
;
}
public
List
<
String
>
getChannelAccountArray
()
{
return
ChannelAccountArray
;
}
public
void
setChannelAccountArray
(
List
<
String
>
channelAccountArray
)
{
ChannelAccountArray
=
channelAccountArray
;
}
}
app/src/main/java/com/miya/fastcashier/bean/ChannelInfoBean.kt
0 → 100644
View file @
8f3643b6
package
com.miya.fastcashier.bean
import
com.fastcashier.lib_common.base.BaseBean
/**
* 类描述:渠道配置信息
* 创建人:zpxiang
* 创建时间:
* 修改人:
* 修改时间:
*/
class
ChannelInfoBean
:
BaseBean
()
{
/**
* ChannelId : 1
* ChannelName : 匡威
* ChannelNameEn : converse
* ChannelAccountArray : ["6011","6013","6014","6017","6021"]
*/
var
channelId
:
String
?
=
null
var
channelName
:
String
?
=
null
var
channelNameEn
:
String
?
=
null
var
channelAccountArray
:
List
<
String
>?
=
null
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/ui/adapter/PathAdapter.java
deleted
100644 → 0
View file @
9e3d311b
package
com
.
miya
.
fastcashier
.
ui
.
adapter
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.CompoundButton
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.util.FileUtils
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.util.List
;
import
androidx.recyclerview.widget.RecyclerView
;
/**
* 作者:Leon
* 时间:2017/3/15 15:47
*/
public
class
PathAdapter
extends
RecyclerView
.
Adapter
<
PathAdapter
.
PathViewHolder
>
{
public
interface
OnItemClickListener
{
void
click
(
int
position
);
}
public
interface
OnCancelChoosedListener
{
void
cancelChoosed
(
CheckBox
checkBox
);
}
private
final
String
TAG
=
"FilePickerLeon"
;
private
List
<
File
>
mListData
;
private
Context
mContext
;
public
OnItemClickListener
onItemClickListener
;
private
FileFilter
mFileFilter
;
private
boolean
[]
mCheckedFlags
;
private
boolean
mMutilyMode
;
private
int
mIconStyle
;
private
boolean
mIsGreater
;
private
long
mFileSize
;
public
PathAdapter
(
List
<
File
>
mListData
,
Context
mContext
,
FileFilter
mFileFilter
,
boolean
mMutilyMode
,
boolean
mIsGreater
,
long
mFileSize
)
{
this
.
mListData
=
mListData
;
this
.
mContext
=
mContext
;
this
.
mFileFilter
=
mFileFilter
;
this
.
mMutilyMode
=
mMutilyMode
;
this
.
mIsGreater
=
mIsGreater
;
this
.
mFileSize
=
mFileSize
;
mCheckedFlags
=
new
boolean
[
mListData
.
size
()];
}
@Override
public
PathViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
View
.
inflate
(
mContext
,
R
.
layout
.
layout_lfile_list_item
,
null
);
PathViewHolder
pathViewHolder
=
new
PathViewHolder
(
view
);
return
pathViewHolder
;
}
@Override
public
int
getItemCount
()
{
return
mListData
.
size
();
}
@Override
public
void
onBindViewHolder
(
final
PathViewHolder
holder
,
@SuppressLint
(
"RecyclerView"
)
int
position
)
{
final
File
file
=
mListData
.
get
(
position
);
if
(
file
.
isFile
())
{
updateFileIconStyle
(
holder
.
ivType
);
holder
.
tvName
.
setText
(
file
.
getName
());
holder
.
tvDetail
.
setText
(
mContext
.
getString
(
R
.
string
.
lfile_FileSize
)
+
" "
+
FileUtils
.
getReadableFileSize
(
file
.
length
()));
holder
.
cbChoose
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
updateFloaderIconStyle
(
holder
.
ivType
);
holder
.
tvName
.
setText
(
file
.
getName
());
//文件大小过滤
List
files
=
FileUtils
.
getFileList
(
file
.
getAbsolutePath
(),
mFileFilter
,
mIsGreater
,
mFileSize
);
if
(
files
==
null
)
{
holder
.
tvDetail
.
setText
(
"0 "
+
mContext
.
getString
(
R
.
string
.
lfile_LItem
));
}
else
{
holder
.
tvDetail
.
setText
(
files
.
size
()
+
" "
+
mContext
.
getString
(
R
.
string
.
lfile_LItem
));
}
holder
.
cbChoose
.
setVisibility
(
View
.
GONE
);
}
if
(!
mMutilyMode
)
{
holder
.
cbChoose
.
setVisibility
(
View
.
GONE
);
}
holder
.
layoutRoot
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
file
.
isFile
())
{
holder
.
cbChoose
.
setChecked
(!
holder
.
cbChoose
.
isChecked
());
}
onItemClickListener
.
click
(
position
);
}
});
holder
.
cbChoose
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//同步复选框和外部布局点击的处理
onItemClickListener
.
click
(
position
);
}
});
holder
.
cbChoose
.
setOnCheckedChangeListener
(
null
);
//先设置一次CheckBox的选中监听器,传入参数null
holder
.
cbChoose
.
setChecked
(
mCheckedFlags
[
position
]);
//用数组中的值设置CheckBox的选中状态
//再设置一次CheckBox的选中监听器,当CheckBox的选中状态发生改变时,把改变后的状态储存在数组中
holder
.
cbChoose
.
setOnCheckedChangeListener
(
new
CompoundButton
.
OnCheckedChangeListener
()
{
@Override
public
void
onCheckedChanged
(
CompoundButton
compoundButton
,
boolean
b
)
{
mCheckedFlags
[
position
]
=
b
;
}
});
}
private
void
updateFloaderIconStyle
(
ImageView
imageView
)
{
// switch (mIconStyle) {
// case Constant.ICON_STYLE_BLUE:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_blue);
// break;
// case Constant.ICON_STYLE_GREEN:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_green);
// break;
// case Constant.ICON_STYLE_YELLOW:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_yellow);
// break;
// }
}
private
void
updateFileIconStyle
(
ImageView
imageView
)
{
// switch (mIconStyle) {
// case Constant.ICON_STYLE_BLUE:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_blue);
// break;
// case Constant.ICON_STYLE_GREEN:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_green);
// break;
// case Constant.ICON_STYLE_YELLOW:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_yellow);
// break;
// }
}
/**
* 设置监听器
*
* @param onItemClickListener
*/
public
void
setOnItemClickListener
(
OnItemClickListener
onItemClickListener
)
{
this
.
onItemClickListener
=
onItemClickListener
;
}
/**
* 设置数据源
*
* @param mListData
*/
public
void
setmListData
(
List
<
File
>
mListData
)
{
this
.
mListData
=
mListData
;
mCheckedFlags
=
new
boolean
[
mListData
.
size
()];
}
public
void
setmIconStyle
(
int
mIconStyle
)
{
this
.
mIconStyle
=
mIconStyle
;
}
/**
* 设置是否全选
*
* @param isAllSelected
*/
public
void
updateAllSelelcted
(
boolean
isAllSelected
)
{
for
(
int
i
=
0
;
i
<
mCheckedFlags
.
length
;
i
++)
{
mCheckedFlags
[
i
]
=
isAllSelected
;
}
notifyDataSetChanged
();
}
class
PathViewHolder
extends
RecyclerView
.
ViewHolder
{
private
RelativeLayout
layoutRoot
;
private
ImageView
ivType
;
private
TextView
tvName
;
private
TextView
tvDetail
;
private
CheckBox
cbChoose
;
public
PathViewHolder
(
View
itemView
)
{
super
(
itemView
);
ivType
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
iv_type
);
layoutRoot
=
(
RelativeLayout
)
itemView
.
findViewById
(
R
.
id
.
layout_item_root
);
tvName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
tv_name
);
tvDetail
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
tv_detail
);
cbChoose
=
(
CheckBox
)
itemView
.
findViewById
(
R
.
id
.
cb_choose
);
}
}
}
app/src/main/java/com/miya/fastcashier/ui/adapter/PathAdapter.kt
0 → 100644
View file @
8f3643b6
package
com.miya.fastcashier.ui.adapter
import
androidx.recyclerview.widget.RecyclerView
import
com.miya.fastcashier.ui.adapter.PathAdapter.PathViewHolder
import
android.view.ViewGroup
import
com.miya.fastcashier.R
import
android.annotation.SuppressLint
import
android.content.Context
import
android.view.View
import
android.widget.*
import
com.miya.fastcashier.util.FileUtils
import
java.io.File
import
java.io.FileFilter
class
PathAdapter
(
private
var
mListData
:
List
<
File
>,
private
val
mContext
:
Context
,
private
val
mFileFilter
:
FileFilter
,
private
val
mMutilyMode
:
Boolean
,
private
val
mIsGreater
:
Boolean
,
private
val
mFileSize
:
Long
)
:
RecyclerView
.
Adapter
<
PathViewHolder
>()
{
interface
OnItemClickListener
{
fun
click
(
position
:
Int
)
}
interface
OnCancelChoosedListener
{
fun
cancelChoosed
(
checkBox
:
CheckBox
?)
}
private
val
TAG
=
"FilePickerLeon"
var
onItemClickListener
:
OnItemClickListener
?
=
null
private
var
mCheckedFlags
:
BooleanArray
private
var
mIconStyle
=
0
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
PathViewHolder
{
val
view
=
View
.
inflate
(
mContext
,
R
.
layout
.
layout_lfile_list_item
,
null
)
return
PathViewHolder
(
view
)
}
override
fun
getItemCount
():
Int
{
return
mListData
.
size
}
override
fun
onBindViewHolder
(
holder
:
PathViewHolder
,
@SuppressLint
(
"RecyclerView"
)
position
:
Int
)
{
val
file
=
mListData
[
position
]
if
(
file
.
isFile
)
{
updateFileIconStyle
(
holder
.
ivType
)
holder
.
tvName
.
text
=
file
.
name
holder
.
tvDetail
.
text
=
mContext
.
getString
(
R
.
string
.
lfile_FileSize
)
+
" "
+
FileUtils
.
getReadableFileSize
(
file
.
length
()
)
holder
.
cbChoose
.
visibility
=
View
.
VISIBLE
}
else
{
updateFloaderIconStyle
(
holder
.
ivType
)
holder
.
tvName
.
text
=
file
.
name
//文件大小过滤
val
files
:
List
<*>?
=
FileUtils
.
getFileList
(
file
.
absolutePath
,
mFileFilter
,
mIsGreater
,
mFileSize
)
if
(
files
==
null
)
{
holder
.
tvDetail
.
text
=
"0 "
+
mContext
.
getString
(
R
.
string
.
lfile_LItem
)
}
else
{
holder
.
tvDetail
.
text
=
files
.
size
.
toString
()
+
" "
+
mContext
.
getString
(
R
.
string
.
lfile_LItem
)
}
holder
.
cbChoose
.
visibility
=
View
.
GONE
}
if
(!
mMutilyMode
)
{
holder
.
cbChoose
.
visibility
=
View
.
GONE
}
holder
.
layoutRoot
.
setOnClickListener
{
if
(
file
.
isFile
)
{
holder
.
cbChoose
.
isChecked
=
!
holder
.
cbChoose
.
isChecked
}
onItemClickListener
!!
.
click
(
position
)
}
holder
.
cbChoose
.
setOnClickListener
{
//同步复选框和外部布局点击的处理
onItemClickListener
!!
.
click
(
position
)
}
holder
.
cbChoose
.
setOnCheckedChangeListener
(
null
)
//先设置一次CheckBox的选中监听器,传入参数null
holder
.
cbChoose
.
isChecked
=
mCheckedFlags
[
position
]
//用数组中的值设置CheckBox的选中状态
//再设置一次CheckBox的选中监听器,当CheckBox的选中状态发生改变时,把改变后的状态储存在数组中
holder
.
cbChoose
.
setOnCheckedChangeListener
{
compoundButton
,
b
->
mCheckedFlags
[
position
]
=
b
}
}
private
fun
updateFloaderIconStyle
(
imageView
:
ImageView
)
{
// switch (mIconStyle) {
// case Constant.ICON_STYLE_BLUE:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_blue);
// break;
// case Constant.ICON_STYLE_GREEN:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_green);
// break;
// case Constant.ICON_STYLE_YELLOW:
// imageView.setBackgroundResource(R.mipmap.lfile_folder_style_yellow);
// break;
// }
}
private
fun
updateFileIconStyle
(
imageView
:
ImageView
)
{
// switch (mIconStyle) {
// case Constant.ICON_STYLE_BLUE:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_blue);
// break;
// case Constant.ICON_STYLE_GREEN:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_green);
// break;
// case Constant.ICON_STYLE_YELLOW:
// imageView.setBackgroundResource(R.mipmap.lfile_file_style_yellow);
// break;
// }
}
/**
* 设置监听器
*
* @param onItemClickListener
*/
@JvmName
(
"setOnItemClickListener1"
)
fun
setOnItemClickListener
(
onItemClickListener
:
OnItemClickListener
?)
{
this
.
onItemClickListener
=
onItemClickListener
}
/**
* 设置数据源
*
* @param mListData
*/
fun
setmListData
(
mListData
:
List
<
File
>)
{
this
.
mListData
=
mListData
mCheckedFlags
=
BooleanArray
(
mListData
.
size
)
}
fun
setmIconStyle
(
mIconStyle
:
Int
)
{
this
.
mIconStyle
=
mIconStyle
}
/**
* 设置是否全选
*
* @param isAllSelected
*/
fun
updateAllSelelcted
(
isAllSelected
:
Boolean
)
{
for
(
i
in
mCheckedFlags
.
indices
)
{
mCheckedFlags
[
i
]
=
isAllSelected
}
notifyDataSetChanged
()
}
inner
class
PathViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
layoutRoot
:
RelativeLayout
val
ivType
:
ImageView
val
tvName
:
TextView
val
tvDetail
:
TextView
val
cbChoose
:
CheckBox
init
{
ivType
=
itemView
.
findViewById
<
View
>(
R
.
id
.
iv_type
)
as
ImageView
layoutRoot
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layout_item_root
)
as
RelativeLayout
tvName
=
itemView
.
findViewById
<
View
>(
R
.
id
.
tv_name
)
as
TextView
tvDetail
=
itemView
.
findViewById
<
View
>(
R
.
id
.
tv_detail
)
as
TextView
cbChoose
=
itemView
.
findViewById
<
View
>(
R
.
id
.
cb_choose
)
as
CheckBox
}
}
init
{
mCheckedFlags
=
BooleanArray
(
mListData
.
size
)
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/util/manage/ChannelManageKit.kt
View file @
8f3643b6
...
...
@@ -49,7 +49,7 @@ object ChannelManageKit {
for
(
i
in
channelInfoList
.
indices
)
{
val
channelInfoBean
=
channelInfoList
[
i
]
val
channelAccountArray
=
channelInfoBean
.
channelAccountArray
if
(
channelAccountArray
.
isEmpty
()
)
{
if
(
null
==
channelAccountArray
)
{
initDefaultChannelRes
()
continue
}
...
...
@@ -92,7 +92,7 @@ object ChannelManageKit {
val
containsKey
=
channelMap
!!
.
containsKey
(
getUserName
())
return
if
(!
containsKey
)
{
CHANNEL_OFFICIAL_CHANNELNAME
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelName
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelName
!!
}
/**
...
...
@@ -107,7 +107,7 @@ object ChannelManageKit {
}
return
if
(!
channelMap
!!
.
containsKey
(
getUserName
()))
{
CHANNEL_OFFICIAL_ACCOUNT
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelId
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelId
!!
}
fun
clearChannelResData
()
{
...
...
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