MillersvilleCS / MoleculeFlashcardsAndroid

2 stars 0 forks source link

TODO #2

Closed CMahaff closed 10 years ago

CMahaff commented 10 years ago

Maybe? / Long-Term Goals

saschlac commented 10 years ago

Categories are live on the request handler at https://exscitech.org/request_handler.php. I modified the "get_avail_flashcard_games" request to contain category information. I've attached an example response with the category information. Now each question set has an category ID and all of the category information can be found in the "categories" object which is a sibling of "available_games". I know it would make more sense to have a hierarchal organization where the question sets are children of their parent category, but I did it this way in order to preserve compatibility.

{ "success": "true", "categories": [ { "ID": "1", "name": "Test1", "description": "Test1 Desc" }, { "ID": "2", "name": "Test2", "description": "Test2 Desc" } ], "available_games": [ { "id": "1", "name": "Food Chemistry", "category": "1", "image": "/data/flashcardImages/9.png", "description": "This question set is bananas!", "time_limit": "1800000", "high_scores": [ { "rank": 1, "username": "sherbein", "score": 14524 }, { "rank": 2, "username": "tbaldwin", "score": 14507 }, { "rank": 3, "username": "tbaldwin", "score": 13744 }, { "rank": 4, "username": "Amy", "score": 13695 }, { "rank": 5, "username": "Laura", "score": 7060 }, { "rank": 6, "username": "Becky", "score": 7028 }, { "rank": 7, "username": "Joel", "score": 6007 }, { "rank": 8, "username": "Eli", "score": 6001 }, { "rank": 9, "username": "Steve", "score": 5999 }, { "rank": 10, "username": "Laura", "score": 5932 } ] }, { "id": "2", "name": "Hydrocarbons", "category": "2", "image": "/data/flashcardImages/hydrocarbons.png", "description": "In organic chemistry, a hydrocarbon is an organic compound consisting entirely of hydrogen and carbon. Hydrocarbons from which one hydrogen atom has been removed are functional groups, called hydrocarbyls. Aromatic hydrocarbons (arenes), alkanes, alkenes, cycloalkanes and alkyne-based compounds are different types of hydrocarbons.", "time_limit": "300000", "high_scores": [ { "rank": 1, "username": "kpallip", "score": 10596 }, { "rank": 2, "username": "tbaldwin", "score": 6710 }, { "rank": 3, "username": "sherbein", "score": 3637 }, { "rank": 4, "username": "jdimarco", "score": 1579 }, { "rank": 5, "username": "jdimarco", "score": 874 }, { "rank": 6, "username": "jdimarco", "score": -506 } ] }, { "id": "13", "name": "Organic Chemistry", "category": "1", "image": "/data/flashcardImages/4.png", "description": "Organic chemistry is a chemistry subdiscipline involving the scientific study of the structure, properties, and reactions of organic compounds and organic materials, i.e., matter in its various forms that contain carbon atoms.", "time_limit": "300000", "high_scores": [ { "rank": 1, "username": "kpallip", "score": 10954 }, { "rank": 2, "username": "sherbein", "score": 7510 }, { "rank": 3, "username": "tbaldwin", "score": 7452 }, { "rank": 4, "username": "tbaldwin", "score": 7121 }, { "rank": 5, "username": "tbaldwin", "score": 4991 } ] } ] }

saschlac commented 10 years ago
CMahaff commented 10 years ago

I've updated the top.

You can't really style Android buttons. You can change the font color and opacity of the whole thing (what I do now) but that's it. We could provide our own drawables for the buttons eventually though. We would need some button .png's in various sizes.

I also thought it needed some sort of feedback I just wasn't sure what. Any ideas? Should I just cover the button select area with a semi-transparent black color? I could do a loading bar but usually it responds pretty quickly and I don't want too much stuff popping up everywhere.

Also, thanks for not breaking compatibility, at least not yet.

CMahaff commented 10 years ago

Hey Sam, to get categories I switched over to using exscitech.org calls instead of the old url. This broke a lot of things since the api had changed. Could you update the documentation on these changes?

