Skip to content

Commit

Permalink
Update to 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chihane committed Jun 30, 2016
1 parent b4cb70d commit 40461f8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

dependencies {
...
compile 'com.github.chihane:JDAddressSelector:1.1.2'
compile 'com.github.chihane:JDAddressSelector:1.1.3'
}

## 使用方法
Expand All @@ -45,6 +45,49 @@
dialog.setOnAddressSelectedListener(listener);
dialog.show();

### 使用自定义数据源

selector.setAddressProvider(new AddressProvider() {
@Override
public void provideProvinces(AddressReceiver<Province> addressReceiver) {
List<Province> provinces = // blahblahblah
addressReceiver.send(provinces);
}

@Override
public void provideCitiesWith(int provinceId, AddressReceiver<City> addressReceiver) {
new Thread(new Runnable() {
@Override
public void run() {
List<City> cities = // blahblahblah
addressReceiver.send(cities);
}
}).start();
}

@Override
public void provideCountiesWith(int cityId, AddressReceiver<County> addressReceiver) {
addressApi.counties(cityId)
.subscribeOn(Schedulers.io())
.subscribe(new Action1<List<County>>() {
@Override
public void call(List<County> counties) {
addressReceiver.send(counties);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
addressReceiver.send(null);
}
});
}

@Override
public void provideStreetsWith(int countyId, AddressReceiver<Street> addressReceiver) {
// blahblahblah
}
});

## 关于我

**Chihane Habana**
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 4
versionName "1.1.2"
versionCode 5
versionName "1.1.3"
}
buildTypes {
release {
Expand Down

0 comments on commit 40461f8

Please sign in to comment.