Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
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
lify
RvApp
Commits
0ca8a274
Commit
0ca8a274
authored
Jul 13, 2019
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加本地日志记录
parent
43c670a6
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
306 additions
and
4 deletions
+306
-4
RvClientApplication.java
RvClient/src/main/java/com/xxfc/rv/RvClientApplication.java
+2
-0
WelcomeActivity.java
RvClient/src/main/java/com/xxfc/rv/WelcomeActivity.java
+5
-2
LogUtil.java
...t_utils/src/main/java/com/rv/component/utils/LogUtil.java
+90
-0
FilePathGgenerator.java
...n/java/com/rv/component/utils/log/FilePathGgenerator.java
+50
-0
Log2File.java
...ls/src/main/java/com/rv/component/utils/log/Log2File.java
+57
-0
LogFormatter.java
...rc/main/java/com/rv/component/utils/log/LogFormatter.java
+65
-0
LogLevel.java
...ls/src/main/java/com/rv/component/utils/log/LogLevel.java
+22
-0
MineFragment.java
module_mine/src/main/java/com/rv/rvmine/MineFragment.java
+5
-1
BillActivity.java
plugin_share/src/main/java/com/rv/share/BillActivity.java
+9
-0
shape_rv_bg_bill.xml
plugin_share/src/main/res/drawable/shape_rv_bg_bill.xml
+1
-1
No files found.
RvClient/src/main/java/com/xxfc/rv/RvClientApplication.java
View file @
0ca8a274
...
...
@@ -19,6 +19,7 @@ import com.frame.base.bean.BeanHeartbeat;
import
com.frame.base.manager.MyFrameManager
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.util.LogUtils
;
import
com.rv.component.utils.LogUtil
;
import
com.sh.sdk.shareinstall.ShareInstall
;
import
com.tencent.bugly.crashreport.CrashReport
;
import
com.umeng.commonsdk.UMConfigure
;
...
...
@@ -53,6 +54,7 @@ public class RvClientApplication extends FrameApp {
ShareInstall
.
getInstance
().
init
(
getApplicationContext
());
}
LogUtil
.
setLogEnable
(
true
,
getApplicationContext
());
CrashHandler
.
getInstance
().
init
(
this
);
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
...
...
RvClient/src/main/java/com/xxfc/rv/WelcomeActivity.java
View file @
0ca8a274
...
...
@@ -10,6 +10,7 @@ import com.ruiwenliu.wrapper.base.BaseBean;
import
com.ruiwenliu.wrapper.util.UtilsManager
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.component.utils.LogUtil
;
import
com.rv.home.rv.module.basic.presenter.CommonPresenter
;
import
com.sh.sdk.shareinstall.ShareInstall
;
import
com.sh.sdk.shareinstall.listener.AppGetInfoListener
;
...
...
@@ -44,16 +45,18 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> {
showTitle
(
false
);
//隐藏菜单栏
interval
();
LogUtil
.
d
(
"start"
);
ShareInstall
.
getInstance
().
getInfo
(
getIntent
(),
new
AppGetInfoListener
()
{
@Override
public
void
onGetInfoFinish
(
String
info
)
{
// 客户端获取到的参数是json字符串格式
Log
.
d
(
"ShareInstall"
,
"info = "
+
info
);
Log
Util
.
d
(
"ShareInstall"
,
"info = "
+
info
);
try
{
JSONObject
object
=
new
JSONObject
(
info
);
// 通过该方法拿到设置的渠道值,剩余值为自定义的其他参数
String
channel
=
object
.
optString
(
"channel"
);
Log
.
d
(
"ShareInstall"
,
"channel = "
+
channel
);
Log
Util
.
d
(
"ShareInstall"
,
"channel = "
+
channel
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
component_utils/src/main/java/com/rv/component/utils/LogUtil.java
0 → 100644
View file @
0ca8a274
package
com
.
rv
.
component
.
utils
;
import
android.content.Context
;
import
com.rv.component.utils.log.Log2File
;
import
com.rv.component.utils.log.LogLevel
;
/********
* 日志
*
* 1 将日志输入到控制台
* 2 将日志打印至本地文件中
* (日志是否打开)
*
*/
public
class
LogUtil
{
public
static
final
String
TAG
=
LogUtil
.
class
.
getName
();
public
static
Boolean
LOG_ENABLE
=
true
;
private
static
Context
mContext
;
/*********
* 在程序的入口设置日志开关
* LogUtil.setLogEnable(BuildConfig.debug)
* @param b
*/
public
static
void
setLogEnable
(
boolean
b
,
Context
context
)
{
LOG_ENABLE
=
b
;
mContext
=
context
;
}
public
static
Context
getContext
()
{
return
mContext
;
}
public
static
void
i
(
String
msg
)
{
i
(
TAG
,
msg
);
}
public
static
void
i
(
String
tag
,
String
msg
)
{
if
(
LOG_ENABLE
)
{
android
.
util
.
Log
.
i
(
tag
,
msg
);
Log2File
.
log2file
(
LogLevel
.
I
,
tag
,
msg
);
}
}
public
static
void
v
(
String
msg
)
{
v
(
TAG
,
msg
);
}
public
static
void
v
(
String
tag
,
String
msg
)
{
if
(
LOG_ENABLE
)
{
android
.
util
.
Log
.
v
(
tag
,
msg
);
Log2File
.
log2file
(
LogLevel
.
V
,
tag
,
msg
);
}
}
public
static
void
d
(
String
msg
)
{
d
(
TAG
,
msg
);
}
public
static
void
d
(
String
tag
,
String
msg
)
{
if
(
LOG_ENABLE
)
{
android
.
util
.
Log
.
d
(
tag
,
msg
);
Log2File
.
log2file
(
LogLevel
.
D
,
tag
,
msg
);
}
}
public
static
void
w
(
String
msg
)
{
w
(
TAG
,
msg
);
}
public
static
void
w
(
String
tag
,
String
msg
)
{
if
(
LOG_ENABLE
)
{
android
.
util
.
Log
.
w
(
tag
,
msg
);
Log2File
.
log2file
(
LogLevel
.
W
,
tag
,
msg
);
}
}
public
static
void
e
(
String
msg
)
{
e
(
TAG
,
msg
);
}
public
static
void
e
(
String
tag
,
String
msg
)
{
if
(
LOG_ENABLE
)
{
android
.
util
.
Log
.
e
(
tag
,
msg
);
Log2File
.
log2file
(
LogLevel
.
E
,
tag
,
msg
);
}
}
}
component_utils/src/main/java/com/rv/component/utils/log/FilePathGgenerator.java
0 → 100644
View file @
0ca8a274
package
com
.
rv
.
component
.
utils
.
log
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
java.io.File
;
public
class
FilePathGgenerator
{
protected
String
dir
=
""
;
protected
String
filename
=
"app"
;
protected
String
suffix
=
".log"
;
private
String
path
=
null
;
public
FilePathGgenerator
(
Context
context
,
String
filename
,
String
suffix
)
{
if
(
context
==
null
)
{
throw
new
NullPointerException
(
"FilePathGgenerator context is null"
);
}
this
.
dir
=
context
.
getExternalCacheDir
()
+
File
.
separator
+
"log"
;
if
(!
TextUtils
.
isEmpty
(
filename
))
{
this
.
filename
=
filename
;
}
if
(!
TextUtils
.
isEmpty
(
suffix
))
{
this
.
suffix
=
suffix
;
}
this
.
path
=
dir
+
File
.
separator
+
filename
+
suffix
;
}
public
FilePathGgenerator
(
String
dir
,
String
filename
,
String
suffix
)
{
if
(!
TextUtils
.
isEmpty
(
dir
))
{
this
.
dir
=
dir
;
}
if
(!
TextUtils
.
isEmpty
(
filename
))
{
this
.
filename
=
filename
;
}
if
(!
TextUtils
.
isEmpty
(
suffix
))
{
this
.
suffix
=
suffix
;
}
this
.
path
=
dir
+
File
.
separator
+
filename
+
suffix
;
}
public
String
getPath
()
{
return
this
.
path
;
}
public
String
getDir
()
{
return
this
.
dir
;
}
}
component_utils/src/main/java/com/rv/component/utils/log/Log2File.java
0 → 100644
View file @
0ca8a274
package
com
.
rv
.
component
.
utils
.
log
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.rv.component.utils.LogUtil
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
/*******
* 把日志写到文件里面
*/
public
class
Log2File
{
private
static
final
String
TAG
=
"日志文件"
;
private
static
ExecutorService
executorService
=
null
;
protected
static
ExecutorService
getExecutorService
()
{
return
executorService
;
}
public
static
void
log2file
(
final
LogLevel
level
,
final
String
tag
,
final
String
msg
)
{
if
(
executorService
==
null
)
{
executorService
=
Executors
.
newSingleThreadExecutor
();
}
if
(
executorService
!=
null
)
{
executorService
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
LogFormatter
formatter
=
new
LogFormatter
();
String
log
=
formatter
.
format
(
level
,
tag
,
msg
);
FilePathGgenerator
ggenerator
=
new
FilePathGgenerator
(
LogUtil
.
getContext
(),
formatter
.
formatDate
(),
".log"
);
String
path
=
ggenerator
.
getPath
();
String
dir
=
ggenerator
.
dir
;
try
{
File
parent
=
new
File
(
dir
);
if
(!
parent
.
exists
())
{
parent
.
mkdirs
();
}
File
file
=
new
File
(
path
);
FileOutputStream
outputStream
=
new
FileOutputStream
(
file
,
true
);
outputStream
.
write
(
log
.
getBytes
());
outputStream
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
}
protected
static
void
setExecutorService
(
ExecutorService
paramExecutorService
)
{
executorService
=
paramExecutorService
;
}
}
component_utils/src/main/java/com/rv/component/utils/log/LogFormatter.java
0 → 100644
View file @
0ca8a274
package
com
.
rv
.
component
.
utils
.
log
;
import
android.os.Process
;
import
android.text.TextUtils
;
import
com.rv.component.utils.LogUtil
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
/*****
* 构建打印的前缀
*/
public
class
LogFormatter
{
private
final
String
formatter
;
public
LogFormatter
()
{
this
.
formatter
=
"yyyy-MM-dd HH:mm:ss.SSSZ"
;
}
public
LogFormatter
(
String
paramString
)
{
if
(!
TextUtils
.
isEmpty
(
paramString
))
{
this
.
formatter
=
paramString
;
return
;
}
this
.
formatter
=
"yyyy-MM-dd HH:mm:ss.SSSZ"
;
}
public
String
format
(
LogLevel
level
,
String
tag
,
String
msg
)
{
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
level
.
getType
())
.
append
(
"\t"
)
.
append
(
formatDate
(
new
Date
(
System
.
currentTimeMillis
()),
this
.
formatter
))
.
append
(
"\t"
)
.
append
(
Process
.
myPid
())
.
append
(
"\t"
)
.
append
(
Process
.
myTid
())
.
append
(
"\t"
)
.
append
(
tag
)
.
append
(
"\t"
)
.
append
(
msg
)
.
append
(
"\r\n"
);
return
buffer
.
toString
();
}
public
String
formatDate
()
{
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
(
System
.
currentTimeMillis
()));
}
public
String
formatDate
(
Date
paramDate
,
String
paramString
)
{
if
(
paramDate
==
null
)
{
return
""
;
}
if
(
TextUtils
.
isEmpty
(
paramString
))
{
return
""
;
}
try
{
return
new
SimpleDateFormat
(
paramString
,
Locale
.
ENGLISH
).
format
(
paramDate
);
}
catch
(
Exception
e
)
{
LogUtil
.
e
(
e
.
toString
());
}
return
""
;
}
}
component_utils/src/main/java/com/rv/component/utils/log/LogLevel.java
0 → 100644
View file @
0ca8a274
package
com
.
rv
.
component
.
utils
.
log
;
public
enum
LogLevel
{
I
(
"I"
),
D
(
"D"
),
V
(
"V"
),
W
(
"W"
),
E
(
"E"
);
private
String
type
;
LogLevel
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
\ No newline at end of file
module_mine/src/main/java/com/rv/rvmine/MineFragment.java
View file @
0ca8a274
...
...
@@ -108,6 +108,8 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
RelativeLayout
rlItemSetting
;
@BindView
(
R2
.
id
.
travel_fragment_layout
)
LinearLayout
travelFragmentLayout
;
@BindView
(
R2
.
id
.
rl_item_share
)
RelativeLayout
rlItemShare
;
@BindView
(
R2
.
id
.
mine_banner
)
Banner
mineBanner
;
@BindView
(
R2
.
id
.
refresh
)
...
...
@@ -196,7 +198,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
@OnClick
({
R2
.
id
.
iv_avatar
,
R2
.
id
.
tv_login
,
R2
.
id
.
tv_verified
,
R2
.
id
.
rl_item_to_be_paid
,
R2
.
id
.
rl_item_staying
,
R2
.
id
.
rl_item_traveling
,
R2
.
id
.
rl_item_completed
,
R2
.
id
.
rl_item_all
,
R2
.
id
.
rl_item_collection
,
R2
.
id
.
rl_item_personal_information
,
R2
.
id
.
rl_item_setting
,
R2
.
id
.
rl_item_driver
,
R2
.
id
.
rl_item_traveler
,
R2
.
id
.
tv_view_privileges
})
R2
.
id
.
tv_view_privileges
,
R2
.
id
.
rl_item_share
})
public
void
onViewClicked
(
View
view
)
{
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
iv_avatar
)
{
...
...
@@ -271,6 +273,8 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
// }
else
if
(
id
==
R
.
id
.
tv_view_privileges
)
{
startActivity
(
MemberCenterActivity
.
getIntent
(
_mActivity
));
}
else
if
(
id
==
R
.
id
.
rl_item_share
)
{
startActivity
(
new
Intent
(
_mActivity
,
ShareActivity
.
class
));
}
}
...
...
plugin_share/src/main/java/com/rv/share/BillActivity.java
View file @
0ca8a274
...
...
@@ -2,6 +2,7 @@ package com.rv.share;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.support.v7.app.AppCompatActivity
;
...
...
@@ -19,6 +20,8 @@ import com.ruiwenliu.wrapper.base.BaseActivity;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.component.utils.DisplayUtil
;
import
com.rv.component.utils.ZxingUtils
;
import
com.rv.home.rv.module.basic.presenter.CommonPresenter
;
import
com.rv.share.presenter.BillPresenter
;
...
...
@@ -47,6 +50,8 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
@BindView
(
R2
.
id
.
ll_bill_content
)
LinearLayout
llBillContent
;
private
String
testUrl
=
"https://xxtest.upyuns.com/renovate/Dripcar_2019-7-10_4_1-1-13.apk"
;
@Override
protected
int
setLayout
()
{
return
R
.
layout
.
activity_bill
;
...
...
@@ -62,6 +67,10 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
return
false
;
}
});
Bitmap
success
=
ZxingUtils
.
createQRImage
(
testUrl
,
DisplayUtil
.
dip2px
(
this
,
80
f
),
DisplayUtil
.
dip2px
(
this
,
80
f
),
BitmapFactory
.
decodeResource
(
getResources
(),
com
.
rv
.
home
.
R
.
mipmap
.
ic_launcher
));
imgZxing
.
setImageBitmap
(
success
);
}
@Override
...
...
plugin_share/src/main/res/drawable/shape_rv_bg_bill.xml
View file @
0ca8a274
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"
5
dp"
/>
<corners
android:radius=
"
10
dp"
/>
<solid
android:color=
"@color/white"
/>
</shape>
\ 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