Skip to content

Commit 0315b40

Browse files
Add all files
1 parent 917612c commit 0315b40

70 files changed

Lines changed: 1844 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"allFiles": [
3+
{
4+
"file": "/storage/emulated/0/AndroidIDEProjects/FileTree/filetree/src/main/res/values/ids.xml",
5+
"selection": {
6+
"end": {
7+
"column": 0,
8+
"index": 188,
9+
"line": 6
10+
},
11+
"start": {
12+
"column": 0,
13+
"index": 188,
14+
"line": 6
15+
}
16+
}
17+
},
18+
{
19+
"file": "/storage/emulated/0/AndroidIDEProjects/FileTree/filetree/src/main/java/com/zyron/filetree/NodeManager.java",
20+
"selection": {
21+
"end": {
22+
"column": 0,
23+
"index": 1596,
24+
"line": 52
25+
},
26+
"start": {
27+
"column": 0,
28+
"index": 1596,
29+
"line": 52
30+
}
31+
}
32+
}
33+
],
34+
"selectedFile": "/storage/emulated/0/AndroidIDEProjects/FileTree/filetree/src/main/java/com/zyron/filetree/NodeManager.java"
35+
}

.gitignore

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
/bin/
15+
/gen/
16+
/out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# Gradle files
19+
.gradle/
20+
/build/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
25+
# Proguard folder generated by Eclipse
26+
proguard/
27+
28+
# Log Files
29+
*.log
30+
31+
# Android Studio Navigation editor temp files
32+
.navigation/
33+
34+
# Android Studio captures folder
35+
captures/
36+
37+
# IntelliJ
38+
*.iml
39+
.idea/workspace.xml
40+
.idea/tasks.xml
41+
.idea/gradle.xml
42+
.idea/assetWizardSettings.xml
43+
.idea/dictionaries
44+
.idea/libraries
45+
# Android Studio 3 in .gitignore file.
46+
.idea/caches
47+
.idea/modules.xml
48+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
49+
.idea/navEditor.xml
50+
51+
# Keystore files
52+
# Uncomment the following lines if you do not want to check your keystore files in.
53+
#*.jks
54+
#*.keystore
55+
56+
# External native build folder generated in Android Studio 2.2 and later
57+
.externalNativeBuild
58+
.cxx/
59+
60+
# Google Services (e.g. APIs or Firebase)
61+
# google-services.json
62+
63+
# Freeline
64+
freeline.py
65+
freeline/
66+
freeline_project_description.json
67+
68+
# fastlane
69+
fastlane/report.xml
70+
fastlane/Preview.html
71+
fastlane/screenshots
72+
fastlane/test_output
73+
fastlane/readme.md
74+
75+
# Version control
76+
vcs.xml
77+
78+
# lint
79+
lint/intermediates/
80+
lint/generated/
81+
lint/outputs/
82+
lint/tmp/
83+
# lint/reports/

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
plugins {
3+
id 'com.android.application'
4+
id 'org.jetbrains.kotlin.android'
5+
6+
}
7+
8+
android {
9+
namespace 'com.zyron.filetree'
10+
compileSdk 34
11+
12+
defaultConfig {
13+
applicationId "com.zyron.filetree"
14+
minSdk 29
15+
targetSdk 34
16+
versionCode 1
17+
versionName "1.0"
18+
19+
vectorDrawables {
20+
useSupportLibrary true
21+
}
22+
}
23+
24+
buildTypes {
25+
release {
26+
minifyEnabled true
27+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28+
}
29+
}
30+
31+
compileOptions {
32+
sourceCompatibility JavaVersion.VERSION_17
33+
targetCompatibility JavaVersion.VERSION_17
34+
}
35+
36+
buildFeatures {
37+
viewBinding true
38+
39+
}
40+
41+
}
42+
43+
dependencies {
44+
45+
implementation project(':filetree')
46+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
47+
implementation 'com.google.android.material:material:1.12.0'
48+
implementation 'androidx.appcompat:appcompat:1.6.1'
49+
implementation 'androidx.core:core-ktx:1.13.1'
50+
implementation 'androidx.recyclerview:recyclerview:1.3.2'
51+
implementation 'androidx.preference:preference-ktx:1.2.1'
52+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<manifest
4+
xmlns:android="http://schemas.android.com/apk/res/android">
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:roundIcon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity
13+
android:name="MainActivity"
14+
android:exported="true">
15+
<intent-filter>
16+
<action
17+
android:name="android.intent.action.MAIN" />
18+
<category
19+
android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
</application>
23+
</manifest>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.zyron.filetree
2+
3+
import android.graphics.drawable.Drawable
4+
import android.os.Bundle
5+
import android.widget.Toast
6+
import androidx.appcompat.app.AppCompatActivity
7+
import androidx.recyclerview.widget.LinearLayoutManager
8+
import androidx.recyclerview.widget.RecyclerView
9+
import com.zyron.filetree.ui.FileTreeAdapter
10+
import java.io.File
11+
import java.util.concurrent.Executors
12+
import java.util.concurrent.LinkedBlockingQueue
13+
import java.util.concurrent.ThreadPoolExecutor
14+
import java.util.concurrent.TimeUnit
15+
16+
// Example usage in MainActivity
17+
public class MainActivity : AppCompatActivity() {
18+
19+
override fun onCreate(savedInstanceState: Bundle?) {
20+
super.onCreate(savedInstanceState)
21+
setContentView(R.layout.activity_main)
22+
23+
// Get references to the RecyclerView and other UI elements
24+
val recyclerView: RecyclerView = findViewById(R.id.recyclerView)
25+
val folderIcon: Drawable = ContextCompat.getDrawable(this, R.drawable.ic_folder)!!
26+
val fileIcon: Drawable = ContextCompat.getDrawable(this, R.drawable.ic_file)!!
27+
28+
// Create an instance of FileTree
29+
val fileTree = FileTree(this, File("/"))
30+
31+
// Create an instance of FileTreeAdapter
32+
val adapter = FileTreeAdapter(this, fileTree, folderIcon, fileIcon, object : FileTreeClickListener {
33+
override fun onFileClick(file: File) {
34+
// Handle file click
35+
Toast.makeText(this@MainActivity, "File clicked: ${file.absolutePath}", Toast.LENGTH_SHORT).show()
36+
}
37+
38+
override fun onFolderClick(folder: File) {
39+
// Handle folder click
40+
Toast.makeText(this@MainActivity, "Folder clicked: ${folder.absolutePath}", Toast.LENGTH_SHORT).show()
41+
}
42+
})
43+
44+
// Set up the RecyclerView with the adapter and a suitable layout manager
45+
recyclerView.layoutManager = LinearLayoutManager(this)
46+
recyclerView.adapter = adapter
47+
48+
// Load files in a separate thread
49+
Thread {
50+
// Load files from the root directory
51+
fileTree.loadTree()
52+
// Update the UI on the main thread
53+
runOnUiThread {
54+
adapter.notifyDataSetChanged()
55+
}
56+
}.start()
57+
}
58+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
8+
<aapt:attr name="android:fillColor">
9+
<gradient
10+
android:endX="85.84757"
11+
android:endY="92.4963"
12+
android:startX="42.9492"
13+
android:startY="49.59793"
14+
android:type="linear">
15+
<item
16+
android:color="#44000000"
17+
android:offset="0.0" />
18+
<item
19+
android:color="#00000000"
20+
android:offset="1.0" />
21+
</gradient>
22+
</aapt:attr>
23+
</path>
24+
<path
25+
android:fillColor="#FFFFFF"
26+
android:fillType="nonZero"
27+
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
28+
android:strokeWidth="1"
29+
android:strokeColor="#00000000" />
30+
</vector>

0 commit comments

Comments
 (0)