Skip to content

Commit

Permalink
1.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilaver committed May 9, 2019
1 parent 264561f commit a199b39
Show file tree
Hide file tree
Showing 49 changed files with 669 additions and 79 deletions.
18 changes: 11 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "com.example.mockgps"
minSdkVersion 14
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.9.4"
versionName "1.9.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -38,13 +38,17 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/BaiduLBS_Android.jar')
implementation files('libs/library-1.0.19.jar')
implementation 'com.android.support:cardview-v7:27.1.1'
// implementation files('com.android.volley:volley:1.1.1')
implementation 'com.android.support:cardview-v7:28.0.0'
implementation files('libs/log4j-1.2.17.jar')
}
Binary file modified app/libs/BaiduLBS_Android.jar
Binary file not shown.
Binary file not shown.
Binary file removed app/libs/arm64-v8a/libBaiduMapSDK_bikenavi_v5_1_0.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/libs/arm64-v8a/libindoor.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/libs/armeabi-v7a/libindoor.so
Binary file not shown.
Binary file not shown.
Binary file removed app/libs/armeabi/libBaiduMapSDK_bikenavi_v5_1_0.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/libs/armeabi/libindoor.so
Binary file not shown.
Binary file added app/libs/log4j-1.2.17.jar
Binary file not shown.
Binary file removed app/libs/x86/libBaiduMapSDK_base_v5_1_0.so
Binary file not shown.
Binary file added app/libs/x86/libBaiduMapSDK_base_v5_3_2.so
Binary file not shown.
Binary file removed app/libs/x86/libBaiduMapSDK_bikenavi_v5_1_0.so
Binary file not shown.
Binary file added app/libs/x86/libBaiduMapSDK_bikenavi_v5_3_2.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/libs/x86/libindoor.so
Binary file not shown.
Binary file not shown.
Binary file removed app/libs/x86_64/libBaiduMapSDK_bikenavi_v5_1_0.so
Binary file not shown.
Binary file added app/libs/x86_64/libBaiduMapSDK_bikenavi_v5_3_2.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/libs/x86_64/libindoor.so
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.9.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.9.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
Expand Down Expand Up @@ -46,6 +46,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<service
android:name="com.baidu.location.f"
android:enabled="true"
Expand Down
92 changes: 92 additions & 0 deletions app/src/main/java/com/example/log4j/LogCatAppender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.example.log4j;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Layout;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.spi.LoggingEvent;

import android.util.Log;

