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
512fdfe6
Commit
512fdfe6
authored
May 10, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看本地日志功能添加,日志浏览配置完成
parent
e0f31f6f
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1240 additions
and
11 deletions
+1240
-11
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-3
CustomImageCenterDialog.java
...ava/com/miya/fastcashier/log/CustomImageCenterDialog.java
+153
-0
EmptyRecyclerView.java
...main/java/com/miya/fastcashier/log/EmptyRecyclerView.java
+62
-0
FileComparator.java
...rc/main/java/com/miya/fastcashier/log/FileComparator.java
+26
-0
FileUtils.java
app/src/main/java/com/miya/fastcashier/log/FileUtils.java
+92
-0
LFileFilter.java
app/src/main/java/com/miya/fastcashier/log/LFileFilter.java
+33
-0
LFilePicker.java
app/src/main/java/com/miya/fastcashier/log/LFilePicker.java
+7
-8
LFilePickerActivity.java
...in/java/com/miya/fastcashier/log/LFilePickerActivity.java
+465
-0
PathAdapter.java
app/src/main/java/com/miya/fastcashier/log/PathAdapter.java
+199
-0
selector_file_item_bg.xml
app/src/main/res/drawable/selector_file_item_bg.xml
+6
-0
shape_dialog_btn_normal_bg.xml
app/src/main/res/drawable/shape_dialog_btn_normal_bg.xml
+7
-0
shape_dialog_btn_pressed_bg.xml
app/src/main/res/drawable/shape_dialog_btn_pressed_bg.xml
+6
-0
shape_lfile_back_bg.xml
app/src/main/res/drawable/shape_lfile_back_bg.xml
+7
-0
shape_lfile_btn_bg.xml
app/src/main/res/drawable/shape_lfile_btn_bg.xml
+7
-0
activity_lfile_picker.xml
app/src/main/res/layout/activity_lfile_picker.xml
+77
-0
layout_lfile_emptyview.xml
app/src/main/res/layout/layout_lfile_emptyview.xml
+25
-0
layout_lfile_list_item.xml
app/src/main/res/layout/layout_lfile_list_item.xml
+56
-0
menu_main_toolbar.xml
app/src/main/res/menu/menu_main_toolbar.xml
+9
-0
app_icon_lfile_file_style_green.png
...main/res/mipmap-xhdpi/app_icon_lfile_file_style_green.png
+0
-0
app_icon_lfile_up.png
app/src/main/res/mipmap-xhdpi/app_icon_lfile_up.png
+0
-0
lfile_emptyimg.png
app/src/main/res/mipmap-xhdpi/lfile_emptyimg.png
+0
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
512fdfe6
...
...
@@ -60,9 +60,9 @@
<activity
android:name=
".log.FunctionCenterActivity"
android:exported=
"true"
/>
<!-- <activity-->
<!-- android:name=".log.LFilePickerActivity"-->
<!-- android:exported="true" />--
>
<activity
android:name=
".log.LFilePickerActivity"
android:exported=
"true"
/
>
</application>
...
...
app/src/main/java/com/miya/fastcashier/log/CustomImageCenterDialog.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.blankj.utilcode.util.SizeUtils
;
import
com.miya.fastcashier.R
;
import
com.miya.print.utils.QRCodeUtil
;
import
androidx.annotation.NonNull
;
public
class
CustomImageCenterDialog
extends
Dialog
{
private
TextView
tvOk
;
private
TextView
tvHint
;
private
ImageView
ivContent
;
boolean
isFullScreen
;
private
String
mImageContent
;
private
String
mHintContentText
;
private
String
mConfirmContent
;
private
Bitmap
mQrCodeBitmap
;
/**
* 设置是否全屏显示
*
* @param isFullScreen
* @return
*/
public
CustomImageCenterDialog
setFullScreen
(
boolean
isFullScreen
)
{
this
.
isFullScreen
=
isFullScreen
;
return
this
;
}
@Override
public
void
onWindowFocusChanged
(
boolean
hasFocus
)
{
super
.
onWindowFocusChanged
(
hasFocus
);
if
(
isFullScreen
)
{
setFullScreen
();
}
}
/**
* 隐藏虚拟按键,并且全屏
*/
protected
void
setFullScreen
()
{
//隐藏虚拟按键,并且全屏
if
(
Build
.
VERSION
.
SDK_INT
>
11
&&
Build
.
VERSION
.
SDK_INT
<
19
)
{
// lower api
View
v
=
this
.
getWindow
().
getDecorView
();
v
.
setSystemUiVisibility
(
View
.
GONE
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
//for new api versions.
View
decorView
=
getWindow
().
getDecorView
();
int
uiOptions
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION//暂时不需要hideNavigation
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
// hide status bar
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE_STICKY
;
decorView
.
setSystemUiVisibility
(
uiOptions
);
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
}
}
public
CustomImageCenterDialog
(
@NonNull
Context
context
)
{
super
(
context
,
R
.
style
.
CommonDialog
);
initWindows
();
setCanceledOnTouchOutside
(
false
);
// setContentView(R.layout.dialog_center_image);
setCancelable
(
true
);
initView
();
}
private
void
initView
()
{
// tvOk = findViewById(R.id.tvOk);
// tvHint = findViewById(R.id.tvSubContent);
// ivContent = findViewById(R.id.ivContent);
}
public
CustomImageCenterDialog
setQrContent
(
String
msg
)
{
mImageContent
=
msg
;
return
this
;
}
public
CustomImageCenterDialog
setConfirmContent
(
String
msg
)
{
mConfirmContent
=
msg
;
return
this
;
}
public
CustomImageCenterDialog
setHintContent
(
String
msg
)
{
mHintContentText
=
msg
;
return
this
;
}
/**
* 创建dialog
*
* @return
*/
public
CustomImageCenterDialog
build
()
{
if
(!
TextUtils
.
isEmpty
(
mConfirmContent
)){
tvOk
.
setText
(
mConfirmContent
);
}
if
(!
TextUtils
.
isEmpty
(
mHintContentText
)){
tvHint
.
setText
(
mHintContentText
);
}
if
(!
TextUtils
.
isEmpty
(
mImageContent
)){
mQrCodeBitmap
=
QRCodeUtil
.
createQRCodeBitmap
(
mImageContent
,
SizeUtils
.
dp2px
(
300
));
ivContent
.
setImageBitmap
(
mQrCodeBitmap
);
}
tvOk
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
mQrCodeBitmap
!=
null
)
{
mQrCodeBitmap
.
recycle
();
}
dismiss
();
}
});
if
(
isFullScreen
)
{
setFullScreen
();
}
return
this
;
}
/**
* 初始化对话框(供子类选择调用)
*/
protected
void
initWindows
()
{
Window
win
=
this
.
getWindow
();
win
.
requestFeature
(
Window
.
FEATURE_NO_TITLE
);
win
.
getDecorView
().
setPadding
(
0
,
0
,
0
,
0
);
WindowManager
.
LayoutParams
lp
=
win
.
getAttributes
();
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
;
lp
.
height
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
;
// lp.windowAnimations = R.style.LightInAndOutStyle;
lp
.
gravity
=
Gravity
.
CENTER
;
win
.
setAttributes
(
lp
);
win
.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
);
}
}
app/src/main/java/com/miya/fastcashier/log/EmptyRecyclerView.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
/**
* 作者:Leon
* 时间:2017/3/17 13:44
*/
public
class
EmptyRecyclerView
extends
RecyclerView
{
private
View
mEmptyView
;
public
EmptyRecyclerView
(
Context
context
)
{
super
(
context
);
}
public
EmptyRecyclerView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
public
EmptyRecyclerView
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyle
)
{
super
(
context
,
attrs
,
defStyle
);
}
/**
* 根据数据源判断是否显示空白view
*/
private
void
checkIfEmpty
()
{
if
(
mEmptyView
!=
null
||
getAdapter
()
!=
null
)
{
mEmptyView
.
setVisibility
(
getAdapter
().
getItemCount
()
>
0
?
GONE
:
VISIBLE
);
}
}
public
void
setmEmptyView
(
View
mEmptyView
)
{
this
.
mEmptyView
=
mEmptyView
;
checkIfEmpty
();
}
@Override
public
void
setAdapter
(
Adapter
adapter
)
{
Adapter
adapterOld
=
getAdapter
();
if
(
adapterOld
!=
null
)
{
adapterOld
.
unregisterAdapterDataObserver
(
observer
);
}
super
.
setAdapter
(
adapter
);
if
(
adapter
!=
null
)
{
adapter
.
registerAdapterDataObserver
(
observer
);
}
}
AdapterDataObserver
observer
=
new
AdapterDataObserver
()
{
@Override
public
void
onChanged
()
{
super
.
onChanged
();
checkIfEmpty
();
}
};
}
app/src/main/java/com/miya/fastcashier/log/FileComparator.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
java.io.File
;
import
java.util.Comparator
;
/**
* Created by Dimorinny on 24.10.15.
*/
public
class
FileComparator
implements
Comparator
<
File
>
{
@Override
public
int
compare
(
File
f1
,
File
f2
)
{
if
(
f1
==
f2
)
{
return
0
;
}
if
(
f1
.
isDirectory
()
&&
f2
.
isFile
())
{
// Show directories above files
return
-
1
;
}
if
(
f1
.
isFile
()
&&
f2
.
isDirectory
())
{
// Show files below directories
return
1
;
}
// Sort the directories alphabetically
return
f1
.
getName
().
compareToIgnoreCase
(
f2
.
getName
());
}
}
app/src/main/java/com/miya/fastcashier/log/FileUtils.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Created by Dimorinny on 24.10.15.
*/
public
class
FileUtils
{
public
static
List
<
File
>
getFileListByDirPath
(
String
path
,
FileFilter
filter
)
{
File
directory
=
new
File
(
path
);
File
[]
files
=
directory
.
listFiles
(
filter
);
List
<
File
>
result
=
new
ArrayList
<>();
if
(
files
==
null
)
{
return
new
ArrayList
<>();
}
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
result
.
add
(
files
[
i
]);
}
Collections
.
sort
(
result
,
new
FileComparator
());
return
result
;
}
public
static
String
cutLastSegmentOfPath
(
String
path
)
{
return
path
.
substring
(
0
,
path
.
lastIndexOf
(
"/"
));
}
public
static
String
getReadableFileSize
(
long
size
)
{
if
(
size
<=
0
)
return
"0"
;
final
String
[]
units
=
new
String
[]{
"B"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
};
int
digitGroups
=
(
int
)
(
Math
.
log10
(
size
)
/
Math
.
log10
(
1024
));
return
new
DecimalFormat
(
"#"
).
format
(
size
/
Math
.
pow
(
1024
,
digitGroups
))
+
" "
+
units
[
digitGroups
];
}
/**
* 获取文件长度
*
* @param file 文件
* @return 文件长度
*/
public
static
long
getFileLength
(
final
File
file
)
{
if
(!
isFile
(
file
))
return
-
1
;
return
file
.
length
();
}
/**
* 判断是否是文件
*
* @param file 文件
* @return {@code true}: 是<br>{@code false}: 否
*/
public
static
boolean
isFile
(
final
File
file
)
{
return
file
!=
null
&&
file
.
exists
()
&&
file
.
isFile
();
}
/**
* 根据地址获取当前地址下的所有目录和文件,并且排序,同时过滤掉不符合大小要求的文件
*
* @param path
* @return List<File>
*/
public
static
List
<
File
>
getFileList
(
String
path
,
FileFilter
filter
,
boolean
isGreater
,
long
targetSize
)
{
List
<
File
>
list
=
FileUtils
.
getFileListByDirPath
(
path
,
filter
);
//进行过滤文件大小
Iterator
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
())
{
File
f
=
(
File
)
iterator
.
next
();
if
(
f
.
isFile
())
{
//获取当前文件大小
long
size
=
FileUtils
.
getFileLength
(
f
);
if
(
isGreater
)
{
//当前想要留下大于指定大小的文件,所以过滤掉小于指定大小的文件
if
(
size
<
targetSize
)
{
iterator
.
remove
();
}
}
else
{
//当前想要留下小于指定大小的文件,所以过滤掉大于指定大小的文件
if
(
size
>
targetSize
)
{
iterator
.
remove
();
}
}
}
}
return
list
;
}
}
app/src/main/java/com/miya/fastcashier/log/LFileFilter.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
java.io.File
;
import
java.io.FileFilter
;
/**
* 作者:Leon
* 时间:2017/3/24 13:43
*/
public
class
LFileFilter
implements
FileFilter
{
private
String
[]
mTypes
;
public
LFileFilter
(
String
[]
types
)
{
this
.
mTypes
=
types
;
}
@Override
public
boolean
accept
(
File
file
)
{
if
(
file
.
isDirectory
())
{
return
true
;
}
if
(
mTypes
!=
null
&&
mTypes
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
mTypes
.
length
;
i
++)
{
if
(
file
.
getName
().
endsWith
(
mTypes
[
i
].
toLowerCase
())
||
file
.
getName
().
endsWith
(
mTypes
[
i
].
toUpperCase
()))
{
return
true
;
}
}
}
else
{
return
true
;
}
return
false
;
}
}
app/src/main/java/com/miya/fastcashier/log/LFilePicker.java
View file @
512fdfe6
...
...
@@ -270,14 +270,13 @@ public class LFilePicker {
private
Intent
initIntent
()
{
// Intent intent;
// if (mActivity != null) {
// intent = new Intent(mActivity, LFilePickerActivity.class);
// } else {
// intent = new Intent(mFragment.getActivity(), LFilePickerActivity.class);
// }
// return intent;
return
null
;
Intent
intent
;
if
(
mActivity
!=
null
)
{
intent
=
new
Intent
(
mActivity
,
LFilePickerActivity
.
class
);
}
else
{
intent
=
new
Intent
(
mFragment
.
getActivity
(),
LFilePickerActivity
.
class
);
}
return
intent
;
}
@NonNull
...
...
app/src/main/java/com/miya/fastcashier/log/LFilePickerActivity.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.blankj.utilcode.util.EncodeUtils
;
import
com.blankj.utilcode.util.StringUtils
;
import
com.miya.fastcashier.BuildConfig
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.beans.SelfCashierTerminalConfig
;
import
com.miya.fastcashier.service.AccountService
;
import
com.miya.fastcashier.ui.BaseActivity
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
public
class
LFilePickerActivity
extends
BaseActivity
{
private
final
String
TAG
=
"FilePickerLeon"
;
private
CustomImageCenterDialog
mCustomImageCenterDialog
;
private
EmptyRecyclerView
mRecylerView
;
private
View
mEmptyView
;
private
TextView
mTvPath
;
private
TextView
mTvBack
;
private
Button
mBtnAddBook
;
private
String
mPath
;
private
PathAdapter
mPathAdapter
;
private
Toolbar
mToolbar
;
private
ParamEntity
mParamEntity
;
private
boolean
mIsAllSelected
=
false
;
private
Menu
mMenu
;
private
Toast
successToast
;
protected
SelfCashierTerminalConfig
selfCashierTerminalConfig
;
private
LFileFilter
mFilter
;
private
List
<
File
>
mListFiles
;
private
ArrayList
<
String
>
mListNumbers
=
new
ArrayList
<
String
>();
//存放选中条目的数据地址
private
String
mQrCodeEncodeMsg
;
private
byte
[]
dialogLock
=
new
byte
[
0
];
public
static
boolean
isProhibitWrite
=
false
;
//是否禁止写入文件
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
mParamEntity
=
(
ParamEntity
)
getIntent
().
getExtras
().
getSerializable
(
"param"
);
setTheme
(
mParamEntity
.
getTheme
());
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_lfile_picker
);
selfCashierTerminalConfig
=
AccountService
.
INSTANCE
.
getAccountInfo
().
transformToSelfCashierTermianlConfig
();
initView
();
setSupportActionBar
(
mToolbar
);
getSupportActionBar
().
setHomeButtonEnabled
(
true
);
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
initToolbar
();
updateAddButton
();
if
(!
checkSDState
())
{
Toast
.
makeText
(
this
,
R
.
string
.
lfile_NotFoundPath
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
mPath
=
mParamEntity
.
getPath
();
if
(
StringUtils
.
isEmpty
(
mPath
))
{
//如果没有指定路径,则使用默认路径
mPath
=
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
();
}
mTvPath
.
setText
(
mPath
);
mFilter
=
new
LFileFilter
(
mParamEntity
.
getFileTypes
());
mListFiles
=
FileUtils
.
getFileList
(
mPath
,
mFilter
,
mParamEntity
.
isGreater
(),
mParamEntity
.
getFileSize
());
mPathAdapter
=
new
PathAdapter
(
mListFiles
,
this
,
mFilter
,
mParamEntity
.
isMutilyMode
(),
mParamEntity
.
isGreater
(),
mParamEntity
.
getFileSize
());
mRecylerView
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
mPathAdapter
.
setmIconStyle
(
mParamEntity
.
getIconStyle
());
mRecylerView
.
setAdapter
(
mPathAdapter
);
mRecylerView
.
setmEmptyView
(
mEmptyView
);
mCustomImageCenterDialog
=
new
CustomImageCenterDialog
(
this
);
initListener
();
}
/**
* 更新Toolbar展示
*/
private
void
initToolbar
()
{
if
(
mParamEntity
.
getTitle
()
!=
null
)
{
mToolbar
.
setTitle
(
mParamEntity
.
getTitle
());
}
if
(
mParamEntity
.
getTitleStyle
()
!=
0
)
{
mToolbar
.
setTitleTextAppearance
(
this
,
mParamEntity
.
getTitleStyle
());
}
if
(
mParamEntity
.
getTitleColor
()
!=
null
)
{
mToolbar
.
setTitleTextColor
(
Color
.
parseColor
(
mParamEntity
.
getTitleColor
()));
//设置标题颜色
}
if
(
mParamEntity
.
getBackgroundColor
()
!=
null
)
{
mToolbar
.
setBackgroundColor
(
Color
.
parseColor
(
mParamEntity
.
getBackgroundColor
()));
}
mToolbar
.
setNavigationOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
finish
();
}
});
}
private
void
updateAddButton
()
{
if
(!
mParamEntity
.
isMutilyMode
())
{
mBtnAddBook
.
setVisibility
(
View
.
GONE
);
}
if
(!
mParamEntity
.
isChooseMode
())
{
mBtnAddBook
.
setVisibility
(
View
.
VISIBLE
);
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_OK
));
//文件夹模式默认为单选模式
mParamEntity
.
setMutilyMode
(
false
);
}
}
/**
* 添加点击事件处理
*/
private
void
initListener
()
{
// 返回目录上一级
mTvBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
String
tempPath
=
new
File
(
mPath
).
getParent
();
if
(
tempPath
==
null
)
{
return
;
}
mPath
=
tempPath
;
mListFiles
=
FileUtils
.
getFileList
(
mPath
,
mFilter
,
mParamEntity
.
isGreater
(),
mParamEntity
.
getFileSize
());
mPathAdapter
.
setmListData
(
mListFiles
);
mPathAdapter
.
updateAllSelelcted
(
false
);
mIsAllSelected
=
false
;
updateMenuTitle
();
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_Selected
));
mRecylerView
.
scrollToPosition
(
0
);
setShowPath
(
mPath
);
//清除添加集合中数据
mListNumbers
.
clear
();
if
(
mParamEntity
.
getAddText
()
!=
null
)
{
mBtnAddBook
.
setText
(
mParamEntity
.
getAddText
());
}
else
{
mBtnAddBook
.
setText
(
R
.
string
.
lfile_Selected
);
}
}
});
mPathAdapter
.
setOnItemClickListener
(
new
PathAdapter
.
OnItemClickListener
()
{
@Override
public
void
click
(
int
position
)
{
if
(
mParamEntity
.
isMutilyMode
())
{
if
(
mListFiles
.
get
(
position
).
isDirectory
())
{
//如果当前是目录,则进入继续查看目录
chekInDirectory
(
position
);
mPathAdapter
.
updateAllSelelcted
(
false
);
mIsAllSelected
=
false
;
updateMenuTitle
();
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_Selected
));
}
else
{
//如果已经选择则取消,否则添加进来
if
(
mListNumbers
.
contains
(
mListFiles
.
get
(
position
).
getAbsolutePath
()))
{
mListNumbers
.
remove
(
mListFiles
.
get
(
position
).
getAbsolutePath
());
}
else
{
mListNumbers
.
add
(
mListFiles
.
get
(
position
).
getAbsolutePath
());
}
if
(
mParamEntity
.
getAddText
()
!=
null
)
{
mBtnAddBook
.
setText
(
mParamEntity
.
getAddText
()
+
"( "
+
mListNumbers
.
size
()
+
" )"
);
}
else
{
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_Selected
)
+
"( "
+
mListNumbers
.
size
()
+
" )"
);
}
//先判断是否达到最大数量,如果数量达到上限提示,否则继续添加
if
(
mParamEntity
.
getMaxNum
()
>
0
&&
mListNumbers
.
size
()
>
mParamEntity
.
getMaxNum
())
{
Toast
.
makeText
(
LFilePickerActivity
.
this
,
R
.
string
.
lfile_OutSize
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
}
}
else
{
//单选模式直接返回
if
(
mListFiles
.
get
(
position
).
isDirectory
())
{
chekInDirectory
(
position
);
return
;
}
if
(
mParamEntity
.
isChooseMode
())
{
//选择文件模式,需要添加文件路径,否则为文件夹模式,直接返回当前路径
mListNumbers
.
add
(
mListFiles
.
get
(
position
).
getAbsolutePath
());
chooseDone
();
}
else
{
Toast
.
makeText
(
LFilePickerActivity
.
this
,
R
.
string
.
lfile_ChooseTip
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
});
mBtnAddBook
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
mParamEntity
.
isChooseMode
()
&&
mListNumbers
.
size
()
<
1
)
{
String
info
=
mParamEntity
.
getNotFoundFiles
();
if
(
TextUtils
.
isEmpty
(
info
))
{
Toast
.
makeText
(
LFilePickerActivity
.
this
,
R
.
string
.
lfile_NotFoundBooks
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
LFilePickerActivity
.
this
,
info
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
else
{
//返回
chooseDone
();
}
}
});
}
/**
* 点击进入目录
*
* @param position
*/
private
void
chekInDirectory
(
int
position
)
{
mPath
=
mListFiles
.
get
(
position
).
getAbsolutePath
();
setShowPath
(
mPath
);
//更新数据源
mListFiles
=
FileUtils
.
getFileList
(
mPath
,
mFilter
,
mParamEntity
.
isGreater
(),
mParamEntity
.
getFileSize
());
mPathAdapter
.
setmListData
(
mListFiles
);
mPathAdapter
.
notifyDataSetChanged
();
mRecylerView
.
scrollToPosition
(
0
);
}
/**
* 完成提交
*/
private
void
chooseDone
()
{
//判断是否数量符合要求
if
(
mParamEntity
.
isChooseMode
())
{
if
(
mParamEntity
.
getMaxNum
()
>
0
&&
mListNumbers
.
size
()
>
mParamEntity
.
getMaxNum
())
{
Toast
.
makeText
(
LFilePickerActivity
.
this
,
R
.
string
.
lfile_OutSize
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
}
String
path
=
mTvPath
.
getText
().
toString
().
trim
();
Intent
intent
=
new
Intent
();
intent
.
putStringArrayListExtra
(
"paths"
,
mListNumbers
);
intent
.
putExtra
(
"path"
,
path
);
setResult
(
RESULT_OK
,
intent
);
showProgressDialog
();
uploadFile
(
mListNumbers
.
get
(
0
));
}
public
void
uploadFile
(
String
path
)
{
// isProhibitWrite = true;
// String equType = getEquType();
//
// File file = new File(path);
// RequestBody requestBody = RequestBody.create(MediaType.parse(""), file);
// MultipartBody.Part part = MultipartBody.Part.createFormData("logFile", file.getName(), requestBody);
// String ip = DataSourceIpUtils.getDataSourceIp(selfCashierTerminalConfig, NetWorkUrl.UPLOAD_LOG_FILE + "?equType=" + equType);
// if (!TextUtils.isEmpty(selfCashierTerminalConfig.getScoRuntimeConfig().getPlatformUrl())) {
// ip = selfCashierTerminalConfig.getScoRuntimeConfig().getPlatformUrl() + NetWorkUrl.UPLOAD_LOG_FILE;
// }
//
// LogUtils.e("ip = " + ip);
//
// //防止文件过大 导致OOM 30M
// long size = file.length();
// if(size > 34307335){
// ToastUtils.showLong("日志文件过大");
// isProhibitWrite = false;
// hidProgressDialog();
// return;
// }
//
// tryGenQrCodeMsg(file.getName());
//
// ApiClient.get().getFileApi().uploadFile(ip, part)
// .subscribeOn(RxExecutorsUtils.getScheduler())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new Action1<HttpResult>() {
// @Override
// public void call(HttpResult s) {
// hidProgressDialog();
// isProhibitWrite = false;
// successToast = Toasty.success(LFilePickerActivity.this, "文件上传成功!");
// successToast.show();
// showQrImageIfNeeded();
// }
// }, new Action1<Throwable>() {
// @Override
// public void call(Throwable throwable) {
// hidProgressDialog();
// isProhibitWrite = false;
// Toasty.error(LFilePickerActivity.this, "文件上传失败!").show();
// }
// });
}
@NonNull
private
String
getEquType
()
{
String
equType
=
""
;
if
(
BuildConfig
.
appType
.
equals
(
"weixin"
))
{
//微信
equType
=
"WECHAT_EQU"
;
}
else
if
(
BuildConfig
.
appType
.
equals
(
"standard"
))
{
//支付宝
equType
=
"ALIPAY_EQU"
;
}
else
if
(
BuildConfig
.
appType
.
equals
(
"mpos"
))
{
equType
=
"MPOS_EQU"
;
}
else
if
(
BuildConfig
.
appType
.
equals
(
"miya"
))
{
//强制进入米雅页面
equType
=
""
;
}
return
equType
;
}
private
void
tryGenQrCodeMsg
(
String
fileName
)
{
SelfCashierTerminalConfig
.
HuihuaConfig
huihuaConfig
=
selfCashierTerminalConfig
.
getHuihuaConfig
();
if
(
huihuaConfig
!=
null
)
{
String
hhMerchant
=
huihuaConfig
.
getHhMerchant
();
String
storeId
=
huihuaConfig
.
getStoreId
();
String
username
=
AccountService
.
INSTANCE
.
getUserName
();
String
qrMsg
=
String
.
format
(
"%s/%s/%s/%s/%s"
,
hhMerchant
,
storeId
,
username
,
getUploadEq
(),
fileName
);
mQrCodeEncodeMsg
=
EncodeUtils
.
base64Encode2String
(
qrMsg
.
getBytes
());
}
}
private
void
showQrImageIfNeeded
()
{
if
(
TextUtils
.
isEmpty
(
mQrCodeEncodeMsg
))
{
return
;
}
if
(
mCustomImageCenterDialog
==
null
)
{
mCustomImageCenterDialog
=
new
CustomImageCenterDialog
(
this
);
}
mCustomImageCenterDialog
.
setOnDismissListener
(
dialog
->
LFilePickerActivity
.
this
.
finish
());
mCustomImageCenterDialog
.
setFullScreen
(
true
)
.
setHintContent
(
"请将日志二维码拍照保存"
)
.
setQrContent
(
mQrCodeEncodeMsg
)
.
build
().
show
();
}
private
String
getUploadEq
()
{
String
eq
=
""
;
String
equType
=
getEquType
();
switch
(
equType
){
case
"WECHAT_EQU"
:
eq
=
"w_eq"
;
break
;
case
"MPOS_EQU"
:
eq
=
"m_eq"
;
break
;
default
:
break
;
}
return
eq
;
}
/**
* 初始化控件
*/
private
void
initView
()
{
mRecylerView
=
(
EmptyRecyclerView
)
findViewById
(
R
.
id
.
recylerview
);
mTvPath
=
(
TextView
)
findViewById
(
R
.
id
.
tv_path
);
mTvBack
=
(
TextView
)
findViewById
(
R
.
id
.
tv_back
);
mBtnAddBook
=
(
Button
)
findViewById
(
R
.
id
.
btn_addbook
);
mEmptyView
=
findViewById
(
R
.
id
.
empty_view
);
mToolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar
);
if
(
mParamEntity
.
getAddText
()
!=
null
)
{
mBtnAddBook
.
setText
(
mParamEntity
.
getAddText
());
}
}
/**
* 检测SD卡是否可用
*/
private
boolean
checkSDState
()
{
return
Environment
.
getExternalStorageState
().
equals
(
Environment
.
MEDIA_MOUNTED
);
}
/**
* 显示顶部地址
*
* @param path
*/
private
void
setShowPath
(
String
path
)
{
mTvPath
.
setText
(
path
);
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
R
.
menu
.
menu_main_toolbar
,
menu
);
this
.
mMenu
=
menu
;
updateOptionsMenu
(
menu
);
return
true
;
}
/**
* 更新选项菜单展示,如果是单选模式,不显示全选操作
*
* @param menu
*/
private
void
updateOptionsMenu
(
Menu
menu
)
{
mMenu
.
findItem
(
R
.
id
.
action_selecteall_cancel
).
setVisible
(
mParamEntity
.
isMutilyMode
());
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
if
(
item
.
getItemId
()
==
R
.
id
.
action_selecteall_cancel
)
{
//将当前目录下所有文件选中或者取消
mPathAdapter
.
updateAllSelelcted
(!
mIsAllSelected
);
mIsAllSelected
=
!
mIsAllSelected
;
if
(
mIsAllSelected
)
{
for
(
File
mListFile
:
mListFiles
)
{
//不包含再添加,避免重复添加
if
(!
mListFile
.
isDirectory
()
&&
!
mListNumbers
.
contains
(
mListFile
.
getAbsolutePath
()))
{
mListNumbers
.
add
(
mListFile
.
getAbsolutePath
());
}
if
(
mParamEntity
.
getAddText
()
!=
null
)
{
mBtnAddBook
.
setText
(
mParamEntity
.
getAddText
()
+
"( "
+
mListNumbers
.
size
()
+
" )"
);
}
else
{
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_Selected
)
+
"( "
+
mListNumbers
.
size
()
+
" )"
);
}
}
}
else
{
mListNumbers
.
clear
();
mBtnAddBook
.
setText
(
getString
(
R
.
string
.
lfile_Selected
));
}
updateMenuTitle
();
}
return
true
;
}
/**
* 更新选项菜单文字
*/
public
void
updateMenuTitle
()
{
if
(
mIsAllSelected
)
{
mMenu
.
getItem
(
0
).
setTitle
(
getString
(
R
.
string
.
lfile_Cancel
));
}
else
{
mMenu
.
getItem
(
0
).
setTitle
(
getString
(
R
.
string
.
lfile_SelectAll
));
}
}
public
void
showProgressDialog
()
{
showProgressDialog
(
getString
(
R
.
string
.
please_wait
));
}
public
void
hidProgressDialog
()
{
dismissProgressDialog
();
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
if
(
successToast
!=
null
)
successToast
.
cancel
();
}
}
app/src/main/java/com/miya/fastcashier/log/PathAdapter.java
0 → 100644
View file @
512fdfe6
package
com
.
miya
.
fastcashier
.
log
;
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
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/res/drawable/selector_file_item_bg.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@color/lfile_lightgray"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@color/lfile_lightgray"
android:state_selected=
"true"
/>
<item
android:drawable=
"@color/lfile_white"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/shape_dialog_btn_normal_bg.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#FFFFFF"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_dialog_btn_pressed_bg.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"12dp"
/>
<solid
android:color=
"#ffe5e5e5"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_lfile_back_bg.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@color/lfile_gray"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@color/lfile_gray"
android:state_selected=
"true"
/>
<item
android:drawable=
"@color/lfile_lightgray"
/>
</selector>
\ No newline at end of file
app/src/main/res/drawable/shape_lfile_btn_bg.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@color/lfile_defaultColor"
android:state_pressed=
"true"
/>
<item
android:drawable=
"@color/lfile_defaultColor"
android:state_selected=
"true"
/>
<item
android:drawable=
"@color/lfile_defaultColor"
/>
</selector>
\ No newline at end of file
app/src/main/res/layout/activity_lfile_picker.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/lfile_white"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"?android:attr/actionBarSize"
android:background=
"?attr/colorPrimary"
android:minHeight=
"?android:attr/actionBarSize"
app:navigationIcon=
"?attr/navigationIcon"
/>
<LinearLayout
android:id=
"@+id/layout_path"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
android:layout_below=
"@id/toolbar"
android:background=
"#dddddd"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_path"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"8dp"
android:layout_weight=
"1"
android:ellipsize=
"middle"
android:gravity=
"left|center"
android:singleLine=
"true"
android:textSize=
"14sp"
/>
<TextView
android:visibility=
"gone"
android:id=
"@+id/tv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/shape_lfile_back_bg"
android:clickable=
"true"
android:drawableLeft=
"@mipmap/app_icon_lfile_up"
android:drawablePadding=
"4dp"
android:gravity=
"center"
android:paddingLeft=
"8dp"
android:paddingRight=
"8dp"
android:text=
"@string/lfile_UpOneLevel"
/>
</LinearLayout>
<Button
android:id=
"@+id/btn_addbook"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:background=
"@drawable/shape_lfile_btn_bg"
android:text=
"@string/lfile_Selected"
android:textColor=
"@color/lfile_white"
android:textSize=
"18sp"
/>
<com.miya.fastcashier.log.EmptyRecyclerView
android:id=
"@+id/recylerview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@id/btn_addbook"
android:layout_below=
"@id/layout_path"
/>
<include
android:id=
"@+id/empty_view"
layout=
"@layout/layout_lfile_emptyview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@id/layout_path"
/>
</RelativeLayout>
app/src/main/res/layout/layout_lfile_emptyview.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/lfile_white"
>
<ImageView
android:layout_width=
"120dp"
android:layout_height=
"120dp"
android:layout_above=
"@id/tv_empty"
android:layout_centerHorizontal=
"true"
android:background=
"@mipmap/lfile_emptyimg"
/>
<TextView
android:id=
"@+id/tv_empty"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:padding=
"12dp"
android:text=
"暂无数据"
android:textColor=
"@color/lfile_gray"
android:textSize=
"18sp"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/layout_lfile_list_item.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/layout_item_root"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/selector_file_item_bg"
android:clickable=
"true"
android:paddingLeft=
"12dp"
android:paddingRight=
"12dp"
>
<CheckBox
android:id=
"@+id/cb_choose"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:theme=
"@style/LFileCheckBoxTheme"
/>
<ImageView
android:id=
"@+id/iv_type"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_centerVertical=
"true"
android:background=
"@mipmap/app_icon_lfile_file_style_green"
/>
<LinearLayout
android:id=
"@+id/layout_info"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"10dp"
android:layout_toLeftOf=
"@id/cb_choose"
android:layout_toRightOf=
"@id/iv_type"
android:orientation=
"vertical"
android:padding=
"10dp"
>
<TextView
android:id=
"@+id/tv_name"
style=
"@style/LFile_item_text_name"
android:text=
"鬼吹灯"
/>
<TextView
android:id=
"@+id/tv_detail"
style=
"@style/LFile_item_text_detail"
android:text=
"类型:txt 大小:1024KB"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:layout_below=
"@id/layout_info"
android:layout_marginTop=
"6dp"
android:background=
"@color/lfile_lightgray"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/menu/menu_main_toolbar.xml
0 → 100644
View file @
512fdfe6
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/action_selecteall_cancel"
android:title=
"全选"
app:showAsAction=
"always"
/>
</menu>
\ No newline at end of file
app/src/main/res/mipmap-xhdpi/app_icon_lfile_file_style_green.png
0 → 100644
View file @
512fdfe6
2.43 KB
app/src/main/res/mipmap-xhdpi/app_icon_lfile_up.png
0 → 100644
View file @
512fdfe6
827 Bytes
app/src/main/res/mipmap-xhdpi/lfile_emptyimg.png
0 → 100644
View file @
512fdfe6
2.9 KB
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