├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── runConfigurations.xml ├── modules.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── domain ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── micky │ │ │ └── commonproj │ │ │ └── domain │ │ │ ├── service │ │ │ ├── response │ │ │ │ ├── BaseResponse.java │ │ │ │ ├── GetIpInfoResponse.java │ │ │ │ └── WeatherResponse.java │ │ │ ├── WeatherService.java │ │ │ └── ServiceManager.java │ │ │ ├── model │ │ │ ├── WeatherExtra.java │ │ │ ├── WeatherResult.java │ │ │ ├── WeatherData.java │ │ │ ├── IpInfo.java │ │ │ └── Place.java │ │ │ ├── db │ │ │ ├── manager │ │ │ │ ├── PlaceDaoManager.java │ │ │ │ └── BaseDaoManager.java │ │ │ ├── DaoManagerFactory.java │ │ │ ├── DBCore.java │ │ │ ├── dao │ │ │ │ ├── DaoSession.java │ │ │ │ ├── DaoMaster.java │ │ │ │ ├── PlaceDao.java │ │ │ │ └── IpInfoDao.java │ │ │ ├── generator │ │ │ │ └── GreenDaoGenerator.java │ │ │ └── MigrationHelper.java │ │ │ ├── DomainInit.java │ │ │ └── repository │ │ │ └── PlaceRepository.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── micky │ │ │ └── domain │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── micky │ │ └── domain │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── domain.iml ├── commonlib ├── .gitignore ├── libs │ ├── log4j-1.2.16.jar │ └── android-logging-log4j-1.0.3.jar ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── micky │ │ │ └── commonlib │ │ │ └── utils │ │ │ ├── ViewUtils.java │ │ │ ├── RxUtils.java │ │ │ ├── Constants.java │ │ │ ├── DateUtils.java │ │ │ ├── CrashHandler.java │ │ │ ├── RxBus.java │ │ │ └── FileUtils.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── micky │ │ │ └── commonlib │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── micky │ │ └── commonlib │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── commonlib.iml ├── presentation ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── back.png │ │ │ │ ├── menu.png │ │ │ │ ├── test.png │ │ │ │ ├── header.jpg │ │ │ │ ├── refresh.png │ │ │ │ ├── test1.png │ │ │ │ ├── weather.png │ │ │ │ ├── cols_head.png │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable │ │ │ │ ├── left_menu_place_item_bg.xml │ │ │ │ ├── left_menu_weather_item_bg.xml │ │ │ │ └── list_divider.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ └── layout │ │ │ │ ├── content_right.xml │ │ │ │ ├── item_place.xml │ │ │ │ ├── content_left.xml │ │ │ │ ├── view_toolbar.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── item_weather_extra.xml │ │ │ │ ├── item_weather_data.xml │ │ │ │ └── content_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── micky │ │ │ │ └── commonproj │ │ │ │ ├── presenter │ │ │ │ ├── BasePresenter.java │ │ │ │ ├── MainPresenter.java │ │ │ │ └── impl │ │ │ │ │ ├── BasePresenterImpl.java │ │ │ │ │ └── MainPresenterImpl.java │ │ │ │ ├── ui │ │ │ │ ├── view │ │ │ │ │ ├── MainView.java │ │ │ │ │ └── ItemDecoration.java │ │ │ │ ├── adapter │ │ │ │ │ ├── BaseListAdapter.java │ │ │ │ │ ├── WeatherExtraAdapter.java │ │ │ │ │ ├── WeatherDataAdapter.java │ │ │ │ │ └── PlaceAdapter.java │ │ │ │ └── activity │ │ │ │ │ ├── BaseActivity.java │ │ │ │ │ └── MainActivity.java │ │ │ │ └── BaseApplication.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── micky │ │ │ └── retrofitrxandroiddragger2 │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── micky │ │ └── retrofitrxandroiddragger2 │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── presentation.iml ├── settings.gradle ├── screenshots ├── a.png ├── b.png └── c.png ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── local.properties ├── gradle.properties ├── CommonProj.iml ├── gradlew.bat └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | CommonProj -------------------------------------------------------------------------------- /domain/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /commonlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /presentation/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':domain', ':presentation', ':commonlib' -------------------------------------------------------------------------------- /screenshots/a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/screenshots/a.png -------------------------------------------------------------------------------- /screenshots/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/screenshots/b.png -------------------------------------------------------------------------------- /screenshots/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/screenshots/c.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /.idea/workspace.xml 3 | /.idea/libraries 4 | .DS_Store 5 | /build 6 | /captures 7 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /commonlib/libs/log4j-1.2.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/commonlib/libs/log4j-1.2.16.jar -------------------------------------------------------------------------------- /domain/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | domain 3 | 4 | -------------------------------------------------------------------------------- /commonlib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | commonLib 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /commonlib/libs/android-logging-log4j-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/commonlib/libs/android-logging-log4j-1.0.3.jar -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/back.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/menu.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/test.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/header.jpg -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/refresh.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/test1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/test1.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/weather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/weather.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/cols_head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/cols_head.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mickyliu945/CommonProj/HEAD/presentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Apr 15 16:49:02 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/left_menu_place_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/left_menu_weather_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 使用RxAndroid、Retrofit、MVP模式实现的简易天气APP 2 | ==== 3 | ![image](https://github.com/mickyliu945/CommonProj/raw/master/screenshots/a.png) 4 | 5 | 6 | ![image](https://github.com/mickyliu945/CommonProj/raw/master/screenshots/b.png) 7 | 8 | 9 | ![image](https://github.com/mickyliu945/CommonProj/raw/master/screenshots/c.png) -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/list_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /commonlib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /domain/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 50dp 7 | 8 | 9 | -------------------------------------------------------------------------------- /presentation/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /presentation/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /domain/src/test/java/com/micky/domain/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.domain; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /commonlib/src/test/java/com/micky/commonlib/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/service/response/BaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.service.response; 2 | 3 | /** 4 | * @Project CommonProject 5 | * @Packate com.micky.commonproject.data.api.response 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2015-12-21 16:39 10 | * @Version 1.0 11 | */ 12 | public class BaseResponse { 13 | public int code; 14 | } 15 | -------------------------------------------------------------------------------- /presentation/src/test/java/com/micky/retrofitrxandroiddragger2/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /domain/src/androidTest/java/com/micky/domain/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.domain; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /commonlib/src/androidTest/java/com/micky/commonlib/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/presenter/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.presenter; 2 | 3 | /** 4 | * @Project CommonProject 5 | * @Packate com.micky.presentation 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2015-12-22 13:46 10 | * @Version 1.0 11 | */ 12 | public interface BasePresenter { 13 | void onCreate(); 14 | void onResume(); 15 | void onPause(); 16 | void onDestroy(); 17 | } 18 | -------------------------------------------------------------------------------- /presentation/src/androidTest/java/com/micky/retrofitrxandroiddragger2/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/model/WeatherExtra.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.model; 2 | 3 | /** 4 | * @Project CommonProj 5 | * @Packate com.micky.commonproj.domain.model 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2016-01-04 18:13 10 | * @Version 1.0 11 | */ 12 | public class WeatherExtra { 13 | public String title; 14 | public String zs; 15 | public String tipt; 16 | public String des; 17 | } 18 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Tue Apr 12 09:50:14 CST 2016 11 | sdk.dir=D\:\\Android\\sdk 12 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CommonProj 3 | Settings 4 | Please input ip address 5 | network error 6 | 空气质量:%s 7 | 城市:%s 8 | %1$s : %2$s 9 | 暂无天气推荐数据,请查看左侧栏最近天气信息 10 | 11 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/service/response/GetIpInfoResponse.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.service.response; 2 | 3 | 4 | import com.micky.commonproj.domain.model.IpInfo; 5 | 6 | /** 7 | * @Project CommonProject 8 | * @Packate com.micky.commonproject.data.api.response 9 | * @Description 10 | * @Author Micky Liu 11 | * @Email mickyliu@126.com 12 | * @Date 2015-12-21 16:39 13 | * @Version 1.0 14 | */ 15 | public class GetIpInfoResponse extends BaseResponse { 16 | public IpInfo data; 17 | } 18 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/model/WeatherResult.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @Project CommonProj 7 | * @Packate com.micky.commonproj.domain.model 8 | * @Description 9 | * @Author Micky Liu 10 | * @Email mickyliu@126.com 11 | * @Date 2016-01-04 18:13 12 | * @Version 1.0 13 | */ 14 | public class WeatherResult { 15 | public String currentCity; 16 | public String pm25; 17 | public List index; 18 | public List weather_data; 19 | } 20 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/presenter/MainPresenter.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.presenter; 2 | 3 | /** 4 | * @Project CommonProject 5 | * @Packate com.micky.presentation 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2015-12-22 13:46 10 | * @Version 1.0 11 | */ 12 | public interface MainPresenter extends BasePresenter { 13 | 14 | void getWeatherData(String place); 15 | 16 | void getPlaceData(); 17 | 18 | void getPlaceAndWeatherData(String place); 19 | 20 | void onRefresh(); 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/model/WeatherData.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.model; 2 | 3 | /** 4 | * @Project CommonProj 5 | * @Packate com.micky.commonproj.domain.model 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2016-01-04 18:12 10 | * @Version 1.0 11 | */ 12 | public class WeatherData { 13 | public String date; 14 | public String dayPictureUrl; 15 | public String nightPictureUrl; 16 | public String weather; 17 | public String wind; 18 | public String temperature; 19 | } 20 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/db/manager/PlaceDaoManager.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.db.manager; 2 | 3 | import com.micky.commonproj.domain.model.Place; 4 | 5 | import de.greenrobot.dao.AbstractDao; 6 | 7 | /** 8 | * @Project CommonProj 9 | * @Packate com.micky.commonproj.domain.db.manager 10 | * @Description 11 | * @Author Micky Liu 12 | * @Email mickyliu@126.com 13 | * @Date 2016-01-29 13:43 14 | * @Version 1.0 15 | */ 16 | public class PlaceDaoManager extends BaseDaoManager { 17 | 18 | public PlaceDaoManager(AbstractDao dao) { 19 | super(dao); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/service/response/WeatherResponse.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.service.response; 2 | 3 | import com.micky.commonproj.domain.model.WeatherResult; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @Project CommonProj 9 | * @Packate com.micky.commonproj.domain.service.response 10 | * @Description 11 | * @Author Micky Liu 12 | * @Email mickyliu@126.com 13 | * @Date 2016-01-04 18:14 14 | * @Version 1.0 15 | */ 16 | public class WeatherResponse extends BaseResponse { 17 | public int error; 18 | public String status; 19 | public String date; 20 | public List results; 21 | } 22 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/ui/view/MainView.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.ui.view; 2 | 3 | import com.micky.commonproj.domain.model.Place; 4 | import com.micky.commonproj.domain.service.response.WeatherResponse; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @Project CommonProject 10 | * @Packate com.micky.presentation 11 | * @Description 12 | * @Author Micky Liu 13 | * @Email mickyliu@126.com 14 | * @Date 2015-12-22 13:55 15 | * @Version 1.0 16 | */ 17 | public interface MainView { 18 | void showProgress(); 19 | void hideProgress(); 20 | void setupPlaceData(List placeList); 21 | void setupWeatherData(WeatherResponse response); 22 | } -------------------------------------------------------------------------------- /presentation/src/main/res/layout/content_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/ViewUtils.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | /** 4 | * @Project CommonProj 5 | * @Packate com.micky.commonlib.utils 6 | * @Description 7 | * @Author Micky Liu 8 | * @Email mickyliu@126.com 9 | * @Date 2016-01-08 14:51 10 | * @Version 1.0 11 | */ 12 | public class ViewUtils { 13 | /**防止连续点击*/ 14 | private static long lastClickTime; 15 | public static boolean isFastClick() { 16 | long time = System.currentTimeMillis(); 17 | long timeD = time - lastClickTime; 18 | if ( timeD > 0 && timeD < 500) { 19 | return true; 20 | } 21 | lastClickTime = time; 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /commonlib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\software\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /domain/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\software\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /presentation/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\software\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/DomainInit.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain; 2 | 3 | import android.content.Context; 4 | 5 | import com.micky.commonproj.domain.db.DBCore; 6 | 7 | /** 8 | * @Project CommonProj 9 | * @Packate com.micky.commonproj.domain 10 | * 11 | * @Description Domain 相关初始化 12 | * 13 | * @Author Micky Liu 14 | * @Email mickyliu@126.com 15 | * @Date 2016-01-29 14:34 16 | * @Version 1.0 17 | */ 18 | public class DomainInit { 19 | 20 | public static void init(Context context) { 21 | initDatabase(context); 22 | } 23 | 24 | /** 25 | * 初始化数据库 26 | * @param context 27 | */ 28 | public static void initDatabase(Context context) { 29 | DBCore.init(context); 30 | DBCore.enableQueryBuilderLog(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /domain/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 10 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.1.1' 25 | compile 'de.greenrobot:greendao:2.0.0' 26 | compile 'de.greenrobot:greendao-generator:2.0.0' 27 | 28 | compile project(':commonlib') 29 | } 30 | -------------------------------------------------------------------------------- /presentation/src/main/res/layout/item_place.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 20 | 21 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/db/DaoManagerFactory.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.db; 2 | 3 | import com.micky.commonproj.domain.db.dao.PlaceDao; 4 | import com.micky.commonproj.domain.db.manager.PlaceDaoManager; 5 | 6 | /** 7 | * @Project CommonProj 8 | * @Packate com.micky.commonproj.domain.db 9 | * 10 | * @Description 11 | * 12 | * @Author Micky Liu 13 | * @Email mickyliu@126.com 14 | * @Date 2016-01-29 14:29 15 | * @Version 1.0 16 | */ 17 | public class DaoManagerFactory { 18 | 19 | private static PlaceDaoManager sPlaceDaoManager; 20 | 21 | public static PlaceDaoManager getPlaceDaoManager() { 22 | if (sPlaceDaoManager == null) { 23 | PlaceDao userDao = DBCore.getDaoSession().getPlaceDao(); 24 | sPlaceDaoManager = new PlaceDaoManager(userDao); 25 | } 26 | return sPlaceDaoManager; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /presentation/src/main/res/layout/content_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 22 | 23 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #1a9bd0 4 | #1a9bd0 5 | #ff009688 6 | #EFEFF4 7 | #FFFFFF 8 | #000000 9 | #ddd 10 | 11 | #05c7a5 12 | #0ca3d0 13 | #01b8d7 14 | #d76d93 15 | #7e4b84 16 | #ea8010 17 | #27ae60 18 | #61c883 19 | #01b8d7 20 | #05c7a5 21 | 22 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/RxUtils.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | import rx.Subscription; 4 | import rx.subscriptions.CompositeSubscription; 5 | 6 | /** 7 | * @Project CommonProj 8 | * @Packate com.micky.commonlib.utils 9 | * @Description 10 | * @Author Micky Liu 11 | * @Email mickyliu@126.com 12 | * @Date 2016-01-11 14:22 13 | * @Version 1.0 14 | */ 15 | public class RxUtils { 16 | 17 | public static void unsubscribeIfNotNull(Subscription subscription) { 18 | if (subscription != null) { 19 | subscription.unsubscribe(); 20 | } 21 | } 22 | 23 | public static CompositeSubscription getNewCompositeSubIfUnsubscribed(CompositeSubscription subscription) { 24 | if (subscription == null || subscription.isUnsubscribed()) { 25 | return new CompositeSubscription(); 26 | } 27 | 28 | return subscription; 29 | } 30 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /presentation/src/main/res/layout/view_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 23 | -------------------------------------------------------------------------------- /CommonProj.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * @Project CommonProject 7 | * @Packate com.micky.commonlib.utils 8 | * @Description 9 | * @Author Micky Liu 10 | * @Email mickyliu@126.com 11 | * @Date 2015-12-30 17:43 12 | * @Version 1.0 13 | */ 14 | public class Constants { 15 | 16 | //网络相关 17 | public static final int HTTP_RESPONSE_DISK_CACHE_MAX_SIZE = 10 * 1024 * 1024; 18 | 19 | public static final String ENDPOINT_IP = "http://ip.taobao.com"; 20 | public static final String ENDPOINT_WEATHER = " http://api.map.baidu.com"; 21 | public static final String BAIDU_AK = "MPDgj92wUYvRmyaUdQs1XwCf"; 22 | 23 | 24 | 25 | public static final boolean DEBUG = true; 26 | 27 | //日志相关 28 | public static final String BASE_FILE_PATH = "CommonProj"; 29 | public static final String LOG_PATH = BASE_FILE_PATH + File.separator + "log"; 30 | public static final String LOG_FILE = BASE_FILE_PATH + ".log"; 31 | } 32 | -------------------------------------------------------------------------------- /commonlib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 10 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | final RETROFIT_VERSION = '2.0.2' 23 | 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | testCompile 'junit:junit:4.12' 26 | 27 | compile 'io.reactivex:rxandroid:1.1.0' 28 | compile 'io.reactivex:rxjava:1.1.3' 29 | compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION" 30 | compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" 31 | compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" 32 | compile 'com.squareup.okhttp3:logging-interceptor:3.0.1' 33 | } 34 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | -------------------------------------------------------------------------------- /presentation/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | /** 8 | * @Project CommonProj 9 | * @Packate com.micky.commonlib.utils 10 | * @Description 11 | * @Author Micky Liu 12 | * @Email mickyliu@126.com 13 | * @Date 2016-01-08 10:30 14 | * @Version 1.0 15 | */ 16 | public class DateUtils { 17 | private static final String DATE_SHORT_FORMAT = "yyyy-MM-dd"; 18 | private static final String DATE_WEEK_FORMAT = "yyyy-MM-dd EEEE"; 19 | 20 | public static String getWeekDay(String dateStr) { 21 | String result = ""; 22 | try { 23 | Date date = new SimpleDateFormat(DATE_SHORT_FORMAT).parse(dateStr); 24 | result = getWeekDate(date); 25 | } catch (Exception e) { 26 | e.printStackTrace(); 27 | } 28 | return result; 29 | } 30 | 31 | public static String getWeekDate(Date date) { 32 | SimpleDateFormat dateFm = new SimpleDateFormat(DATE_WEEK_FORMAT); 33 | return dateFm.format(date); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/main/java/com/micky/commonproj/domain/service/WeatherService.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.domain.service; 2 | 3 | 4 | import com.micky.commonproj.domain.service.response.WeatherResponse; 5 | 6 | import org.w3c.dom.UserDataHandler; 7 | 8 | import java.util.List; 9 | 10 | import retrofit2.http.POST; 11 | import retrofit2.http.Query; 12 | import rx.Observable; 13 | 14 | /** 15 | * @Project CommonProject 16 | * @Packate com.micky.commonproj.data.api 17 | * @Description 18 | * @Author Micky Liu 19 | * @Email mickyliu@126.com 20 | * @Date 2015-12-21 17:22 21 | * @Version 1.0 22 | */ 23 | public interface WeatherService { 24 | 25 | /*@GET("service/getIpInfo.php") 26 | Call getIpInfo(@Query("ip") String ip);*/ 27 | 28 | // @GET("service/getIpInfo.php") 29 | // Observable getIpInfo(@Query("ip") String ip); 30 | 31 | 32 | //http://api.map.baidu.com/telematics/v3/weather?location=%E6%88%90%E9%83%BD&output=json&ak=MPDgj92wUYvRmyaUdQs1XwCf 33 | @POST("/telematics/v3/weather?output=json") 34 | Observable getWeatherInfo(@Query("location") String location, @Query("ak") String ak); 35 | } 36 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/CrashHandler.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | 4 | import android.content.Context; 5 | import android.util.Log; 6 | 7 | /** 8 | * @Description 全局Crash捕获处理 9 | * @Author Micky Liu 10 | * @Email sglazelhw@126.com 11 | * @Date 2015-04-03 下午 1:43 12 | */ 13 | public class CrashHandler implements Thread.UncaughtExceptionHandler { 14 | 15 | // public final Logger mLogger = Logger.getLogger(getClass()); 16 | 17 | private static CrashHandler INSTANCE = new CrashHandler(); 18 | private Thread.UncaughtExceptionHandler mDefaultUEH; 19 | private Context mContext; 20 | 21 | private CrashHandler() { 22 | mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler(); 23 | } 24 | 25 | public static CrashHandler getInstance() { 26 | return INSTANCE; 27 | } 28 | 29 | public void init(Context ctx) { 30 | Thread.setDefaultUncaughtExceptionHandler(this); 31 | mContext = ctx; 32 | } 33 | 34 | @Override 35 | public void uncaughtException(Thread thread, Throwable ex) { 36 | Log.e("CrashHandler", ex.getMessage(), ex); 37 | mDefaultUEH.uncaughtException(thread, ex); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /commonlib/src/main/java/com/micky/commonlib/utils/RxBus.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonlib.utils; 2 | 3 | import rx.Observable; 4 | import rx.subjects.PublishSubject; 5 | import rx.subjects.SerializedSubject; 6 | import rx.subjects.Subject; 7 | 8 | /** 9 | * @Project CommonProj 10 | * @Packate com.micky.commonlib.utils 11 | * @Description 12 | * @Author Micky Liu 13 | * @Email mickyliu@126.com 14 | * @Date 2016-01-11 15:03 15 | * @Version 1.0 16 | */ 17 | public class RxBus { 18 | 19 | private final PublishSubject publishSubject = PublishSubject.create(); 20 | private final Subject mBus = new SerializedSubject(publishSubject); 21 | 22 | private static class RxBusHolder { 23 | private static final RxBus INSTANCE = new RxBus(); 24 | } 25 | 26 | private RxBus() {} 27 | 28 | public static final RxBus getInstance() { 29 | return RxBusHolder.INSTANCE; 30 | } 31 | 32 | public void send(BusEvent event) { 33 | mBus.onNext(event); 34 | } 35 | 36 | public Observable toObserverable() { 37 | return mBus; 38 | } 39 | 40 | public boolean hasObservers() { 41 | return mBus.hasObservers(); 42 | } 43 | 44 | public static class BusEvent {} 45 | } -------------------------------------------------------------------------------- /presentation/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.micky.commonproj" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile project(':commonlib') 26 | compile project(':domain') 27 | 28 | compile 'com.android.support:appcompat-v7:23.1.1' 29 | compile 'com.android.support:design:23.1.1' 30 | compile 'com.android.support:cardview-v7:23.1.1' 31 | compile 'com.jakewharton:butterknife:7.0.1' 32 | compile 'com.jakewharton.rxbinding:rxbinding:0.3.0' 33 | compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.3.0' 34 | compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.3.0' 35 | compile 'com.jakewharton.rxbinding:rxbinding-design:0.3.0' 36 | compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7:0.3.0' 37 | compile 'com.facebook.fresco:fresco:0.8.0+' 38 | 39 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' 40 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' 41 | } 42 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/ui/view/ItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.ui.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.drawable.Drawable; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.View; 8 | 9 | import com.micky.commonproj.R; 10 | 11 | /** 12 | * @Package com.micky.commonlib.view 13 | * @Project CommonProj 14 | * @Description 15 | * @Author Micky Liu 16 | * @Email mickyliu@126.com 17 | * @Team KTEAM 18 | * @Date 2016-01-04 23:13 19 | */ 20 | public class ItemDecoration extends RecyclerView.ItemDecoration { 21 | private Drawable mDivider; 22 | 23 | public ItemDecoration(Context context) { 24 | mDivider = context.getResources().getDrawable(R.drawable.list_divider); 25 | } 26 | 27 | @Override 28 | public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { 29 | int left = parent.getPaddingLeft(); 30 | int right = parent.getWidth() - parent.getPaddingRight(); 31 | 32 | int childCount = parent.getChildCount(); 33 | for (int i = 0; i < childCount; i++) { 34 | View child = parent.getChildAt(i); 35 | 36 | RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); 37 | 38 | int top = child.getBottom() + params.bottomMargin; 39 | int bottom = top + mDivider.getIntrinsicHeight(); 40 | 41 | mDivider.setBounds(left, top, right, bottom); 42 | mDivider.draw(c); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/presenter/impl/BasePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.presenter.impl; 2 | 3 | import com.micky.commonlib.utils.RxUtils; 4 | import com.micky.commonproj.presenter.BasePresenter; 5 | 6 | import rx.Observable; 7 | import rx.android.schedulers.AndroidSchedulers; 8 | import rx.schedulers.Schedulers; 9 | import rx.subscriptions.CompositeSubscription; 10 | 11 | /** 12 | * @Project CommonProject 13 | * @Packate com.micky.commonproj.presenter 14 | * @Description 15 | * @Author Micky Liu 16 | * @Email mickyliu@126.com 17 | * @Date 2015-12-22 14:34 18 | * @Version 0.1 19 | */ 20 | public class BasePresenterImpl implements BasePresenter { 21 | protected CompositeSubscription mSubscriptions = new CompositeSubscription(); 22 | 23 | @Override 24 | public void onCreate() { 25 | mSubscriptions = RxUtils.getNewCompositeSubIfUnsubscribed(mSubscriptions); 26 | } 27 | 28 | @Override 29 | public void onResume() { 30 | 31 | } 32 | 33 | @Override 34 | public void onPause() { 35 | 36 | } 37 | 38 | @Override 39 | public void onDestroy() { 40 | mSubscriptions.unsubscribe(); 41 | } 42 | 43 | protected Observable.Transformer applyScheduler() { 44 | return new Observable.Transformer() { 45 | @Override 46 | public Observable call(Observable observable) { 47 | return observable.subscribeOn(Schedulers.io()) 48 | .observeOn(AndroidSchedulers.mainThread()); 49 | } 50 | }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/micky/commonproj/ui/adapter/BaseListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.micky.commonproj.ui.adapter; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.ViewGroup; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * @Package org.kteam.palm.adapter 11 | * @Project CommonProj 12 | * @Description 13 | * @Author Micky Liu 14 | * @Email mickyliu@126.com 15 | * @Team KTEAM 16 | * @Date 2015-12-05 15:45 17 | */ 18 | public class BaseListAdapter extends RecyclerView.Adapter { 19 | protected List mDataList; 20 | 21 | public BaseListAdapter() { 22 | mDataList = new ArrayList(); 23 | } 24 | 25 | public void clearData() { 26 | mDataList.clear(); 27 | } 28 | 29 | public void setData(List list) { 30 | mDataList.clear(); 31 | mDataList.addAll(list); 32 | } 33 | 34 | public void appendDataList(List list) { 35 | mDataList.addAll(list); 36 | } 37 | 38 | public void appendData(T t) { 39 | mDataList.add(t); 40 | } 41 | 42 | @Override 43 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { 49 | 50 | } 51 | 52 | @Override 53 | public int getItemCount() { 54 | return mDataList.size(); 55 | } 56 | 57 | public T getItem(int position) { 58 | return mDataList.get(position); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /presentation/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 30 | 31 | 32 | 41 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 19 | 20 | 24 | 28 | 29 | 33 | 37 |