Skip to content

Commit e3d50b6

Browse files
authored
Merge pull request #25 from xianglin1998/master
Rebuild finished.
2 parents 2324349 + 0c131c3 commit e3d50b6

27 files changed

+207
-170
lines changed

app_main/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<activity
6464
android:name=".activities.tools.MfKey32ConsoleActivity"
6565
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
66+
6667
<activity
6768
android:name=".activities.tools.MfKey64ConsoleActivity"
6869
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
@@ -74,9 +75,11 @@
7475
<activity
7576
android:name=".activities.connect.Proxmark3Rdv4RRGConnectActivity"
7677
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
78+
7779
<activity
7880
android:name=".activities.main.Proxmark3Rdv4RRGMain"
7981
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />
82+
8083
<activity
8184
android:name=".activities.proxmark3.rdv4_rrg.Proxmark3Rdv4RRGRedTeamConsoleActivity"
8285
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout" />

app_main/src/main/java/cn/rrg/rdv/activities/main/BaseActivity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ public void setContentView(View view, ViewGroup.LayoutParams params) {
7777
}
7878

7979
public void setStatus(boolean darkMode) {
80-
//这里注意下 因为在评论区发现有网友调用setRootViewFitsSystemWindows 里面 winContent.getChildCount()=0 导致代码无法继续
81-
//是因为你需要在setContentView之后才可以调用 setRootViewFitsSystemWindows
82-
83-
//当FitsSystemWindows设置 true 时,会在屏幕最上方预留出状态栏高度的 padding
84-
StatusBarUtil.setRootViewFitsSystemWindows(this, false);
8580
//设置状态栏透明
8681
StatusBarUtil.setTranslucentStatus(this);
8782
//一般的手机的状态栏文字和图标都是白色的, 可如果你的应用也是纯白色的, 或导致状态栏文字看不清

app_main/src/main/java/cn/rrg/rdv/activities/px53x/NfcListConsoleActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import cn.rrg.console.define.ICommandTools;
66
import cn.rrg.console.define.ICommandType;
77
import cn.rrg.natives.NfcListTools;
8+
import cn.rrg.rdv.R;
89
import cn.rrg.rdv.implement.EntryICommandType;
910

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

3233
@Override
3334
protected void onTestEnd() {
34-
showToast("执行完成,您可以观察收集到的标签信息了!");
35+
showToast(getString(R.string.finish));
3536
}
3637
}

app_main/src/main/java/cn/rrg/rdv/activities/tools/BaseConsoleActivity.java

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import cn.dxl.common.util.PrintUtil;
3838
import cn.rrg.rdv.R;
3939
import cn.dxl.common.util.DynamicLineParseUtil;
40+
import cn.rrg.rdv.implement.TextWatcherImpl;
4041

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

