Commit 3a5df330 authored by fallenstardust's avatar fallenstardust
parents 826024bb 59cdbf17
......@@ -7,7 +7,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.4.2'
//classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
......
......@@ -230,11 +230,6 @@ public class BaseActivity extends AppCompatActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
FileLogUtil.writeAndTime("resultcode值"+resultCode);
} catch (IOException e) {
e.printStackTrace();
}
// 拒绝时, 关闭页面, 缺少主要权限, 无法运行
if (requestCode == REQUEST_PERMISSIONS && resultCode == PermissionsActivity.PERMISSIONS_DENIED) {
showToast("喵不给我权限让我怎么运行?!");
......
package cn.garymb.ygomobile.ui.activities;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
......@@ -9,6 +10,7 @@ import android.widget.TextView;
import java.io.IOException;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.utils.FileLogUtil;
public class FileLogActivity extends BaseActivity {
......@@ -36,6 +38,37 @@ public class FileLogActivity extends BaseActivity {
}
});
tv_log.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogPlus dialogPlus=new DialogPlus(FileLogActivity.this);
dialogPlus.setMessage("确认清空日志?");
dialogPlus.setLeftButtonText("清空");
dialogPlus.setRightButtonText("取消");
dialogPlus.setLeftButtonListener(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
FileLogUtil.clear();
showToast("清空完毕");
tv_log.setText("");
} catch (IOException e) {
showToast("清空失败,原因为"+e.getMessage());
}
dialog.dismiss();
}
});
dialogPlus.setRightButtonListener(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
dialogPlus.show();
return true;
}
});
}
private void read() {
......
......@@ -79,7 +79,6 @@ public class TaxiConnectionListener implements ConnectionListener {
} catch (Exception e) {
tExit.schedule(new timetask(), logintime);
}
}
}
......@@ -96,12 +95,9 @@ public class TaxiConnectionListener implements ConnectionListener {
Log.e("TaxiConnectionListener", "重新加入房间");
tExit.schedule(new timeJoin(), logintime);
}
// TODO: Implement this method
}
}
}
}
......@@ -21,19 +21,29 @@ public class FileLogUtil {
return new File(AppsSettings.get().getResourcePath(), "YGOMobile.log");
}
public static void clear() throws IOException {
write("",false);
}
public static void writeAndTime(String message) throws IOException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm");// HH:mm:ss
// 获取当前时间
Date date = new Date(System.currentTimeMillis());
//追加内容写入
write(simpleDateFormat.format(date) + ": " + message);
}
public static void write(String message) throws IOException {
write(message,true);
}
public static void write(String message,boolean append) throws IOException {
FileWriter fw = null;
//如果文件存在,则追加内容;如果文件不存在,则创建文件
File f = getConfigFile();
fw = new FileWriter(f, true);
fw = new FileWriter(f, append);
PrintWriter pw = new PrintWriter(fw);
if (writeNum==0)
......
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