This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomePresenterImpl implements HomePresenter { | |
private static final String TAG = HomePresenterImpl.class.getSimpleName(); | |
private final HomeScreen screen; | |
private final DataProvider provider; | |
private Subscription subscription1; | |
public HomePresenterImpl(HomeScreenImpl screen, DataProvider dataProvider) { | |
this.screen = screen; | |
this.provider = dataProvider; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FacebookHomeProvider { | |
protected final PublishSubject<FbPost> behaviorSubject; | |
private Request request; | |
public FacebookHomeProvider() { | |
behaviorSubject = PublishSubject.create(); | |
behaviorSubject.subscribeOn(Schedulers.io()); | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(...) | |
private void setupLayout() { | |
// Create Adapter | |
// (...) | |
listView.setAdapter(fbPostAdapter); | |
// Subscribe on provider changes. | |
homeProvider.getObservable().subscribe(new Observer<FbPost>() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoginActivity extends Activity { | |
private EditText mEmailEdit; | |
private EditText mPassword; | |
private Button btnSend; | |
private EditText mPhoneNumber; | |
private TextWatcher watcher; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.fetch = functions.https.onRequest((req, res) => { | |
(…) // TODO Fetch from API | |
(…) // TODO Clean up | |
(…) // TODO Return result | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Client = require('node - rest - client').Client | |
const client = new Client() | |
exports.fetch = functions.https.onRequest((req, res) => { | |
client.get(BACKEND_URL, function (data, response) { | |
(…) // TODO Clean up | |
return res.status(200) | |
.type('application / json') | |
.send(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rss xmlns:media=”http://search.yahoo.com/mrss/" xmlns:dc=”http://purl.org/dc/elements/1.1/" version=”2.0"> | |
<channel> | |
<title>London | The Guardian</title> | |
<link>https://www.theguardian.com/uk/london</link> | |
<description>Latest news and features from theguardian.com, the world’s leading liberal voice</description> | |
<language>en-gb</language> | |
<copyright>Guardian News and Media Limited or its affiliated companies. All rights reserved. 2017</copyright> | |
<pubDate>Mon, 31 Jul 2017 15:32:49 GMT</pubDate> | |
<dc:date>2017–07–31T15:32:49Z</dc:date> | |
<dc:language>en-gb</dc:language> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"title": "'Leaving London means I can afford kids': readers on why the capital lost its sparkle", | |
"description": "Almost 100,000 Londoners moved out last year. Here they, and others who are avoiding the city altogether, explain why it is no longer the place to be<br></p><p>The rate of Londoners leaving the capital is more than <a href="https://www.theguardian.com/uk-news/2017/jul/24/bloated-london-property-prices-fuelling-exodus-from-capital">80% higher than five years ago</a>, according to Savills, with people in their thirties the age group most likely to leave. </p><p>We asked readers why they’re leaving London, or avoiding moving to the capital altogether. Here’s what you said:</p><p>All my salary was being spent on living costs in London</p> <a href="https://www.theguardian.com/uk-news/2017/jul/31/leaving-london-means-i-can-afford-kids-readers-on-why-the-capital-lost-its-sparkle">Continue reading...</a>", | |
"date": "Mon, 31 Jul 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cleanUp(data) { | |
// Empty array to add cleaned up elements to | |
const items = [] | |
// We are only interested in children of the 'channel' element | |
const channel = data.rss.channel | |
channel.item.forEach(element => { | |
item = { | |
title: element.title, | |
description: element.description, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions') | |
const URL_THE_GUARDIAN = "https://www.theguardian.com/uk/london/rss" | |
const Client = require('node-rest-client').Client | |
const client = new Client() | |
exports.fetch = functions.https.onRequest((req, res) => { | |
client.get(URL_THE_GUARDIAN, function (data, response) { | |
const items = cleanUp(data) | |
res.status(201) |
OlderNewer