This application is getting better and better... check out the latest update...
Version 6 (+extract zip-files and full-screen image paging): in message #10
Version 5 (+SQLite database support): in message #9
Version 4 (+full-screen mode): in message #8
Version 3 (+MediaView controller and PDF controls): in message #7
Version 2 (+ MSOffice files convert to PDF): in message #6
Version 1 (+ webpage and file info list): in message #3
Check out the latest version!
With this application you can explore your drives, folders and files.
With the B4XComboBox on the top left you can select a drive letter. The list gets updated every time you change it.
This means that you can add a USB device that gets a drive letter (a smartphone doesn't get a drive letter by default).
After you select a different drive letter from the existing list the new drive letter will appear in the list.
The Treeview will contain a list of the top level folders and files and their sub folders and files.
The filling of the Treeview doesn't go over all the sub folders and its files (using recursive subroutine) because that takes to much time to load.
When you click on a folder the next levels are loaded for that folder. Clicking on a file in an expanded sub folder will fill the Treeview with its parents folders and files.
The search text field will allow you to quickly open a sub folder that starts with the entered letters.
You can use the breadcrumbs to navigate to a previously opened folder or drive.
The blue label shows the file attributes and name of the selected file (in the Treeview). The DOS attrib command is used for this.
If you click on the info button then a message is displayed showing the file details. The wmic command is used for this. (It should still work in Windows 10 and 11)
And here's the code to select a file viewer:
The code checks the file extension and selects a view to display the contents.
Sound and video files use a MediaView, image files use a ZoomImageView, pdf files use pdfbox code in a ScrollPane, text files use a TextArea, code files use a WebView with the CodeMirror editor and for the rest of the files you will see a message in the TextArea.
You can use the Save button on the top right to save the changes you have made in the textfiles or in the codefiles.
Be aware that changing code this way can cause problems!
The CodeMirror editor uses the mode that is most suited for the file extension.
This application uses a limited list of file extensions. You can add more if you like.
There are some "special" actions you can take on images or sound and video files. Have a look!
The pdf viewer shows the first page in the ScrollPane. If you click on the ScrollPane you can choose to open the rest of the document. Loading many pages can be a slow process.
BTW, if you build a standalone package from the application then you can run multiple instances from it: in one instance you play your favorite music, in another instance you review your photos and in yet another instance you do some code reviewing.
The source code is in the attachment.
Version 6 (+extract zip-files and full-screen image paging): in message #10
Version 5 (+SQLite database support): in message #9
Version 4 (+full-screen mode): in message #8
Version 3 (+MediaView controller and PDF controls): in message #7
Version 2 (+ MSOffice files convert to PDF): in message #6
Version 1 (+ webpage and file info list): in message #3
Check out the latest version!
With this application you can explore your drives, folders and files.
With the B4XComboBox on the top left you can select a drive letter. The list gets updated every time you change it.
This means that you can add a USB device that gets a drive letter (a smartphone doesn't get a drive letter by default).
After you select a different drive letter from the existing list the new drive letter will appear in the list.
The Treeview will contain a list of the top level folders and files and their sub folders and files.
The filling of the Treeview doesn't go over all the sub folders and its files (using recursive subroutine) because that takes to much time to load.
When you click on a folder the next levels are loaded for that folder. Clicking on a file in an expanded sub folder will fill the Treeview with its parents folders and files.
The search text field will allow you to quickly open a sub folder that starts with the entered letters.
You can use the breadcrumbs to navigate to a previously opened folder or drive.
The blue label shows the file attributes and name of the selected file (in the Treeview). The DOS attrib command is used for this.
If you click on the info button then a message is displayed showing the file details. The wmic command is used for this. (It should still work in Windows 10 and 11)
And here's the code to select a file viewer:
B4X:
Try
Select ext.ToLowerCase
Case "mp3","mp4","wav"
show_mv1
play_sound(fpath,fname)
Case "jpg","png","jpeg","gif","bmp"
Dim im As Image
im.Initialize(fpath,fname)
show_ziv1
ziv1.SetBitmap(im)
Dim imleft As Int = 10
Dim imtop As Int = 10
If im.Width < 150 Then imleft = 200
If im.Height < 150 Then imtop = 200
If im.Width < 150 And im.Height < 150 Then
ziv1.ImageView.SetLayoutAnimated(0,imleft,imtop,im.Width,im.Height)
End If
btnrotate.Tag = filename
btnsize.Tag = filename
Case "pdf"
' show_sp1
show_sppagepdf
pdffile = item.Trim
initpage
renderpage(1)
' renderallpages
Case "txt","log","ini","bat","csv","meta"
show_ta1
Dim strtext As String = File.ReadString(fpath.Trim,fname.Trim)
ta1.Text = strtext
btnsave.Tag = filename
' Case "htm","html"
' show_wv1
' Dim strtext As String = File.ReadString(fpath.Trim,fname.Trim)
' wv1.LoadHtml(strtext)
' wv1.Zoom = 0.8
Case "html","htm","css","js","bas","b4a","b4i","b4j","vb","php","xml","json","sql","java","vbs","ps1"
show_wv1
Dim strtext As String = File.ReadString(fpath.Trim,fname.Trim)
If strtext.IndexOf("codemirror.js") <> -1 Then
If strtext.IndexOf("textarea") <> -1 Then
strtext = strtext.Replace("textarea","div") ' to display the codemirror settings
xui.MsgboxAsync("<textarea id='editor'> and </textarea> was changed to show the codemirror code!","Codemirror")
End If
End If
Dim mode As String = set_editor_mode(ext)
Dim htmlstring As String = hclass.set_htmlpage(strtext,mode,"eclipse")
wv1.LoadHtml(htmlstring)
btnsave.Tag = filename
Case "sys","exe","com","dll"
show_ta1
ta1.Text = CRLF & "No viewer available for this file."
Case Else
show_ta1
ta1.Text = CRLF & "No viewer available for this file."
End Select
Catch
Log(LastException)
show_ta1
ta1.Text = "There was an error accessing this file." & CRLF & _
"Maybe access to this file is denied." & CRLF & _
"Or the path and filename may include illegal characters."
End Try
Sound and video files use a MediaView, image files use a ZoomImageView, pdf files use pdfbox code in a ScrollPane, text files use a TextArea, code files use a WebView with the CodeMirror editor and for the rest of the files you will see a message in the TextArea.
You can use the Save button on the top right to save the changes you have made in the textfiles or in the codefiles.
Be aware that changing code this way can cause problems!
The CodeMirror editor uses the mode that is most suited for the file extension.
This application uses a limited list of file extensions. You can add more if you like.
There are some "special" actions you can take on images or sound and video files. Have a look!
The pdf viewer shows the first page in the ScrollPane. If you click on the ScrollPane you can choose to open the rest of the document. Loading many pages can be a slow process.
BTW, if you build a standalone package from the application then you can run multiple instances from it: in one instance you play your favorite music, in another instance you review your photos and in yet another instance you do some code reviewing.
The source code is in the attachment.
Attachments
Last edited: