One Forty More App: How We Created a Tool for Posting More Than 140-Character Stories on Twitter

We would like to introduce our new in-house product called One Forty More, or just 140+, which allows you to write tweets longer than 140 characters.

Lots of us use Twitter every day for reading news, finding funny stuff, posting our own thoughts, and telling the world what’s happening around us. But there are also people who use Twitter to tell stories: politicians, celebrities, bloggers, and others.

We’ve noticed that some of them don’t agree with the 140 character limit. Sometimes they post tweet after tweet telling a long story that can’t be told in 140 characters. It’s hard for them to divide all their thoughts into parts, which is why they need a tool to make their lives easier.

There are a lot of Android applications that help divide your stories into Twitter format. We researched the Google Play Market to find similar apps, and noticed that all existing apps lack one killer feature – posting tweets from the end to make the story more readable.

We couldn’t help but create a more advanced solution to reorder tweets. We combined convenient features, simplicity, neat design, and animations, and here we have it – our brand new One Forty More app.

How we came up with the One Forty More idea

When a Twitter user decides to post a story in two or three tweets, followers can deal with it. But what about five or ten tweets? On Twitter, the beginning of a story is further down than the end, and it’s difficult to restore the right order. It can become quite a mess when followers need to scroll down the feed, read the beginning of a story, scroll up to find other parts, and then – again – scroll down to continue reading your feed.

And it’s not just followers who suffer – so do writers. Writers have to compose tweets so they don’t break words at the end of a tweet and have to cut sentences to make the story smooth.

You may think that Twitter isn’t a suitable place for writing long stories. But such cases happen here and there – people like to break rules, you know. And that’s where our One Forty More app comes into play.

With One Forty More, you can type or paste as long of a text as you wish and the app will take care of splitting it into separate tweets, putting ellipses (three dots) at the beginning and end of middle tweets.

one-forty-more-app-screenshots

The tastiest part is that One Forty More posts your tweets in the right order to make the reading experience smooth and seamless. The app posts the end of the story first and then posts part after part to the beginning. This way the beginning of your story will be at the top of the feed and all the parts will be posted in the right order.

How we created the design of One Forty More

The design of One Forty More follows all Google Material Guidelines and uses our corporate colors. Our designer George Apakhov created the app to be simple. There’s nothing unnecessary in our long tweet app.

one-forty-more-app-screen

We created a nice responsive animation for every user action.

When you tap the Send button, cards with your tweets are animated as stairs, showing the tweeting progress.

one-forty-more-app-twits-uploading

If your internet connection isn’t that good and the progress animation ends, you'll see a nice processing view.

one-forty-more-app-wait-screen

When your tweets have been posted, you see a pop-up saying whether the tweeting was successful.

Technology Stack for One Forty More

To write the One Forty More code we used Kotlin, a concise new language for Android development created by JetBrains.

The main screen of the app is RecyclerView with two types of views in it – the first for displaying prepared tweets, the second for showing an EditText field to handle input.

We used DataBinding for views because of its simplicity of access. To store data, we used Realm, and for Twitter API calls we used Retrofit 2. To tie everything up we used RxJava for Android.

Challenges we faced and overcame

Here at Yalantis, we use an MVP (Model View Presenter) project architecture so all the work happens in the presenter. Let’s talk about one of the One Forty More presenters where all the magic happens. To get all the work done, we pass our text to the presenter, which divides tweets and displays the result. Here’s how stories become tweets :)

override fun handlePastedText(text: StringBuilder) {
   tweetList.clear()
   val tweetCount: Int = Math.ceil(text.length.toDouble() / AVERAGE_SYMBOLS_PER_TWEET).toInt()
   var isBeginning = true

   if (tweetCount > 1) {

       for (j in 1..tweetCount) {
           if (text.length > 140) {
               divideTweets(text, isBeginning, false)
               isBeginning = false

           } else {
               var lastPart = text.toString()
               if (text.length <= TWEET_LENGTH_SINGLE_OFFSET) {
                   lastPart = "...$lastPart"
                   tweetList.add(lastPart)
               } else {
                   divideTweets(text, false, false)
                   tweetList.add("...$text")
               }

           }
       }

   } else {
       tweetList.add(text.toString())
   }

   view?.showPastedTweets(tweetList)
}
private fun divideTweets(text: StringBuilder, isBeginning: Boolean, isManualTyped: Boolean) {
   val startRangePoint = if (isManualTyped) TWEET_LENGTH_SINGLE_OFFSET else TWEET_LENGTH_DOUBLE_OFFSET

   for (i in startRangePoint downTo 1) {
       if (text[i] == ' ') {
           var tweet = text.substring(0, i)
           if (tweet.length <= TWEET_LENGTH_DOUBLE_OFFSET && !isBeginning) {
               tweet = "...$tweet..."
           } else {
               tweet += OFFSET
           }
           tweetList.add(tweet)
           text.delete(0, i)
           wasThereSpace = true
           break
       } else {
           wasThereSpace = false
       }
   }
}

In the above code, the presenter tries to find a breaking point as close as possible to the end of a string. It then pulls off the text for a tweet and removes that text from the StringBuffer, adding it to a list of future tweets. In the end, we simply reverse this list and send it to Twitter.
Kotlin makes this process simpler with its Kotlin Standard Library collections functions including Collection.mapTo() and Collection.reverse().

override fun sendTweets(context: Context, tweets: ArrayList<com.yalantis.onefortymore.model.Tweet>) {
   tweetList = tweets.mapTo(ArrayList()) { it.text }
   tweetList.remove("")
   tweetList.reverse()
   tweetsRepo.sendTweet(context, tweetList[index], object : IActionCallback<Result<Tweet>?> {

       override fun onSuccess(result: Result<Tweet>?) {
           ++index
           if (index < tweetList.size) {
               tweetsRepo.sendTweet(context, tweetList[index], this)
           } else {
               view?.showResultPopUp(true)
               view?.onTweetsSent()
               clearTweets()
           }
       }

       override fun onError(error: Throwable?) {
           if (error is NoInternetException) {
               view?.showResultPopUp(false, context.getString(R.string.no_internet))
           } else {
               view?.showResultPopUp(false)
               clearTweets()
           }
       }
   })
}

You can find our One Forty More App on Google Play Market: it's already there waiting for you. This app is there to help you solve the problem of how to extend tweets beyond 140 characters.

At the moment, we’re discussing a new version with features such as adding media to each tweet, scheduled posting, and more. If you’re interested, feel free to contact us and offer your suggestions :)

4.3/ 5.0
Article rating
36
Reviews
Remember those Facebook reactions? Well, we aren't Facebook but we love reactions too. They can give us valuable insights on how to improve what we're doing. Would you tell us how you feel about this article?