One thing missing (intentionally?) is a count of the number of questions in a given set before you actually load the set. Could we get this added back in? Or should we just omit it from showing on the screen immediately before a game?

Sidenote to everyone: for now, I'm not going to fix rotation in the GameActivity. Android destroys all data in an activity when it rotates and you need to create it again. You can serialize them to strings and restore the objects with the strings but we have so much data it might lag on rotation. Put on hold till we decide what we want to do.

CMahaff commented 10 years ago

Also, since Android can tell if you leave the Activity we can completely prevent cheating. What should we send to the server if this happens? Or should we just end the game?

saschlac commented 10 years ago

Hey Connor,

WRT buttons, I think making the button frame in game black and using drawables is a good idea. If you give me some button sizes I'll be happy to build some drawable pngs. What would you need, just two for each button, a click down and an unclicked button? And then different colors for correct and incorrect? If you want me to I can also give detailed suggestions for style/layout, there wouldn't be any major layout changes mostly font size changes, the most drastic would be the button positions on the home screen. Can you use a drawable for the background of a screen?

The API isn't going to change anymore, it's pretty much in its final state. We're not going to be adding any features to the flashcard game. The number of questions was removed because that information isn't necessary until you get to the "game overview screen". Plus the database doesn't keep track of the number of questions, so, we were having to perform an additional query. If you want I can add it back in, or you can count the number of questions in the array returned by "load_flashcard_game" just let me know.

I'm sorry about not keeping you up to date on the API documentation. I believe the only things that changed were involved with starting the game so that we could decouple the game selection process from the game itself. If you can wait until next week I'll have the full API documented. If you need more information in the meantime you can take a look at the source code here: https://github.com/TauferLab/ExSciTecH/tree/master/public_html/src/php/request_types. Each file corresponds to an api call. The request structures at the beginning of the file overview the required fields for the request and then the first function in the file should be named "handle_XXXX_request". In this function, for each request type, there will be a variable called "$response_object" that will have all of the fields of the response set.

WRT cheating, you can just kick them from the game, the server cleans up any unfinished games and I can't imagine cheating will be such a huge issue that we need to be flagged about it.

I hope I didn't miss anything. Shoot me an email if I did.

CMahaff commented 10 years ago

Right, so for buttons we would need a regular image, a clicked image, and an incorrect image. Incorrect would never be clicked again so just those three. According to: http://developer.android.com/guide/topics/ui/controls/button.html#CustomBackground theoretically the buttons are supposed to be made in such a way that Android can tell how to scale them so you don't have to provide a bunch of different sizes. Alternatively, if you just want to draw a make-up of what you had in mind, I can try and recreate it using drawable XML like this example: http://stackoverflow.com/questions/18507351/how-to-create-custom-button-in-android-using-xml-styles - depending on the complexity. By all means, please, provide us with specific layout requirements. I would try and avoid doing a background image though. I think it would be possible but given that the app will be scaled to thousands of different resolutions I'd avoid it if possible. It would be hard to get right. It may be possible to do gradients without images if that was what you were thinking.

We sort of need the question count because we don't start loading the game in the overview screen. Downloading anything is pretty resource intensive, especially parsing the molecule data, and I don't want to do it unnecessarily. Plus, unlike a desktop, you might often be running on a poor connection and I don't want each section to be behind a loading screen, especially since, at least right now, that is the only way to get to high scores and a description of the game. Just my 2 cents.

And we can do that. I just wasn't sure that since this is going to be used as a teaching aide, if we should be more strict. Can always add it later I suppose.

CMahaff commented 10 years ago

Sidenote: the favicon on exscitech.org is pretty slick. Do you have a larger version we could use for the app icon?

saschlac commented 10 years ago

Np, I can add the question count back in. The additional time for the extra sql query is tiny compared to the additional request you have to do on the client side.

Oh, cool, so it looks like we can do the buttons with xml styles. I don't think we need anything more complex than the stackoverflow example you listed.

I sent you an email with a high res png of the favicon as well at the original illustrator file. I'll send you some layout mockups and ideas for buttons this coming week.

CMahaff commented 10 years ago

That all sounds great, thanks a bunch!