├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── markdown-exported-files.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── CHANGESLOG.md ├── LICENSE ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── gear │ │ └── yc │ │ └── com │ │ └── gearapplication │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── gear │ │ │ └── yc │ │ │ └── com │ │ │ └── gearapplication │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseApplication.java │ │ │ ├── BasePresenter.java │ │ │ └── BaseView.java │ │ │ ├── component │ │ │ ├── ComponentManager.java │ │ │ ├── ComponentPresenter.java │ │ │ ├── medules │ │ │ │ ├── AdapterModel.java │ │ │ │ ├── ModulePojo.java │ │ │ │ └── ModulePresenter.java │ │ │ └── scope │ │ │ │ └── ActivityScope.java │ │ │ ├── config │ │ │ └── APIConfig.java │ │ │ ├── demo │ │ │ ├── activity │ │ │ │ ├── DataBindingActivity.java │ │ │ │ ├── FunctionListActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── RecyclerViewActivity.java │ │ │ │ ├── RxJavaActivity.java │ │ │ │ └── WebViewActivity.java │ │ │ └── network │ │ │ │ ├── Request.java │ │ │ │ └── RouterDemo.java │ │ │ ├── manager │ │ │ ├── APIDataSourceManager.java │ │ │ └── CommonManager.java │ │ │ ├── network │ │ │ ├── HttpServiceManager.java │ │ │ ├── helper │ │ │ │ └── SchedulersHelper.java │ │ │ └── service │ │ │ │ ├── APIService.java │ │ │ │ ├── ApiService.java │ │ │ │ ├── BreadtripAPI.java │ │ │ │ ├── QyerGuideAPI.java │ │ │ │ └── TravelNotesAPI.java │ │ │ ├── pojo │ │ │ ├── APIDataSource.java │ │ │ ├── Clock.java │ │ │ ├── ResponseJson.java │ │ │ ├── TravelNoteBook.java │ │ │ ├── TravelNotesList.java │ │ │ └── User.java │ │ │ ├── ui │ │ │ ├── activity │ │ │ │ ├── SearchBooksActivity.java │ │ │ │ ├── TravelNotesBookDetailsActivity.java │ │ │ │ └── WelcomeActivity.java │ │ │ ├── adapter │ │ │ │ └── RecyclerListDemoAdapter.java │ │ │ ├── custom │ │ │ │ ├── animation │ │ │ │ │ └── ManagerAnimation.java │ │ │ │ └── view │ │ │ │ │ └── CustomVideoView.java │ │ │ └── mvp │ │ │ │ └── travelnotes │ │ │ │ ├── TravelNotesActivity.java │ │ │ │ ├── TravelNotesAdapter.java │ │ │ │ ├── TravelNotesContract.java │ │ │ │ └── TravelNotesPresenter.java │ │ │ └── utils │ │ │ ├── DataRouting │ │ │ ├── APIDataRouting.java │ │ │ └── annotation │ │ │ │ ├── LoadData.java │ │ │ │ └── Query.java │ │ │ └── EncryptUtil.java │ └── res │ │ ├── drawable-hdpi │ │ ├── bg_img.png │ │ ├── img_back.png │ │ ├── img_gridview.png │ │ ├── img_lv.png │ │ └── img_search.png │ │ ├── drawable │ │ └── bg_books_item_text_bg.xml │ │ ├── layout │ │ ├── activity_databinding.xml │ │ ├── activity_gear.xml │ │ ├── activity_main.xml │ │ ├── activity_recycler_view.xml │ │ ├── activity_search_books.xml │ │ ├── activity_travel_notes.xml │ │ ├── activity_travel_notes_book_details.xml │ │ ├── activity_web_view.xml │ │ ├── activity_welcome.xml │ │ ├── demo_indicator_progress_bar.xml │ │ ├── function_list_activity.xml │ │ ├── include_header_back.xml │ │ ├── include_header_search.xml │ │ ├── item_foot.xml │ │ ├── item_recycler_view.xml │ │ ├── item_travel_notes.xml │ │ └── layout_databinding_user_pwd.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── raw │ │ ├── guide_1.mp4 │ │ └── guide_2.mp4 │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── gear │ └── yc │ └── com │ └── gearapplication │ ├── ui │ └── mvp │ │ └── travelnotes │ │ └── TravelNotesPresenterTest.java │ └── utils │ └── EncryptUtilTest.java ├── build.gradle ├── gearapifinder-annotation ├── .gitignore ├── bintray.gradle ├── build.gradle ├── gradle.properties └── src │ └── main │ └── java │ └── com │ └── gear │ └── apifinder │ └── annotation │ ├── APICustomHandleResult.java │ ├── APIHandleResult.java │ ├── APIManager.java │ ├── APIRouter.java │ └── APIService.java ├── gearapifinder-compiler ├── bintray.gradle ├── build.gradle ├── gradle.properties ├── readme.md └── src │ └── main │ └── java │ └── gear │ └── yc │ └── finder │ ├── FinderProcesser.java │ ├── anno │ └── handler │ │ ├── APIManagerHandler.java │ │ ├── APIRouterHandler.java │ │ ├── APIServiceHandler.java │ │ └── AbstractAnnotationHandler.java │ ├── model │ ├── APIManagerElementModel.java │ ├── APIRouterModel.java │ ├── BaseModel.java │ └── ServiceElementModel.java │ ├── utils │ ├── MtdHead.java │ ├── MtdMark.java │ └── StrHandling.java │ └── write │ ├── APIManagerWrite.java │ ├── APIRouterWrite.java │ └── AbstractWrite.java ├── gearapifinder ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── gamedemo │ │ └── ycz │ │ └── cn │ │ └── gearapifinder │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── gamedemo │ └── ycz │ └── cn │ └── gearapifinder │ └── ExampleUnitTest.java ├── gearlibrary ├── .gitignore ├── bintray.gradle ├── build.gradle ├── proguard-rules.pro ├── readme.md └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── gear │ │ └── yc │ │ └── com │ │ └── gearlibrary │ │ ├── GearActivity.java │ │ ├── GearApplication.java │ │ ├── GearFragment.java │ │ ├── RxLifecycle2DemoActivity.java │ │ ├── RxLifecycle2DemoFragment.java │ │ ├── intarface │ │ └── view │ │ │ └── GearRecyclerMore.java │ │ ├── manager │ │ └── ActivityManager.java │ │ ├── network │ │ ├── api │ │ │ └── GearHttpServiceManager.java │ │ ├── http │ │ │ ├── HttpInfo.java │ │ │ └── OkHttpManager.java │ │ └── socker │ │ │ ├── SocketTCPService.java │ │ │ └── SocketTcpContextListener.java │ │ ├── rxjava │ │ ├── helper │ │ │ └── RxSchedulersHelper.java │ │ └── rxbus │ │ │ ├── RxBus.java │ │ │ ├── annotation │ │ │ ├── Subscribe.java │ │ │ └── UseRxBus.java │ │ │ ├── event │ │ │ ├── EventTag.java │ │ │ └── EventThread.java │ │ │ └── pojo │ │ │ └── Msg.java │ │ ├── ui │ │ ├── adapter │ │ │ └── GearRecyclerViewAdapter.java │ │ └── custom │ │ │ ├── GearRecyclerItemDecoration.java │ │ │ └── GearRecyclerView.java │ │ └── utils │ │ ├── ConvertPadPlus.java │ │ ├── IndicatorProgressBar.java │ │ ├── Preconditions.java │ │ ├── ProgressDialogUtil.java │ │ ├── ToastUtil.java │ │ ├── encryption │ │ ├── BASE64.java │ │ └── DES.java │ │ └── web │ │ └── BaseWeb.java │ └── res │ ├── anim │ ├── backin.xml │ ├── backout.xml │ ├── zoomin.xml │ └── zoomout.xml │ ├── drawable │ └── progress_horizontal.xml │ ├── layout │ └── item_foot.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── readme.md └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/android,intellij,gradle 2 | 3 | ### Android ### 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the ART/Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | out/ 18 | 19 | # Gradle files 20 | .gradle/ 21 | build/ 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Log Files 30 | *.log 31 | 32 | # Android Studio Navigation editor temp files 33 | .navigation/ 34 | 35 | # Android Studio captures folder 36 | captures/ 37 | 38 | # Intellij 39 | *.iml 40 | .idea/workspace.xml 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | ### Android Patch ### 47 | gen-external-apklibs 48 | 49 | 50 | ### Intellij ### 51 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 52 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 53 | 54 | # User-specific stuff: 55 | .idea/workspace.xml 56 | .idea/tasks.xml 57 | .idea/dictionaries 58 | .idea/vcs.xml 59 | .idea/jsLibraryMappings.xml 60 | 61 | # Sensitive or high-churn files: 62 | .idea/dataSources.ids 63 | .idea/dataSources.xml 64 | .idea/dataSources.local.xml 65 | .idea/sqlDataSources.xml 66 | .idea/dynamic.xml 67 | .idea/uiDesigner.xml 68 | 69 | # Gradle: 70 | .idea/gradle.xml 71 | .idea/libraries 72 | 73 | # Mongo Explorer plugin: 74 | .idea/mongoSettings.xml 75 | 76 | ## File-based project format: 77 | *.iws 78 | 79 | ## Plugin-specific files: 80 | 81 | # IntelliJ 82 | /out/ 83 | 84 | # mpeltonen/sbt-idea plugin 85 | .idea_modules/ 86 | 87 | # JIRA plugin 88 | atlassian-ide-plugin.xml 89 | 90 | # Crashlytics plugin (for Android Studio and IntelliJ) 91 | com_crashlytics_export_strings.xml 92 | crashlytics.properties 93 | crashlytics-build.properties 94 | fabric.properties 95 | 96 | ### Intellij Patch ### 97 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 98 | 99 | # *.iml 100 | # modules.xml 101 | # .idea/misc.xml 102 | # *.ipr 103 | 104 | 105 | ### Gradle ### 106 | .gradle 107 | /build/ 108 | 109 | # Ignore Gradle GUI config 110 | gradle-app.setting 111 | 112 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 113 | !gradle-wrapper.jar 114 | 115 | # Cache of project 116 | .gradletasknamecache 117 | 118 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 119 | # gradle/wrapper/gradle-wrapper.properties -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/markdown-exported-files.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 33 | 34 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /CHANGESLOG.md: -------------------------------------------------------------------------------- 1 | ##### 1.5.2 2 | ``` 3 | 更新了部分第三方jar包的版本 4 | ``` 5 | ##### 1.5.1 6 | ``` 7 | 自动生成HTTPServiceManager文件的修改 8 | 修复apt文件创建时如果没有annotation时出现错误的情况,现在文件不会生成也不会造成其他apt相关文件错误 9 | ``` 10 | ##### 1.5.0 11 | ``` 12 | rxjava2.0更新 13 | bus重新改为线程安全对象 14 | 欢迎页面增加了短视频显示,并且文字渐变显示 15 | 增加Animation管理类 16 | ``` 17 | ##### 1.4.2 18 | ``` 19 | 更新了引用library 20 | ``` 21 | ##### 1.4.1 22 | ``` 23 | RxBus优化 24 | ``` 25 | ##### 1.4.0 26 | ``` 27 | 以 Rxlifecycle 来管理Rx生命周期 28 | 增加RxBus来发射数据 29 | ``` 30 | ##### 1.3.6 31 | ``` 32 | 去掉了Fresco的引用,增加了RxBus 33 | ``` 34 | ##### 1.2.1 35 | ``` 36 | 改变OKHttp创建方式,改为简单创建者方式构建 37 | 38 | ``` 39 | ##### 1.1.1 40 | ``` 41 | 修改Gearlibrary 支持最低sdk 14 42 | ``` 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 hackerlc 2 | 3 | "Anti 996" License Version 1.0 (Draft) 4 | 5 | Permission is hereby granted to any individual or legal entity 6 | obtaining a copy of this licensed work (including the source code, 7 | documentation and/or related items, hereinafter collectively referred 8 | to as the "licensed work"), free of charge, to deal with the licensed 9 | work for any purpose, including without limitation, the rights to use, 10 | reproduce, modify, prepare derivative works of, distribute, publish 11 | and sublicense the licensed work, subject to the following conditions: 12 | 13 | 1. The individual or the legal entity must conspicuously display, 14 | without modification, this License and the notice on each redistributed 15 | or derivative copy of the Licensed Work. 16 | 17 | 2. The individual or the legal entity must strictly comply with all 18 | applicable laws, regulations, rules and standards of the jurisdiction 19 | relating to labor and employment where the individual is physically 20 | located or where the individual was born or naturalized; or where the 21 | legal entity is registered or is operating (whichever is stricter). In 22 | case that the jurisdiction has no such laws, regulations, rules and 23 | standards or its laws, regulations, rules and standards are 24 | unenforceable, the individual or the legal entity are required to 25 | comply with Core International Labor Standards. 26 | 27 | 3. The individual or the legal entity shall not induce, suggest or force 28 | its employee(s), whether full-time or part-time, or its independent 29 | contractor(s), in any methods, to agree in oral or written form, to 30 | directly or indirectly restrict, weaken or relinquish his or her 31 | rights or remedies under such laws, regulations, rules and standards 32 | relating to labor and employment as mentioned above, no matter whether 33 | such written or oral agreements are enforceable under the laws of the 34 | said jurisdiction, nor shall such individual or the legal entity 35 | limit, in any methods, the rights of its employee(s) or independent 36 | contractor(s) from reporting or complaining to the copyright holder or 37 | relevant authorities monitoring the compliance of the license about 38 | its violation(s) of the said license. 39 | 40 | THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 41 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 42 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 43 | IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, 44 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 45 | OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE 46 | LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. 47 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'me.tatarka.retrolambda' 3 | 4 | repositories{ 5 | 6 | } 7 | 8 | android { 9 | compileSdkVersion 23 10 | buildToolsVersion '25' 11 | 12 | defaultConfig { 13 | applicationId "gear.yc.com.explore" 14 | minSdkVersion 18 15 | targetSdkVersion 23 16 | versionCode 3 17 | versionName "1.2.0" 18 | } 19 | 20 | signingConfigs { 21 | myConfig { 22 | storeFile file("./MyGearKey.jks") 23 | storePassword 'GearApplication123' 24 | keyAlias("joker") 25 | keyPassword 'joker123' 26 | } 27 | } 28 | 29 | dataBinding{ 30 | enabled true 31 | } 32 | 33 | buildTypes { 34 | release { 35 | minifyEnabled false 36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 37 | signingConfig signingConfigs.myConfig 38 | } 39 | debug { 40 | signingConfig signingConfigs.myConfig 41 | } 42 | } 43 | compileOptions { 44 | sourceCompatibility JavaVersion.VERSION_1_8 45 | targetCompatibility JavaVersion.VERSION_1_8 46 | } 47 | 48 | applicationVariants.all { variant -> 49 | 50 | // if (variant.buildType.name.equals('release')) { 51 | // variant.outputs.each { output -> 52 | // def appName = 'Explore' 53 | // def oldFile = output.outputFile 54 | // def releaseApkName 55 | // releaseApkName = appName + getVersionNameFromManifest() + '.apk' 56 | // output.outputFile = new File(oldFile.parent, releaseApkName) 57 | // } 58 | // } 59 | } 60 | 61 | lintOptions { 62 | abortOnError false 63 | } 64 | } 65 | 66 | def getVersionNameFromManifest() { 67 | 68 | return android.defaultConfig.versionName+"-"+android.defaultConfig.versionCode 69 | } 70 | 71 | 72 | dependencies { 73 | compile fileTree(include: ['*.jar'], dir: 'libs') 74 | compile project(':gearlibrary') 75 | compile 'com.android.support:support-v4:23.4.0' 76 | compile 'com.android.support:design:23.1.1' 77 | compile 'com.android.support:cardview-v7:23.4.0' 78 | 79 | compile 'com.github.bumptech.glide:glide:3.7.0' 80 | compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar' 81 | 82 | compile 'com.trello.rxlifecycle2:rxlifecycle:2.0.1' 83 | compile 'com.trello.rxlifecycle2:rxlifecycle-android:2.0.1' 84 | compile 'com.trello.rxlifecycle2:rxlifecycle-components:2.0.1' 85 | 86 | compile 'com.google.android.gms:play-services-appindexing:8.4.0' 87 | annotationProcessor 'com.google.guava:guava:19.0' 88 | compile 'com.google.dagger:dagger:2.9' 89 | annotationProcessor 'com.google.dagger:dagger-compiler:2.9' 90 | provided 'javax.annotation:jsr250-api:1.0' 91 | 92 | compile project(':gearapifinder-annotation') 93 | annotationProcessor project(':gearapifinder-compiler') 94 | 95 | testCompile 'junit:junit:4.12' 96 | } 97 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/proguard-rules.pro -------------------------------------------------------------------------------- /app/src/androidTest/java/gear/yc/com/gearapplication/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication; 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 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 36 | 37 | 40 | 41 | 44 | 45 | 48 | 49 | 52 | 53 | 54 | 57 | 58 | 61 | 62 | 65 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.base; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | import android.support.annotation.CallSuper; 6 | import android.support.annotation.CheckResult; 7 | import android.support.annotation.NonNull; 8 | import android.view.KeyEvent; 9 | 10 | import com.trello.rxlifecycle2.LifecycleTransformer; 11 | import com.trello.rxlifecycle2.RxLifecycle; 12 | import com.trello.rxlifecycle2.android.ActivityEvent; 13 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; 14 | 15 | import gear.yc.com.gearlibrary.GearActivity; 16 | import gear.yc.com.gearlibrary.rxjava.rxbus.RxBus; 17 | import io.reactivex.Observable; 18 | import io.reactivex.subjects.BehaviorSubject; 19 | 20 | /** 21 | * GearApplication 22 | * Created by YichenZ on 2016/3/23 11:26. 23 | */ 24 | public class BaseActivity extends GearActivity{ 25 | protected final BehaviorSubject lifecycleSubject = BehaviorSubject.create(); 26 | 27 | @NonNull 28 | @CheckResult 29 | public final Observable lifecycle() { 30 | return lifecycleSubject.hide(); 31 | } 32 | 33 | @NonNull 34 | @CheckResult 35 | public final LifecycleTransformer bindUntilEvent(@NonNull ActivityEvent event) { 36 | return RxLifecycle.bindUntilEvent(lifecycleSubject, event); 37 | } 38 | 39 | @NonNull 40 | @CheckResult 41 | public final LifecycleTransformer bindToLifecycle() { 42 | return RxLifecycleAndroid.bindActivity(lifecycleSubject); 43 | } 44 | 45 | @Override 46 | @CallSuper 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | RxBus.getInstance().init(this); 50 | lifecycleSubject.onNext(ActivityEvent.CREATE); 51 | } 52 | 53 | @Override 54 | @CallSuper 55 | protected void onStart() { 56 | super.onStart(); 57 | lifecycleSubject.onNext(ActivityEvent.START); 58 | } 59 | 60 | @Override 61 | @CallSuper 62 | protected void onResume() { 63 | super.onResume(); 64 | lifecycleSubject.onNext(ActivityEvent.RESUME); 65 | } 66 | 67 | @Override 68 | @CallSuper 69 | protected void onPause() { 70 | lifecycleSubject.onNext(ActivityEvent.PAUSE); 71 | super.onPause(); 72 | } 73 | 74 | @Override 75 | @CallSuper 76 | protected void onStop() { 77 | lifecycleSubject.onNext(ActivityEvent.STOP); 78 | super.onStop(); 79 | } 80 | 81 | @Override 82 | @CallSuper 83 | protected void onDestroy() { 84 | lifecycleSubject.onNext(ActivityEvent.DESTROY); 85 | RxBus.getInstance().unRegister(this); 86 | super.onDestroy(); 87 | } 88 | 89 | 90 | /** 91 | * 返回按钮finish activity 92 | * 93 | * @param keyCode 94 | * @param event 95 | * @return true or false 96 | */ 97 | @Override 98 | public boolean onKeyDown(int keyCode, KeyEvent event) { 99 | if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { 100 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 101 | finishAfterTransition(); 102 | }else{ 103 | finish(true); 104 | } 105 | return true; 106 | } 107 | return super.onKeyDown(keyCode, event); 108 | } 109 | 110 | public BehaviorSubject getLifecycleSubject() { 111 | return lifecycleSubject; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/base/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.base; 2 | 3 | import gear.yc.com.gearapplication.config.APIConfig; 4 | import gear.yc.com.gearapplication.manager.CommonManager; 5 | import gear.yc.com.gearapplication.network.HttpServiceManager; 6 | import gear.yc.com.gearlibrary.GearApplication; 7 | import gear.yc.com.gearlibrary.network.http.OkHttpManager; 8 | 9 | /** 10 | * GearApplication 11 | * Created by YichenZ on 2016/3/23 11:25. 12 | */ 13 | public class BaseApplication extends GearApplication{ 14 | @Override 15 | public void onCreate() { 16 | super.onCreate(); 17 | init(); 18 | } 19 | 20 | public void init(){ 21 | HttpServiceManager.getInstance() 22 | .setBaseUrl(APIConfig.BASE_URL) 23 | .build( 24 | OkHttpManager.getInstance() 25 | .setHeader("apikey","beae89ef686795322d5a3c48579875d5") 26 | .build() 27 | .getClient() 28 | ); 29 | CommonManager.getInstance(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.base; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/7/1 09:30. 6 | */ 7 | 8 | public interface BasePresenter{ 9 | 10 | void start(); 11 | 12 | void close(); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/base/BaseView.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.base; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/7/1 09:29. 6 | */ 7 | 8 | public interface BaseView { 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/ComponentManager.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component; 2 | 3 | import dagger.Component; 4 | import gear.yc.com.gearapplication.component.medules.ModulePojo; 5 | import gear.yc.com.gearapplication.ui.activity.WelcomeActivity; 6 | 7 | /** 8 | * GearApplication 9 | * 需要初始化的activity 并分配Module 10 | * Created by YichenZ on 2016/7/22 14:02. 11 | */ 12 | @Component(modules = {ModulePojo.class}) 13 | public interface ComponentManager { 14 | void inject(WelcomeActivity activity); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/ComponentPresenter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component; 2 | 3 | import dagger.Component; 4 | import gear.yc.com.gearapplication.component.medules.AdapterModel; 5 | import gear.yc.com.gearapplication.component.medules.ModulePresenter; 6 | import gear.yc.com.gearapplication.component.scope.ActivityScope; 7 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesActivity; 8 | 9 | /** 10 | * GearApplication 11 | * 需要初始化的activity并分配此activity需要的modules,modules类中标示为@Provides的方法可以共用 12 | * 例如 AdapterModel中需要TravelNotesActivity这个参数,而它就可以使用ModulePresenter中provideActivity 13 | * 方法获取相关依赖。 14 | * 都是由Dagger2通过反射自动判断。 15 | * Created by YichenZ on 2016/7/22 14:02. 16 | */ 17 | @ActivityScope 18 | @Component(modules = { ModulePresenter.class, AdapterModel.class}) 19 | public interface ComponentPresenter { 20 | void inject(TravelNotesActivity activity); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/medules/AdapterModel.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component.medules; 2 | 3 | import java.util.ArrayList; 4 | 5 | import dagger.Module; 6 | import dagger.Provides; 7 | import gear.yc.com.gearapplication.component.scope.ActivityScope; 8 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesActivity; 9 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesAdapter; 10 | 11 | /** 12 | * GearApplication 13 | * Dagger中相关Adapter所需要使用的model,初始化相关的adapter,可复用 14 | * @Module 意思为表明此类为Module类 15 | * @ActivityScope 标示此类的生命周期与activity相同 16 | * Created by YichenZ on 2016/7/29 17:35. 17 | */ 18 | @Module 19 | @ActivityScope 20 | public class AdapterModel { 21 | 22 | @Provides 23 | public TravelNotesAdapter provideAdapterData(TravelNotesActivity activity){ 24 | return new TravelNotesAdapter(activity,new ArrayList<>()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/medules/ModulePojo.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component.medules; 2 | 3 | import dagger.Module; 4 | import dagger.Provides; 5 | import gear.yc.com.gearapplication.pojo.Clock; 6 | 7 | /** 8 | * GearApplication 9 | * Created by YichenZ on 2016/7/22 14:31. 10 | */ 11 | @Module 12 | public class ModulePojo { 13 | 14 | @Provides 15 | public Clock provideClock(){ 16 | return new Clock(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/medules/ModulePresenter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component.medules; 2 | 3 | import dagger.Module; 4 | import dagger.Provides; 5 | import gear.yc.com.gearapplication.component.scope.ActivityScope; 6 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesActivity; 7 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesContract; 8 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesPresenter; 9 | 10 | /** 11 | * GearApplication 12 | * Presenter的Module类 13 | * 两个变量表示Presenter所需要的初始化的数据 14 | * @Provides 标识我们所提供的依赖 15 | * Created by YichenZ on 2016/7/22 14:58. 16 | */ 17 | @Module 18 | @ActivityScope 19 | public class ModulePresenter { 20 | TravelNotesContract.View view; 21 | TravelNotesActivity obj; 22 | 23 | public ModulePresenter(TravelNotesContract.View view,TravelNotesActivity obj){ 24 | this.view=view; 25 | this.obj=obj; 26 | } 27 | 28 | @Provides 29 | public TravelNotesPresenter provideTravelNotes(){ 30 | return new TravelNotesPresenter(view,obj); 31 | } 32 | 33 | @Provides 34 | public TravelNotesActivity provideActivity(){ 35 | return obj; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/component/scope/ActivityScope.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.component.scope; 2 | 3 | import java.lang.annotation.Retention; 4 | 5 | import javax.inject.Scope; 6 | 7 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 8 | 9 | /** 10 | * 标示Activity的生命周期 11 | */ 12 | @Scope 13 | @Retention(RUNTIME) 14 | public @interface ActivityScope { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/config/APIConfig.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.config; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/4/13 17:03. 6 | */ 7 | public class APIConfig { 8 | public final static String BASE_URL="http://120.27.118.74/"; 9 | public final static String BASE_URL_TRAVEL_NOTES="http://apis.baidu.com/qunartravel/travellist/"; 10 | 11 | public final static String BASE_URL_BREADTRIP="http://api.breadtrip.com/v2/search/"; 12 | public final static String BASE_URL_BREADTRIP_DETIAL="http://web.breadtrip.com/trips/"; 13 | 14 | public final static String BASE_URL_QYER_GUIDE_TOKEN="http://guide.open.qyer.com/device/register"; 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/activity/DataBindingActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.activity; 2 | 3 | import android.databinding.DataBindingUtil; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import android.os.Message; 7 | import android.support.annotation.Nullable; 8 | 9 | import gear.yc.com.gearapplication.R; 10 | import gear.yc.com.gearapplication.base.BaseActivity; 11 | import gear.yc.com.gearapplication.databinding.ActivityDatabindingBinding; 12 | import gear.yc.com.gearapplication.network.APIServiceManager; 13 | import gear.yc.com.gearapplication.pojo.ResponseJson; 14 | import gear.yc.com.gearapplication.pojo.User; 15 | import gear.yc.com.gearlibrary.rxjava.helper.RxSchedulersHelper; 16 | 17 | /** 18 | * GearApplication 19 | * Created by YichenZ on 2016/3/23 15:25. 20 | */ 21 | public class DataBindingActivity extends BaseActivity { 22 | User user; 23 | ActivityDatabindingBinding binding; 24 | 25 | @Override 26 | protected void onCreate(@Nullable Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | initUI(); 29 | initData(); 30 | new Thread(runnable).start(); 31 | 32 | } 33 | 34 | @Override 35 | public void initUI() { 36 | super.initUI(); 37 | binding = DataBindingUtil.setContentView(this, R.layout.activity_databinding); 38 | } 39 | 40 | @Override 41 | public void initData() { 42 | super.initData(); 43 | user = new User(); 44 | user.setUid("2213"); 45 | user.setUsername("Joker"); 46 | user.setPassword("120.00"); 47 | binding.setUser(user); 48 | APIServiceManager 49 | .getApiService() 50 | .getUser() 51 | .compose(RxSchedulersHelper.io_main()) 52 | .subscribe(userResponseJson -> { 53 | Message msg = new Message(); 54 | msg.obj = userResponseJson; 55 | msg.what = 1; 56 | handler.sendMessage(msg); 57 | }); 58 | 59 | APIServiceManager 60 | .getTravelNotesAPI() 61 | .getTravelNotesList("", "1") 62 | .compose(RxSchedulersHelper.io_main()) 63 | .subscribe(tnbs -> { 64 | Message msg = new Message(); 65 | msg.obj = tnbs; 66 | msg.what = 2; 67 | handler.sendMessage(msg); 68 | }); 69 | } 70 | 71 | Runnable runnable = new Runnable() { 72 | @Override 73 | public void run() { 74 | try { 75 | Thread.sleep(3000); 76 | user.setPassword("321.10"); 77 | handler.sendEmptyMessage(0); 78 | } catch (InterruptedException e) { 79 | e.printStackTrace(); 80 | } 81 | } 82 | }; 83 | 84 | Handler handler = new Handler() { 85 | @Override 86 | public void handleMessage(Message msg) { 87 | super.handleMessage(msg); 88 | if (msg.obj != null) { 89 | if (msg.what == 1) { 90 | user = ((ResponseJson) msg.obj).getData(); 91 | if (user != null) { 92 | binding.setUser(user); 93 | } else { 94 | 95 | } 96 | } 97 | } else { 98 | 99 | } 100 | } 101 | }; 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/activity/FunctionListActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.view.View; 6 | import android.widget.Button; 7 | 8 | import gear.yc.com.gearapplication.base.BaseActivity; 9 | import gear.yc.com.gearapplication.R; 10 | 11 | /** 12 | * GearApplication 13 | * Created by YichenZ on 2016/3/23 11:14. 14 | */ 15 | public class FunctionListActivity extends BaseActivity { 16 | Button mainActivity; 17 | Button mainDataBinding; 18 | Button btn_RxJava; 19 | Button btn_WebView; 20 | Button btn_recycler; 21 | 22 | @Override 23 | protected void onCreate(@Nullable Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | initUI(); 26 | initData(); 27 | } 28 | 29 | @Override 30 | public void initUI() { 31 | super.initUI(); 32 | setContentView(R.layout.function_list_activity); 33 | 34 | mainActivity=(Button)findViewById(R.id.btn_main_activity); 35 | mainDataBinding=(Button)findViewById(R.id.btn_data_binding); 36 | btn_RxJava=(Button)findViewById(R.id.btn_RxJava); 37 | btn_WebView=(Button)findViewById(R.id.btn_WebView); 38 | btn_recycler=(Button)findViewById(R.id.btn_recycler); 39 | 40 | mainActivity.setOnClickListener(this); 41 | mainDataBinding.setOnClickListener(this); 42 | btn_RxJava.setOnClickListener(this); 43 | btn_WebView.setOnClickListener(this); 44 | btn_recycler.setOnClickListener(this); 45 | } 46 | 47 | @Override 48 | public void onClick(View v) { 49 | super.onClick(v); 50 | switch (v.getId()) { 51 | case R.id.btn_data_binding: 52 | strActivity(this,DataBindingActivity.class); 53 | break; 54 | case R.id.btn_main_activity: 55 | strActivity(this,MainActivity.class); 56 | break; 57 | case R.id.btn_RxJava: 58 | strActivity(this,RxJavaActivity.class); 59 | break; 60 | case R.id.btn_WebView: 61 | strActivity(this,WebViewActivity.class); 62 | break; 63 | case R.id.btn_recycler: 64 | strActivity(this,RecyclerViewActivity.class); 65 | break; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.os.Handler; 5 | import android.os.Message; 6 | import android.support.design.widget.Snackbar; 7 | import android.widget.TextView; 8 | 9 | import gear.yc.com.gearapplication.base.BaseActivity; 10 | import gear.yc.com.gearapplication.R; 11 | import gear.yc.com.gearlibrary.network.http.HttpInfo; 12 | 13 | public class MainActivity extends BaseActivity { 14 | TextView hello_tv; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | hello_tv = (TextView) findViewById(R.id.hello_tv); 21 | hello_tv.setOnClickListener(v -> Snackbar.make(v, "Replace with your own action", Snackbar.LENGTH_LONG) 22 | .setAction("Action", v1 -> hello_tv.setText("On Click Hello")).show()); 23 | testOkHttp(); 24 | 25 | } 26 | 27 | /** 28 | * git 29 | */ 30 | public void testOkHttp(){ 31 | try { 32 | HttpInfo.getInstance().getHttpOfGet("http://www.baidu.com",mHandler); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | // ExecutorService mExecutorS=Executors.newFixedThreadPool(3); 37 | // mExecutorS.execute(new Runnable() { 38 | // @Override 39 | // public void run() { 40 | // try { 41 | // String str = OkHttpManager.getInstance().getHttpOfGet("http://www.baidu.com").body().string(); 42 | // Message message =new Message(); 43 | // message.obj=str; 44 | // mHandler.sendMessage(message); 45 | // } catch (Exception e) { 46 | // e.printStackTrace(); 47 | // } 48 | // 49 | // } 50 | // }); 51 | // OkHttpClient okHttpClient =new OkHttpClient(); 52 | // 53 | // FormBody formBodys=new FormBody.Builder() 54 | // .add("city","248").build(); 55 | // 56 | // final Request request =new Request.Builder() 57 | // .post(RequestBody.create(MediaType.parse("application/json"),"{\"module_id\":\"101\"}")) 58 | // .url("http://test.awu.cn/api/index.php?act=main").build(); 59 | // 60 | // final Call call=okHttpClient.newCall(request); 61 | // 62 | 63 | 64 | 65 | // call.enqueue(new Callback() { 66 | // @Override 67 | // public void onFailure(Call call, IOException e) { 68 | // e.printStackTrace(); 69 | // } 70 | // 71 | // @Override 72 | // public void onResponse(Call call, Response response) throws IOException { 73 | // final Message message = new Message(); 74 | // message.what = 1; 75 | // message.obj = response.body().string(); 76 | // runOnUiThread(new Runnable() { 77 | // @Override 78 | // public void run() { 79 | // mHandler.sendMessage(message); 80 | // } 81 | // }); 82 | // 83 | // } 84 | // }); 85 | 86 | } 87 | 88 | Handler mHandler =new Handler(new Handler.Callback() { 89 | @Override 90 | public boolean handleMessage(Message msg) { 91 | hello_tv.setText((String)msg.obj); 92 | return true; 93 | } 94 | }); 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/activity/RecyclerViewActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.widget.LinearLayoutManager; 6 | import android.support.v7.widget.RecyclerView; 7 | 8 | import java.util.ArrayList; 9 | 10 | import gear.yc.com.gearapplication.base.BaseActivity; 11 | import gear.yc.com.gearapplication.R; 12 | import gear.yc.com.gearapplication.ui.adapter.RecyclerListDemoAdapter; 13 | import gear.yc.com.gearapplication.pojo.User; 14 | import gear.yc.com.gearlibrary.ui.custom.GearRecyclerItemDecoration; 15 | 16 | /** 17 | * GearApplication 18 | * Created by YichenZ on 2016/3/30 14:10. 19 | */ 20 | public class RecyclerViewActivity extends BaseActivity{ 21 | private RecyclerView recyclerView; 22 | private ArrayList users; 23 | private RecyclerListDemoAdapter rListDemoAdapter; 24 | 25 | @Override 26 | protected void onCreate(@Nullable Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | initUI(); 29 | initData(); 30 | } 31 | 32 | @Override 33 | public void initUI() { 34 | super.initUI(); 35 | setContentView(R.layout.activity_recycler_view); 36 | recyclerView=(RecyclerView)findViewById(R.id.rv_data_list); 37 | } 38 | 39 | @Override 40 | public void initData() { 41 | super.initData(); 42 | users=new ArrayList(); 43 | for (int i='A';i<'z';i++){ 44 | User user=new User(); 45 | user.setUsername("joker:"+(char)i); 46 | user.setHeadPortrait("http://img1.3lian.com/2015/w7/98/d/22.jpg"); 47 | user.setUid("89723"); 48 | users.add(user); 49 | } 50 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 51 | recyclerView.addItemDecoration(new GearRecyclerItemDecoration(this,LinearLayoutManager.VERTICAL)); 52 | rListDemoAdapter=new RecyclerListDemoAdapter(this,users); 53 | recyclerView.setAdapter(rListDemoAdapter); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/activity/RxJavaActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | 6 | import org.reactivestreams.Subscriber; 7 | import org.reactivestreams.Subscription; 8 | 9 | import gear.yc.com.gearapplication.base.BaseActivity; 10 | import io.reactivex.Observable; 11 | 12 | /** 13 | * GearApplication 14 | * Created by YichenZ on 2016/3/25 16:40. 15 | */ 16 | public class RxJavaActivity extends BaseActivity{ 17 | @Override 18 | protected void onCreate(@Nullable Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | // 1. 21 | // mObservable.subscribe(mSubscriber); 22 | // 2. 23 | // Observable.just("Hello world").subscribe(new Action1() { 24 | // @Override 25 | // public void call(String s) { 26 | // System.out.println(s); 27 | // } 28 | // }); 29 | //3. 30 | // Observable.just("Hello world").subscribe(s -> System.out.println(s)); 31 | 32 | //3. map 33 | // Observable.just("Hello world") 34 | // .map(s -> s+"Joker") 35 | // .map(s -> s.hashCode()) 36 | // .map(i -> Integer.toString(i)) 37 | // .subscribe(s -> System.out.println(s)); 38 | 39 | //4 40 | // List urls =new ArrayList(); 41 | // urls.add("a"); 42 | // urls.add("b"); 43 | // Observable.just(urls) 44 | // .flatMap( u -> Observable.from(u)) 45 | // .subscribe(url -> System.out.println(url)); 46 | //5 Demo 47 | Observable.just("#Basic Markdown to HTML with lambda") 48 | .filter(s -> s!=null && s.startsWith("#")) 49 | .map(s -> "