/**
* 源自 android-logging-log4j-1.0.3.jar
*
* @author Administrator
*/
public class LogCatAppender extends AppenderSkeleton {
protected Layout tagLayout;

public LogCatAppender(Layout messageLayout, Layout tagLayout) {
this.tagLayout = tagLayout;
setLayout(messageLayout);
}

public LogCatAppender(Layout messageLayout) {
//这里定义的是Tag名称
this(messageLayout, new PatternLayout("%c"));
}

public LogCatAppender() {
this(new PatternLayout("%c"));
}

protected void append(LoggingEvent le) {
switch (le.getLevel().toInt()) {
case 5000:
if (le.getThrowableInformation() != null) {
Log.v(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else {
Log.v(getTagLayout().format(le), getLayout().format(le));
}
break;
case 10000:
if (le.getThrowableInformation() != null) {
Log.d(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else {
Log.d(getTagLayout().format(le), getLayout().format(le));
}
break;
case 20000:
if (le.getThrowableInformation() != null) {
Log.i(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else {
Log.i(getTagLayout().format(le), getLayout().format(le));
}
break;
case 30000:
if (le.getThrowableInformation() != null) {
Log.w(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else {
Log.w(getTagLayout().format(le), getLayout().format(le));
}
break;
case 40000:
if (le.getThrowableInformation() != null) {
Log.e(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else {
Log.e(getTagLayout().format(le), getLayout().format(le));
}
break;
case 50000:
if (le.getThrowableInformation() != null) {
Log.wtf(getTagLayout().format(le), getLayout().format(le), le.getThrowableInformation().getThrowable());
} else
Log.wtf(getTagLayout().format(le), getLayout().format(le));
break;
}
}

public void close() {
}

public boolean requiresLayout() {
return true;
}

public Layout getTagLayout() {
return this.tagLayout;
}

public void setTagLayout(Layout tagLayout) {
this.tagLayout = tagLayout;
}
}
218 changes: 218 additions & 0 deletions app/src/main/java/com/example/log4j/LogConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
package com.example.log4j;

import java.io.IOException;

import org.apache.log4j.Layout;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.RollingFileAppender;
import org.apache.log4j.helpers.LogLog;


/**
* 源自 android-logging-log4j-1.0.3.jar
*
* @author Administrator
*/
public class LogConfig {
private Level rootLevel = Level.DEBUG;
/**
* ### log文件的格式
*
* ### 输出格式解释:
* ### [%-d{yyyy-MM-dd HH:mm:ss}][Class: %c.%M(%F:%L)] %n[Level: %-5p] - Msg: %m%n
*
* ### %d{yyyy-MM-dd HH:mm:ss}: 时间,大括号内是时间格式
* ### %c: 全类名
* ### %M: 调用的方法名称
* ### %F:%L 类名:行号(在控制台可以追踪代码)
* ### %n: 换行
* ### %p: 日志级别,这里%-5p是指定的5个字符的日志名称,为的是格式整齐
* ### %m: 日志信息
* ### 输出的信息大概如下:
* ### [时间{时间格式}][信息所在的class.method(className:lineNumber)] 换行
* ### [Level: 5个字符的等级名称] - Msg: 输出信息 换行
*/
private String filePattern = "[%-d{yyyy-MM-dd HH:mm:ss}][Class: %c.%M(%F:%L)] %n[Level: %-5p] - Msg: %m%n";

/**
* ### LogCat控制台输出格式
*
* ### [Class: 信息所在的class.method(className:lineNumber)] 换行
* ### [Level: 5个字符的等级名称] - Msg: 输出信息 换行
*/
private String logCatPattern = "[Class: %c.%M(%F:%L)] %n[Level: %-5p] - Msg: %m%n";
private String fileName = "android-log4j.log";
private int maxBackupSize = 5;
private long maxFileSize = 1024 * 1024 * 5L;
private boolean immediateFlush = true;
private boolean useLogCatAppender = true;
private boolean useFileAppender = true;
private boolean resetConfiguration = true;
private boolean internalDebugging = false;

public LogConfig() {
}

public LogConfig(String fileName) {
setFileName(fileName);
}

public LogConfig(String fileName, Level rootLevel) {
this(fileName);
setRootLevel(rootLevel);
}

public LogConfig(String fileName, Level rootLevel, String filePattern) {
this(fileName);
setRootLevel(rootLevel);
setFilePattern(filePattern);
}

public LogConfig(String fileName, int maxBackupSize, long maxFileSize, String filePattern, Level rootLevel) {
this(fileName, rootLevel, filePattern);
setMaxBackupSize(maxBackupSize);
setMaxFileSize(maxFileSize);
}

public void configure() {
Logger root = Logger.getRootLogger();

if (isResetConfiguration()) {
LogManager.getLoggerRepository().resetConfiguration();
}

LogLog.setInternalDebugging(isInternalDebugging());

if (isUseFileAppender()) {
configureFileAppender();
}

if (isUseLogCatAppender()) {
configureLogCatAppender();
}

root.setLevel(getRootLevel());
}

public void setLevel(String loggerName, Level level) {
Logger.getLogger(loggerName).setLevel(level);
}

private void configureFileAppender() {
Logger root = Logger.getRootLogger();

Layout fileLayout = new PatternLayout(getFilePattern());
RollingFileAppender rollingFileAppender;
try {
rollingFileAppender = new RollingFileAppender(fileLayout, getFileName());
} catch (IOException e) {
throw new RuntimeException("Exception configuring log system", e);
}

rollingFileAppender.setMaxBackupIndex(getMaxBackupSize());
rollingFileAppender.setMaximumFileSize(getMaxFileSize());
rollingFileAppender.setImmediateFlush(isImmediateFlush());

root.addAppender(rollingFileAppender);
}

private void configureLogCatAppender() {
Logger root = Logger.getRootLogger();
Layout logCatLayout = new PatternLayout(getLogCatPattern());
LogCatAppender logCatAppender = new LogCatAppender(logCatLayout);

root.addAppender(logCatAppender);
}

public Level getRootLevel() {
return this.rootLevel;
}

public void setRootLevel(Level level) {
this.rootLevel = level;
}

public String getFilePattern() {
return this.filePattern;
}

public void setFilePattern(String filePattern) {
this.filePattern = filePattern;
}

public String getLogCatPattern() {
return this.logCatPattern;
}

public void setLogCatPattern(String logCatPattern) {
this.logCatPattern = logCatPattern;
}

public String getFileName() {
return this.fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
}

public int getMaxBackupSize() {
return this.maxBackupSize;
}

public void setMaxBackupSize(int maxBackupSize) {
this.maxBackupSize = maxBackupSize;
}

public long getMaxFileSize() {
return this.maxFileSize;
}

public void setMaxFileSize(long maxFileSize) {
this.maxFileSize = maxFileSize;
}

public boolean isImmediateFlush() {
return this.immediateFlush;
}

public void setImmediateFlush(boolean immediateFlush) {
this.immediateFlush = immediateFlush;
}

public boolean isUseFileAppender() {
return this.useFileAppender;
}

public void setUseFileAppender(boolean useFileAppender) {
this.useFileAppender = useFileAppender;
}

public boolean isUseLogCatAppender() {
return this.useLogCatAppender;
}

public void setUseLogCatAppender(boolean useLogCatAppender) {
this.useLogCatAppender = useLogCatAppender;
}

public void setResetConfiguration(boolean resetConfiguration) {
this.resetConfiguration = resetConfiguration;
}

public boolean isResetConfiguration() {
return this.resetConfiguration;
}

public void setInternalDebugging(boolean internalDebugging) {
this.internalDebugging = internalDebugging;
}

public boolean isInternalDebugging() {
return this.internalDebugging;
}
}
Loading

0 comments on commit a199b39

Please sign in to comment.