Skip to content

Commit

Permalink
Merge pull request #25 from xianglin1998/master
Browse files Browse the repository at this point in the history
Rebuild finished.
  • Loading branch information
xianglin1998 authored Mar 6, 2020
2 parents 2324349 + 0c131c3 commit e3d50b6
Show file tree
Hide file tree
Showing 27 changed files with 207 additions and 170 deletions.
3 changes: 3 additions & 0 deletions app_main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<activity
android:name=".activities.tools.MfKey32ConsoleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />

<activity
android:name=".activities.tools.MfKey64ConsoleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
Expand All @@ -74,9 +75,11 @@
<activity
android:name=".activities.connect.Proxmark3Rdv4RRGConnectActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />

<activity
android:name=".activities.main.Proxmark3Rdv4RRGMain"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />

<activity
android:name=".activities.proxmark3.rdv4_rrg.Proxmark3Rdv4RRGRedTeamConsoleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public void setContentView(View view, ViewGroup.LayoutParams params) {
}

public void setStatus(boolean darkMode) {
//这里注意下 因为在评论区发现有网友调用setRootViewFitsSystemWindows 里面 winContent.getChildCount()=0 导致代码无法继续
//是因为你需要在setContentView之后才可以调用 setRootViewFitsSystemWindows

//当FitsSystemWindows设置 true 时,会在屏幕最上方预留出状态栏高度的 padding
StatusBarUtil.setRootViewFitsSystemWindows(this, false);
//设置状态栏透明
StatusBarUtil.setTranslucentStatus(this);
//一般的手机的状态栏文字和图标都是白色的, 可如果你的应用也是纯白色的, 或导致状态栏文字看不清
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import cn.rrg.console.define.ICommandTools;
import cn.rrg.console.define.ICommandType;
import cn.rrg.natives.NfcListTools;
import cn.rrg.rdv.R;
import cn.rrg.rdv.implement.EntryICommandType;

public class NfcListConsoleActivity extends PN53XConsoleActivity {
Expand All @@ -31,6 +32,6 @@ protected int startTest(ICommandTools cmd) {

@Override
protected void onTestEnd() {
showToast("执行完成,您可以观察收集到的标签信息了!");
showToast(getString(R.string.finish));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import cn.dxl.common.util.PrintUtil;
import cn.rrg.rdv.R;
import cn.dxl.common.util.DynamicLineParseUtil;
import cn.rrg.rdv.implement.TextWatcherImpl;

/*
* TODO 此类留存,用于封装基础控制台!
Expand Down Expand Up @@ -142,7 +143,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
throw new RuntimeException("BaseConsoleActivity has some resources did not init!");
}

txtOutConsole.addTextChangedListener(new TextWatcher() {
txtOutConsole.addTextChangedListener(new TextWatcherImpl() {
//存放上次的尾部索引
int last = 0;

Expand All @@ -152,10 +153,6 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
last = s.length();
}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}

@Override
public void afterTextChanged(Editable s) {
//在文本改变后的回调,这里我们需要截取他的字符串!
Expand All @@ -168,7 +165,7 @@ public void afterTextChanged(Editable s) {
}
});

txtErrConsole.addTextChangedListener(new TextWatcher() {
txtErrConsole.addTextChangedListener(new TextWatcherImpl() {
//存放上次的尾部索引
int last = 0;

Expand All @@ -178,10 +175,6 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
last = s.length();
}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}

@Override
public void afterTextChanged(Editable s) {
//在文本改变后的回调,这里我们需要截取他的字符串!
Expand All @@ -193,17 +186,7 @@ public void afterTextChanged(Editable s) {
}
});

txtLogConsole.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

txtLogConsole.addTextChangedListener(new TextWatcherImpl() {
@Override
public void afterTextChanged(Editable s) {
svLogContain.fullScroll(ScrollView.FOCUS_DOWN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.FileFilter;

import cn.rrg.rdv.javabean.FileBean;
import cn.rrg.rdv.util.DumpUtils;
import cn.rrg.rdv.util.Paths;

public class DumpListActivity extends FileListActivity {
Expand Down Expand Up @@ -40,8 +41,8 @@ private boolean isDumpFileName(String name) {
return false;
}

private boolean isHardnestedDir(String name) {
return Paths.HARDNESTED_PATH.equalsIgnoreCase(name);
private boolean isHardnestedDir(File name) {
return name.isDirectory() && Paths.HARDNESTED_PATH.equalsIgnoreCase(name.getName());
}

@Override
Expand All @@ -52,14 +53,20 @@ public boolean accept(File pathname) {
// 1. The name is match!
// 2. not a hardnested res dir.
String name = pathname.getName();
return isDumpFileName(name) && !isHardnestedDir(name);
if (isHardnestedDir(pathname)) {
return false;
}
if (pathname.isDirectory()) {
return true;
}
return isDumpFileName(name) && DumpUtils.isDump(pathname);
}
};
}

@Override
protected String onInitPath() {
return Paths.DUMP_DIRECTORY;
return Paths.TOOLS_DIRECTORY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -20,6 +21,7 @@
import java.util.LinkedList;

import cn.dxl.common.util.FileUtils;
import cn.dxl.common.widget.ToastUtil;
import cn.rrg.rdv.R;
import cn.rrg.rdv.activities.main.BaseActivity;
import cn.rrg.rdv.binder.FileInfoBinder;
Expand All @@ -36,21 +38,20 @@ public enum MODE {
}

protected MultiTypeAdapter multiTypeAdapter;
protected Items items = new Items();
protected AlertDialog workDialog;
protected ImageButton btnAdd;

protected MODE mode;

protected FileFilter fileFilter;
protected String initPath;
protected Items items;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_file_list);

multiTypeAdapter = new MultiTypeAdapter(items);

initViews();
initActions();
Expand All @@ -69,11 +70,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
}

private void initViews() {
multiTypeAdapter = new MultiTypeAdapter();
RecyclerView rvDumpList = findViewById(R.id.rvDumpList);
rvDumpList.setAdapter(multiTypeAdapter);
rvDumpList.setLayoutManager(new LinearLayoutManager(context));
items = new Items();

multiTypeAdapter.register(FileBean.class, new FileInfoBinder());
multiTypeAdapter.setItems(items);

rvDumpList.setLayoutManager(new LinearLayoutManager(context));
rvDumpList.setAdapter(multiTypeAdapter);

workDialog = new AlertDialog.Builder(context)
.setTitle(R.string.woring)
Expand Down Expand Up @@ -103,7 +108,6 @@ public void run() {
}

protected void traverFile2UseRawFile(Uri path) {
items.clear();
showOrDismissDialog(true);
LinkedList<File> list = new LinkedList<>();
if (path != null) {
Expand All @@ -114,49 +118,61 @@ protected void traverFile2UseRawFile(Uri path) {
return;
}
}
items.clear();
// 版本不同可以导致迭代思路不同!
while (!list.isEmpty()) {
File f = list.poll();
if (f != null) {
// 处理迭代逻辑!
if (f.isFile()) { // 如果是文件,并且后缀是我们需要的,则进行保存!
new Thread(new Runnable() {
// TODO 是文件!
StringBuilder info = new StringBuilder();
Date date = new Date(f.lastModified());
String dateStr = SimpleDateFormat.getDateTimeInstance().format(date);
// 是文件,则拼接大小信息 + 最后修改日期!
info.append(FileUtils.getFileLengthIfFile(f));
// 拼接最后的修改日期!
info.append(" | ").append(dateStr);
items.add(new FileBean(f.isFile(), f.getName(), f.getPath(), info.toString(),
false) {
@Override
public void run() {
// TODO 是文件!
StringBuilder info = new StringBuilder();
Date date = new Date(f.lastModified());
String dateStr = SimpleDateFormat.getDateTimeInstance().format(date);
// 是文件,则拼接大小信息 + 最后修改日期!
info.append(FileUtils.getFileLengthIfFile(f));
// 拼接最后的修改日期!
info.append(" | ").append(dateStr);
items.add(new FileBean(
f.isFile(),
f.getName(),
f.getPath(),
info.toString(),
false) {
@Override
public void onClick() {
if (mode == MODE.EDIT) {
onEdit(this);
} else {
Intent intent = new Intent().putExtra("file", getPath());
setResult(Activity.RESULT_OK, intent);
finish();
}
}
public void onClick() {
if (mode == MODE.EDIT) {
onEdit(this);
} else {
Intent intent = new Intent().putExtra("file", getPath());
setResult(Activity.RESULT_OK, intent);
finish();
}
}

@Override
public boolean onLongClick() {
// TODO 实现文件删除或者共享(发送)
String[] items = new String[]{getString(R.string.share), getString(R.string.delete)};
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@Override
public boolean onLongClick() {
// TODO 实现文件删除或者共享(发送)
return true;
public void onClick(DialogInterface dialog, int which) {
File f = new File(getPath());
switch (which) {
case 0:
FileUtils.shareFile(f);
break;
case 1:
if (FileUtils.delete(f)) {
ToastUtil.show(context, getString(R.string.successful), false);
} else {
ToastUtil.show(context, getString(R.string.failed), false);
}
initDatas();
break;
}
}
});
updateViews();
};
new AlertDialog.Builder(context, R.style.CircleDialogStyle).setItems(items, listener).show();
return true;
}
}).start();
});
} else {
// 加入队列,以便进入接下来的迭代!
File[] files = f.listFiles(fileFilter);
Expand All @@ -167,6 +183,7 @@ public boolean onLongClick() {
}
}
}
updateViews();
showOrDismissDialog(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,12 @@ public void onPermissionNormal(PermissionUtil util) {
Log.d(LOG_TAG, "权限正常!");
}
});
//6.0以及以上可能需要申请权限

String[] permissionArray = new String[]{
//位置访问 TODO 2019/07/29 从APP必须的动态权限列表移除,替换为有设备需要时动态申请!
//Manifest.permission.ACCESS_COARSE_LOCATION,
//内存卡写
Manifest.permission.WRITE_EXTERNAL_STORAGE,
//内存卡读
Manifest.permission.READ_EXTERNAL_STORAGE,
//读取手机信息! TODO 2019/08/21 从APP必须的权限移除,目前暂时用不上IMEI!
//Manifest.permission.READ_PHONE_STATE
};
//设置可能需要动态请求的权限!
permissionUtil.setPermissions(permissionArray);
//开始请求!
permissionUtil.checks();
}

Expand All @@ -116,7 +108,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
}
//如果所有的权限都有才能让他初始化
if (!result) {
Toast.makeText(this, "部分权限获取失败,请给予权限!", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.tips_permission_request_failed, Toast.LENGTH_SHORT).show();
//执行finish,结束当前act,直接退出初始化!!!
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,21 @@ public void onClick() {
private void updateDeviceStatus(boolean status) {
Log.d("TAG", "新状态:" + status);
// update device status to bean!
if (deviceInfoBean != null) {
deviceInfoBean.setEnable(status);
}
for (Object tmp : deviceItems) {
if (tmp instanceof DeviceInfoBean) {
if (tmp != deviceInfoBean) {
((DeviceInfoBean) tmp).setEnable(!status);
if (status) {
if (deviceInfoBean != null) {
deviceInfoBean.setEnable(status);
}
for (Object tmp : deviceItems) {
if (tmp instanceof DeviceInfoBean) {
if (tmp != deviceInfoBean) {
((DeviceInfoBean) tmp).setEnable(false);
}
}
}
} else {
for (Object tmp : deviceItems) {
if (tmp instanceof DeviceInfoBean) {
((DeviceInfoBean) tmp).setEnable(true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ public void run() {
InitUtil.startLogcat(true);
//进行一些设置的读取初始化!
InitUtil.initSettings();
//跳转到主页面处理!
go2MainAct();
} catch (Exception e) {
e.printStackTrace();
go2MainAct();
}
//跳转到主页面处理!
go2MainAct();
}
}

Expand Down
Loading

0 comments on commit e3d50b6

Please sign in to comment.