This file contains 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
/* | |
* Copyright 2014 Julian Shen | |
* | |
* 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 |
This file contains 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
{ | |
"success": 1, | |
"successmsg": "Success", | |
"error": 0, | |
"errormsg": "", | |
"posts": [ | |
{ | |
"post_id": "819595", | |
"post_title": "test" | |
}, |
This file contains 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
{"data":[{"id":"55c064df11b7f310c6882589","type":"Feature","properties":{"OBJECTID":1,"ST":"Ayeyarwady","ST_PCODE":"MMR017","DT":"Hinthada","DT_PCODE":"MMR017D002","Shape_Leng":4.94490045094,"Shape_Area":0.597080590429,"DT_Mya":"?????????????"},"geometry":{"type":"Polygon","coordinates":[[[95.126367502558,18.505117378065],[95.129693702702,18.503786106244],[95.130174348068,18.50288589207],[95.131597349838,18.50244686643],[95.135877248636,18.500219129709],[95.139219011548,18.496629546017],[95.145383594378,18.495317475621],[95.147752718913,18.494882621936],[95.15345555563,18.492215787629],[95.155839788775,18.489972953089],[95.162617609415,18.489013644464],[95.168770049598,18.490185689518],[95.17462952843,18.49047876868],[95.181660982169,18.486377059754],[95.187520583308,18.479638447756],[95.191329360562,18.473192789915],[95.191622472999,18.46528213826],[95.191622633978,18.45590654675],[95.190158038563,18.440964171559],[95.188400366684,18.431002578207],[95.188986426982,18.424556867306],[95.193674157537,18.4163533 |
This file contains 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
Best score 0 0 0 0 0 0 1 0 2 1e+99 0 0 0 0 1 1 1 1 0 0 0 2.14742e+12 | |
Pattern has 21 elts (size 32) | |
family: "Radiance"(s) | |
familylang: "en"(s) | |
style: "Regular"(s) | |
stylelang: "en"(s) | |
fullname: "Radiance"(s) | |
fullnamelang: "en"(s) | |
slant: 0(i)(s) | |
weight: 80(i)(s) |
This file contains 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
OkHttpClient client = new OkHttpClient(); | |
client.setAuthenticator(new Authenticator() { | |
@Override public Request authenticate(Proxy proxy, Response response) { | |
String credential = Credentials.basic("c2f3b91b02c045747c26", "C21FE7CAF2129294747B"); | |
return response.request().newBuilder() | |
.header("Authorization", credential) | |
.build(); | |
} | |
@Override public Request authenticateProxy(Proxy proxy, Response response) { |
This file contains 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 interface TownshipListView extends LoadDataView { | |
void renderTownshipList(List<TownshipModel> townshipModels); | |
} |
This file contains 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 interface TownshipDataStore { | |
Observable<List<TownshipEntity>> townships(); | |
} |
This file contains 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 TownshipLocalDataStore implements TownshipDataStore { | |
private final TownshipCache townshipCache; | |
TownshipLocalDataStore(TownshipCache townshipCache){ | |
this.townshipCache = townshipCache; | |
} | |
//Return a list of townships from DB | |
@Override | |
public Observable<List<TownshipEntity>> townships() { | |
return townshipCache.get(); | |
} |
This file contains 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 TownshipCloudDataStore implements TownshipDataStore { | |
private final TownshipCache townshipCache; | |
TownshipCloudDataStore(TownshipCache townshipCache){ | |
this.townshipCache = townshipCache; | |
} | |
@Override | |
public Observable<List<TownshipEntity>> townships() { | |
return ServiceGenerator.getTownshipService().getTownships().doOnNext(new Consumer<List<TownshipEntity>>() { | |
@Override |
This file contains 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 TownshipDataStoreFactory { | |
private final TownshipCache townshipCache; | |
public TownshipDataStoreFactory(TownshipCache townshipCache){ | |
this.townshipCache = townshipCache; | |
} | |
public TownshipDataStore create(){ | |
if(!townshipCache.isExpired() && townshipCache.isCached()){ | |
return new TownshipLocalDataStore(townshipCache); | |
}else{ |
OlderNewer