145-
txtOutConsole.addTextChangedListener(new TextWatcher() {
146+
txtOutConsole.addTextChangedListener(new TextWatcherImpl() {
146147
//存放上次的尾部索引
147148
int last = 0;
148149

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

155-
@Override
156-
public void onTextChanged(CharSequence s, int start, int before, int count) {
157-
}
158-
159156
@Override
160157
public void afterTextChanged(Editable s) {
161158
//在文本改变后的回调,这里我们需要截取他的字符串!
@@ -168,7 +165,7 @@ public void afterTextChanged(Editable s) {
168165
}
169166
});
170167

171-
txtErrConsole.addTextChangedListener(new TextWatcher() {
168+
txtErrConsole.addTextChangedListener(new TextWatcherImpl() {
172169
//存放上次的尾部索引
173170
int last = 0;
174171

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

181-
@Override
182-
public void onTextChanged(CharSequence s, int start, int before, int count) {
183-
}
184-
185178
@Override
186179
public void afterTextChanged(Editable s) {
187180
//在文本改变后的回调,这里我们需要截取他的字符串!
@@ -193,17 +186,7 @@ public void afterTextChanged(Editable s) {
193186
}
194187
});
195188

196-
txtLogConsole.addTextChangedListener(new TextWatcher() {
197-
@Override
198-
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
199-
200-
}
201-
202-
@Override
203-
public void onTextChanged(CharSequence s, int start, int before, int count) {
204-
205-
}
206-
189+
txtLogConsole.addTextChangedListener(new TextWatcherImpl() {
207190
@Override
208191
public void afterTextChanged(Editable s) {
209192
svLogContain.fullScroll(ScrollView.FOCUS_DOWN);

app_main/src/main/java/cn/rrg/rdv/activities/tools/DumpListActivity.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.io.FileFilter;
1111

1212
import cn.rrg.rdv.javabean.FileBean;
13+
import cn.rrg.rdv.util.DumpUtils;
1314
import cn.rrg.rdv.util.Paths;
1415

1516
public class DumpListActivity extends FileListActivity {
@@ -40,8 +41,8 @@ private boolean isDumpFileName(String name) {
4041
return false;
4142
}
4243

43-
private boolean isHardnestedDir(String name) {
44-
return Paths.HARDNESTED_PATH.equalsIgnoreCase(name);
44+
private boolean isHardnestedDir(File name) {
45+
return name.isDirectory() && Paths.HARDNESTED_PATH.equalsIgnoreCase(name.getName());
4546
}
4647

4748
@Override
@@ -52,14 +53,20 @@ public boolean accept(File pathname) {
5253
// 1. The name is match!
5354
// 2. not a hardnested res dir.
5455
String name = pathname.getName();
55-
return isDumpFileName(name) && !isHardnestedDir(name);
56+
if (isHardnestedDir(pathname)) {
57+
return false;
58+
}
59+
if (pathname.isDirectory()) {
60+
return true;
61+
}
62+
return isDumpFileName(name) && DumpUtils.isDump(pathname);
5663
}
5764
};
5865
}
5966

6067
@Override
6168
protected String onInitPath() {
62-
return Paths.DUMP_DIRECTORY;
69+
return Paths.TOOLS_DIRECTORY;
6370
}
6471

6572
@Override

app_main/src/main/java/cn/rrg/rdv/activities/tools/FileListActivity.java

Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.app.AlertDialog;
5+
import android.content.DialogInterface;
56
import android.content.Intent;
67
import android.net.Uri;
78
import android.os.Bundle;
@@ -20,6 +21,7 @@
2021
import java.util.LinkedList;
2122

2223
import cn.dxl.common.util.FileUtils;
24+
import cn.dxl.common.widget.ToastUtil;
2325
import cn.rrg.rdv.R;
2426
import cn.rrg.rdv.activities.main.BaseActivity;
2527
import cn.rrg.rdv.binder.FileInfoBinder;
@@ -36,21 +38,20 @@ public enum MODE {
3638
}
3739

3840
protected MultiTypeAdapter multiTypeAdapter;
39-
protected Items items = new Items();
4041
protected AlertDialog workDialog;
4142
protected ImageButton btnAdd;
4243

4344
protected MODE mode;
4445

4546
protected FileFilter fileFilter;
4647
protected String initPath;
48+
protected Items items;
4749

4850
@Override
4951
protected void onCreate(@Nullable Bundle savedInstanceState) {
5052
super.onCreate(savedInstanceState);
5153
setContentView(R.layout.act_file_list);
5254

53-
multiTypeAdapter = new MultiTypeAdapter(items);
5455

5556
initViews();
5657
initActions();
@@ -69,11 +70,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6970
}
7071

7172
private void initViews() {
73+
multiTypeAdapter = new MultiTypeAdapter();
7274
RecyclerView rvDumpList = findViewById(R.id.rvDumpList);
73-
rvDumpList.setAdapter(multiTypeAdapter);
74-
rvDumpList.setLayoutManager(new LinearLayoutManager(context));
75+
items = new Items();
7576

7677
multiTypeAdapter.register(FileBean.class, new FileInfoBinder());
78+
multiTypeAdapter.setItems(items);
79+
80+
rvDumpList.setLayoutManager(new LinearLayoutManager(context));
81+
rvDumpList.setAdapter(multiTypeAdapter);
7782

7883
workDialog = new AlertDialog.Builder(context)
7984
.setTitle(R.string.woring)
@@ -103,7 +108,6 @@ public void run() {
103108
}
104109

105110
protected void traverFile2UseRawFile(Uri path) {
106-
items.clear();
107111
showOrDismissDialog(true);
108112
LinkedList<File> list = new LinkedList<>();
109113
if (path != null) {
@@ -114,49 +118,61 @@ protected void traverFile2UseRawFile(Uri path) {
114118
return;
115119
}
116120
}
121+
items.clear();
117122
// 版本不同可以导致迭代思路不同!
118123
while (!list.isEmpty()) {
119124
File f = list.poll();
120125
if (f != null) {
121126
// 处理迭代逻辑!
122127
if (f.isFile()) { // 如果是文件,并且后缀是我们需要的,则进行保存!
123-
new Thread(new Runnable() {
128+
// TODO 是文件!
129+
StringBuilder info = new StringBuilder();
130+
Date date = new Date(f.lastModified());
131+
String dateStr = SimpleDateFormat.getDateTimeInstance().format(date);
132+
// 是文件,则拼接大小信息 + 最后修改日期!
133+
info.append(FileUtils.getFileLengthIfFile(f));
134+
// 拼接最后的修改日期!
135+
info.append(" | ").append(dateStr);
136+
items.add(new FileBean(f.isFile(), f.getName(), f.getPath(), info.toString(),
137+
false) {
124138
@Override
125-
public void run() {
126-
// TODO 是文件!
127-
StringBuilder info = new StringBuilder();
128-
Date date = new Date(f.lastModified());
129-
String dateStr = SimpleDateFormat.getDateTimeInstance().format(date);
130-
// 是文件,则拼接大小信息 + 最后修改日期!
131-
info.append(FileUtils.getFileLengthIfFile(f));
132-
// 拼接最后的修改日期!
133-
info.append(" | ").append(dateStr);
134-
items.add(new FileBean(
135-
f.isFile(),
136-
f.getName(),
137-
f.getPath(),
138-
info.toString(),
139-
false) {
140-
@Override
141-
public void onClick() {
142-
if (mode == MODE.EDIT) {
143-
onEdit(this);
144-
} else {
145-
Intent intent = new Intent().putExtra("file", getPath());
146-
setResult(Activity.RESULT_OK, intent);
147-
finish();
148-
}
149-
}
139+
public void onClick() {
140+
if (mode == MODE.EDIT) {
141+
onEdit(this);
142+
} else {
143+
Intent intent = new Intent().putExtra("file", getPath());
144+
setResult(Activity.RESULT_OK, intent);
145+
finish();
146+
}
147+
}
150148

149+
@Override
150+
public boolean onLongClick() {
151+
// TODO 实现文件删除或者共享(发送)
152+
String[] items = new String[]{getString(R.string.share), getString(R.string.delete)};
153+
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
151154
@Override
152-
public boolean onLongClick() {
153-
// TODO 实现文件删除或者共享(发送)
154-
return true;
155+
public void onClick(DialogInterface dialog, int which) {
156+
File f = new File(getPath());
157+
switch (which) {
158+
case 0:
159+
FileUtils.shareFile(f);
160+
break;
161+
case 1:
162+
if (FileUtils.delete(f)) {
163+
ToastUtil.show(context, getString(R.string.successful), false);
164+
} else {
165+
ToastUtil.show(context, getString(R.string.failed), false);
166+
}
167+
initDatas();
168+
break;
169+
}
155170
}
156-
});
157-
updateViews();
171+
};
172+
new AlertDialog.Builder(context, R.style.CircleDialogStyle).setItems(items, listener).show();
173+
return true;
158174
}
159-
}).start();
175+
});
160176
} else {
161177
// 加入队列,以便进入接下来的迭代!
162178
File[] files = f.listFiles(fileFilter);
@@ -167,6 +183,7 @@ public boolean onLongClick() {
167183
}
168184
}
169185
}
186+
updateViews();
170187
showOrDismissDialog(false);
171188
}
172189

app_main/src/main/java/cn/rrg/rdv/activities/tools/LoginActivity.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,12 @@ public void onPermissionNormal(PermissionUtil util) {
8787
Log.d(LOG_TAG, "权限正常!");
8888
}
8989
});
90-
//6.0以及以上可能需要申请权限
90+
9191
String[] permissionArray = new String[]{
92-
//位置访问 TODO 2019/07/29 从APP必须的动态权限列表移除,替换为有设备需要时动态申请!
93-
//Manifest.permission.ACCESS_COARSE_LOCATION,
94-
//内存卡写
9592
Manifest.permission.WRITE_EXTERNAL_STORAGE,
96-
//内存卡读
9793
Manifest.permission.READ_EXTERNAL_STORAGE,
98-
//读取手机信息! TODO 2019/08/21 从APP必须的权限移除,目前暂时用不上IMEI!
99-
//Manifest.permission.READ_PHONE_STATE
10094
};
101-
//设置可能需要动态请求的权限!
10295
permissionUtil.setPermissions(permissionArray);
103-
//开始请求!
10496
permissionUtil.checks();
10597
}
10698

@@ -116,7 +108,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
116108
}
117109
//如果所有的权限都有才能让他初始化
118110
if (!result) {
119-
Toast.makeText(this, "部分权限获取失败,请给予权限!", Toast.LENGTH_SHORT).show();
111+
Toast.makeText(this, R.string.tips_permission_request_failed, Toast.LENGTH_SHORT).show();
120112
//执行finish,结束当前act,直接退出初始化!!!
121113
finish();
122114
}

app_main/src/main/java/cn/rrg/rdv/fragment/base/AppMainDevicesFragment.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,21 @@ public void onClick() {
228228
private void updateDeviceStatus(boolean status) {
229229
Log.d("TAG", "新状态:" + status);
230230
// update device status to bean!
231-
if (deviceInfoBean != null) {
232-
deviceInfoBean.setEnable(status);
233-
}
234-
for (Object tmp : deviceItems) {
235-
if (tmp instanceof DeviceInfoBean) {
236-
if (tmp != deviceInfoBean) {
237-
((DeviceInfoBean) tmp).setEnable(!status);
231+
if (status) {
232+
if (deviceInfoBean != null) {
233+
deviceInfoBean.setEnable(status);
234+
}
235+
for (Object tmp : deviceItems) {
236+
if (tmp instanceof DeviceInfoBean) {
237+
if (tmp != deviceInfoBean) {
238+
((DeviceInfoBean) tmp).setEnable(false);
239+
}
240+
}
241+
}
242+
} else {
243+
for (Object tmp : deviceItems) {
244+
if (tmp instanceof DeviceInfoBean) {
245+
((DeviceInfoBean) tmp).setEnable(true);
238246
}
239247
}
240248
}

app_main/src/main/java/cn/rrg/rdv/fragment/init/InitFragment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ public void run() {
6262
InitUtil.startLogcat(true);
6363
//进行一些设置的读取初始化!
6464
InitUtil.initSettings();
65-
//跳转到主页面处理!
66-
go2MainAct();
6765
} catch (Exception e) {
6866
e.printStackTrace();
69-
go2MainAct();
7067
}
68+
//跳转到主页面处理!
69+
go2MainAct();
7170
}
7271
}
7372

0 commit comments

Comments
 (0)