"+s.substring(1,s.length())+"

") 50 | .subscribe(System.out::println); 51 | 52 | 53 | } 54 | //4 55 | // Observable> query(String text){ 56 | // return Observable.create(Observable>); 57 | // } 58 | 59 | // //1. 60 | // Flowable mObservable = Flowable.create(new FlowableOnSubscribe() { 61 | // @Override 62 | // public void subscribe(FlowableEmitter e) throws Exception { 63 | // e.onNext("Hello world"); 64 | // e.onComplete(); 65 | // } 66 | // }); 67 | 68 | //1. 69 | Subscriber mSubscriber =new Subscriber() { 70 | @Override 71 | public void onError(Throwable e) { 72 | 73 | } 74 | 75 | @Override 76 | public void onComplete() { 77 | 78 | } 79 | 80 | @Override 81 | public void onSubscribe(Subscription s) { 82 | 83 | } 84 | 85 | @Override 86 | public void onNext(String s) { 87 | System.out.println(s); 88 | } 89 | }; 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/network/Request.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.network; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/8/12 14:47. 6 | */ 7 | 8 | public final class Request { 9 | private final String url; 10 | private final String method; 11 | 12 | public Request(Builder builder){ 13 | this.url=builder.url; 14 | this.method=builder.method; 15 | } 16 | 17 | public String getUrl() { 18 | return url; 19 | } 20 | 21 | public String getMethod() { 22 | return method; 23 | } 24 | 25 | public static class Builder{ 26 | private String url; 27 | private String method; 28 | 29 | public Builder(){ 30 | this.method="GET"; 31 | } 32 | 33 | public Builder url(String url){ 34 | this.url=url; 35 | return this; 36 | } 37 | 38 | public Builder method(String method){ 39 | this.method=method; 40 | return this; 41 | } 42 | 43 | public Request build(){ 44 | return new Request(this); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/demo/network/RouterDemo.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.demo.network; 2 | 3 | import com.trello.rxlifecycle2.LifecycleTransformer; 4 | import com.trello.rxlifecycle2.RxLifecycle; 5 | import com.trello.rxlifecycle2.android.ActivityEvent; 6 | 7 | import gear.yc.com.gearapplication.network.APIServiceManager; 8 | import gear.yc.com.gearapplication.network.helper.SchedulersHelper; 9 | import gear.yc.com.gearapplication.pojo.TravelNoteBook; 10 | import io.reactivex.Flowable; 11 | import io.reactivex.android.schedulers.AndroidSchedulers; 12 | import io.reactivex.schedulers.Schedulers; 13 | import io.reactivex.subjects.BehaviorSubject; 14 | 15 | /** 16 | * GearApplication 17 | * Created by YichenZ on 2017/3/30 13:45. 18 | */ 19 | 20 | public class RouterDemo { 21 | 22 | public static final Flowable getRouter(BehaviorSubjectlifecycleSubject, String query, String page){ 23 | return APIServiceManager 24 | .getTravelNotesAPI() 25 | .getTravelNotesList(query, page) 26 | .compose(bindUntilEvent(lifecycleSubject)) 27 | .subscribeOn(Schedulers.io()) 28 | .observeOn(AndroidSchedulers.mainThread()) 29 | .compose(SchedulersHelper.handleResult()); 30 | } 31 | 32 | public static final LifecycleTransformer bindUntilEvent(BehaviorSubject lifecycleSubject) { 33 | return RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/manager/APIDataSourceManager.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.manager; 2 | 3 | import gear.yc.com.gearapplication.pojo.APIDataSource; 4 | 5 | /** 6 | * GearApplication 7 | * Created by YichenZ on 2016/7/13 10:53. 8 | */ 9 | 10 | public class APIDataSourceManager { 11 | public static APIDataSource mDataSource = APIDataSource.DEFAULT; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/manager/CommonManager.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.manager; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.content.pm.PackageInfo; 6 | import android.content.pm.PackageManager; 7 | import android.support.annotation.NonNull; 8 | import android.util.DisplayMetrics; 9 | import android.view.WindowManager; 10 | 11 | /** 12 | * GearApplication 13 | * Created by YichenZ on 2016/6/27 14:42. 14 | */ 15 | 16 | public class CommonManager { 17 | private static CommonManager instance; 18 | 19 | public static CommonManager getInstance(@NonNull Application application) { 20 | if (instance == null) { 21 | synchronized (CommonManager.class) { 22 | if (instance == null) { 23 | instance = new CommonManager(application); 24 | } 25 | } 26 | } 27 | return instance; 28 | } 29 | 30 | public static CommonManager getInstance() { 31 | return instance; 32 | } 33 | 34 | private Application mApplication; 35 | //程序信息 36 | private PackageInfo packageInfo; 37 | 38 | //系统版本号以及版本名称 39 | private short currVerCode = 0; 40 | private String currVerName; 41 | 42 | private int mobileWidth = 0; 43 | private int mobileHeight = 0; 44 | 45 | public CommonManager(Application application) { 46 | mApplication = application; 47 | init(); 48 | } 49 | 50 | private void init() { 51 | if (currVerCode == 0 && currVerName == null) { 52 | try { 53 | packageInfo = mApplication.getPackageManager().getPackageInfo(mApplication.getPackageName(), 0); 54 | } catch (PackageManager.NameNotFoundException e) { 55 | e.printStackTrace(); 56 | } 57 | currVerCode = (short) packageInfo.versionCode; 58 | currVerName = packageInfo.packageName; 59 | } 60 | } 61 | 62 | public short getCurrVerCode() { 63 | return currVerCode; 64 | } 65 | 66 | public String getCurrVerName() { 67 | return currVerName; 68 | } 69 | 70 | public int getMobileWidth(Context context) { 71 | if (mobileWidth == 0) { 72 | getMobileWindow(context); 73 | } 74 | return mobileWidth; 75 | } 76 | 77 | public int getMobileHeight(Context context) { 78 | if (mobileHeight == 0) { 79 | getMobileWindow(context); 80 | } 81 | return mobileHeight; 82 | } 83 | 84 | private void getMobileWindow(Context context) { 85 | DisplayMetrics dm = new DisplayMetrics(); 86 | ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(dm); 87 | mobileWidth = new Integer(dm.widthPixels); 88 | mobileHeight = new Integer(dm.heightPixels); 89 | dm=null; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/HttpServiceManager.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network; 2 | 3 | import com.gear.apifinder.annotation.APIManager; 4 | import com.gear.apifinder.annotation.APIRouter; 5 | 6 | import gear.yc.com.gearlibrary.network.api.GearHttpServiceManager; 7 | 8 | /** 9 | * GearApplication 10 | * Created by YichenZ on 2017/1/18 17:01. 11 | */ 12 | @APIManager 13 | @APIRouter(value = "DEMO") 14 | public class HttpServiceManager extends GearHttpServiceManager { 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/helper/SchedulersHelper.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.helper; 2 | 3 | import org.reactivestreams.Publisher; 4 | 5 | import gear.yc.com.gearapplication.pojo.ResponseJson; 6 | import io.reactivex.BackpressureStrategy; 7 | import io.reactivex.Flowable; 8 | import io.reactivex.FlowableTransformer; 9 | import io.reactivex.functions.Function; 10 | 11 | /** 12 | * Created by Android on 2016/6/16. 13 | */ 14 | public class SchedulersHelper { 15 | static String str="暂无数据"; 16 | 17 | public static FlowableTransformer, T> handleResult() { 18 | return responseJsonObservable -> responseJsonObservable.flatMap( 19 | tResponseJson -> { 20 | if (tResponseJson == null) { 21 | } else if(tResponseJson.getErrcode() != 0){ 22 | str=tResponseJson.getErrmsg(); 23 | }else { 24 | return createData(tResponseJson.getData()); 25 | } 26 | return Flowable.error(new Throwable(str)); 27 | }); 28 | } 29 | 30 | /** 31 | * 检测面包旅行 32 | * @param 33 | * @return 34 | */ 35 | public static FlowableTransformer, T> handleResultBread() { 36 | return resJsonObs -> resJsonObs.flatMap(new Function, Publisher>() { 37 | @Override 38 | public Publisher apply(ResponseJson tResponseJson) throws Exception { 39 | if (tResponseJson == null) { 40 | } else if(tResponseJson.getStatus() != 0){ 41 | str=tResponseJson.getMessage(); 42 | }else { 43 | return createData(tResponseJson.getData()); 44 | } 45 | return Flowable.error(new Throwable(str)); 46 | } 47 | }); 48 | } 49 | 50 | private static Flowable createData(T data) { 51 | return Flowable.create(subscriber -> { 52 | subscriber.onNext(data); 53 | subscriber.onComplete(); 54 | }, BackpressureStrategy.BUFFER); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/service/APIService.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.service; 2 | 3 | import gear.yc.com.gearapplication.pojo.ResponseJson; 4 | import gear.yc.com.gearapplication.pojo.User; 5 | import io.reactivex.Flowable; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.POST; 8 | import retrofit2.http.Path; 9 | 10 | /** 11 | * GearApplication 12 | * Created by YichenZ on 2016/4/13 14:37. 13 | */ 14 | @com.gear.apifinder.annotation.APIService 15 | public interface ApiService { 16 | @GET("src/app/{path}") 17 | Flowable> getUser(@Path("path") String path); 18 | 19 | // @POST("src/app/demo.php") 20 | // Call> getUser(); 21 | 22 | @POST("src/app/demo.php") 23 | Flowable> getUser(); 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/service/ApiService.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.service; 2 | 3 | import gear.yc.com.gearapplication.pojo.ResponseJson; 4 | import gear.yc.com.gearapplication.pojo.User; 5 | import io.reactivex.Flowable; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.POST; 8 | import retrofit2.http.Path; 9 | 10 | /** 11 | * GearApplication 12 | * Created by YichenZ on 2016/4/13 14:37. 13 | */ 14 | @com.gear.apifinder.annotation.APIService 15 | public interface ApiService { 16 | @GET("src/app/{path}") 17 | Flowable> getUser(@Path("path") String path); 18 | 19 | // @POST("src/app/demo.php") 20 | // Call> getUser(); 21 | 22 | @POST("src/app/demo.php") 23 | Flowable> getUser(); 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/service/BreadtripAPI.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.service; 2 | 3 | import com.gear.apifinder.annotation.APIService; 4 | 5 | import gear.yc.com.gearapplication.config.APIConfig; 6 | import gear.yc.com.gearapplication.pojo.ResponseJson; 7 | import gear.yc.com.gearapplication.pojo.TravelNoteBook; 8 | import io.reactivex.Flowable; 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Query; 11 | 12 | /** 13 | * GearApplication 14 | * Created by YichenZ on 2016/4/20 17:24. 15 | */ 16 | @APIService 17 | public interface BreadtripAPI { 18 | @GET(APIConfig.BASE_URL_BREADTRIP+"?") 19 | Flowable> getTravelNotesList(@Query("key") String key, @Query("start") String start, 20 | @Query("count") String count, @Query("data_type") String data_type); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/service/QyerGuideAPI.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.service; 2 | 3 | import com.gear.apifinder.annotation.APIService; 4 | 5 | import gear.yc.com.gearapplication.config.APIConfig; 6 | import gear.yc.com.gearapplication.pojo.ResponseJson; 7 | import gear.yc.com.gearapplication.pojo.TravelNoteBook; 8 | import io.reactivex.Flowable; 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Query; 11 | 12 | /** 13 | * GearApplication 14 | * Created by YichenZ on 2016/4/20 17:24. 15 | */ 16 | @APIService 17 | public interface QyerGuideAPI { 18 | @GET(APIConfig.BASE_URL_TRAVEL_NOTES+"travellist?") 19 | Flowable> getTravelNotesList(@Query("query") String query, @Query("page") String page); 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/network/service/TravelNotesAPI.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.network.service; 2 | 3 | import gear.yc.com.gearapplication.config.APIConfig; 4 | import gear.yc.com.gearapplication.pojo.ResponseJson; 5 | import gear.yc.com.gearapplication.pojo.TravelNoteBook; 6 | import io.reactivex.Flowable; 7 | import retrofit2.http.GET; 8 | import retrofit2.http.Query; 9 | 10 | /** 11 | * GearApplication 12 | * Created by YichenZ on 2016/4/20 17:24. 13 | */ 14 | @com.gear.apifinder.annotation.APIService 15 | public interface TravelNotesAPI { 16 | @GET(APIConfig.BASE_URL_TRAVEL_NOTES+"travellist?") 17 | Flowable> getTravelNotesList(@Query("query") String query, @Query("page") String page); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/APIDataSource.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/7/13 10:45. 6 | */ 7 | 8 | public enum APIDataSource { 9 | DEFAULT("默认"), 10 | BREAD("面包"); 11 | 12 | String value; 13 | 14 | APIDataSource(String value){ 15 | this.value=value; 16 | } 17 | 18 | public String value(){ 19 | return value; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/Clock.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * GearApplication 8 | * Created by YichenZ on 2016/4/19 16:20. 9 | */ 10 | public class Clock { 11 | private String year; 12 | private String time; 13 | 14 | public String getYear() { 15 | return year; 16 | } 17 | 18 | public void setYear(String year) { 19 | this.year = year; 20 | } 21 | 22 | public String getTime() { 23 | return time; 24 | } 25 | 26 | public void setTime(String time) { 27 | this.time = time; 28 | } 29 | 30 | /** 31 | * 设置时间 32 | * @return clock 33 | */ 34 | public Clock setTime(){ 35 | SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd"); 36 | year=simpleDateFormat.format(new Date()); 37 | simpleDateFormat=new SimpleDateFormat("HH:mm:ss"); 38 | time=simpleDateFormat.format(new Date()); 39 | simpleDateFormat=null; 40 | return this; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/ResponseJson.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * GearApplication 9 | * Created by YichenZ on 2016/4/13 15:04. 10 | */ 11 | public class ResponseJson implements Serializable { 12 | 13 | private static final long serialVersionUID = -2230862622774206736L; 14 | @SerializedName("data") 15 | private T data; 16 | 17 | public T getData() { 18 | return data; 19 | } 20 | 21 | public void setData(T data) { 22 | this.data = data; 23 | } 24 | 25 | private String ret; 26 | private int errcode; 27 | private String errmsg; 28 | private String errMsg; 29 | private String ver; 30 | private int errNum; 31 | //bread 32 | private int status; 33 | private String message; 34 | 35 | public void setMessage(String message) { 36 | this.message = message; 37 | } 38 | 39 | public void setStatus(int status) { 40 | this.status = status; 41 | } 42 | 43 | public int getStatus() { 44 | return status; 45 | } 46 | 47 | public String getMessage() { 48 | return message; 49 | } 50 | 51 | public void setErrMsg(String errMsg) { 52 | this.errMsg = errMsg; 53 | } 54 | 55 | public void setErrNum(int errNum) { 56 | this.errNum = errNum; 57 | } 58 | 59 | public String getRet() { 60 | return ret; 61 | } 62 | 63 | public void setRet(String ret) { 64 | this.ret = ret; 65 | } 66 | 67 | public int getErrcode() { 68 | return errNum==0 ? errcode:errNum; 69 | } 70 | 71 | public void setErrcode(int errcode) { 72 | this.errcode = errcode; 73 | } 74 | 75 | public String getErrmsg() { 76 | return errmsg==null ? errMsg:errmsg; 77 | } 78 | 79 | public void setErrmsg(String errmsg) { 80 | this.errmsg = errmsg; 81 | } 82 | 83 | public String getVer() { 84 | return ver; 85 | } 86 | 87 | public void setVer(String ver) { 88 | this.ver = ver; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/TravelNoteBook.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | 7 | import gear.yc.com.gearapplication.config.APIConfig; 8 | 9 | /** 10 | * GearApplication 11 | * Created by YichenZ on 2016/4/20 17:21. 12 | */ 13 | public class TravelNoteBook { 14 | 15 | @SerializedName("books") 16 | ArrayList mBookses; 17 | 18 | public ArrayList getBookses() { 19 | if(mBookses==null){ 20 | return mTrips; 21 | } 22 | return mBookses; 23 | } 24 | 25 | public void setBookses(ArrayList bookses) { 26 | mBookses = bookses; 27 | } 28 | 29 | @SerializedName("trips") 30 | ArrayList mTrips; 31 | 32 | public void setmTrips(ArrayList mTrips) { 33 | this.mTrips = mTrips; 34 | } 35 | 36 | public class Books { 37 | 38 | @SerializedName("title") 39 | String title; 40 | @SerializedName("bookUrl") 41 | String html; 42 | @SerializedName("headImage") 43 | String imgUrl; 44 | 45 | //面包接口 46 | @SerializedName("id") 47 | String id; 48 | @SerializedName("cover_image_default") 49 | String coverImageDefault; 50 | @SerializedName("name") 51 | String name; 52 | 53 | public String getId() { 54 | return id; 55 | } 56 | 57 | public void setId(String id) { 58 | this.id = id; 59 | } 60 | 61 | public void setCoverImageDefault(String coverImageDefault) { 62 | this.coverImageDefault = coverImageDefault; 63 | } 64 | 65 | public void setName(String name) { 66 | this.name = name; 67 | } 68 | 69 | public String getTitle() { 70 | if(title==null || "".equals(title)){ 71 | return name; 72 | } 73 | return title; 74 | } 75 | 76 | public void setTitle(String title) { 77 | this.title = title; 78 | } 79 | 80 | public String getHtml() { 81 | if(html==null || "".equals(html)){ 82 | return APIConfig.BASE_URL_BREADTRIP_DETIAL+id; 83 | } 84 | return html; 85 | } 86 | 87 | public void setHtml(String html) { 88 | this.html = html; 89 | } 90 | 91 | public String getImgUrl() { 92 | if(imgUrl==null || "".equals(imgUrl)){ 93 | return coverImageDefault; 94 | } 95 | return imgUrl; 96 | } 97 | 98 | public void setImgUrl(String imgUrl) { 99 | this.imgUrl = imgUrl; 100 | } 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/TravelNotesList.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import gear.yc.com.gearapplication.config.APIConfig; 6 | 7 | /** 8 | * GearApplication 9 | * Created by YichenZ on 2016/7/12 16:40. 10 | */ 11 | 12 | public class TravelNotesList { 13 | 14 | @SerializedName("title") 15 | String title; 16 | @SerializedName("bookUrl") 17 | String html; 18 | @SerializedName("headImage") 19 | String imgUrl; 20 | 21 | //面包接口 22 | @SerializedName("id") 23 | String id; 24 | @SerializedName("cover_image_default") 25 | String coverImageDefault; 26 | @SerializedName("name") 27 | String name; 28 | 29 | public String getId() { 30 | return id; 31 | } 32 | 33 | public void setId(String id) { 34 | this.id = id; 35 | } 36 | 37 | public void setCoverImageDefault(String coverImageDefault) { 38 | this.coverImageDefault = coverImageDefault; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getTitle() { 46 | if(title==null || "".equals(title)){ 47 | return name; 48 | } 49 | return title; 50 | } 51 | 52 | public void setTitle(String title) { 53 | this.title = title; 54 | } 55 | 56 | public String getHtml() { 57 | if(html==null || "".equals(html)){ 58 | return APIConfig.BASE_URL_BREADTRIP_DETIAL+id; 59 | } 60 | return html; 61 | } 62 | 63 | public void setHtml(String html) { 64 | this.html = html; 65 | } 66 | 67 | public String getImgUrl() { 68 | if(imgUrl==null || "".equals(imgUrl)){ 69 | return coverImageDefault; 70 | } 71 | return imgUrl; 72 | } 73 | 74 | public void setImgUrl(String imgUrl) { 75 | this.imgUrl = imgUrl; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/pojo/User.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.pojo; 2 | 3 | import android.text.SpannableString; 4 | import android.text.Spanned; 5 | import android.text.style.AbsoluteSizeSpan; 6 | 7 | /** 8 | * GearApplication 9 | * Created by YichenZ on 2016/3/23 15:16. 10 | */ 11 | public class User{ 12 | private String uid; 13 | private String username; 14 | private String password; 15 | private String headPortrait; 16 | 17 | public String getUid() { 18 | return uid; 19 | } 20 | 21 | public void setUid(String uid) { 22 | this.uid = uid; 23 | } 24 | 25 | public String getUsername() { 26 | return username; 27 | } 28 | 29 | public void setUsername(String username) { 30 | this.username = username; 31 | } 32 | 33 | public String getPassword() { 34 | return password; 35 | } 36 | 37 | public void setPassword(String password) { 38 | this.password = password; 39 | } 40 | 41 | public String getHeadPortrait() { 42 | return headPortrait; 43 | } 44 | 45 | public void setHeadPortrait(String headPortrait) { 46 | this.headPortrait = headPortrait; 47 | } 48 | 49 | // 设置字的大小 50 | public SpannableString setTextSize(String pic) { 51 | int i = pic.indexOf("."); 52 | SpannableString msp = new SpannableString(pic); 53 | if (i > 0) { 54 | msp.setSpan(new AbsoluteSizeSpan(15, true), i, pic.length(), 55 | Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 56 | } 57 | return msp; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/activity/SearchBooksActivity.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.view.View; 6 | import android.view.inputmethod.EditorInfo; 7 | import android.widget.EditText; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import gear.yc.com.gearapplication.R; 12 | import gear.yc.com.gearapplication.base.BaseActivity; 13 | import gear.yc.com.gearapplication.ui.mvp.travelnotes.TravelNotesActivity; 14 | import gear.yc.com.gearlibrary.rxjava.rxbus.RxBus; 15 | import gear.yc.com.gearlibrary.utils.ToastUtil; 16 | 17 | /** 18 | * GearApplication 19 | * Created by YichenZ on 2016/4/21 16:51. 20 | */ 21 | public class SearchBooksActivity extends BaseActivity { 22 | ImageView mBack; 23 | TextView mTitle; 24 | EditText mSearchBooks; 25 | 26 | String query = ""; 27 | 28 | boolean isNote =true; 29 | 30 | @Override 31 | protected void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | query = getStrIntent(); 34 | initUI(); 35 | } 36 | 37 | @Override 38 | protected void onStop() { 39 | super.onStop(); 40 | } 41 | 42 | @Override 43 | public void initUI() { 44 | super.initUI(); 45 | setContentView(R.layout.activity_search_books); 46 | mBack = (ImageView) findViewById(R.id.iv_back); 47 | mBack.setOnClickListener(this); 48 | mTitle = (TextView) findViewById(R.id.tv_title); 49 | mTitle.setVisibility(View.VISIBLE); 50 | mTitle.setText("换源"); 51 | mTitle.setOnClickListener(this); 52 | mSearchBooks = (EditText) findViewById(R.id.et_search_books); 53 | mSearchBooks.setOnEditorActionListener((v, i, e) -> { 54 | if (i == EditorInfo.IME_ACTION_SEARCH) { 55 | strActivity(this, TravelNotesActivity.class, true, true, mSearchBooks.getText().toString()); 56 | return true; 57 | } 58 | return false; 59 | }); 60 | mSearchBooks.setText(query); 61 | } 62 | 63 | @Override 64 | public void onClick(View v) { 65 | super.onClick(v); 66 | switch (v.getId()) { 67 | case R.id.iv_back: 68 | finish(true); 69 | break; 70 | case R.id.tv_title: 71 | //这里要切换api地址 72 | isNote=!isNote; 73 | if(isNote){ 74 | ToastUtil.getInstance().makeShortToast(this,"默认"); 75 | }else{ 76 | ToastUtil.getInstance().makeShortToast(this,"面包"); 77 | } 78 | RxBus.getInstance().post(100,isNote); 79 | break; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/adapter/RecyclerListDemoAdapter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.bumptech.glide.Glide; 12 | 13 | import java.util.ArrayList; 14 | 15 | import gear.yc.com.gearapplication.R; 16 | import gear.yc.com.gearapplication.pojo.User; 17 | import gear.yc.com.gearlibrary.ui.adapter.GearRecyclerViewAdapter; 18 | 19 | /** 20 | * GearApplication 21 | * Created by YichenZ on 2016/3/30 16:24. 22 | */ 23 | public class RecyclerListDemoAdapter extends GearRecyclerViewAdapter { 24 | 25 | public RecyclerListDemoAdapter(Context context, ArrayList dates){ 26 | super(context,dates); 27 | } 28 | 29 | @Override 30 | public DemoHolder onCreateViewHolder(ViewGroup parent, int viewType) { 31 | DemoHolder demoHolder=new DemoHolder(LayoutInflater.from(mContext) 32 | .inflate(R.layout.item_recycler_view,parent,false)); 33 | return demoHolder; 34 | } 35 | 36 | @Override 37 | public void onBindViewHolder(DemoHolder holder, int position) { 38 | User data =mData.get(position); 39 | holder.name.setText(data.getUsername()); 40 | holder.content.setText(data.getUid()); 41 | Glide.with(mContext).load(data.getHeadPortrait()).into(holder.bgImage); 42 | } 43 | 44 | class DemoHolder extends RecyclerView.ViewHolder{ 45 | 46 | ImageView headPortrait; 47 | ImageView bgImage; 48 | TextView name; 49 | TextView content; 50 | 51 | public DemoHolder(View itemView) { 52 | super(itemView); 53 | headPortrait=(ImageView)itemView.findViewById(R.id.iv_head_portrait); 54 | bgImage=(ImageView)itemView.findViewById(R.id.sdv_bg_image); 55 | name=(TextView)itemView.findViewById(R.id.tv_name); 56 | content=(TextView)itemView.findViewById(R.id.tv_content); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/custom/animation/ManagerAnimation.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.custom.animation; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.animation.AlphaAnimation; 6 | import android.view.animation.AnimationSet; 7 | import android.view.animation.TranslateAnimation; 8 | 9 | /** 10 | * GearApplication 11 | * Created by YichenZ on 2016/8/12 14:47. 12 | */ 13 | 14 | public final class ManagerAnimation { 15 | private Context mContext; 16 | private AnimationSet mAnimationSet; 17 | 18 | public static Builder builder() { 19 | return new Builder(); 20 | } 21 | 22 | public ManagerAnimation(Builder builder) { 23 | mContext=builder.mContext; 24 | mAnimationSet=builder.mAnimationSet; 25 | } 26 | 27 | public void inject(View view){ 28 | view.setAnimation(mAnimationSet); 29 | } 30 | 31 | public AnimationSet getAnimationSet() { 32 | return mAnimationSet; 33 | } 34 | 35 | public static class Builder { 36 | private Context mContext; 37 | private AnimationSet mAnimationSet; 38 | private TranslateAnimation mTranslateAnimation; 39 | private AlphaAnimation mAlphaAnimation; 40 | 41 | private int translateDuration=1000; 42 | private int alphaDuration=1000; 43 | 44 | public Builder(){ 45 | mAnimationSet=new AnimationSet(true); 46 | } 47 | 48 | public Builder setContext(Context context) { 49 | mContext = context; 50 | return this; 51 | } 52 | 53 | public Builder setTranslateAnimation(TranslateAnimation translateAnimation) { 54 | mTranslateAnimation = translateAnimation; 55 | 56 | return this; 57 | } 58 | 59 | public Builder setAlphaAnimation(AlphaAnimation alphaAnimation) { 60 | mAlphaAnimation = alphaAnimation; 61 | 62 | return this; 63 | } 64 | 65 | public Builder setTranslateDuration(int translateDuration) { 66 | this.translateDuration = translateDuration; 67 | return this; 68 | } 69 | 70 | public Builder setAlphaDuration(int alphaDuration) { 71 | this.alphaDuration = alphaDuration; 72 | return this; 73 | } 74 | 75 | public ManagerAnimation build() { 76 | if(mTranslateAnimation!=null){ 77 | mTranslateAnimation.setDuration(translateDuration); 78 | mAnimationSet.addAnimation(mTranslateAnimation); 79 | } 80 | if(mAlphaAnimation!=null){ 81 | mAlphaAnimation.setDuration(alphaDuration); 82 | mAnimationSet.addAnimation(mAlphaAnimation); 83 | } 84 | return new ManagerAnimation(this); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/custom/view/CustomVideoView.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.custom.view; 2 | 3 | import android.content.Context; 4 | import android.net.Uri; 5 | import android.support.annotation.NonNull; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | import android.widget.VideoView; 9 | 10 | /** 11 | * GearApplication 12 | * Created by YichenZ on 2016/11/15 14:44. 13 | */ 14 | 15 | public class CustomVideoView extends VideoView { 16 | 17 | public CustomVideoView(Context context) { 18 | super(context); 19 | } 20 | 21 | public CustomVideoView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public CustomVideoView(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | } 28 | 29 | @Override 30 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 31 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 32 | setMeasuredDimension(View.MeasureSpec.getSize(widthMeasureSpec),View.MeasureSpec.getSize(heightMeasureSpec)); 33 | } 34 | 35 | public void palyVideo(@NonNull Uri uri){ 36 | setVideoURI(uri); 37 | start(); 38 | 39 | setOnPreparedListener(mp -> mp.setLooping(true)); 40 | 41 | // setOnCompletionListener(mp -> mp.start()); 42 | 43 | setOnErrorListener((mp, what, extra) -> true); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/mvp/travelnotes/TravelNotesAdapter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.mvp.travelnotes; 2 | 3 | import android.content.Context; 4 | import android.databinding.DataBindingUtil; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.bumptech.glide.Glide; 10 | 11 | import java.util.ArrayList; 12 | 13 | import gear.yc.com.gearapplication.R; 14 | import gear.yc.com.gearapplication.databinding.ItemTravelNotesBinding; 15 | import gear.yc.com.gearapplication.pojo.TravelNoteBook; 16 | import gear.yc.com.gearlibrary.ui.adapter.GearRecyclerViewAdapter; 17 | 18 | /** 19 | * GearApplication 20 | * Created by YichenZ on 2016/4/21 14:09. 21 | */ 22 | public class TravelNotesAdapter extends GearRecyclerViewAdapter{ 23 | private static int oldPos=0; 24 | 25 | public TravelNotesAdapter(Context context,ArrayList dates){ 26 | super(context,dates); 27 | } 28 | 29 | @Override 30 | public Holder onCreateViewHolder(ViewGroup parent, int viewType) { 31 | 32 | ItemTravelNotesBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), 33 | R.layout.item_travel_notes,parent,false); 34 | binding.getRoot().setOnClickListener(this); 35 | Holder holder =new Holder(binding); 36 | return holder; 37 | } 38 | 39 | @Override 40 | public void onBindViewHolder(Holder holder, int position) { 41 | super.onBindViewHolder(holder,position); 42 | // if(oldPos-position<=0) { 43 | // holder.itemView.setTranslationY(CommonManager.getInstance().getMobileHeight(mContext)); 44 | // holder.itemView.animate().translationY(0) 45 | // .setStartDelay(100 * position) 46 | // .setInterpolator(new DecelerateInterpolator(3.f)) 47 | // .setDuration(700) 48 | // .start(); 49 | // } 50 | TravelNoteBook.Books data=mData.get(position); 51 | holder.binding.setBook(data); 52 | Glide.with(mContext) 53 | .load(data.getImgUrl()) 54 | .thumbnail(0.1f) 55 | .placeholder(android.R.color.transparent) 56 | .crossFade() 57 | .into(holder.binding.sdvBooksImg); 58 | holder.binding.getRoot().setTag(data); 59 | oldPos=position; 60 | data=null; 61 | } 62 | 63 | public class Holder extends RecyclerView.ViewHolder{ 64 | private final ItemTravelNotesBinding binding; 65 | public Holder(ItemTravelNotesBinding binding) { 66 | super(binding.getRoot()); 67 | this.binding=binding; 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/mvp/travelnotes/TravelNotesContract.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.mvp.travelnotes; 2 | 3 | import gear.yc.com.gearapplication.base.BasePresenter; 4 | import gear.yc.com.gearapplication.base.BaseView; 5 | 6 | /** 7 | * GearApplication 8 | * MVP接口类 9 | * Created by YichenZ on 2016/6/30 14:59. 10 | */ 11 | 12 | public interface TravelNotesContract { 13 | 14 | /** 15 | * 界面显示接口 16 | */ 17 | interface View extends BaseView{ 18 | void changeListView(); 19 | 20 | void showDialog(); 21 | 22 | void disDialog(); 23 | } 24 | 25 | /** 26 | * 界面数据接口 27 | */ 28 | interface Presenter extends BasePresenter{ 29 | int refreshData(String key,int page,boolean isNote); 30 | 31 | void loadData(String key,int page); 32 | 33 | void loadData(String key,int page,int count); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/ui/mvp/travelnotes/TravelNotesPresenter.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.ui.mvp.travelnotes; 2 | 3 | import gear.yc.com.gearapplication.network.APIServiceManager; 4 | import gear.yc.com.gearapplication.network.helper.SchedulersHelper; 5 | import gear.yc.com.gearlibrary.rxjava.helper.RxSchedulersHelper; 6 | 7 | /** 8 | * GearApplication 9 | * MVP数据逻辑类,承接数据与界面的交互,通过Dagger的方式初始化 10 | * Created by YichenZ on 2016/7/4 15:56. 11 | */ 12 | public class TravelNotesPresenter implements TravelNotesContract.Presenter { 13 | private final String INIT_KEY="全国";//面包key不能为空,默认搜索全国后期可以改成定位 14 | private TravelNotesContract.View view; 15 | public TravelNotesActivity obj; 16 | 17 | public TravelNotesPresenter(TravelNotesContract.View view, TravelNotesActivity obj) { 18 | this.view = view; 19 | this.obj = obj; 20 | } 21 | 22 | @Override 23 | public int refreshData(String key,int page,boolean isNote) { 24 | page = 1; 25 | if(isNote) { 26 | loadData(key, page); 27 | }else{ 28 | loadData(key, page,10); 29 | } 30 | return page; 31 | } 32 | 33 | @Override 34 | public void loadData(String key,int page) { 35 | view.showDialog(); 36 | // RouterDemo.getRouter(obj.getLifecycleSubject(),key, page+"") 37 | // .doOnTerminate(() -> view.disDialog()) 38 | // .subscribe(d -> obj.dataBinding(d), 39 | // e -> obj.dataError(e)); 40 | APIServiceManager 41 | .getTravelNotesAPI() 42 | .getTravelNotesList(key, page + "") 43 | .compose(obj.bindToLifecycle()) 44 | .compose(RxSchedulersHelper.io_main()) 45 | .compose(SchedulersHelper.handleResult()) 46 | .doOnTerminate(() -> view.disDialog()) 47 | .subscribe(d -> obj.dataBinding(d), 48 | e -> obj.dataError(e)); 49 | // .subscribe(s -> RxBus.getInstance().post(RxBus.getInstance() 50 | // .getTag(obj.getClass(),RxBus.TAG_UPDATE), s), 51 | // e -> RxBus.getInstance().post(RxBus.getInstance() 52 | // .getTag(obj.getClass(),RxBus.TAG_ERROR), e.getMessage())); 53 | } 54 | 55 | @Override 56 | public void loadData(String key,int page,int count){ 57 | if("".equals(key) || key==null){ 58 | key=INIT_KEY; 59 | } 60 | page=(page-1)*count; 61 | view.showDialog(); 62 | APIServiceManager 63 | .getBreadtripAPI() 64 | .getTravelNotesList(key,String.valueOf(page) ,count+"","trip") 65 | .compose(obj.bindToLifecycle()) 66 | .compose(RxSchedulersHelper.io_main()) 67 | .compose(SchedulersHelper.handleResultBread()) 68 | .doOnTerminate(() -> view.disDialog()) 69 | .subscribe(d -> obj.dataBinding(d), 70 | e -> obj.dataError(e)); 71 | // .subscribe(s -> RxBus.getInstance().post(RxBus.getInstance() 72 | // .getTag(obj.getClass(),RxBus.TAG_UPDATE), s.getBookses()), 73 | // e -> RxBus.getInstance().post(RxBus.getInstance() 74 | // .getTag(obj.getClass(),RxBus.TAG_ERROR), e.getMessage())); 75 | } 76 | 77 | @Override 78 | public void start() { 79 | } 80 | 81 | @Override 82 | public void close() { 83 | obj=null; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/utils/DataRouting/APIDataRouting.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.utils.DataRouting; 2 | 3 | /** 4 | * Created by joker on 2017/1/13. 5 | */ 6 | 7 | public class APIDataRouting { 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/utils/DataRouting/annotation/LoadData.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.utils.DataRouting.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Created by joker on 2017/1/13. 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.TYPE) 13 | public @interface LoadData { 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/utils/DataRouting/annotation/Query.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.utils.DataRouting.annotation; 2 | 3 | /** 4 | * Created by joker on 2017/1/13. 5 | */ 6 | 7 | public class Query { 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/gear/yc/com/gearapplication/utils/EncryptUtil.java: -------------------------------------------------------------------------------- 1 | package gear.yc.com.gearapplication.utils; 2 | 3 | /** 4 | * GearApplication 5 | * Created by YichenZ on 2016/7/20 16:32. 6 | */ 7 | 8 | public class EncryptUtil { 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bg_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/src/main/res/drawable-hdpi/bg_img.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/img_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/src/main/res/drawable-hdpi/img_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/img_gridview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/src/main/res/drawable-hdpi/img_gridview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/img_lv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/src/main/res/drawable-hdpi/img_lv.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/img_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerlc/GearApplication/21d72a36d8fdf896db4457fcf5f0a1d6ca64293c/app/src/main/res/drawable-hdpi/img_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_books_item_text_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_databinding.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | 17 | 18 | 24 | 25 | 31 | 32 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_gear.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_recycler_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search_books.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_travel_notes.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 14 | 15 | 19 | 20 | 25 | 26 | 32 | 33 | 34 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_travel_notes_book_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_web_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 14 | 18 | 19 | 30 | 42 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/demo_indicator_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/function_list_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 |