URL : https://developers.facebooklive.com/
[PM] Building for the Next Billion
[all] Lessons From Creative Labs how facebook bring a new idea into true live
... | |
protected onCreate(Bundle savedStateInstance) { | |
RestAdapter restAdapter = new RestAdapter.Builder() | |
.setEndpoint("https://example.com") | |
.build(); | |
SampleService service = restAdapter.create(SampleService.class); | |
List<Repo> repos = service.listRepos("PRADA", 10); | |
} | |
... |
... | |
protected onCreate(Bundle savedStateInstance) { | |
NetworkTask task = new NetworkTask(this); | |
NetworkTask.execute(); | |
} | |
public void successful(List<Repo> repos) { | |
// do something | |
} | |
public void fail(Exception e) { |
URL : https://developers.facebooklive.com/
[PM] Building for the Next Billion
[all] Lessons From Creative Labs how facebook bring a new idea into true live
for (Company comp : companies) { | |
int userIdx = 0 | |
for (Time time : comp.times) { | |
(0..5).each { | |
time.add(comp.user[userIdx++]) | |
} | |
} | |
} |
Online Video : | |
https://www.youtube.com/playlist?list=PLhr1KZpdzukeD0iBeDI9WqZLYtuaFaaGc&mkt_tok=3RkMMJWWfF9wsRonu67Jc%2B%2FhmjTEU5z16eUoW66%2Fh4kz2EFye%2BLIHETpodcMT8NgMLDYDBceEJhqyQJxPr3NJdMN0cN8RhjjAQ%3D%3D | |
Slides | |
http://www.slideshare.net/AmazonWebServices/tag/2015sfsummit?mkt_tok=3RkMMJWWfF9wsRonu67Jc%2B%2FhmjTEU5z16eUoW66%2Fh4kz2EFye%2BLIHETpodcMT8NgMLDYDBceEJhqyQJxPr3NJdMN0cN8RhjjAQ%3D%3D | |
/** | |
* Example : | |
* input : {server: { result : { data: { a:1, b:2 }} }} | |
**/ | |
public class MyDeserializer implements JsonDeserializer<MyClass> { | |
public MyClass deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) | |
throws JsonParseException { | |
JsonElement j = json.getAsJsonObject().get("server").getAsJsonObject().get("result").getAsJsonObject().get("data"); | |
MyClass clz = new MyClass(); |
RxView.clicks(v.findViewById(R.id.btn_detail_new_image)).map(aVoid -> "Event_Click_Detail_New_Image") | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_comment)).map(aVoid -> "Event_Click_Detail_Comment")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_map)).map(aVoid -> "Event_Click_Detail_Map")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_report)).map(aVoid -> "Event_Click_Detail_Report")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_share)).map(aVoid -> "Event_Click_Detail_Share")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_like_text)).map(aVoid -> "Event_Click_Detail_Like")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.btn_detail_share_text)).map(aVoid -> "Event_Click_Detail_Share")) | |
.mergeWith(RxView.clicks(v.findViewById(R.id.detail_story)).map(aVoid -> "Event_Click_Detail_Story")) | |
.subscribe(s -> FlurryAgent.logEvent(s, false)); |
/** | |
* Background database for lookups of fittest color to represent. | |
*/ | |
private static List<Pair<Integer, String>> sBackgrounds = new ArrayList<>(); | |
static { | |
// Color Tickets: ------------A-R-G-B- | |
sBackgrounds.add(new Pair<>(0xFF040404, "background_01.png")); | |
sBackgrounds.add(new Pair<>(0xFF040404, "background_02.png")); | |
sBackgrounds.add(new Pair<>(0xFFF2F2F2, "background_03.png")); | |
... |
Giffle.GiffleBuilder builder = new Giffle.GiffleBuilder() | |
.size(320, 480) // otuput image size 320x480 | |
.delay(100) // 100 ms | |
.file(File.createTempFile("PicCollage", "gif")); | |
final Giffle encoder = builder.build(); | |
List<Bitmap> bitmaps = getOutputBitmaps(); // please impelemnt this block by youself | |
int[] colors = getTrainingPixels(bitmaps, pw, ph, totalFrame, frameMs); // this part is tricky | |
encoder.GenPalette(colors.length, colors); | |
for (Bitmap bm : bitmaps) { | |
encoder.AddFrame(bm); |
private Task<WeatherResult> queryWeather() { | |
final TaskCompletionSource<WeatherResult> task = new TaskCompletionSource<>(); | |
Awareness.SnapshotApi.getWeather(mApiClient) | |
.setResultCallback(new ResultCallback<WeatherResult>() { | |
@Override | |
public void onResult(@NonNull WeatherResult weatherResult) { | |
if (!weatherResult.getStatus().isSuccess()) { | |
task.setError(new IllegalStateException("Could not get weather.")); | |
return; | |
} |