Skip to content

- Android app that allows a user to view their Twitter timeline and post tweets using the Twitter API & OAuth

License

Notifications You must be signed in to change notification settings

DSantanax/SimpleTweet

Repository files navigation

Project 2 Part 2- SimpleTweet

Name of your app is an android app that allows a user to view his Twitter timeline and post a new tweet. The app utilizes Twitter REST API.

Time spent: 34 hours spent in total

User Stories

The following required functionality is completed:

  • User can compose and post a new tweet
    • User can click a “Compose” icon in the Action Bar on the top right
    • User can then enter a new tweet and post this to twitter
    • User is taken back to home timeline with new tweet visible in timeline
    • Newly created tweet should be manually inserted into the timeline and not rely on a full refresh
    • User can see a counter with total number of characters left for tweet on compose tweet page

The following optional features are implemented:

  • User is using "Twitter branded" colors and styles
  • User can click links in tweets launch the web browser
  • User can select "reply" from detail view to respond to a tweet
  • The "Compose" action is moved to a FloatingActionButton instead of on the AppBar
  • Compose tweet functionality is build using modal overlay
  • Use Parcelable instead of Serializable using the popular Parceler library.
  • User can open the twitter app offline and see last loaded tweets. Persisted in SQLite tweets are refreshed on every application launch. While "live data" is displayed when app can get it from Twitter API, it is also saved for use in offline mode.
  • When a user leaves the compose view without publishing and there is existing text, prompt to save or delete the draft. If saved, the draft should then be persisted to disk and can later be resumed from the compose view.
  • Enable your app to receive implicit intents from other apps. When a link is shared from a web browser, it should pre-fill the text and title of the web page when composing a tweet.

The following additional features are implemented:

  • Custom SnackBars
  • Disable tweet button & display text override color when tweet exceeds 280 characters
  • Added Detail Activity

Video Walkthrough

Here's a walkthrough of implemented user stories:

Video Walkthrough

GIF created with LiceCap.

Notes

Update I: For part 2 I did encounter a few issues with the POST method since my screen did freeze when tapping Submit which caused my app to terminate. I debugged by program and found out in the compose Activity that I instantiated the TwitterClient rather than getting the instance of it. Overall, I have been working on adding more functionality and touching up the UI.

Update II: Working on the Float Button and Modal overlay was different and challenging since it required significant refactoring as it was part of my code. From the Modal overlay I learned how to pass an object and use that object in the Overlay which I found much simpler than passing through Activities but only when the UI/UX is necessary. For the Float button I had to find documentation on how to make the float disappear and appear. I found the Material layout behavior had this ability which saved time.

Update II: Another issue I faced was that the Navigation bar was translucent since I added a responsive navigation bar. This caused overlay with my Float button. I found that in the Android documentation using the SystemDetail attribute caused this. Instead I kept the default behavior which fixed the Float and Navigation bar.

Open-source libraries used

  • Android Async HTTP - Simple asynchronous HTTP requests with JSON parsing
  • Glide - Image loading and caching library for Android

License

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Project 2 Part 1- SimpleTweet

SimpleTweet is an android app that allows a user to view their Twitter timeline. The app utilizes Twitter REST API.

Time spent: 49 hours spent in total

User Stories

The following required functionality is completed:

  • User can sign in to Twitter using OAuth login
  • User can view tweets from their home timeline
    • User is displayed the username, name, and body for each tweet
    • User is displayed the relative timestamp for each tweet "8m", "7h"
  • User can refresh tweets timeline by pulling down to refresh

The following optional features are implemented:

  • User can view more tweets as they scroll with infinite pagination
  • Improve the user interface and theme the app to feel "twitter branded"
  • Links in tweets are clickable and will launch the web browser

Detail View

  • User can tap a tweet to display a "detailed" view of that tweet
  • User can see embedded image media within the tweet detail view

  • User can watch embedded video within the tweet
  • User can open the twitter app offline and see last loaded tweets
  • On the Twitter timeline, leverage the CoordinatorLayout to apply scrolling behavior that hides / shows the toolbar.

The following additional features are implemented:

  • Added heterogeneous layouts to the RecyclerView for Image & Text tweet
  • Added logout functionality to the Twitter icon in the stream screen
  • Toolbar hides/shows based on user scrolling with the Float button
  • Added App Icon

Video Walkthrough

Here's a walkthrough of implemented user stories & stretch goals:

Video Walkthrough

GIF created with ScreenToGif.

Notes

A very difficult part was creating heterogeneous layouts for the Stream RecyclerView. Initially the concepts were a bit difficult however once I understood how the superclass Object played a role in adding the List of data I managed to add both layouts. My original issue was that I could not add an image and use the same layout for the different Tweets that did not have the attribute for the JSON data. This caused an error when fetching at first then another issue with recycled item getting an image even though they did not have that attribute in the JSON. Creating a heterogeneous layout in the RecyclerView solved these issues.

Update: The more challenging part was persisting the data when the user was not connected to the Internet or had no signal using Room DAO SQLite. This was very challenging and required me to break down the code into specific parts such as the Save and Load method for the TweetDAO. This significantly increase my efficiency. Also, another issue regarding Room DAO required me to use the debugger to check for any small minor errors which let me to the discovery of a bug that caused my Tweet attributes to be null. On top of this I had to load in another table for the Media class which required me to modify and refactor parts of my code to establish a reference to the Tweet and removing Media as a null reference.

Also, for the heterogeneous layouts I had to extend the Tweet for TweetImg which solved my issue for Type Casting (Tweet) when getting the last item in the list since it could of been both. Extending solved this issue since TweetImg is of Type Tweet now so I had to check the instanceOf TweetImg first before checking instanceOf Tweet because of inheritance.

A challenge I experienced was with the RelativeLayout when the user had a long handle/username causing the timer to overlay and make it illegible to read. What I did was add a constraint from the handle TextView to the time TextView. This allowed the date to stay within the View and cause the handle's overflow to hide if the handle/username was long.

The stretch infinite pagination also caused a few minor issues since the List of tweets was not updating due to the max_id. However, this issue was fixed immediately by logging and debugging.

Overall, an amazing project with many new concepts learned!

Open-source libraries used

License

Copyright 2021 Daniel Santana

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

- Android app that allows a user to view their Twitter timeline and post tweets using the Twitter API & OAuth

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages