alexnj / AndroidTwitterClient

A simple Twitter client for Android.
https://github.com/alexnj/AndroidTwitterClient
0 stars 1 forks source link

Review assignment 3 - Twitter Client #1

Open alexnj opened 10 years ago

alexnj commented 10 years ago

/cc @nesquena @timothy1ee

Third assignment submission. I wasn't able to get to the optional stories this time with lack of time. I will attempt if I'm able to find more time today or tomorrow.

A couple of issues I faced so far, which I haven't been able to understand completely:

Please review and let me know your feedback. Thank you.

nesquena commented 10 years ago

Hey Alex,

I wasn't able to figure out why TimelineActivity keeps getting reopened when I hit back. It's like onLoginSuccess is getting called each time TimelineActivity closes and it goes back to LoginActivity.

There are many ways to avoid the LoginActivity from being triggered. One way is to go into your manifest and do this:

// AndroidManifest.xml
<activity
            android:name="com.codepath.apps.basictwitter.LoginActivity"
            android:noHistory="true"

This will make the LoginActivity stop being recorded on the task stack and fix this issue.

I'm also wondering if it is the right way to start from LoginActivity. Modeling from the web world, we should be hitting TimelineActivity, which on realizing there's no authorized session available, throws a user to LoginActivity and it returns with a successful or failed auth attempt. Or is it done differently in Android?

In Android, you can actually do it either way and they are both viable. Once we learn fragments next week, you can even to a login without having to change to a different activity at all.

ListView that is tied to adapter seems to make multiple API calls as I scroll and interact with the view.

Can you explain this a bit more? Did you setup endless scroll? Because if you did then it makes sense for new tweets to be loaded into the adapter as you scroll.

nesquena commented 10 years ago

I will do a full review of your application later tonight or tomorrow. Hope you were able to complete required user stories.

alexnj commented 10 years ago

Thank you. All the required user stories are complete. I will try what you suggested to see if that fixes the issue.

Regarding multiple API calls getting invoked, I haven't setup endless scroll. I will test the behavior again tonight and let you know when exactly it's occurring.

nesquena commented 10 years ago

:+1: Nice work overall. A few thoughts:

I have provided a detailed Project 3 Feedback Guide here which covers the most common issues with this submitted project. Read through the feedback guide point-by-point to determine how you could improve your submission.

Let us know if you have any other thoughts or questions about this assignment. Hopefully by now you feel pretty comfortable with all the major pieces to basic Android apps (Views, Controllers, Models, Authentication, API Communication, Preferences, ActionBar, et al) and see how they all fit together.

nesquena commented 10 years ago

Modeling from the web world, we should be hitting TimelineActivity, which on realizing there's no authorized session available, throws a user to LoginActivity and it returns with a successful or failed auth attempt. Or is it done differently in Android?

You asked me about this today. In a nutshell, have the Authenticated activity be your root activity and then in onCreate immediately you can access the isAuthenticated() from the RestClient which returns false if the user is not logged in. If it is false, simply launch up the LoginActivity. Once that's complete, take them back to the authenticated activity, and now isAuthenticated() will be true. Let me know if that answers your question.

alexnj commented 10 years ago

I've completed all of the stories, except Persistence. The code to read back is commented out, since it's not really working per expectation. I'm curious, how do we persist an associated user object, along with user profile images? The app crashes when tested with no network connectivity.

I will try my best to debug and fix persistence before tomorrow's session fingers crossed.

nesquena commented 10 years ago

Will review your assignment tonight

I'm curious, how do we persist an associated user object

See relationships guide. You need to have a User model and a field in Tweet for the User. Then you can save both the tweet and the user to the database with a link between them. See the activeandroid cliffnotes and helpful hints for more details.

along with user profile images

The images are already being cached on disk for you via universal-image-loader. The urls are stored as part of the tweet model.

I will try my best to debug and fix persistence before tomorrow's session fingers crossed.

Great should be a useful learning experience.

alexnj commented 10 years ago

Done! Persistence added. Thanks for your tips, I had missed out User.save() before Tweet.save().

I also added an abstract function getSerializationTag() that inherited Fragments need to implement. This function essentially returns a key for filtering out persisted Tweets, depending on the fragment being invoked - i.e., separate persistence for home timeline vs. mentions, using a common store.

That completes all the required stories.

nesquena commented 10 years ago

Done! Persistence added. Thanks for your tips, I had missed out User.save() before Tweet.save().

Awesome, project looks great!

nesquena commented 10 years ago

:+1: Really great job Alex, Excellent submission! A few notes:

I have provided a detailed Project 4 Feedback Guide here which covers the most common issues with this submitted project. Read through the feedback guide point-by-point to determine how you might be able to improve your submission.

Let us know if you have any other thoughts or questions about this assignment. Hopefully you can see this coming together as a "fully fledged" twitter client with some more work and polish. This app contains all of the components now (fragments, models, networking, client, tab navigation, image loading, et al) of 90% of dynamic data-driven API client. Obviously there are lots of details and patterns to learn, but by this point you have been introduced to all the major frameworks and concepts. Hopefully you would feel fairly confident getting started making Android apps for instagram, pinterest, yardsale, flickr, using the same patterns.