(Partial draft)
We are working on an android file manager, and the code is basically complete. However, due to process-oriented development, the amount of code in the later stage has been increasing, and bugs have frequently occurred. It is very complicated and difficult to modify the code.
So I want to re-integrate and code the project from the demand analysis.
This is the first write requirement analysis, and there will inevitably be many bugs. I hope our predecessors can give some suggestions and ask you to correct them or share some ideas.
File Manager Requirement Analysis
I. basic functions.
1. File Operations: shortcut directory, home page, favorites, multiple options, file opening (enable opening mode when you click the file, do not set the button), hide the file, add it to the desktop, create a new one, cut, copy, paste, delete, rename, share, sort, compress and decompress, attributes, add to favorites, remove from favorites, search by type, search, and display files
2. Settings: Theme style settings, file display mode, and Basic settings of the File Manager
3. Hardware response: Touch response and button response
Ii. Function details.
1. File Operations
1.1 File Manager Startup Process
(1) Click the open application icon.
(2) start the application buffer loading page
(3) start the application Homepage
(4) The application reads local data, obtains screen resolution, and then begins Layout
(5) read the home page and proceed to the next step.
(6) load the file directory and display the file (1.2)
1.2 file directory loading and display process [operations in the thread; if the time is too long, you can add a Buffer Interface]
(1) Get the file path (folder)
(2) create a file object based on the file path
(3) Determine whether the object is null
(4) if the object is null, the screen output cannot be accessed; otherwise, proceed to the next step.
(5) obtain the sub-file list of the folder, create a new FileInfo based on the sub-file, and obtain the new file list2.
(6) refresh the adapter and update the View
(7) check whether the original position exists and scroll the list to the selected position.
1.3 file opening process
(1) The user clicks the Item in the GridView or ListView
(2) send a message to the next layer on the home page
(3) The underlying GridView accepts the click message and responds to the Click Event accordingly.
(4) obtain the information of the Click file through the Item Id
(5) determine the file type
(6) if it is a folder, load the file refresh adapter under its Directory; otherwise, call the corresponding function based on the file type for the next step.
1.4 multiple selections of Files
(1) The user clicks the multiple selected buttons to respond to the event
(2) set the variable for displaying the check box to true.
(3) refresh the file Display Adapter
1.5 Homepage
(1) If the user clicks the home page button, the second step will be taken in response to the event. If the user presses the home page button long, the fourth step will be taken in response to the event.
(2) determine the status of the home page and obtain the returned object File. If File is null, the message "the File does not exist" is displayed. Otherwise, proceed to the next step.
(3) slide the center of the home page and load the display directory (1.2)
(4) display the homepage settings page
1.6 determine the status of the home page and return
(1) Open the local data document and read the corresponding data
(2) If there is corresponding data, obtain the path and create a File object based on it, and perform step 3; otherwise, perform step 4.
(3) If the File object is not null and the File is a folder, perform Step 5; otherwise, perform step 4.
(4) set the path to the default directory (root directory), and create a File object using this path. If this object is not null, write the path to the local data File and perform Step 5.
(5) return the File object.
1.7 new
(1) The user clicks the new button, and the response event enters the second step. The user long presses the new file button, and the response event enters the second step;
(2) Start the Create File Dialog Box. There are two options: create a file and create a folder.
(3) Click Create File to create a new file (1.8)
(4) Click Create folder to create a folder (1.9)
1.8 create a file
(1) Change the dialog box View. The file name input window appears and the keyboard is opened.
(2) set the file name to the newly created file .txt ". If you click OK, proceed to the next step. If you click a non-dialog box on the screen, exit the dialog box. If you change the content of the input box again, perform Step 6.
(3) create a file object based on the file name and the current directory. If the file object is null, the message "file creation failed" is displayed; otherwise, the system checks whether the file already exists and proceeds to the next step.
(4) If the file exists, the message "the file already exists" is displayed; otherwise, the file is created;
(5) If the file is successfully created, the message "File Created successfully" is displayed. Exit the dialog box and perform Step 7. Otherwise, the message "file creation failed" is displayed.
(6) check whether the content in the input box is equal to (""). If yes, the message "Enter blank" is displayed; otherwise, step 3 is performed.
(7) refresh the file directory and scroll the list to the newly created file.
1.9 create a folder
(1) In the change dialog box, the file name input window appears, and the keyboard is opened (same as 1.8.1)
(2) The default file name is "new folder ". If you click OK, proceed to the next step. If you click a non-dialog box on the screen, exit the dialog box. If you change the content of the input box again, perform Step 6.
(3) create a file object based on the file name and the current directory. If the file object is null, the message "failed to create a folder" is displayed. Otherwise, the system checks whether the file already exists and proceeds to the next step.
(4) If the folder exists, the message "folder already exists" is displayed; otherwise, the file is created;
(5) If the folder is successfully created, the message "folder created successfully" is displayed. Exit the dialog box and perform Step 7. Otherwise, the message "Folder creation failed" is displayed.
(6) check whether the content in the input box is equal to (""). If yes, the message "Enter blank" is displayed; otherwise, step 3 is performed.
(7) refresh the file directory and scroll the list to the newly created folder.
1.10 cut
(1) The user clicks the cut button, responds to the click event, and performs the next step. The user long presses the cut button, responds to the long press event, and performs step 4.
(2) Check the selected status. If no selected item is selected, the message "No selected item" is displayed. Otherwise, proceed to the next step.
(3) Save the selected file and mark it as cut. The message "file cut" is displayed. If a check box exists, exit the check box.
(4) message "cut" prompt"
1.11 copy
(1) The user clicks the copy button, responds to the click event, and proceeds to the next step. The user long presses the copy button, responds to the long press event, and performs step 4.
(2) Check the selected status. If no selected items are selected, the message "No selected items" is displayed. Otherwise, proceed to the next step.
(3) Save the selected file and mark it as copied. A message is displayed, indicating that the file has been copied. If a check box exists, exit the check box.
(4) message "copy" prompt"
1.12 Paste
(1) The user clicks the paste button to respond to the event and proceed to the next step. The user long presses the paste button to perform Step 9.
(2) Determine whether the file tag has been cut or copied: if there is a next step; otherwise, the message "No copy or cut operation" is prompted.
(3) The paste progress dialog box is displayed. Traverse the first-level file directory to determine whether the paste path is a sub-path of the source file: If yes, the message "paste .." is displayed .. file failed. The target file is a sub-file of the source file. Otherwise, check whether a file with the same name exists. If a file with the same name exists, perform Step 8. Otherwise, proceed to the next step.
(4) Identify the file Tag: If the tag is cut, perform Step 5; if the tag is copy, perform Step 7;
(5) Determine whether the start path of the file is in the same SD card: if the file is in the same SD card, perform step 6; otherwise, perform Step 7.
(6) traverse all the pasted files to change the file directory and display the progress (size, speed, remaining time, start path, number of projects) of the cut file)
(7) traverse all the pasted files, copy the files (1.12), and display the paste progress. After the copy is completed, if the file is marked as cut, delete the file
(8) If the source path is the same as the target path, if the file is marked as cut, the file will not be changed. If the file is marked as copy, a file copy will be created (a copy will be created cyclically ), step 7; proceed to the next step
(9) Otherwise, overwrite the file with the same name (Focus). The dialog box with the same name appears, asking the user to select whether to overwrite the file and proceed to the next step.
(10) If the user clicks the override button, the dialog box with the same name is exited and Step 7 is performed. If the user clicks the Skip button, the dialog box is exited. If the user clicks the check box to apply it to all, before the next step, perform operations
(11) after pasting, clear the clipboard if it is a cut operation. Exit the paste dialog box, release the memory, refresh the file directory, and scroll the list to the new file.
(12) message "Paste" prompt"
1.12 copy a file
(1) provide the initial path and target path,
(2) Check the source file size and the remaining space on the target memory card.
(3) If there is not enough space available, the system prompts "paste .. file failed, there is not enough space available" to exit file copy and terminate the paste operation; otherwise, the file is copied.
(4) Open the input stream and output stream, copy the file, and update the UI based on the information (size, speed, remaining time, start path, and number of projects ).
(5) Close the input stream and output stream
1.13 Delete
(1) If the user clicks the delete button, the user responds to the event and proceeds to the next step. If the user presses the delete button long, the user responds to the long-pressed event and performs Step 7.
(2) If no selected item is selected, the message "No selected item" is displayed; otherwise, proceed to the next step.
(3) In the dialog box that appears, traverse the selected file and ask the user to confirm whether to delete the selected file and proceed to the next step.
(4) If you click "OK", continue to traverse the selected file until the traversal is complete. During this period, the UI information is updated regularly. After the completion, proceed to the next step. If you click "cancel", exit the dialog box.
(5) delete the file and display the progress bar.
(6) After deletion, exit the dialog box and update the file list.
(7) message "delete"
1.14 rename
(1) If the user clicks the rename button, the user responds to the event and proceeds to the next step. If the user clicks the rename button long
(2) If no selected item is selected, the message "No selected item" is displayed; otherwise, proceed to the next step.
(3) If the current status is multi-choice, perform Step 8; otherwise, proceed to the next step.
(4) The rename dialog box is displayed. The text window contains the file name and the keyboard is opened.
(5) If you enter a name and click OK, proceed to the next step.
(6) obtain the name in the text box. Compare it with the existing file name. If the file name is not changed, no change is made to the file name. If the file name is changed, rename the file.
(7) Exit the dialog box and get the file rename return value. If the value is true, the message "the file is renamed successfully" is displayed and Step 2 is performed. If the value is false, the message "file rename failed" is displayed"
(8) In the dialog box that appears, rename multiple files, enter the name of the starting file, and click OK to rename the file in sequence.
(9) The progress dialog box is displayed, showing real-time information.
(10) If a file with the same name already exists, skip the file name and rename the file with the file name number + 1.
(11) after renaming, the system prompts "the file is successfully renamed" and proceeds to the next step.
(12) refresh the file list and scroll to the renamed file.
Appendix: