-
Notifications
You must be signed in to change notification settings - Fork 0
This is a basic app I have bult in android studio to help students and employees track the time they spend on tasks in order to help boost their productivity, and in the case of an employee help them accurately fill out their time sheet at the end of the week.
License
WestInSpace/Project-Time-Tracker
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Project 3 - v0.3 Date: 11/1/2025 I added framework so that when the user clicks on a button to an OutsideObject the tag is saved so that it can be used as a foreign key to get all the InsideObjects under it when the InsideObjActivity is loaded. I utilized bundles to do this XML files edited: None java files edited: CustomAdapter, InsideObjActivity ____________________________________________________________________________________________________________________ Project 3 - v0.4 Date: 11/1/2025 I added a footer that allows the user to enter a name for a new OutsideObject and hit enter and it will create the OutsideObjects with that name. Also had to use SharedPrefs to know how manyOutsideObjs were already created so I know what the next tag should be when a new OutsideObj is created by the user I still have a method in MainAxctivity to delete all the outSideObjs in the database for testing purposes. XML files edited: activity_main java files edited: MainActivity ____________________________________________________________________________________________________________________ Project 3 - v0.6 Date: 11/1/2025 I had to skip version 5. For some reason when I would launch the project with the name "Project 3 - v0.5" it would just lose the ObjDatabase class, or at least lose connections to it. However when I rename the exact same folder containing the project to "Project 3 - v0.6" everything works fine. So with that out of the way I continue with version 6 I have added a footer to the bottom of the InsideObjsActivity so that the user can create new InsideObjects with a name. It looks the same as the OutsideObjectActivity UI. The user is expected to use the back arrow on their phone to navigate back to the previous Activity. I also added a method in the main activity that will delete all inside objects. and one to "reset the database" that will delete all the objects from the database XML files edited: activity_inside_obj java files edited: MainActivity, InsideObjActivity ____________________________________________________________________________________________________________________ Project 3 - v0.7 Date: 11/1/2025 I have made the Activity to display the details of the InsideObject that was clicked on. The activity is scuccesfully loaded, but when I try to get any attributes of the InsideObject that was clicked on it crashes. They may have something to do with the GetTitle(tag) function in the InsideObj class, or it may be a database problem and the InsideObj is not properly found by the tag (the primary key) so I'm trying to get an attribute of a null object. This may be due to the fact that a primary key is usually an int put for the insideObjects it is a String made up of: TheOutSidePrimaryKey + . + theInsideObjNumber In the background that database may be trying to compare it like it's an int when it is really a String. If this is the case I may need to restructure my database. I.E. add an attribute to the insideObject that is an integer called InsideObjNumber and multiple insideObjs may have the same number, but it will be used with the foreign key to find a single object. XML files edited: activity_inside_obj_dets java files edited: InsideObjDets ____________________________________________________________________________________________________________________ Project 3 - v0.8 Date: 11/13/2025 I added a button at the top of the main activity for testing purposes. When the button is clicked the database is reset. Everything is deleted from the ObjDatabase. I.E. (in essence) the app is reset. I had to change the tag for the InsideObj it is no an int representing the number associated with each InsideObj To get a specific InsideObj the primary key (the tag) and the outsideTag must both be used. you must use the outsideTag which the insideObject you want is under and the tag to the insideObject you want under that specific outsideTag. I couldn't get the method to work in InsideObjectDAO where you can get a specific InsideObject by passing in the tag to the insideObj you want and the tag to the OutsideObj that it's under. However, I came up with a workaround. It's not efficient, in fact it's O(n) but at least it works. When insideObjDets is loaded (by the user clicking on an InsideObj) I just use the GetInsideObjsForOutside() from the InsideObjDAO and pass in the outsideObj tag that the insideObj is under then I get the InsideObj at the index of the InsideObj tag that I want to display / edit the details for. I know that getting all the insideObjs under an OutsideObj just to get one specific one is not efficient at all, but it's all I can do to get it to work right now. I've already spent too much time on this bug and the deadline approaches on 11/30/2025. When InsideObjDets is loaded all the data from the InsideObj that was clicked on is loaded to the screen. In the next version I will allow the user to update that data. XML files edited: activity_inside_obj_dets, activity_main java files edited: InsideObj, InsideObjDets, InsideObjDAO, ObjDatabase, MainActivity ____________________________________________________________________________________________________________________ Project 3 - v0.9 Date: 11/14/2025 I have added a delete button to all insideObjs and OutsideObjs in their corresponding recycler views as per the updated assignment requirements which now state we must implement all parts of CRUD, (create, read, update, delete) in our database. For deleting an outsideObj: There is a specific method for the deleteBtn in the CustomAdapter.java file. In this method: The tag of the outsideObj that is being deleted is saved to a file called: "unusedOutsideObjKeys.txt" This is so the tag can be reused later whe the user creates another outsideObj this will prevent the integer tags of the outsideObjs from getting to large. Then, all the insideObjs under that outsideObj are deleted. Lastly the outsideObj itself is deleted. When the user creates a new OutsideObj that file is first checked and if the file is not empty then a tag is used form that file for the new outsideObj. if the file is empty a new tag is created. As for writing to and reading from files I have made a fileManagerclass Also, instead of saving the number of outsideObjs to sharedPrefs, I am instead saving it as the first line in the "unusedOutsideObjKeys.txt" file This is because sharedPrefs is not accessible from the Adapter classes and that's where the objects are being deleted from, and that number needs to be decremented when an object is deleted. --------------------------------------------------------------------------------- Well, after all that work, I have found that primary keys cannot be reused in Android Studio Room databases, even if the entity that the key was connected to is deleted. So, keeping track of available keys is pointless. I am still saving the number of objects to a file so the information is accessible anywhere in the project. The file name(s) for the number of inside objects is: "numInsideObjs-#.txt" The # represents the OutsideObj that the insdieObjs are under. and the file name for the number of outsideObjs is: "numOutsideObjs.txt" ----------------------------------------------------------------------------------- However, I am going to fix this in the next version and leave this version as is, where it keeps track of the unused keys. XML files edited: outside_inside_obj_layout java files edited: CustomAdapter, FileManager, MainActivity ____________________________________________________________________________________________________________________ Project 3 - v1.0 Date: 11/15/2025 Not being able to reuse keys, even when the object has been deleted complicates things. Now I not only need to keep track of the keys being used but also all keys that were used. Becsue, for example, the user deletes the last outsideObj, the number of outside objects will be decremented but the next time the user creates an outsideObj it will try to use that key again and cause an error Focusing only on the OutsideObj or only on the InsideObj the solution is simple, just keep a running counter in the file that represents the next key to be used when an object is created. however, looking at both the inside and outside objects in tandom it becomes complicated becsue it would cause the amount of data in the file to grow quickly because every time an outsideObj is created a new int is added to the file representing the number insideObjs under it. even if that object is deleted in order to maintain the proper indexing the file would still need an int saying the deleted outsideObj has 0 insideObjs under it. Then when a new insideOBJ s created all the data has to be pulled from the file to know what key is needed for that insideObj under the outsideObj with specific index. One solution to this would be to store two number for each outsideObj. the first number is the index of the outsideObj and the second number is the number oinsdieObjs under that outsideObj. This will double the amount of data stored if the user were not able to delete data but in the long run with the user deleting data it will decrease the amount of data by n ints, n being the number of outsideObjs that the user deletes. So. the file structure will look something like this: # # # # # # # # # Where the number on the first line is the number of outsideObjs that have been created. For each line after that the first number will be the key to each OutsideObj that exists and the second number will be the number of insideObjs under that outsideObj When an outsideObj is deleted the row corresponding to that outsideObj is deleted from the file. but no change is made to the number of outsideObjs (the first number in the file) When an insideObj is deleted there is no change to the file. This is becsue you can't reuse keys and these numbers reprent the next key to be used when the user create a new insideObj or outsideObj Also, I fixed the problem where the method to get a single insdieObj in the insideObjDAO was not returning the insideObj. So when I load the details for an insideObject I no longer have to get all the inside objects from the outsideObj Functionality to delete an outsideObj and functionality to delete a single insideObj now works. Lastly, I set up setter methods in the InsideObj.java to update the time and progress of the insideObj XML files edited: java files edited: FileManager, MainActivity, CustomAdaptor, CustomAdaptor2, InsideObjDets, InsideObjActivity ____________________________________________________________________________________________________________________ Project 3 - v1.1 Date: 11/16/2025 This version has implemented the functionality for the user to change the details under an insideObj. The user is able to change their estimated progress on an insideObj by dragging the slider. When they change the value it just shows it on the textView below the slider, when they stop changing the slider the inObj in the database is updated with the new value. When they start the time it begins counting and when they stop the time it stops counting and updated the new time spent on the inObj. In the future version I will utilize the onPause() and onResume() methods in the app development life cycle to allow the user to leave the app (or put there phone to sleep) and the timer will keep counting. This will allow the user to work on tasks while the app is still tracking their time spent. To do this I will not let the timer continue to run but rather on pause I will save what the timer has, stopping the actual counting of the timer, then I will capture the new start time (the time the user levees the app) Then on resume I will calculate how much time has passed while they were out of the app. Then I will resume the timer so the user can see that time had passed and resume seeing it count. XML files edited: java files edited: InsideObjDets ____________________________________________________________________________________________________________________ Project 3 - v1.2 Date: 11/16/2025 The timer now "continues" in the background when the user leaves the app. It is also saved when the user closes the app. The timer is also automatically stopped when the user clicks the back arow to go elsewhere in the app. When the user puts their phone to sleep or leaves the app (onPause) I save a Boolean value of if the timer was going or not, then stop the timer, then get the time that the app was paused. Then, when the user wakes their phone up or opens the app again (onResume) I get from sharedPrefs if the timer was going of not. If it was then I get the difference between the start time and the end time and update the saved Time. I then resume the timer going again. This way the timer is not counting in the background if the user leaves the app or puts their phone to sleep. I also made a small change in the MainActivity and InsideObjActivity. When the user hits enter after putting a name for their new object the textbox it reset to be empty. This just helps with the flow of the app. Also, the user is no longer allowed to input a null name. XML files edited: java files edited: InsideObjDets, MainActivity, InsideObjActivity ____________________________________________________________________________________________________________________ Project 3 - v1.3 Date: 11/16/2025 I set the texView width that displays the title of the inside and outside objects to be a constant value. This way the buttons won't move depending on the length of the title and if the user enters a sting that is greater than 10 characters it will just drop to the next line on the object. It doesn't look nice but at least it accommodates long Strings that the user may enter. I also changed the background color of the displayed objects to a dark grey. This adds some contrast to the app and gives it a better appearance of a list. I'd like to add some space between the elements to give them more of a list appearance but the current appearance is alright. In the activity_inside_obj_dets I replaced the pause and play button for the timers with ImageButtons and I put an image on each one to make the app appear more like my mockup. I also centered text and adjusted font sizes etc. XML files edited: outside_inside_obj_layout, activity_inside_obj_dets java files edited: ____________________________________________________________________________________________________________________ Project 3 - v1.4 - bug fixes Date: 11/26/2025 When testing with some other students in my App development class one of them discovered an error in my app. 1. When you first launch the app then reset the database with no objects created, then you create an outside object, then you delete it without creating any of the inside objects the app crashes -Will just remove the reset app button from the app. 2. When the user deletes an inside object, the screen goes blank then when you click the back arrow on the phone the insideObj appears to have come back. If you try to open that insideObj, it will open then when you go back the app crashes. If you try to delete it the same thing happens as if you deleted it the first time. When you click the back arrow and go back to the outsideObjs then open the same outsideObj you deleted the deleted insideObj is gone, as it should be. -Problem with when the activity is restarted 3. Another tester found that when you create an inside object within an outside object then go back to the list of outsideObjs then go back into one of the outsideObjs and create and insideObj the app crashes. -The problem with this is that each inside object does not have a unique key. Rather I reply on a combination of the foreign key and the primary key to get a specific object. I need to make the primary key unique. An the first inside object under outside object 0 will have a primary key of 0 and a foreign key of 0 but the first inside object under the outside object 1 will have the primary key 0 and the foreign key 1 so those two object have the same primary key. - To solve this I am going to go back to my original strategy for the keys of the inside objects. they will be strings with the first number being the outsideObj primary key which it's under and the second number being the key to that specific object. Some other critiques I got were to make the app more visually appealing by adding some space between the list items and to make the reset button less prominent or remove it completely. I was also told to make the button more appealing (right now they are just the default buttons) and to give the app a background color that's not just white. Also, I was told to put the class name at the selected outside object name at the top of the list of inside objects. For this version I will focus on bug fixes. Bug 3 resolved I also added a spacer between objects in the list. XML files edited: outside_inside_obj_layout java files edited: InsideObj, InsideObjDAO, ObjDatabase, CustomAdapter2, InsideObjDets ____________________________________________________________________________________________________________________ Project 3 - v1.5 - bug fixes Date: 11/26/2025 Bug 2 (as described in the v1.4 write up) resolved Instead of reloading the activity when an object is deleted I just remove the object from the list of objects that the recycle view displays then notifyDataSetChanged(); XML files edited: java files edited: CustomAdapter, CustomAdapter2 ____________________________________________________________________________________________________________________ Project 3 - v1.6 - bug fixes Date: 11/26/2025 Bug 1 (as described in the v1.4 write up) resolved I fixed this bug because in the FileManager class it was trying to add the last line back in, but if there is only one line in the file it would be index out of bounds. However, I ended up removeing the reset database button from the app as one of my test users suggester. I removed the reset database button. However for development purposes I made a specific string that when entered into the userInput box for the name of an outsideObj it will reset the database instead of creating a new object. ____________________________________________________________________________________________________________________ ************Important Dev info**************** The string to reset the database is: */*!947356ReSEt*\/*dAtaBasE590432!*\* ____________________________________________________________________________________________________________________ I also added the title of the app to the top of the activity_main I added the title to the top of the insideObjActivity. This title displays the name of the outsideObj which the insideObjs are being displayed for. XML files edited: activity_main, activity_inside_obj, outside_inside_obj_layout java files edited: FileManager, MainActivity, InsideActivity ____________________________________________________________________________________________________________________
About
This is a basic app I have bult in android studio to help students and employees track the time they spend on tasks in order to help boost their productivity, and in the case of an employee help them accurately fill out their time sheet at the end of the week.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published