Open forrest87 opened 7 years ago
I have been working to understand the code from https://github.com/egelfand/TinyKitchenHelper. It has taken me longer than anticipated because I am very unfamiliar with how the flow is for Android applications, which made tracing difficult. Anyway, this is how I believe it generally works:
AndroidManifest.xml looks at all the Java files in the "com.example.tinykitchenhelper" directory. Based on those files, it creates an activity for each, which is what I presume to be the page that we would see on the phone screen, along with all its functionalities. Within the activity tags, there is android::name which uses a particular .java file as the backend. Then android::label gets the corresponding .xml file from what looks like the "res.layout" directory. From what I have read, .xml is a markup language like .html so I believe this is what creates the page we see on the phone screen.
Some activities also have android::parentActivityName. This appears to be the page that the user was redirected from in order to get there. So since EntryPage is the first thing a user would see, it has no parent activity. EntryPage in particular also seems to have a unique tag:
...I believe this is to tell the app that it should be the first (main) thing that is shown (launched) when the app is started.
Nearly all other activities have a
So, feeling like I have a decent understanding of the AndroidManifest.xml file, I looked next at EntryPage.java. It appears to just be the front page that promtps users to log in. Some lines that confuse me are: welcomeText = (TextView) findViewById(R.id.welcomeText); username = (EditText) findViewById(R.id.uN); guest = (Button) findViewById(R.id.guest); I do understand how the "R" inside the arguments work. I have read that it stands for "resources" and can be thought of as a class that holds all the data that is stored in the application, but I do not know how that occurs. After that I get a little confused. The user is prompted to sign in, continue as a guest or add themselves (which is verified to not be an already existing username). But there is no redirection to the other activities at all. I believe this particular file is a stub, and was not completed. Especially because there are a few comments in there saying what should be coded to interact with the user.
The OptionsPage.java file seems to be the real front page - It looks like it has several buttons which redirect to their corresponding files when clicked (ProfileManager, RecipeManager, MealManager, ShoppingManager, and KitchenManager). Several of them only appear to have: setContentView(R.layout.***); I think this means that the original author did not get around to making backend functions for all the recipes, and they are placeholders.
All of that in mind, I think I would need to figure out how to get these files to work with Android Studio in order to see the flow better than just trying to trace the code. I can't quite figure out what the RecipeManager is doing, and think that by seeing the interface, it might become more clear. That will be my next task, as the database is not yet up so I cannot contribute to it yet.
Spend an hour or so getting to understand how the existing program works based on its source code.