Skip to content

Commit

Permalink
Merge pull request google#159 from matthewsibigtroth/lengthen_short_urls
Browse files Browse the repository at this point in the history
reinstated lengthened url in the edit urls card
  • Loading branch information
schilit committed Nov 2, 2014
2 parents 888dadf + 88938de commit f4c634a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,17 @@ public void onBeaconConfigReadUrlComplete(byte[] scanRecord, int status) {
Log.e(TAG, "onUriBeaconRead - error " + status);
} else {
UriBeacon uriBeacon = UriBeacon.parseFromBytes(scanRecord);
final String url = (uriBeacon != null) ? uriBeacon.getUriString() : "";
String url = (uriBeacon != null) ? uriBeacon.getUriString() : "";
Log.d(TAG, "onReadUrlComplete" + " url: " + url);
if (UrlShortener.isShortUrl(url)) {
url = UrlShortener.lengthenShortUrl(url);
}
final String urlToDisplay = url;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// Update the url edit text field with the given url
mEditCardUrl.setText(url);
mEditCardUrl.setText(urlToDisplay);
// Show the beacon configuration card
showConfigurableBeaconCard();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class UrlShortener {
* @param longUrl The url that will be shortened
* @return The short url for the given longUrl
*/
// TODO: make sure this network operation is off the ui thread
public static String shortenUrl(String longUrl) {
String shortUrl = null;
try {
Expand Down Expand Up @@ -112,6 +113,7 @@ public static boolean isShortUrl(String url) {
* @param shortUrl The short url that will be lengthened
* @return The lengthened url for the given short url
*/
// TODO: make sure this network operation is off the ui thread
public static String lengthenShortUrl(String shortUrl) {
String longUrl = null;
try {
Expand Down

0 comments on commit f4c634a

Please sign in to comment.