Commit c265d99c authored by 赵鹏翔's avatar 赵鹏翔

日志事件添加,日志中转组件添加

parent 81acdb06
...@@ -37,13 +37,13 @@ class FunctionCenterActivity : BaseActivity() { ...@@ -37,13 +37,13 @@ class FunctionCenterActivity : BaseActivity() {
} }
fun toUploadLog() { fun toUploadLog() {
// LFilePicker() LFilePicker()
// .withActivity(this) .withActivity(this)
// .withStartPath(LogFileUtils.CACHE_FILE_PATH) //指定初始显示路径 .withStartPath(LogFileUtils.CACHE_FILE_PATH) //指定初始显示路径
// .withIsGreater(true) //过滤文件大小 小于指定大小的文件 .withIsGreater(true) //过滤文件大小 小于指定大小的文件
// .withFileSize(0) //指定文件大小为500K .withFileSize(0) //指定文件大小为500K
// .withMutilyMode(false) .withMutilyMode(false)
// .start() .start()
} }
......
package com.miya.fastcashier.log;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import com.miya.fastcashier.R;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
/**
* 作者:Leon
* 时间:2017/3/20 16:57
*/
public class LFilePicker {
private Activity mActivity;
private Fragment mFragment;
private String mTitle;
private String mTitleColor;
private int theme = R.style.LFileTheme;
private int mTitleStyle = R.style.LFileToolbarTextStyle;
private String mBackgroundColor;
private int mBackStyle;
private int mRequestCode;
private boolean mMutilyMode = true;
private boolean mChooseMode = true;
private String mAddText;
private int mIconStyle;
private String[] mFileTypes;
private String mNotFoundFiles;
private int mMaxNum;
private String mStartPath;
private boolean mIsGreater = true;//是否大于
private long mFileSize;
private String mFileName;
/**
* 绑定Activity
*
* @param activity
* @return
*/
public LFilePicker withActivity(Activity activity) {
this.mActivity = activity;
return this;
}
/**
* 绑定Fragment
*
* @param fragment
* @return
*/
public LFilePicker withFragment(Fragment fragment) {
this.mFragment = fragment;
return this;
}
/**
* 设置主标题
*
* @param title
* @return
*/
public LFilePicker withTitle(String title) {
this.mTitle = title;
return this;
}
/**
* 设置辩题颜色
*
* @param color
* @return
*/
@Deprecated
public LFilePicker withTitleColor(String color) {
this.mTitleColor = color;
return this;
}
/**
* 设置主题
*
* @param theme
* @return
*/
public LFilePicker withTheme(@StyleRes int theme) {
this.theme = theme;
return this;
}
/**
* 设置标题的颜色和字体大小
*
* @param style
* @return
*/
public LFilePicker withTitleStyle(@StyleRes int style) {
this.mTitleStyle = style;
return this;
}
/**
* 设置背景色
*
* @param color
* @return
*/
public LFilePicker withBackgroundColor(String color) {
this.mBackgroundColor = color;
return this;
}
/**
* 请求码
*
* @param requestCode
* @return
*/
public LFilePicker withRequestCode(int requestCode) {
this.mRequestCode = requestCode;
return this;
}
/**
* 设置返回图标
*
* @param backStyle
* @return
*/
public LFilePicker withBackIcon(int backStyle) {
this.mBackStyle = 0;//默认样式
this.mBackStyle = backStyle;
return this;
}
/**
* 设置选择模式,默认为true,多选;false为单选
*
* @param isMutily
* @return
*/
public LFilePicker withMutilyMode(boolean isMutily) {
this.mMutilyMode = isMutily;
return this;
}
/**
* 设置多选时按钮文字
*
* @param text
* @return
*/
public LFilePicker withAddText(String text) {
this.mAddText = text;
return this;
}
/**
* 设置文件夹图标风格
*
* @param style
* @return
*/
public LFilePicker withIconStyle(int style) {
this.mIconStyle = style;
return this;
}
public LFilePicker withFileFilter(String[] arrs) {
this.mFileTypes = arrs;
return this;
}
/**
* 没有选中文件时的提示信息
*
* @param notFoundFiles
* @return
*/
public LFilePicker withNotFoundBooks(String notFoundFiles) {
this.mNotFoundFiles = notFoundFiles;
return this;
}
/**
* 设置最大选中数量
*
* @param num
* @return
*/
public LFilePicker withMaxNum(int num) {
this.mMaxNum = num;
return this;
}
/**
* 设置选择上传的文件
*
* @param fileName
* @return
*/
public LFilePicker withFileName(String fileName) {
this.mFileName = fileName;
return this;
}
/**
* 设置初始显示路径
*
* @param path
* @return
*/
public LFilePicker withStartPath(String path) {
this.mStartPath = path;
return this;
}
/**
* 设置选择模式,true为文件选择模式,false为文件夹选择模式,默认为true
*
* @param chooseMode
* @return
*/
public LFilePicker withChooseMode(boolean chooseMode) {
this.mChooseMode = chooseMode;
return this;
}
/**
* 设置文件大小过滤方式:大于指定大小或者小于指定大小
*
* @param isGreater true:大于 ;false:小于,同时包含指定大小在内
* @return
*/
public LFilePicker withIsGreater(boolean isGreater) {
this.mIsGreater = isGreater;
return this;
}
/**
* 设置过滤文件大小
*
* @param fileSize
* @return
*/
public LFilePicker withFileSize(long fileSize) {
this.mFileSize = fileSize;
return this;
}
public void start() {
if (mActivity == null && mFragment == null) {
throw new RuntimeException("You must pass Activity or Fragment by withActivity or withFragment or withSupportFragment method");
}
Intent intent = initIntent();
Bundle bundle = getBundle();
intent.putExtras(bundle);
if (mActivity != null) {
mActivity.startActivityForResult(intent, mRequestCode);
} else {
mFragment.startActivityForResult(intent, mRequestCode);
}
}
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;
}
@NonNull
private Bundle getBundle() {
ParamEntity paramEntity = new ParamEntity();
paramEntity.setTitle(mTitle);
paramEntity.setTheme(theme);
paramEntity.setTitleColor(mTitleColor);
paramEntity.setTitleStyle(mTitleStyle);
paramEntity.setBackgroundColor(mBackgroundColor);
paramEntity.setBackIcon(mBackStyle);
paramEntity.setMutilyMode(mMutilyMode);
paramEntity.setAddText(mAddText);
paramEntity.setIconStyle(mIconStyle);
paramEntity.setFileTypes(mFileTypes);
paramEntity.setNotFoundFiles(mNotFoundFiles);
paramEntity.setMaxNum(mMaxNum);
paramEntity.setChooseMode(mChooseMode);
paramEntity.setPath(mStartPath);
paramEntity.setFileSize(mFileSize);
paramEntity.setFileName(mFileName);
paramEntity.setGreater(mIsGreater);
Bundle bundle = new Bundle();
bundle.putSerializable("param", paramEntity);
return bundle;
}
}
package com.miya.fastcashier.log;
import java.io.Serializable;
/**
* 作者:Leon
* 时间:2017/3/21 14:50
*/
public class ParamEntity implements Serializable {
private String title;
private String titleColor;
private int titleStyle ;
private int theme ;
private String backgroundColor;
private int backIcon;
private boolean mutilyMode;
private String addText;
private int iconStyle;
private String[] fileTypes;
private String notFoundFiles;
private int maxNum;
private boolean chooseMode = true;
private String path;
private long fileSize;
private boolean isGreater;
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Deprecated
public String getTitleColor() {
return titleColor;
}
@Deprecated
public void setTitleColor(String titleColor) {
this.titleColor = titleColor;
}
public int getTheme() {
return theme;
}
public void setTheme(int theme) {
this.theme = theme;
}
public int getTitleStyle() {
return titleStyle;
}
public void setTitleStyle(int titleStyle) {
this.titleStyle = titleStyle;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public boolean isMutilyMode() {
return mutilyMode;
}
public void setMutilyMode(boolean mutilyMode) {
this.mutilyMode = mutilyMode;
}
public int getBackIcon() {
return backIcon;
}
public void setBackIcon(int backIcon) {
this.backIcon = backIcon;
}
public String getAddText() {
return addText;
}
public void setAddText(String addText) {
this.addText = addText;
}
public int getIconStyle() {
return iconStyle;
}
public void setIconStyle(int iconStyle) {
this.iconStyle = iconStyle;
}
public String[] getFileTypes() {
return fileTypes;
}
public void setFileTypes(String[] fileTypes) {
this.fileTypes = fileTypes;
}
public String getNotFoundFiles() {
return notFoundFiles;
}
public void setNotFoundFiles(String notFoundFiles) {
this.notFoundFiles = notFoundFiles;
}
public int getMaxNum() {
return maxNum;
}
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
public boolean isChooseMode() {
return chooseMode;
}
public void setChooseMode(boolean chooseMode) {
this.chooseMode = chooseMode;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
public boolean isGreater() {
return isGreater;
}
public void setGreater(boolean greater) {
isGreater = greater;
}
}
...@@ -33,4 +33,29 @@ ...@@ -33,4 +33,29 @@
<item name="android:backgroundDimAmount">0.7</item> <item name="android:backgroundDimAmount">0.7</item>
</style> </style>
<style name="LFileToolbarTextStyle" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColor">@color/lfile_white</item>
<item name="android:textSize">16sp</item>
</style>
<style name="LFile_item_text_detail">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">0dp</item>
<item name="android:textColor">#999999</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">left</item>
<item name="android:textSize">14sp</item>
</style>
<style name="LFile_item_text_name">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:textColor">#101010</item>
<item name="android:gravity">left</item>
<item name="android:textSize">16sp</item>
</style>
</resources> </resources>
...@@ -16,4 +16,21 @@ ...@@ -16,4 +16,21 @@
<item name="android:statusBarColor" tools:targetApi="l">@color/green</item> <item name="android:statusBarColor" tools:targetApi="l">@color/green</item>
</style> </style>
<style name="LFileTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/lfile_colorPrimary</item>
<item name="colorPrimaryDark">@color/lfile_colorPrimaryDark</item>
<item name="colorAccent">@color/lfile_colorAccent</item>
<item name="homeAsUpIndicator">@mipmap/app_icon_lfile_back</item>
<item name="actionBarSize">36dp</item>
<item name="navigationIcon">@mipmap/app_icon_lfile_back</item><!--返回icon-->
<!-- 溢出菜单图标颜色-->
<item name="colorControlNormal">@android:color/white</item>
<item name="actionMenuTextColor">@android:color/white</item>
</style>
<style name="LFileCheckBoxTheme" parent="LFileTheme">
<!-- 溢出菜单图标颜色-->
<item name="colorControlNormal">@color/lfile_gray</item>
</style>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment