|
|
|
@ -82,6 +82,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
@Override
|
|
|
|
|
public void onEvent(int event, String s) {
|
|
|
|
|
int e = event & FileObserver.ALL_EVENTS;
|
|
|
|
|
|
|
|
|
|
if (e == FileObserver.MODIFY) {
|
|
|
|
|
File file = new File(mPath);
|
|
|
|
|
long newOffset = file.length();
|
|
|
|
@ -98,6 +99,8 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
msg.arg1 = bytesRead;
|
|
|
|
|
mHandler.sendMessage(msg);
|
|
|
|
|
}
|
|
|
|
|
} else if (e == FileObserver.CREATE) {
|
|
|
|
|
mOffset = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -529,7 +532,16 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String logFilePath = MicroPhotoContext.buildAppDir(this.getApplicationContext());
|
|
|
|
|
logFilePath += "logs/log.txt";
|
|
|
|
|
logFilePath += "logs";
|
|
|
|
|
File file = new File(logFilePath);
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
file.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
logFilePath += "/log.txt";
|
|
|
|
|
file = new File(logFilePath);
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
file.createNewFile();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mLogFileObserver = new LogFileObserver(logFilePath);
|
|
|
|
|
mLogFileObserver.startWatching();
|
|
|
|
|