12

Just one or two days ago there was a guy asking for opinions on his UI (a reddit viewer app). I couldn't find him and wanted to ask him a question tho.

You probably use some class for fetching the data from reddit, hoe to you make it accessible within your app? Storing a static instance within the application class (like many do with the application context) and using that one?

Would be nice if you could answer ^^

Comments
  • 0
  • 0
    It's straightforward MVC implementation.

    I have model classes contained in a singleton data accessor. Whenever a view needs data, it asks the model, and if the model is not populated yet, I ask the controller to load the data.. Once the data is fetched, I update my model and notify the view, which then displays the data.

    I use the jraw library for fetching data from reddit in my controller classes.. But you may directly use rest apis of any service using a framework like retrofit!!

    Not sure if I answered your question, but feel free to let me know if you need more information.
  • 0
    @manrock007 looks like android mvc is (at least for me) a bit different from JavaFX Mvc. So your model is for example a simple Post containing multiple comments. Your view is the xml file right? And the controller is the underlying fragment or activity. So if the user interacts with the view (opens the post) the controller fetches data from the rest api into the model class. The model class gets updated and the controller makes sure to notify the view that it can populate itself.

    I hope I get it right here. Thanks for mentioning retrofit. Will have a look into it. What are your opinions on volley, the home made http library from google?
  • 0
    My view is the xmls and the activities combined.. Display the data, handling of scrolling, button clicks, etc. all inclusive handled here

    My model is huge.. Hierarchical. Imagine reddit has endless subreddits, each subreddit has endless posts, each post has endless comments.. My model is like a cache that keeps updating the more the user browses reddit. It's a subset of the content visited by user, stored for quick access.

    My controller classes merely talk to the reddit api to fetch /post data..
  • 0
    So what does your controller do then? Sorry if I ask such dump questions. Really new to Android programming. So the model is self aware of reddit as a resource and kinda updates itself?
  • 1
    @dfox this thread is a good example of why we need to bring in a friend/ unfriend mechanism to devRant.. I'm willing to contribute if you need help
  • 0
    @manrock007 I have to agree 👍
  • 0
    @SirWindfield

    To be honest, my controller classes are like extremely task oriented. They're jobs essentially. And they are fired by the model as and when required.

    An example, user wants to view the r/tifu subreddit. The view queries the model, which doesn't contain posts from that subreddit. So the model fires a job to get tifu posts. Meanwhile the view is showing a refreshing indication. Once the job is successful, it makes a call back to the model. The model then updates itself, and notifies the view that the requested data is available.

    Might I ask what are you working on?
  • 0
    @manrock007 sure. I had several ideas for apps. Till today I couldn't find any music player that pleased the features I needed and the design aspects I consider nice and clean. I mainly manage my music through several Ruby scripts running 24/7 fetching me new songs based on already listened ones, updating my Podcasts, managing my audiobooks and checking out iTunes, Amazon for new deals. Would be nice to create a music player + desktop combo that can easily integrate with that environment. I will see tho. So that is on my to do list.

    My first real app is a devrant client (or will be). I just want a more natural material design app that feels polished on Android. I really appreciate good looking and working UX. So ye. It isn't really necessary but I need a smaller project than a music player to get me started ^^.
  • 0
    @SirWindfield btw, I like the design of the current devrant app. It really is nice but things like extended notifications, quick actions for replying or liking are some things that would be awesome! Faster and more suited animations (for example the navigation bar), maybe even using the robo font. I will see.
    Dfox did a great job for sure! I really like devrant as it is.
  • 1
    @SirWindfield sweet. I've been looking for something that curates my music database too. I'm very picky to what I listen to, and waste so much time! Would love to see your work!

    As for devRant app, I'm sure It's a lot simpler than reddit.. In any case I'll be around to answer any questions you might have
  • 0
    @SirWindfield I'm hooked man.. Facebook twitter anyways never seemed interesting..
  • 0
    @manrock007 what exactly where you looking for? If you have some wishes, drop them ^^
Add Comment