Skip to content

Commit bd17b3f

Browse files
Merge pull request amitshekhariitbhu#110 from a-d-j-i/master
Add filesystem navigation (seen from the app perspective)
2 parents 9f085dd + c6250d5 commit bd17b3f

36 files changed

+647
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ buildscript {
2525
google()
2626
}
2727
dependencies {
28-
classpath 'com.android.tools.build:gradle:2.3.3'
28+
classpath 'com.android.tools.build:gradle:3.0.1'
2929
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
3030
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
3131

debug-db/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ dependencies {
5151
compile 'com.google.code.gson:gson:2.8.0'
5252
compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
5353
compile "android.arch.persistence.room:runtime:1.0.0"
54+
compile 'com.android.support:appcompat-v7:27.0.0'
55+
5456
}
5557

5658
//apply from: 'debug-db-upload.gradle'

debug-db/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222

2323
<uses-permission android:name="android.permission.INTERNET" />
2424
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
25+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2526

2627
<application>
2728
<provider
2829
android:authorities="${applicationId}.DebugDBInitProvider"
2930
android:exported="false"
3031
android:enabled="true"
3132
android:name=".DebugDBInitProvider" />
33+
<activity android:name=".RequestPermissionsActivity">
34+
</activity>
3235
</application>
3336

3437
</manifest>

debug-db/src/main/assets/app.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,32 @@ $( document ).ready(function() {
2121
$(this).addClass('selected');
2222
});
2323

24-
24+
$('#fileTree').fileTree({ root: '/', script: 'fileTree', folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false }, function(file) {
25+
console.log(file);
26+
$.ajax({url: "getFileData?fileName="+file, success: function(result){
27+
$("#file-data").empty();
28+
$("#file-data").append("<pre>" + hexdump(result) + "</pre>");
29+
}});
30+
});
2531
});
32+
function hexdump(buffer, blockSize) {
33+
blockSize = blockSize || 16;
34+
var lines = [];
35+
var hex = "0123456789ABCDEF";
36+
for (var b = 0; b < buffer.length; b += blockSize) {
37+
var block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
38+
var addr = ("0000" + b.toString(16)).slice(-4);
39+
var codes = block.split('').map(function (ch) {
40+
var code = ch.charCodeAt(0);
41+
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code];
42+
}).join("");
43+
codes += "&nbsp;&nbsp;&nbsp;".repeat(blockSize - block.length);
44+
var chars = block.replace(/[\x00-\x1F\x20]/g, '.');
45+
chars += " ".repeat(blockSize - block.length);
46+
lines.push(addr + "&nbsp;&nbsp;" + codes + "&nbsp;&nbsp;" + chars);
47+
}
48+
return lines.join("<br/>");
49+
}
2650

2751
var isDatabaseSelected = true;
2852

464 Bytes
Loading
603 Bytes
Loading
618 Bytes
Loading
579 Bytes
Loading
537 Bytes
Loading
651 Bytes
Loading

0 commit comments

Comments
 (0)