├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── app-release.apk ├── build.gradle ├── libs │ └── jsoup-1.10.1.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── lhr │ │ └── jiandou │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── lhr │ │ │ └── jiandou │ │ │ ├── MyApplication.java │ │ │ ├── activity │ │ │ ├── ActorDetailsActivity.java │ │ │ ├── BookDetailsActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── MovieDetailsActivity.java │ │ │ ├── SearchActivity.java │ │ │ └── WebViewActivity.java │ │ │ ├── adapter │ │ │ ├── ActorAdapter.java │ │ │ ├── ActorMovieAdapter.java │ │ │ ├── CollectionActorAdapter.java │ │ │ ├── CollectionBookAdapter.java │ │ │ ├── CollectionMovieAdapter.java │ │ │ ├── LabelAdapter.java │ │ │ ├── LikeMovieAdapter.java │ │ │ ├── PageBookAdapter.java │ │ │ ├── PageLeaderboardAdapter.java │ │ │ ├── PageMovieAdapter.java │ │ │ ├── PageTopAdapter.java │ │ │ ├── SearchBookAdapter.java │ │ │ ├── SearchMovieAdapter.java │ │ │ ├── SpinnerAdapter.java │ │ │ ├── TopViewPagerAdapter.java │ │ │ ├── base │ │ │ │ ├── BaseCollectionAdapter.java │ │ │ │ ├── BasePagerAdapter.java │ │ │ │ ├── BaseRecyclerAdapter.java │ │ │ │ └── BaseSearchAdapter.java │ │ │ └── helper │ │ │ │ ├── ItemDragHelperCallback.java │ │ │ │ ├── OnDragVHListener.java │ │ │ │ └── OnItemMoveListener.java │ │ │ ├── doubanservice │ │ │ └── DouBanService.java │ │ │ ├── fragment │ │ │ ├── BookFragment.java │ │ │ ├── ChangeLabelFragment.java │ │ │ ├── CollectionFragment.java │ │ │ ├── LeaderboardFragment.java │ │ │ ├── MovieFragment.java │ │ │ ├── SettingFragment.java │ │ │ ├── base │ │ │ │ ├── BaseFragment.java │ │ │ │ └── BasePagerFragment.java │ │ │ ├── factory │ │ │ │ └── FragmentFactory.java │ │ │ └── pagerfragment │ │ │ │ ├── BookPagerFragment.java │ │ │ │ ├── CollectionPageFragment.java │ │ │ │ ├── LabelPagerBookFragment.java │ │ │ │ ├── LabelPagerMovieFragment.java │ │ │ │ ├── LeaderboardNewFragment.java │ │ │ │ ├── LeaderboardTopFragment.java │ │ │ │ └── MoviePagerFragment.java │ │ │ ├── model │ │ │ ├── bean │ │ │ │ ├── ActorDetailsBean.java │ │ │ │ ├── BookDetailsBean.java │ │ │ │ ├── BookHttpResult.java │ │ │ │ ├── BooksBean.java │ │ │ │ ├── MovieDetailsBean.java │ │ │ │ ├── MovieHttpResult.java │ │ │ │ ├── SpinnerBean.java │ │ │ │ └── SubjectsBean.java │ │ │ ├── db │ │ │ │ ├── Actor_db.java │ │ │ │ ├── Book_db.java │ │ │ │ ├── GreenDaoHelper.java │ │ │ │ ├── GreenDaoUtils.java │ │ │ │ └── Movie_db.java │ │ │ ├── dbinterface │ │ │ │ ├── DbObservrt.java │ │ │ │ └── DbSubject.java │ │ │ └── httputils │ │ │ │ ├── BookHttpMethods.java │ │ │ │ ├── CachingControlInterceptor.java │ │ │ │ └── MovieHttpMethods.java │ │ │ ├── utils │ │ │ ├── CacheUtils.java │ │ │ ├── ClearCacheUtils.java │ │ │ ├── Constants.java │ │ │ ├── ImageUtils.java │ │ │ ├── LogUtils.java │ │ │ ├── PreferncesUtils.java │ │ │ ├── SnackBarUtils.java │ │ │ ├── SpUtils.java │ │ │ ├── StringUtils.java │ │ │ ├── ToastUtils.java │ │ │ ├── UIUtils.java │ │ │ └── jsoupUtils │ │ │ │ ├── GetActor.java │ │ │ │ ├── GetBookInfo.java │ │ │ │ ├── GetLikeMovie.java │ │ │ │ ├── GetNavImage.java │ │ │ │ └── GetVPImage.java │ │ │ └── view │ │ │ ├── NoScrollViewPager.java │ │ │ ├── ScrollAwareFABBehavior.java │ │ │ ├── StickyNavLayout.java │ │ │ ├── animation │ │ │ └── DepthPageTransformer.java │ │ │ └── mProgressdialog.java │ └── res │ │ ├── drawable │ │ ├── bg_btn.xml │ │ ├── bg_channel.xml │ │ ├── bg_channel_n.xml │ │ ├── bg_channel_p.xml │ │ ├── collection_bg.xml │ │ ├── collection_false.png │ │ ├── collection_true.png │ │ ├── ic_arrow_back_black_24dp.xml │ │ ├── ic_cancel_black_24dp.xml │ │ ├── ic_chevron_right_black_24dp.xml │ │ ├── ic_dehaze_black_24dp.xml │ │ ├── ic_fab_24dp.xml │ │ ├── ic_launcher.png │ │ ├── ic_movie_toweb_24dp.xml │ │ ├── ic_webview_close_24dp.xml │ │ ├── ic_webview_go_24dp.xml │ │ ├── ic_webview_refresh_24dp.xml │ │ ├── ic_webview_to_24dp.xml │ │ ├── myratingbar.xml │ │ ├── nav_bg.jpg │ │ ├── search_book.png │ │ ├── search_close_24dp.xml │ │ ├── search_movie.png │ │ ├── search_open_24dp.xml │ │ ├── selector_bg_point.xml │ │ ├── shape_bg_point_disable.xml │ │ ├── shape_bg_point_enable.xml │ │ ├── tab_actor_24dp.xml │ │ ├── tab_book_24dp.xml │ │ ├── tab_movie_24dp.xml │ │ └── toast_background.xml │ │ ├── layout │ │ ├── activity_actordetials.xml │ │ ├── activity_bookdetails.xml │ │ ├── activity_main.xml │ │ ├── activity_moviedetails.xml │ │ ├── activity_search.xml │ │ ├── activity_webview.xml │ │ ├── fragment_book.xml │ │ ├── fragment_changelabel.xml │ │ ├── fragment_collection.xml │ │ ├── fragment_leaderboard.xml │ │ ├── fragment_movie.xml │ │ ├── include_book_title.xml │ │ ├── include_movie_title.xml │ │ ├── include_toolbar.xml │ │ ├── item_actor.xml │ │ ├── item_actor_movie.xml │ │ ├── item_basepager.xml │ │ ├── item_collection.xml │ │ ├── item_footer.xml │ │ ├── item_likemovie.xml │ │ ├── item_my_label_header.xml │ │ ├── item_mylabel.xml │ │ ├── item_other_label_header.xml │ │ ├── item_otherlabel.xml │ │ ├── item_search.xml │ │ ├── item_spinner.xml │ │ ├── item_top250.xml │ │ ├── mtoast_layout.xml │ │ ├── nav_header.xml │ │ ├── pagefragment_collection.xml │ │ ├── pagefragment_leaderboard.xml │ │ ├── pagefragment_top250.xml │ │ ├── pagerfragment_base.xml │ │ ├── pagerfragment_labelm.xml │ │ ├── preference_category_widget.xml │ │ └── preference_item.xml │ │ ├── menu │ │ ├── menu_moviedetails_toolbar.xml │ │ ├── menu_toolbar.xml │ │ └── nav_menu.xml │ │ ├── mipmap-hdpi │ │ ├── Collection.png │ │ ├── books.png │ │ ├── jb_ico.png │ │ ├── label.png │ │ ├── list.png │ │ ├── movie.png │ │ ├── rb1.png │ │ ├── rb2.png │ │ ├── rb3.png │ │ ├── search.png │ │ ├── setting.png │ │ └── toast_ico.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_channel_edit.png │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v19 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── bottombar_tabs.xml │ │ └── preferences.xml │ └── test │ └── java │ └── com │ └── lhr │ └── jiandou │ └── ExampleUnitTest.java ├── app_display_apk └── JianDou1.2.apk ├── app_display_jpg ├── p1.jpg ├── p2.jpg ├── p3.jpg ├── p4.jpg ├── p5.jpg ├── p6.jpg ├── p7.jpg ├── p8.jpg └── p9.jpg ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.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/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 简豆 2 | > 基于豆瓣Api的客户端,包含电影分类,图书分类,电影榜单,收藏功能,搜索功能。 3 | 4 | ## 特点 5 | * 更小的APK : APK大小仅为2.87MB 6 | * 贴近Google Material Design 设计规范 7 | 8 | ## 效果图 9 | p1 10 | p2 11 | p3 12 | p4 13 | p6 14 | p7 15 | p8 16 | p9 17 | 18 | ## 开源技术 19 | 1. [Rxjava](https://github.com/ReactiveX/RxJava) 20 | 2. [RxAndroid](https://github.com/ReactiveX/RxAndroid) 21 | 3. [Retrofit](https://github.com/square/retrofit) 22 | 4. [Glide](https://github.com/bumptech/glide) 23 | 5. [GreenDao](https://github.com/greenrobot/greenDAO) 24 | 6. [bottom-bar](https://github.com/roughike/BottomBar) 25 | 7. [licensesdialog](https://github.com/PSDev/LicensesDialog) 26 | 27 | ## 声明 28 | > 感谢[豆瓣API](https://developers.douban.com/wiki/?title=api_v2)提供的API接口,部分数据为Jsoup解析HTML获取,原作公司拥有所有权利。本程序仅供测试学习,用于其他用途所造成的纠纷与本人无关。部分图标资源来自网络,如有侵权请联系我删除。 29 | 30 | >此程序为本人基于Material design,RxJava与Retrofit的练习之作,其中还有很多不足与缺陷,如果遇到请联系本人邮箱或提交lssues 31 | 32 | 33 | License 34 | ======= 35 | 36 | Copyright 2016 Maat 37 | 38 | 39 | Licensed under the Apache License, Version 2.0 (the "License"); 40 | you may not use this file except in compliance with the License. 41 | You may obtain a copy of the License at 42 | 43 | http://www.apache.org/licenses/LICENSE-2.0 44 | 45 | Unless required by applicable law or agreed to in writing, software 46 | distributed under the License is distributed on an "AS IS" BASIS, 47 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 48 | See the License for the specific language governing permissions and 49 | limitations under the License. 50 | 51 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/app-release.apk -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'org.greenrobot.greendao'//GreenDao 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "23.0.3" 6 | defaultConfig { 7 | applicationId "com.lhr.jiandou" 8 | minSdkVersion 17 9 | targetSdkVersion 24 10 | versionCode 1 11 | versionName "1.1" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | configurations.all { 23 | resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' 24 | } 25 | 26 | } 27 | greendao { 28 | schemaVersion 2 29 | } 30 | dependencies { 31 | compile fileTree(include: ['*.jar'], dir: 'libs') 32 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 33 | exclude group: 'com.android.support', module: 'support-annotations' 34 | }) 35 | compile 'com.android.support:appcompat-v7:24.0.0' 36 | compile 'com.android.support:cardview-v7:24.0.0' 37 | compile 'com.android.support:recyclerview-v7:24.0.0' 38 | compile 'com.android.support:design:24.0.0' 39 | compile 'com.android.support:palette-v7:24.0.0' 40 | compile 'com.android.support:preference-v7:24.0.0' 41 | //RxJava 42 | compile 'io.reactivex:rxjava:1.1.0' 43 | compile 'io.reactivex:rxandroid:1.1.0' 44 | //Retrofit 45 | compile 'com.squareup.retrofit2:retrofit:2.1.0' 46 | compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 47 | compile 'com.squareup.retrofit2:converter-gson:2.1.0' 48 | compile 'com.google.code.gson:gson:2.8.0' 49 | //glide 50 | compile 'com.github.bumptech.glide:glide:3.7.0' 51 | //GreenDao 52 | compile 'org.greenrobot:greendao:3.2.0' 53 | //View 54 | compile('de.psdev.licensesdialog:licensesdialog:1.8.1') 55 | compile 'com.roughike:bottom-bar:2.0.2' 56 | testCompile 'junit:junit:4.12' 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/libs/jsoup-1.10.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/libs/jsoup-1.10.1.jar -------------------------------------------------------------------------------- /app/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 D:\adt-bundle-windows-x86_64-20140702\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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lhr/jiandou/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lhr.jiandou", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 37 | 41 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.net.ConnectivityManager; 6 | import android.net.NetworkInfo; 7 | 8 | import com.lhr.jiandou.model.db.GreenDaoUtils; 9 | 10 | /** 11 | * Created by ChinaLHR on 2016/12/13. 12 | * Email:13435500980@163.com 13 | */ 14 | 15 | public class MyApplication extends Application { 16 | private static Context context; 17 | private static GreenDaoUtils mDaoUtils; 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | context = getApplicationContext(); 23 | mDaoUtils = new GreenDaoUtils(context); 24 | } 25 | 26 | public static Context getContext() { 27 | return context; 28 | } 29 | 30 | public static boolean isNetworkAvailable(Context context) { 31 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 32 | if (connectivityManager == null) { 33 | return false; 34 | } else { 35 | // 获取NetworkInfo对象 36 | NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo(); 37 | if (networkInfo != null && networkInfo.length > 0) { 38 | for (int i = 0; i < networkInfo.length; i++) { 39 | // 判断当前网络状态是否为连接状态 40 | if (networkInfo[i].getState() == NetworkInfo.State.CONNECTED) { 41 | return true; 42 | } 43 | } 44 | } 45 | } 46 | return false; 47 | } 48 | 49 | public static GreenDaoUtils getDbUtils() { 50 | return mDaoUtils; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/ActorMovieAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.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 | import com.lhr.jiandou.R; 13 | import com.lhr.jiandou.adapter.base.BaseRecyclerAdapter; 14 | import com.lhr.jiandou.model.bean.ActorDetailsBean; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Created by ChinaLHR on 2016/12/22. 20 | * Email:13435500980@163.com 21 | */ 22 | 23 | public class ActorMovieAdapter extends BaseRecyclerAdapter { 24 | private LayoutInflater mInflater; 25 | private Context mContext; 26 | private List mdate; 27 | 28 | public ActorMovieAdapter(Context context, List bean) { 29 | mContext = context; 30 | mInflater = LayoutInflater.from(context); 31 | mdate = bean; 32 | } 33 | 34 | @Override 35 | public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { 36 | Glide.with(mContext) 37 | .load(mdate.get(position).getSubject().getImages().getLarge()) 38 | .into(((MyHolder) holder).item_actor_movie_iv); 39 | if (mdate.get(position).getSubject().getTitle() != null) { 40 | ((MyHolder) holder).item_actor__movie_title.setText(mdate.get(position).getSubject().getTitle()); 41 | } 42 | if (mdate.get(position).getRoles().get(0) != null) { 43 | ((MyHolder) holder).item_actor_movie_work.setText(mdate.get(position).getRoles().get(0)); 44 | } 45 | 46 | if (mListener != null) { 47 | ((MyHolder) holder).item_actor_movie_iv.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View view) { 50 | mListener.onItemClick(mdate.get(position).getSubject().getId(), mdate.get(position).getSubject().getImages().getLarge()); 51 | } 52 | }); 53 | } 54 | 55 | } 56 | 57 | @Override 58 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 59 | MyHolder mHolder = new MyHolder(mInflater.inflate(R.layout.item_actor_movie, parent, false)); 60 | return mHolder; 61 | } 62 | 63 | @Override 64 | public int getItemCount() { 65 | return mdate.size(); 66 | } 67 | 68 | class MyHolder extends BaseRecyclerAdapter.Holder { 69 | ImageView item_actor_movie_iv; 70 | TextView item_actor_movie_work; 71 | TextView item_actor__movie_title; 72 | 73 | public MyHolder(View itemView) { 74 | super(itemView); 75 | item_actor_movie_iv = (ImageView) itemView.findViewById(R.id.item_actor_movie_iv); 76 | item_actor_movie_work = (TextView) itemView.findViewById(R.id.item_actor_movie_work); 77 | item_actor__movie_title = (TextView) itemView.findViewById(R.id.item_actor__movie_title); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/CollectionActorAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.support.v4.graphics.drawable.RoundedBitmapDrawable; 6 | import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.View; 9 | 10 | import com.bumptech.glide.Glide; 11 | import com.bumptech.glide.request.target.BitmapImageViewTarget; 12 | import com.lhr.jiandou.adapter.base.BaseCollectionAdapter; 13 | import com.lhr.jiandou.model.db.Actor_db; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by ChinaLHR on 2017/1/9. 19 | * Email:13435500980@163.com 20 | */ 21 | 22 | public class CollectionActorAdapter extends BaseCollectionAdapter { 23 | private Context mContext; 24 | private List mdate; 25 | public CollectionActorAdapter(Context context,List list) { 26 | super(context); 27 | mdate = list; 28 | mContext = context; 29 | } 30 | 31 | @Override 32 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { 33 | Glide.with(mContext) 34 | .load(mdate.get(position).getImgurl()) 35 | .asBitmap() 36 | .centerCrop() 37 | .into(new BitmapImageViewTarget(((Holder)holder).item_collection_img){ 38 | @Override 39 | protected void setResource(Bitmap resource) { 40 | RoundedBitmapDrawable circularBitmapDrawable = 41 | RoundedBitmapDrawableFactory.create(mContext.getResources(), resource); 42 | circularBitmapDrawable.setCircular(true); 43 | ((Holder)holder).item_collection_img.setImageDrawable(circularBitmapDrawable); 44 | } 45 | }); 46 | ((Holder) holder).item_collection_ratll.setVisibility(View.GONE); 47 | ((Holder) holder).item_collection_title.setText(mdate.get(position).getTitle()); 48 | ((Holder) holder).item_collection_tv1.setText("性别:"+mdate.get(position).getGender()); 49 | ((Holder) holder).item_collection_tv2.setText("出生地:"+mdate.get(position).getBorn_place()); 50 | ((Holder) holder).item_collection_tv3.setText("收藏时间:"+mdate.get(position).getTime()); 51 | if (mListener!=null){ 52 | ((Holder) holder).item_collection_card.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View view) { 55 | mListener.onItemClick(mdate.get(position).getActor_id(),mdate.get(position).getImgurl()); 56 | } 57 | }); 58 | } 59 | } 60 | 61 | @Override 62 | public int getItemCount() { 63 | return mdate.size(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/CollectionBookAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.lhr.jiandou.adapter.base.BaseCollectionAdapter; 9 | import com.lhr.jiandou.model.db.Book_db; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ChinaLHR on 2017/1/9. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class CollectionBookAdapter extends BaseCollectionAdapter { 19 | private Context mContext; 20 | private List mdate; 21 | 22 | public CollectionBookAdapter(Context context, List list) { 23 | super(context); 24 | mdate = list; 25 | mContext = context; 26 | } 27 | 28 | 29 | @Override 30 | public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { 31 | Glide.with(mContext) 32 | .load(mdate.get(position).getImgurl()) 33 | .into(((Holder) holder).item_collection_img); 34 | ((Holder) holder).item_collection_title.setText(mdate.get(position).getTitle()); 35 | ((Holder) holder).item_collection_ratingbar.setRating(mdate.get(position).getRating()/2); 36 | ((Holder) holder).item_collection_ratingnum.setText(mdate.get(position).getRating()+""); 37 | ((Holder) holder).item_collection_tv1.setText("作者:"+mdate.get(position).getAuthor()); 38 | ((Holder) holder).item_collection_tv2.setText("出版社:"+mdate.get(position).getPublisher()); 39 | ((Holder) holder).item_collection_tv3.setText("收藏时间:"+mdate.get(position).getTime()); 40 | if (mListener != null) { 41 | ((Holder) holder).item_collection_card.setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View view) { 44 | mListener.onItemClick(mdate.get(position).getBook_id(), mdate.get(position).getImgurl()); 45 | } 46 | }); 47 | } 48 | } 49 | 50 | @Override 51 | public int getItemCount() { 52 | return mdate.size(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/CollectionMovieAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.lhr.jiandou.adapter.base.BaseCollectionAdapter; 9 | import com.lhr.jiandou.model.db.Movie_db; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ChinaLHR on 2017/1/9. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class CollectionMovieAdapter extends BaseCollectionAdapter { 19 | private Context mContext; 20 | private List mdate; 21 | 22 | public CollectionMovieAdapter(Context context, List list) { 23 | super(context); 24 | mdate = list; 25 | mContext = context; 26 | } 27 | 28 | 29 | @Override 30 | public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { 31 | Glide.with(mContext) 32 | .load(mdate.get(position).getImgurl()) 33 | .into(((Holder) holder).item_collection_img); 34 | 35 | ((Holder) holder).item_collection_title.setText(mdate.get(position).getTitle()); 36 | ((Holder) holder).item_collection_tv1.setText("电影类型:" + mdate.get(position).getGenres()); 37 | ((Holder) holder).item_collection_tv2.setText("上映时间:" + mdate.get(position).getYear()); 38 | ((Holder) holder).item_collection_tv3.setText("收藏时间:" + mdate.get(position).getTime()); 39 | 40 | ((Holder) holder).item_collection_ratingbar.setRating(mdate.get(position).getRating() / 2); 41 | ((Holder) holder).item_collection_ratingnum.setText(mdate.get(position).getRating() + ""); 42 | if (mListener != null) { 43 | ((Holder) holder).item_collection_card.setOnClickListener(new View.OnClickListener() { 44 | @Override 45 | public void onClick(View view) { 46 | mListener.onItemClick(mdate.get(position).getMovieId(), mdate.get(position).getImgurl()); 47 | } 48 | }); 49 | } 50 | } 51 | 52 | 53 | @Override 54 | public int getItemCount() { 55 | return mdate.size(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/LikeMovieAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.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 | import com.lhr.jiandou.R; 13 | import com.lhr.jiandou.adapter.base.BaseRecyclerAdapter; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by ChinaLHR on 2016/12/21. 19 | * Email:13435500980@163.com 20 | */ 21 | 22 | public class LikeMovieAdapter extends BaseRecyclerAdapter{ 23 | private Context mContext; 24 | private LayoutInflater mInflater; 25 | private List mTitle; 26 | private List mId; 27 | private List mImg; 28 | 29 | @Override 30 | public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) { 31 | MyHolder holder = new MyHolder(mInflater.inflate(R.layout.item_likemovie, parent, false)); 32 | return holder; 33 | } 34 | 35 | @Override 36 | public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { 37 | ((MyHolder)holder).item_like_title.setText(mTitle.get(position)); 38 | Glide.with(mContext) 39 | .load(mImg.get(position)) 40 | .into(((MyHolder)holder).item_like_iv); 41 | if (mListener != null) { 42 | ((MyHolder)holder).item_like_iv.setOnClickListener(new View.OnClickListener() { 43 | @Override 44 | public void onClick(View view) { 45 | mListener.onItemClick(mId.get(position),mImg.get(position)); 46 | } 47 | }); 48 | } 49 | } 50 | 51 | 52 | @Override 53 | public int getItemCount() { 54 | return mTitle.size(); 55 | } 56 | 57 | 58 | public LikeMovieAdapter(Context context, List title, List img, List id) { 59 | mContext = context; 60 | mInflater = LayoutInflater.from(context); 61 | mTitle = title; 62 | mImg = img; 63 | mId = id; 64 | } 65 | 66 | 67 | class MyHolder extends BaseRecyclerAdapter.Holder{ 68 | ImageView item_like_iv; 69 | TextView item_like_title; 70 | 71 | public MyHolder(View itemView) { 72 | super(itemView); 73 | item_like_iv = (ImageView) itemView.findViewById(R.id.item_like_iv); 74 | item_like_title = (TextView) itemView.findViewById(R.id.item_like_title); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/PageBookAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.CardView; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.RatingBar; 11 | import android.widget.TextView; 12 | 13 | import com.bumptech.glide.Glide; 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.adapter.base.BasePagerAdapter; 16 | import com.lhr.jiandou.model.bean.BooksBean; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Created by ChinaLHR on 2016/12/24. 22 | * Email:13435500980@163.com 23 | */ 24 | 25 | public class PageBookAdapter extends BasePagerAdapter { 26 | 27 | public PageBookAdapter(Context context, List date) { 28 | super(context, date); 29 | } 30 | 31 | @Override 32 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 33 | if (mFooterView != null && viewType == TYPE_FOOTER) 34 | return new MyViewHolder(mFooterView); 35 | 36 | View view = LayoutInflater.from(mContext).inflate(R.layout.item_basepager, parent, false); 37 | return new MyViewHolder(view); 38 | } 39 | 40 | @Override 41 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { 42 | if (getItemViewType(position) == TYPE_FOOTER) return; 43 | 44 | ((PageBookAdapter.MyViewHolder)holder).item_base_tv_title.setText(mDate.get(position).getTitle()); 45 | ((PageBookAdapter.MyViewHolder)holder).item_base_tv_number.setText(mDate.get(position).getRating().getAverage() + ""); 46 | ((PageBookAdapter.MyViewHolder)holder).item_movie_ratingbar.setRating(Float.parseFloat(mDate.get(position).getRating().getAverage())/2); 47 | Glide.with(mContext) 48 | .load(mDate.get(position).getImages().getLarge()) 49 | .into(((PageBookAdapter.MyViewHolder)holder).item_base_iv); 50 | 51 | //设置点击事件 52 | if (mListener!=null){ 53 | ((PageBookAdapter.MyViewHolder)holder).item_movie_cardview.setOnClickListener(new View.OnClickListener() { 54 | @Override 55 | public void onClick(View view) { 56 | int position = holder.getLayoutPosition(); 57 | mListener.ItemClickListener(holder.itemView, mDate.get(position).getId(),mDate.get(position).getImages().getLarge()); 58 | } 59 | }); 60 | 61 | ((PageBookAdapter.MyViewHolder)holder).item_movie_cardview.setOnLongClickListener(new View.OnLongClickListener() { 62 | @Override 63 | public boolean onLongClick(View view) { 64 | int position = holder.getLayoutPosition(); 65 | mListener.ItemLongClickListener(holder.itemView, position); 66 | return true; 67 | } 68 | }); 69 | } 70 | 71 | } 72 | 73 | class MyViewHolder extends RecyclerView.ViewHolder { 74 | ImageView item_base_iv; 75 | TextView item_base_tv_title; 76 | TextView item_base_tv_number; 77 | RatingBar item_movie_ratingbar; 78 | CardView item_movie_cardview; 79 | 80 | public MyViewHolder(View itemView) { 81 | super(itemView); 82 | item_base_iv = (ImageView) itemView.findViewById(R.id.item_base_iv); 83 | item_base_tv_title = (TextView) itemView.findViewById(R.id.item_base_tv_title); 84 | item_base_tv_number = (TextView) itemView.findViewById(R.id.item_base_tv_number); 85 | item_movie_ratingbar = (RatingBar) itemView.findViewById(R.id.item_base_ratingbar); 86 | item_movie_cardview = (CardView) itemView.findViewById(R.id.item_movie_cardview); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/PageMovieAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.CardView; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.RatingBar; 11 | import android.widget.TextView; 12 | 13 | import com.bumptech.glide.Glide; 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.adapter.base.BasePagerAdapter; 16 | import com.lhr.jiandou.model.bean.SubjectsBean; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Created by ChinaLHR on 2016/12/15. 22 | * Email:13435500980@163.com 23 | */ 24 | 25 | public class PageMovieAdapter extends BasePagerAdapter { 26 | 27 | 28 | public PageMovieAdapter(Context context, List date) { 29 | super(context, date); 30 | } 31 | 32 | @Override 33 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 34 | if (mFooterView != null && viewType == TYPE_FOOTER) 35 | return new MyViewHolder(mFooterView); 36 | View view = LayoutInflater.from(mContext).inflate(R.layout.item_basepager, parent, false); 37 | return new MyViewHolder(view); 38 | } 39 | 40 | @Override 41 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { 42 | if (getItemViewType(position) == TYPE_FOOTER) return; 43 | 44 | ((MyViewHolder)holder).item_base_tv_title.setText(mDate.get(position).getTitle()); 45 | ((MyViewHolder)holder).item_base_tv_number.setText(mDate.get(position).getRating().getAverage() + ""); 46 | ((MyViewHolder)holder).item_movie_ratingbar.setRating((float) mDate.get(position).getRating().getAverage() / 2); 47 | 48 | Glide.with(mContext) 49 | .load(mDate.get(position).getImages().getLarge()) 50 | .into(((MyViewHolder)holder).item_base_iv); 51 | 52 | //设置点击事件 53 | if (mListener != null) { 54 | ((MyViewHolder)holder).item_movie_cardview.setOnClickListener(new View.OnClickListener() { 55 | @Override 56 | public void onClick(View view) { 57 | int position = holder.getLayoutPosition(); 58 | mListener.ItemClickListener(holder.itemView, mDate.get(position).getId(),mDate.get(position).getImages().getLarge()); 59 | } 60 | }); 61 | 62 | ((MyViewHolder)holder).item_movie_cardview.setOnLongClickListener(new View.OnLongClickListener() { 63 | @Override 64 | public boolean onLongClick(View view) { 65 | int position = holder.getLayoutPosition(); 66 | mListener.ItemLongClickListener(holder.itemView, position); 67 | return true; 68 | } 69 | }); 70 | } 71 | } 72 | 73 | class MyViewHolder extends RecyclerView.ViewHolder { 74 | ImageView item_base_iv; 75 | TextView item_base_tv_title; 76 | TextView item_base_tv_number; 77 | RatingBar item_movie_ratingbar; 78 | CardView item_movie_cardview; 79 | 80 | public MyViewHolder(View itemView) { 81 | super(itemView); 82 | item_base_iv = (ImageView) itemView.findViewById(R.id.item_base_iv); 83 | item_base_tv_title = (TextView) itemView.findViewById(R.id.item_base_tv_title); 84 | item_base_tv_number = (TextView) itemView.findViewById(R.id.item_base_tv_number); 85 | item_movie_ratingbar = (RatingBar) itemView.findViewById(R.id.item_base_ratingbar); 86 | item_movie_cardview = (CardView) itemView.findViewById(R.id.item_movie_cardview); 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/SearchBookAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.lhr.jiandou.adapter.base.BaseSearchAdapter; 9 | import com.lhr.jiandou.model.bean.BooksBean; 10 | import com.lhr.jiandou.utils.StringUtils; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by ChinaLHR on 2017/1/12. 16 | * Email:13435500980@163.com 17 | */ 18 | 19 | public class SearchBookAdapter extends BaseSearchAdapter { 20 | private Context mContext; 21 | private List bean; 22 | private boolean isOpen = false; 23 | 24 | public SearchBookAdapter(Context context, List list) { 25 | super(context); 26 | mContext = context; 27 | bean = list; 28 | } 29 | 30 | public void addData(List list) { 31 | bean.addAll(list); 32 | notifyDataSetChanged(); 33 | } 34 | 35 | public int getStart() { 36 | return bean.size(); 37 | } 38 | 39 | @Override 40 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { 41 | if (getItemViewType(position) == TYPE_FOOTER) return; 42 | Glide.with(mContext) 43 | .load(bean.get(position).getImages().getLarge()) 44 | .into(((Holder) holder).item_search_iv); 45 | ((Holder) holder).item_search_title.setText(bean.get(position).getTitle()); 46 | float average = Float.parseFloat(bean.get(position).getRating().getAverage()); 47 | ((Holder) holder).item_search_rating.setRating(average / 2); 48 | ((Holder) holder).item_search_ratnum.setText(average + ""); 49 | 50 | ((Holder) holder).item_search_tv1.setText("作者:"); 51 | List author = bean.get(position).getAuthor(); 52 | StringUtils.addViewString(author, ((Holder) holder).item_search_tv1); 53 | 54 | ((Holder) holder).item_search_tv2.setText("出版社:" + bean.get(position).getPublisher()); 55 | 56 | ((Holder) holder).item_search_tv3.setText("出版时间:" + bean.get(position).getPubdate()); 57 | ((Holder) holder).item_search_detail.setVisibility(View.GONE); 58 | ((Holder) holder).item_search_switch.setVisibility(View.GONE); 59 | 60 | if (mListener!=null){ 61 | ((Holder) holder).item_search_card.setOnClickListener(new View.OnClickListener() { 62 | @Override 63 | public void onClick(View view) { 64 | mListener.onItemClick(bean.get(position).getId(),bean.get(position).getImages().getLarge()); 65 | } 66 | }); 67 | } 68 | 69 | 70 | } 71 | 72 | @Override 73 | public int getItemCount() { 74 | if (mFooterView == null) { 75 | return bean.size(); 76 | } else { 77 | return bean.size() + 1; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/SearchMovieAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.lhr.jiandou.adapter.base.BaseSearchAdapter; 9 | import com.lhr.jiandou.model.bean.SubjectsBean; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ChinaLHR on 2017/1/11. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class SearchMovieAdapter extends BaseSearchAdapter { 19 | private Context mContext; 20 | private List bean; 21 | 22 | public SearchMovieAdapter(Context context, List list) { 23 | super(context); 24 | mContext = context; 25 | bean = list; 26 | } 27 | 28 | public void addData(List list){ 29 | bean.addAll(list); 30 | notifyDataSetChanged(); 31 | } 32 | 33 | public int getStart(){ 34 | return bean.size(); 35 | } 36 | 37 | @Override 38 | public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { 39 | if (getItemViewType(position) == TYPE_FOOTER) return; 40 | ((Holder) holder).item_search_tv1.setText(""); 41 | ((Holder) holder).item_search_tv2.setText(""); 42 | Glide.with(mContext) 43 | .load(bean.get(position).getImages().getLarge()) 44 | .into(((Holder) holder).item_search_iv); 45 | 46 | ((Holder) holder).item_search_title.setText(bean.get(position).getTitle()); 47 | float average = (float) bean.get(position).getRating().getAverage(); 48 | ((Holder) holder).item_search_rating.setRating(average / 2); 49 | ((Holder) holder).item_search_ratnum.setText(average + ""); 50 | 51 | 52 | ((Holder) holder).item_search_tv1.append("导演:"); 53 | List directors = bean.get(position).getDirectors(); 54 | for (int i = 0; i < directors.size(); i++) { 55 | if (i == directors.size() - 1) { 56 | ((Holder) holder).item_search_tv1.append(directors.get(i).getName()); 57 | }else { 58 | ((Holder) holder).item_search_tv1.append(directors.get(i).getName()+"/"); 59 | } 60 | } 61 | 62 | ((Holder) holder).item_search_tv2.append("演员:"); 63 | List casts = bean.get(position).getCasts(); 64 | for (int i = 0; i < casts.size(); i++) { 65 | if (i==casts.size()-1){ 66 | ((Holder) holder).item_search_tv2.append(casts.get(i).getName()); 67 | }else{ 68 | ((Holder) holder).item_search_tv2.append(casts.get(i).getName()+"/"); 69 | } 70 | } 71 | 72 | ((Holder) holder).item_search_tv3.setText("上映时间:"+bean.get(position).getYear()); 73 | ((Holder) holder).item_search_switch.setVisibility(View.GONE); 74 | if (mListener!=null){ 75 | ((Holder) holder).item_search_card.setOnClickListener(new View.OnClickListener() { 76 | @Override 77 | public void onClick(View view) { 78 | mListener.onItemClick(bean.get(position).getId(),bean.get(position).getImages().getLarge()); 79 | } 80 | }); 81 | } 82 | 83 | } 84 | 85 | @Override 86 | public int getItemCount() { 87 | if (mFooterView==null) { 88 | return bean.size(); 89 | }else{ 90 | return bean.size()+1; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/SpinnerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.lhr.jiandou.R; 12 | import com.lhr.jiandou.model.bean.SpinnerBean; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Created by ChinaLHR on 2017/1/10. 18 | * Email:13435500980@163.com 19 | */ 20 | 21 | public class SpinnerAdapter extends BaseAdapter { 22 | private List mList; 23 | private Context mContext; 24 | 25 | public SpinnerAdapter(Context context, List bean) { 26 | mList = bean; 27 | mContext = context; 28 | } 29 | 30 | @Override 31 | public int getCount() { 32 | return mList.size(); 33 | } 34 | 35 | @Override 36 | public Object getItem(int i) { 37 | return mList.get(i); 38 | } 39 | 40 | @Override 41 | public long getItemId(int i) { 42 | return i; 43 | } 44 | 45 | @Override 46 | public View getView(int i, View view, ViewGroup viewGroup) { 47 | if (view == null) { 48 | view = LayoutInflater.from(mContext).inflate(R.layout.item_spinner, null); 49 | } 50 | ImageView item_spinner_iv = (ImageView) view.findViewById(R.id.item_spinner_iv); 51 | TextView item_spinner_tv = (TextView) view.findViewById(R.id.item_spinner_tv); 52 | item_spinner_iv.setImageResource(mList.get(i).getId()); 53 | item_spinner_tv.setText(mList.get(i).getName()); 54 | return view; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/TopViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.PagerAdapter; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ImageView; 8 | 9 | import com.bumptech.glide.Glide; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ChinaLHR on 2016/12/29. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class TopViewPagerAdapter extends PagerAdapter { 19 | private List mdate; 20 | private Context mContext; 21 | 22 | public TopViewPagerAdapter(Context context, List imagelist) { 23 | mdate = imagelist; 24 | mContext = context; 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return mdate.size(); 30 | } 31 | 32 | @Override 33 | public boolean isViewFromObject(View view, Object object) { 34 | return view == object; 35 | } 36 | 37 | @Override 38 | public void destroyItem(ViewGroup container, int position, Object object) { 39 | container.removeView((View) object); 40 | } 41 | 42 | @Override 43 | public Object instantiateItem(ViewGroup container, int position) { 44 | ImageView view = new ImageView(mContext); 45 | view.setScaleType(ImageView.ScaleType.FIT_XY); 46 | Glide.with(mContext) 47 | .load(mdate.get(position)) 48 | .into(view); 49 | container.addView(view); 50 | return view; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/base/BaseCollectionAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.base; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.CardView; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.RatingBar; 12 | import android.widget.TextView; 13 | 14 | import com.lhr.jiandou.R; 15 | 16 | /** 17 | * Created by ChinaLHR on 2017/1/9. 18 | * Email:13435500980@163.com 19 | */ 20 | 21 | public abstract class BaseCollectionAdapter extends RecyclerView.Adapter { 22 | private Context mContext; 23 | /** 24 | * 点击回调接口 25 | */ 26 | public OnItemClickListener mListener; 27 | 28 | public void setOnItemClickListener(OnItemClickListener li) { 29 | mListener = li; 30 | } 31 | 32 | public interface OnItemClickListener { 33 | void onItemClick(String id, String url); 34 | } 35 | 36 | public BaseCollectionAdapter(Context context){ 37 | this.mContext = context; 38 | } 39 | @Override 40 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 41 | Holder holder = new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_collection, parent, false)); 42 | return holder; 43 | } 44 | 45 | public class Holder extends RecyclerView.ViewHolder { 46 | public CardView item_collection_card; 47 | public ImageView item_collection_img; 48 | public RatingBar item_collection_ratingbar; 49 | public TextView item_collection_ratingnum; 50 | public LinearLayout item_collection_ratll; 51 | public TextView item_collection_title; 52 | public TextView item_collection_tv1; 53 | public TextView item_collection_tv2; 54 | public TextView item_collection_tv3; 55 | 56 | public Holder(View itemView) { 57 | super(itemView); 58 | item_collection_card = (CardView) itemView.findViewById(R.id.item_collection_card); 59 | item_collection_img = (ImageView) itemView.findViewById(R.id.item_collection_img); 60 | item_collection_ratingbar = (RatingBar) itemView.findViewById(R.id.item_collection_ratingbar); 61 | item_collection_ratingnum = (TextView) itemView.findViewById(R.id.item_collection_ratingnum); 62 | item_collection_ratll = (LinearLayout) itemView.findViewById(R.id.item_collection_ratll); 63 | item_collection_title = (TextView) itemView.findViewById(R.id.item_collection_title); 64 | item_collection_tv1 = (TextView) itemView.findViewById(R.id.item_collection_tv1); 65 | item_collection_tv2 = (TextView) itemView.findViewById(R.id.item_collection_tv2); 66 | item_collection_tv3 = (TextView) itemView.findViewById(R.id.item_collection_tv3); 67 | } 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/base/BaseRecyclerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.base; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by ChinaLHR on 2016/12/22. 8 | * Email:13435500980@163.com 9 | */ 10 | 11 | public abstract class BaseRecyclerAdapter extends RecyclerView.Adapter { 12 | public OnItemClickListener mListener; 13 | 14 | public void setOnItemClickListener(OnItemClickListener li) { 15 | mListener = li; 16 | } 17 | 18 | /** 19 | * 点击回调接口 20 | */ 21 | public interface OnItemClickListener { 22 | void onItemClick(String id, String url); 23 | } 24 | 25 | 26 | public class Holder extends RecyclerView.ViewHolder { 27 | public Holder(View itemView) { 28 | super(itemView); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/base/BaseSearchAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.base; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.CardView; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.RatingBar; 11 | import android.widget.TextView; 12 | 13 | import com.lhr.jiandou.R; 14 | 15 | /** 16 | * Created by ChinaLHR on 2017/1/11. 17 | * Email:13435500980@163.com 18 | */ 19 | 20 | public abstract class BaseSearchAdapter extends RecyclerView.Adapter { 21 | 22 | private Context mContext; 23 | public static final int TYPE_NORMAL = 1; 24 | public static final int TYPE_FOOTER = 2; 25 | public View mFooterView; 26 | 27 | 28 | /** 29 | * 点击回调接口 30 | */ 31 | public OnItemClickListener mListener; 32 | 33 | public void setOnItemClickListener(OnItemClickListener li) { 34 | mListener = li; 35 | } 36 | 37 | public interface OnItemClickListener { 38 | void onItemClick(String id, String url); 39 | } 40 | 41 | public BaseSearchAdapter(Context context) { 42 | this.mContext = context; 43 | } 44 | 45 | @Override 46 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 47 | if (mFooterView != null && viewType == TYPE_FOOTER) 48 | return new Holder(mFooterView); 49 | Holder holder = new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_search, parent, false)); 50 | return holder; 51 | } 52 | 53 | /** 54 | * 设置脚布局 55 | */ 56 | public void setFooterView(View footerView) { 57 | mFooterView = footerView; 58 | notifyItemInserted(getItemCount() - 1); 59 | } 60 | 61 | @Override 62 | public int getItemViewType(int position) { 63 | if (mFooterView == null) return TYPE_NORMAL; 64 | if (position == getItemCount() - 1) return TYPE_FOOTER; 65 | return TYPE_NORMAL; 66 | } 67 | 68 | 69 | public class Holder extends RecyclerView.ViewHolder { 70 | public CardView item_search_card; 71 | public TextView item_search_detail; 72 | public ImageView item_search_iv; 73 | public RatingBar item_search_rating; 74 | public TextView item_search_ratnum; 75 | public ImageView item_search_switch; 76 | public TextView item_search_title; 77 | public TextView item_search_tv1; 78 | public TextView item_search_tv2; 79 | public TextView item_search_tv3; 80 | 81 | public Holder(View itemView) { 82 | super(itemView); 83 | item_search_card = (CardView) itemView.findViewById(R.id.item_search_card); 84 | item_search_detail = (TextView) itemView.findViewById(R.id.item_search_detail); 85 | item_search_iv = (ImageView) itemView.findViewById(R.id.item_search_iv); 86 | item_search_rating = (RatingBar) itemView.findViewById(R.id.item_search_rating); 87 | item_search_ratnum = (TextView) itemView.findViewById(R.id.item_search_ratnum); 88 | item_search_switch = (ImageView) itemView.findViewById(R.id.item_search_switch); 89 | item_search_title = (TextView) itemView.findViewById(R.id.item_search_title); 90 | item_search_tv1 = (TextView) itemView.findViewById(R.id.item_search_tv1); 91 | item_search_tv2 = (TextView) itemView.findViewById(R.id.item_search_tv2); 92 | item_search_tv3 = (TextView) itemView.findViewById(R.id.item_search_tv3); 93 | 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/helper/ItemDragHelperCallback.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.helper; 2 | 3 | import android.support.v7.widget.GridLayoutManager; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.support.v7.widget.StaggeredGridLayoutManager; 6 | import android.support.v7.widget.helper.ItemTouchHelper; 7 | 8 | /** 9 | * Created by ChinaLHR on 2016/12/23. 10 | * Email:13435500980@163.com 11 | */ 12 | 13 | public class ItemDragHelperCallback extends ItemTouchHelper.Callback { 14 | @Override 15 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 16 | int dragFlags; 17 | RecyclerView.LayoutManager manager = recyclerView.getLayoutManager(); 18 | if (manager instanceof GridLayoutManager || manager instanceof StaggeredGridLayoutManager) { 19 | dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; 20 | } else { 21 | dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; 22 | } 23 | //不支持滑动删除 24 | int swipeFlags = 0; 25 | return makeMovementFlags(dragFlags, swipeFlags); 26 | } 27 | 28 | /** 29 | * 当ItemTouchHelper要将拖动的项目从其旧位置移动到新位置时调用。 30 | * 31 | * @param recyclerView 32 | * @param viewHolder 33 | * @param target 34 | * @return 35 | */ 36 | @Override 37 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { 38 | // 不同Type之间不可移动 39 | if (viewHolder.getItemViewType() != target.getItemViewType()) { 40 | return false; 41 | } 42 | if (recyclerView.getAdapter() instanceof OnItemMoveListener) { 43 | //回调OnItemMoveListener:传递原来position,目标position 44 | OnItemMoveListener listener = ((OnItemMoveListener) recyclerView.getAdapter()); 45 | listener.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition()); 46 | } 47 | return true; 48 | } 49 | 50 | /** 51 | * 刷新时调用 52 | * 53 | * @param viewHolder 54 | * @param direction 55 | */ 56 | @Override 57 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { 58 | 59 | } 60 | 61 | /** 62 | * 刷新或拖动时被调用。如果你重写这个方法,你应该调用super。 63 | * 64 | * @param viewHolder 65 | * @param actionState 66 | */ 67 | @Override 68 | public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) { 69 | // 不在闲置状态 70 | if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) { 71 | if (viewHolder instanceof OnDragVHListener) { 72 | //回调选中时Listener 73 | OnDragVHListener itemViewHolder = (OnDragVHListener) viewHolder; 74 | itemViewHolder.onItemSelected(); 75 | } 76 | } 77 | super.onSelectedChanged(viewHolder, actionState); 78 | } 79 | 80 | /** 81 | * 当用户与元素的交互结束并且它也完成了它的动画时调用 82 | * 83 | * @param recyclerView 84 | * @param viewHolder 85 | */ 86 | @Override 87 | public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 88 | if (viewHolder instanceof OnDragVHListener) { 89 | //回调拖拽结束的Listene 90 | OnDragVHListener itemViewHolder = (OnDragVHListener) viewHolder; 91 | itemViewHolder.onItemFinish(); 92 | } 93 | super.clearView(recyclerView, viewHolder); 94 | } 95 | 96 | @Override 97 | public boolean isLongPressDragEnabled() { 98 | return false; 99 | } 100 | 101 | @Override 102 | public boolean isItemViewSwipeEnabled() { 103 | return false; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/helper/OnDragVHListener.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.helper; 2 | 3 | /** 4 | * Created by ChinaLHR on 2016/12/23. 5 | * Email:13435500980@163.com 6 | * ViewHolder 被选中 以及 拖拽释放 触发监听器 7 | */ 8 | 9 | public interface OnDragVHListener { 10 | //Item选中时触发 11 | void onItemSelected(); 12 | 13 | //Item拖拽结束后触发 14 | void onItemFinish(); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/adapter/helper/OnItemMoveListener.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.adapter.helper; 2 | 3 | /** 4 | * Created by ChinaLHR on 2016/12/23. 5 | * Email:13435500980@163.com 6 | * Item移动后回调 7 | */ 8 | 9 | public interface OnItemMoveListener { 10 | 11 | void onItemMove(int fromPosition, int toPosition); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/doubanservice/DouBanService.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.doubanservice; 2 | 3 | import com.lhr.jiandou.model.bean.ActorDetailsBean; 4 | import com.lhr.jiandou.model.bean.BookDetailsBean; 5 | import com.lhr.jiandou.model.bean.BookHttpResult; 6 | import com.lhr.jiandou.model.bean.BooksBean; 7 | import com.lhr.jiandou.model.bean.MovieDetailsBean; 8 | import com.lhr.jiandou.model.bean.MovieHttpResult; 9 | import com.lhr.jiandou.model.bean.SubjectsBean; 10 | 11 | import java.util.List; 12 | 13 | import retrofit2.http.GET; 14 | import retrofit2.http.Path; 15 | import retrofit2.http.Query; 16 | import rx.Observable; 17 | 18 | /** 19 | * Created by ChinaLHR on 2016/12/15. 20 | * Email:13435500980@163.com 21 | */ 22 | 23 | public interface DouBanService { 24 | /** 25 | * 根据tag获取电影 26 | * https://api.douban.com/v2/movie/search?tag=喜剧&start=20 27 | * 28 | * @return 29 | */ 30 | 31 | @GET("search") 32 | Observable>> getMovieByTag 33 | (@Query("tag") String tag, @Query("start") int start, @Query("count") int count); 34 | 35 | /** 36 | * 获取正在热映的电影 37 | * https://api.douban.com/v2/movie/in_theaters 38 | */ 39 | @GET("in_theaters") 40 | Observable>> getMovieByHot 41 | (@Query("start") int start, @Query("count") int count); 42 | 43 | /** 44 | * 即将上映的电影 45 | * https://api.douban.com/v2/movie/coming_soon 46 | */ 47 | @GET("coming_soon") 48 | Observable>> getMovieByNew 49 | (@Query("start") int start, @Query("count") int count); 50 | 51 | /** 52 | * 电影top250 53 | * https://api.douban.com/v2/movie/top250?start=20&count=60 54 | */ 55 | @GET("top250") 56 | Observable>> getMovieByTop 57 | (@Query("start") int start, @Query("count") int count); 58 | 59 | /** 60 | * 根据关键字查找电影 61 | * https://api.douban.com/v2/movie/search?q=无敌&start=20&count=5 62 | * 63 | * @return 64 | */ 65 | @GET("search") 66 | Observable>> getMovieByQ 67 | (@Query("q") String q, @Query("start") int start, @Query("count") int count); 68 | 69 | /** 70 | * 根据tag获取图书 71 | * https://api.douban.com/v2/book/search?tag=日本文学&start=20&count=60 72 | * 73 | * @return 74 | */ 75 | @GET("search") 76 | Observable>> getBooksByTag 77 | (@Query("tag") String tag, @Query("start") int start, @Query("count") int count); 78 | 79 | 80 | @GET("subject/{MovieId}") 81 | Observable getMovieDetails 82 | (@Path("MovieId") String MovieId); 83 | 84 | @GET("celebrity/{actorId}") 85 | Observable getActorDetails 86 | (@Path("actorId") String actorId); 87 | 88 | @GET("{BookId}") 89 | Observable getBookDetails 90 | (@Path("BookId") String BookId); 91 | 92 | @GET("search") 93 | Observable>> getBooksByQ 94 | (@Query("q") String q, @Query("start") int start, @Query("count") int count); 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/BookFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentStatePagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.fragment.base.BaseFragment; 16 | import com.lhr.jiandou.fragment.pagerfragment.BookPagerFragment; 17 | import com.lhr.jiandou.utils.Constants; 18 | import com.lhr.jiandou.utils.SpUtils; 19 | import com.lhr.jiandou.view.animation.DepthPageTransformer; 20 | 21 | import rx.Observable; 22 | 23 | /** 24 | * Created by ChinaLHR on 2016/12/13. 25 | * Email:13435500980@163.com 26 | */ 27 | 28 | public class BookFragment extends BaseFragment { 29 | 30 | private TabLayout fragmentbooktab; 31 | private ViewPager fragmentbookvp; 32 | 33 | @Override 34 | public void onCreate(@Nullable Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | String[] stringArray = SpUtils.getStringArray(getActivity(), Constants.BOOKKEY); 37 | if (stringArray != null && stringArray.length > 1) { 38 | Constants.BOOKTITLE = SpUtils.getStringArray(getActivity(), Constants.BOOKKEY); 39 | Constants.CHANGELABEL_BOOK = false; 40 | } 41 | } 42 | 43 | @Nullable 44 | @Override 45 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 46 | 47 | View view = inflater.inflate(R.layout.fragment_book, container, false); 48 | this.fragmentbookvp = (ViewPager) view.findViewById(R.id.fragment_book_vp); 49 | this.fragmentbooktab = (TabLayout) view.findViewById(R.id.fragment_book_tab); 50 | if (Constants.BOOKTITLE.length <= 5) { 51 | fragmentbooktab.setTabMode(TabLayout.MODE_FIXED); 52 | } else { 53 | fragmentbooktab.setTabMode(TabLayout.MODE_SCROLLABLE); 54 | } 55 | initData(); 56 | return view; 57 | } 58 | 59 | public void initData() { 60 | fragmentbookvp.setAdapter(new BookPagerAdapter(getChildFragmentManager())); 61 | //viewpager的初始化长度 62 | fragmentbookvp.setOffscreenPageLimit(Constants.BOOKTITLE.length); 63 | fragmentbookvp.setPageTransformer(true,new DepthPageTransformer()); 64 | fragmentbooktab.setupWithViewPager(fragmentbookvp); 65 | } 66 | 67 | class BookPagerAdapter extends FragmentStatePagerAdapter { 68 | 69 | public BookPagerAdapter(FragmentManager fm) { 70 | super(fm); 71 | } 72 | 73 | @Override 74 | public Fragment getItem(int position) { 75 | return new BookPagerFragment(Observable.just(position)); 76 | } 77 | 78 | @Override 79 | public int getCount() { 80 | 81 | return Constants.BOOKTITLE.length; 82 | 83 | } 84 | 85 | @Override 86 | public CharSequence getPageTitle(int position) { 87 | 88 | return Constants.BOOKTITLE[position]; 89 | 90 | } 91 | } 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/ChangeLabelFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentPagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.fragment.base.BaseFragment; 16 | import com.lhr.jiandou.fragment.pagerfragment.LabelPagerBookFragment; 17 | import com.lhr.jiandou.fragment.pagerfragment.LabelPagerMovieFragment; 18 | 19 | /** 20 | * Created by ChinaLHR on 2016/12/22. 21 | * Email:13435500980@163.com 22 | */ 23 | 24 | public class ChangeLabelFragment extends BaseFragment { 25 | private String[] title = new String[]{"电影标签", "图书标签"}; 26 | private ViewPager label_vp; 27 | private TabLayout label_tab; 28 | 29 | @Override 30 | public void onCreate(@Nullable Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | 33 | } 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | 39 | View view = inflater.inflate(R.layout.fragment_changelabel, container, false); 40 | label_vp = (ViewPager) view.findViewById(R.id.label_vp); 41 | label_tab = (TabLayout) view.findViewById(R.id.label_tab); 42 | label_vp.setAdapter(new FragmentAdapter(getChildFragmentManager())); 43 | label_tab.setupWithViewPager(label_vp); 44 | return view; 45 | } 46 | 47 | 48 | class FragmentAdapter extends FragmentPagerAdapter { 49 | 50 | public FragmentAdapter(FragmentManager fm) { 51 | super(fm); 52 | } 53 | 54 | @Override 55 | public Fragment getItem(int position) { 56 | if (position == 0) { 57 | return new LabelPagerMovieFragment(); 58 | } else { 59 | return new LabelPagerBookFragment(); 60 | } 61 | } 62 | 63 | @Override 64 | public int getCount() { 65 | return 2; 66 | } 67 | 68 | //返回Tag的标题 69 | @Override 70 | public CharSequence getPageTitle(int position) { 71 | return title[position]; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/CollectionFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.IdRes; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentStatePagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.fragment.base.BaseFragment; 16 | import com.lhr.jiandou.fragment.pagerfragment.CollectionPageFragment; 17 | import com.lhr.jiandou.utils.Constants; 18 | import com.roughike.bottombar.BottomBar; 19 | import com.roughike.bottombar.OnTabSelectListener; 20 | 21 | import rx.Observable; 22 | 23 | import static com.lhr.jiandou.utils.Constants.COLLECTION_TYPE; 24 | 25 | 26 | /** 27 | * Created by ChinaLHR on 2016/12/13. 28 | * Email:13435500980@163.com 29 | */ 30 | 31 | public class CollectionFragment extends BaseFragment{ 32 | private BottomBar collection_tab; 33 | private ViewPager collection_vp; 34 | @Override 35 | public void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | } 38 | 39 | @Nullable 40 | @Override 41 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 42 | 43 | View view = inflater.inflate(R.layout.fragment_collection, container, false); 44 | collection_vp = (ViewPager) view.findViewById(R.id.collection_vp); 45 | collection_tab = (BottomBar) view.findViewById(R.id.collection_tab); 46 | initView(); 47 | initListener(); 48 | return view; 49 | } 50 | 51 | private void initView() { 52 | collection_vp.setAdapter(new CollectionAdapter(getChildFragmentManager())); 53 | collection_vp.setOffscreenPageLimit(Constants.COLLECTION_TYPE.length); 54 | } 55 | 56 | /** 57 | * 初始化监听 58 | */ 59 | private void initListener() { 60 | collection_tab.setOnTabSelectListener(new OnTabSelectListener() { 61 | @Override 62 | public void onTabSelected(@IdRes int tabId) { 63 | switch (tabId) { 64 | case R.id.tab_movie: 65 | collection_vp.setCurrentItem(0, false); 66 | break; 67 | case R.id.tab_book: 68 | collection_vp.setCurrentItem(1, false); 69 | break; 70 | case R.id.tab_actor: 71 | collection_vp.setCurrentItem(2, false); 72 | break; 73 | } 74 | } 75 | }); 76 | } 77 | 78 | class CollectionAdapter extends FragmentStatePagerAdapter { 79 | 80 | public CollectionAdapter(FragmentManager fm) { 81 | super(fm); 82 | } 83 | 84 | @Override 85 | public Fragment getItem(int position) { 86 | return new CollectionPageFragment(Observable.just(COLLECTION_TYPE[position])); 87 | } 88 | 89 | @Override 90 | public int getCount() { 91 | return Constants.COLLECTION_TYPE.length; 92 | } 93 | } 94 | 95 | @Override 96 | public void onDestroy() { 97 | super.onDestroy(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/MovieFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentStatePagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.lhr.jiandou.R; 15 | import com.lhr.jiandou.fragment.base.BaseFragment; 16 | import com.lhr.jiandou.fragment.pagerfragment.MoviePagerFragment; 17 | import com.lhr.jiandou.utils.Constants; 18 | import com.lhr.jiandou.utils.SpUtils; 19 | import com.lhr.jiandou.view.animation.DepthPageTransformer; 20 | 21 | import rx.Observable; 22 | 23 | /** 24 | * Created by ChinaLHR on 2016/12/13. 25 | * Email:13435500980@163.com 26 | */ 27 | 28 | public class MovieFragment extends BaseFragment { 29 | private android.support.design.widget.TabLayout fragmentmovietab; 30 | private android.support.v4.view.ViewPager fragmentmovievp; 31 | 32 | @Override 33 | public void onCreate(@Nullable Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | String[] stringArray = SpUtils.getStringArray(getActivity(), Constants.MOVIEKEY); 36 | if(stringArray!=null&&stringArray.length>1){ 37 | Constants.MOVIETITLE = SpUtils.getStringArray(getActivity(),Constants.MOVIEKEY); 38 | Constants.CHANGELABEL_MOVIE = false; 39 | } 40 | 41 | } 42 | 43 | @Nullable 44 | @Override 45 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 46 | 47 | View view = inflater.inflate(R.layout.fragment_movie, container, false); 48 | this.fragmentmovievp = (ViewPager) view.findViewById(R.id.fragment_movie_vp); 49 | this.fragmentmovietab = (TabLayout) view.findViewById(R.id.fragment_movie_tab); 50 | if (Constants.MOVIETITLE.length<=5){ 51 | fragmentmovietab.setTabMode(TabLayout.MODE_FIXED); 52 | }else { 53 | fragmentmovietab.setTabMode(TabLayout.MODE_SCROLLABLE); 54 | } 55 | 56 | initData(); 57 | return view; 58 | } 59 | 60 | 61 | public void initData() { 62 | fragmentmovievp.setAdapter(new MoviePagerAdapter(getChildFragmentManager())); 63 | //viewpager的初始化长度 64 | fragmentmovievp.setOffscreenPageLimit(Constants.MOVIETITLE.length); 65 | fragmentmovievp.setPageTransformer(true,new DepthPageTransformer()); 66 | fragmentmovietab.setupWithViewPager(fragmentmovievp); 67 | } 68 | 69 | class MoviePagerAdapter extends FragmentStatePagerAdapter { 70 | 71 | public MoviePagerAdapter(FragmentManager fm) { 72 | super(fm); 73 | } 74 | 75 | @Override 76 | public Fragment getItem(int position) { 77 | return new MoviePagerFragment(Observable.just(position)); 78 | } 79 | 80 | @Override 81 | public int getCount() { 82 | 83 | return Constants.MOVIETITLE.length; 84 | 85 | } 86 | 87 | @Override 88 | public CharSequence getPageTitle(int position) { 89 | 90 | return Constants.MOVIETITLE[position]; 91 | 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment.base; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.support.v4.app.Fragment; 6 | 7 | /** 8 | * Created by ChinaLHR on 2016/12/13. 9 | * Email:13435500980@163.com 10 | */ 11 | 12 | public class BaseFragment extends Fragment { 13 | public Activity mActivity; 14 | 15 | 16 | @Override 17 | public void onAttach(Context context) { 18 | super.onAttach(context); 19 | mActivity = (Activity)context; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/factory/FragmentFactory.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment.factory; 2 | 3 | import com.lhr.jiandou.fragment.BookFragment; 4 | import com.lhr.jiandou.fragment.ChangeLabelFragment; 5 | import com.lhr.jiandou.fragment.CollectionFragment; 6 | import com.lhr.jiandou.fragment.LeaderboardFragment; 7 | import com.lhr.jiandou.fragment.MovieFragment; 8 | import com.lhr.jiandou.fragment.base.BaseFragment; 9 | import com.lhr.jiandou.utils.Constants; 10 | 11 | /** 12 | * Created by ChinaLHR on 2016/12/13. 13 | * Email:13435500980@163.com 14 | */ 15 | 16 | public class FragmentFactory { 17 | public static BaseFragment getFragment(String title) { 18 | BaseFragment fragment = null; 19 | switch (title) { 20 | case Constants.MOVIE: 21 | fragment = new MovieFragment(); 22 | break; 23 | case Constants.BOOK: 24 | fragment = new BookFragment(); 25 | break; 26 | case Constants.LIST: 27 | fragment = new LeaderboardFragment(); 28 | break; 29 | case Constants.COLLECTION: 30 | fragment = new CollectionFragment(); 31 | break; 32 | case Constants.CHANGESECTION: 33 | fragment = new ChangeLabelFragment(); 34 | break; 35 | } 36 | return fragment; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/fragment/pagerfragment/LabelPagerBookFragment.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.fragment.pagerfragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.widget.GridLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.support.v7.widget.helper.ItemTouchHelper; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | 13 | import com.lhr.jiandou.R; 14 | import com.lhr.jiandou.adapter.LabelAdapter; 15 | import com.lhr.jiandou.adapter.helper.ItemDragHelperCallback; 16 | import com.lhr.jiandou.utils.Constants; 17 | import com.lhr.jiandou.utils.ToastUtils; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import static com.lhr.jiandou.R.id.pager_f_labelmovie; 23 | 24 | /** 25 | * Created by ChinaLHR on 2016/12/23. 26 | * Email:13435500980@163.com 27 | */ 28 | 29 | public class LabelPagerBookFragment extends Fragment { 30 | private RecyclerView pager_f_labelbook; 31 | private List mLabel; 32 | private List oLabel; 33 | private LabelAdapter adapter; 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | View view = inflater.inflate(R.layout.pagerfragment_labelm, container, false); 39 | pager_f_labelbook = (RecyclerView) view.findViewById(pager_f_labelmovie); 40 | initdata(); 41 | init(); 42 | return view; 43 | } 44 | 45 | private void init() { 46 | 47 | GridLayoutManager manager = new GridLayoutManager(getActivity(), 4); 48 | pager_f_labelbook.setLayoutManager(manager); 49 | ItemDragHelperCallback callback = new ItemDragHelperCallback(); 50 | final ItemTouchHelper helper = new ItemTouchHelper(callback); 51 | helper.attachToRecyclerView(pager_f_labelbook); 52 | 53 | adapter = new LabelAdapter(getActivity(), helper, mLabel, oLabel,Constants.BOOKKEY); 54 | adapter.setOnMyChannelItemClickListener(new LabelAdapter.OnMyChannelItemClickListener() { 55 | @Override 56 | public void onItemClick(View v, int position) { 57 | ToastUtils.show(getActivity(),"请长按或者点击编辑更换标签"); 58 | } 59 | }); 60 | //设置头布局占四个span,其他占一个 61 | manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { 62 | @Override 63 | public int getSpanSize(int position) { 64 | int viewType = adapter.getItemViewType(position); 65 | return viewType == adapter.TYPE_MY || viewType == adapter.TYPE_OTHER ? 1 : 4; 66 | } 67 | }); 68 | 69 | pager_f_labelbook.setAdapter(adapter); 70 | } 71 | 72 | 73 | private void initdata() { 74 | mLabel = new ArrayList<>(); 75 | oLabel = new ArrayList<>(); 76 | for (int i = 0; i < Constants.BOOKTITLE.length; i++) { 77 | mLabel.add(Constants.BOOKTITLE[i]); 78 | } 79 | boolean flag = true; 80 | for(String s:Constants.ALLBOOK){ 81 | for(int i=0;i mLabel; 30 | private List oLabel; 31 | private LabelAdapter adapter; 32 | @Override 33 | public void onCreate(@Nullable Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | } 36 | 37 | @Nullable 38 | @Override 39 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 40 | View view = inflater.inflate(R.layout.pagerfragment_labelm, container, false); 41 | pager_f_labelmovie = (RecyclerView) view.findViewById(R.id.pager_f_labelmovie); 42 | initdata(); 43 | init(); 44 | return view; 45 | } 46 | 47 | private void init() { 48 | 49 | GridLayoutManager manager = new GridLayoutManager(getActivity(), 4); 50 | pager_f_labelmovie.setLayoutManager(manager); 51 | ItemDragHelperCallback callback = new ItemDragHelperCallback(); 52 | final ItemTouchHelper helper = new ItemTouchHelper(callback); 53 | helper.attachToRecyclerView(pager_f_labelmovie); 54 | 55 | adapter = new LabelAdapter(getActivity(), helper, mLabel, oLabel,Constants.MOVIEKEY); 56 | adapter.setOnMyChannelItemClickListener(new LabelAdapter.OnMyChannelItemClickListener() { 57 | @Override 58 | public void onItemClick(View v, int position) { 59 | ToastUtils.show(getActivity(),"请长按或者点击编辑更换标签"); 60 | } 61 | }); 62 | //设置头布局占四个span,其他占一个 63 | manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { 64 | @Override 65 | public int getSpanSize(int position) { 66 | int viewType = adapter.getItemViewType(position); 67 | return viewType == adapter.TYPE_MY || viewType == adapter.TYPE_OTHER ? 1 : 4; 68 | } 69 | }); 70 | 71 | pager_f_labelmovie.setAdapter(adapter); 72 | 73 | } 74 | 75 | private void initdata() { 76 | mLabel = new ArrayList<>(); 77 | oLabel = new ArrayList<>(); 78 | for (int i = 0; i < Constants.MOVIETITLE.length; i++) { 79 | mLabel.add(Constants.MOVIETITLE[i]); 80 | } 81 | boolean flag = true; 82 | for(String s:Constants.ALLMOVIE){ 83 | for(int i=0;i { 9 | 10 | private int count; 11 | private int start; 12 | private int total; 13 | private T books; 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public void setCount(int count) { 20 | this.count = count; 21 | } 22 | 23 | public int getStart() { 24 | return start; 25 | } 26 | 27 | public void setStart(int start) { 28 | this.start = start; 29 | } 30 | 31 | public int getTotal() { 32 | return total; 33 | } 34 | 35 | public void setTotal(int total) { 36 | this.total = total; 37 | } 38 | 39 | public T getBooks() { 40 | return books; 41 | } 42 | 43 | public void setBooks(T books) { 44 | this.books = books; 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/bean/MovieHttpResult.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.bean; 2 | 3 | /** 4 | * Created by ChinaLHR on 2016/12/15. 5 | * Email:13435500980@163.com 6 | */ 7 | 8 | public class MovieHttpResult { 9 | 10 | private int count; 11 | private int start; 12 | private int total; 13 | 14 | //模仿Data 15 | private T subjects; 16 | 17 | public int getCount() { 18 | return count; 19 | } 20 | 21 | public void setCount(int count) { 22 | this.count = count; 23 | } 24 | 25 | public int getStart() { 26 | return start; 27 | } 28 | 29 | public void setStart(int start) { 30 | this.start = start; 31 | } 32 | 33 | public int getTotal() { 34 | return total; 35 | } 36 | 37 | public void setTotal(int total) { 38 | this.total = total; 39 | } 40 | 41 | public T getSubjects() { 42 | return subjects; 43 | } 44 | public void setSubjects(T subjects) { 45 | this.subjects = subjects; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/bean/SpinnerBean.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.bean; 2 | 3 | /** 4 | * Created by ChinaLHR on 2017/1/10. 5 | * Email:13435500980@163.com 6 | */ 7 | 8 | public class SpinnerBean { 9 | 10 | private String name; 11 | private int id; 12 | 13 | 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | 23 | public int getId() { 24 | return id; 25 | } 26 | 27 | public void setId(int id) { 28 | this.id = id; 29 | } 30 | 31 | public SpinnerBean(String name, int id) { 32 | this.name = name; 33 | this.id = id; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/db/Actor_db.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.db; 2 | 3 | import org.greenrobot.greendao.annotation.Entity; 4 | import org.greenrobot.greendao.annotation.Id; 5 | import org.greenrobot.greendao.annotation.NotNull; 6 | import org.greenrobot.greendao.annotation.Generated; 7 | 8 | /** 9 | * Created by ChinaLHR on 2017/1/8. 10 | * Email:13435500980@163.com 11 | */ 12 | @Entity 13 | public class Actor_db { 14 | @Id(autoincrement = true) 15 | private Long id; 16 | 17 | @NotNull 18 | private String actor_id; 19 | 20 | public String getActor_id() { 21 | return actor_id; 22 | } 23 | 24 | public void setActor_id(String actor_id) { 25 | this.actor_id = actor_id; 26 | } 27 | 28 | @NotNull 29 | private String title; 30 | @NotNull 31 | private String imgurl; 32 | 33 | private String gender; 34 | 35 | private String born_place; 36 | 37 | private String time; 38 | 39 | @Generated(hash = 1006026375) 40 | public Actor_db(Long id, @NotNull String actor_id, @NotNull String title, 41 | @NotNull String imgurl, String gender, String born_place, String time) { 42 | this.id = id; 43 | this.actor_id = actor_id; 44 | this.title = title; 45 | this.imgurl = imgurl; 46 | this.gender = gender; 47 | this.born_place = born_place; 48 | this.time = time; 49 | } 50 | 51 | @Generated(hash = 87567351) 52 | public Actor_db() { 53 | } 54 | 55 | public Long getId() { 56 | return id; 57 | } 58 | 59 | public void setId(Long id) { 60 | this.id = id; 61 | } 62 | 63 | public String getTitle() { 64 | return title; 65 | } 66 | 67 | public void setTitle(String title) { 68 | this.title = title; 69 | } 70 | 71 | public String getImgurl() { 72 | return imgurl; 73 | } 74 | 75 | public void setImgurl(String imgurl) { 76 | this.imgurl = imgurl; 77 | } 78 | 79 | public String getGender() { 80 | return gender; 81 | } 82 | 83 | public void setGender(String gender) { 84 | this.gender = gender; 85 | } 86 | 87 | public String getBorn_place() { 88 | return born_place; 89 | } 90 | 91 | public void setBorn_place(String born_place) { 92 | this.born_place = born_place; 93 | } 94 | 95 | public String getTime() { 96 | return time; 97 | } 98 | 99 | public void setTime(String time) { 100 | this.time = time; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/db/Book_db.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.db; 2 | 3 | import org.greenrobot.greendao.annotation.Entity; 4 | import org.greenrobot.greendao.annotation.Generated; 5 | import org.greenrobot.greendao.annotation.Id; 6 | import org.greenrobot.greendao.annotation.NotNull; 7 | 8 | /** 9 | * Created by ChinaLHR on 2017/1/8. 10 | * Email:13435500980@163.com 11 | */ 12 | @Entity 13 | public class Book_db { 14 | @Id(autoincrement = true) 15 | private Long id; 16 | @NotNull 17 | private String book_id; 18 | 19 | 20 | @NotNull 21 | private String title; 22 | @NotNull 23 | private String imgurl; 24 | 25 | private float rating; 26 | 27 | private String author; 28 | 29 | private String publisher; 30 | 31 | private String time; 32 | 33 | @Generated(hash = 1026737697) 34 | public Book_db(Long id, @NotNull String book_id, @NotNull String title, 35 | @NotNull String imgurl, float rating, String author, String publisher, 36 | String time) { 37 | this.id = id; 38 | this.book_id = book_id; 39 | this.title = title; 40 | this.imgurl = imgurl; 41 | this.rating = rating; 42 | this.author = author; 43 | this.publisher = publisher; 44 | this.time = time; 45 | } 46 | 47 | @Generated(hash = 995350502) 48 | public Book_db() { 49 | } 50 | 51 | public Long getId() { 52 | return id; 53 | } 54 | 55 | public void setId(Long id) { 56 | this.id = id; 57 | } 58 | 59 | public String getTitle() { 60 | return title; 61 | } 62 | 63 | public void setTitle(String title) { 64 | this.title = title; 65 | } 66 | 67 | public String getImgurl() { 68 | return imgurl; 69 | } 70 | 71 | public void setImgurl(String imgurl) { 72 | this.imgurl = imgurl; 73 | } 74 | 75 | public String getTime() { 76 | return time; 77 | } 78 | 79 | public void setTime(String time) { 80 | this.time = time; 81 | } 82 | 83 | public String getPublisher() { 84 | return publisher; 85 | } 86 | 87 | public void setPublisher(String publisher) { 88 | this.publisher = publisher; 89 | } 90 | 91 | public String getAuthor() { 92 | return author; 93 | } 94 | 95 | public void setAuthor(String author) { 96 | this.author = author; 97 | } 98 | 99 | public float getRating() { 100 | return rating; 101 | } 102 | 103 | public void setRating(float rating) { 104 | this.rating = rating; 105 | } 106 | 107 | public String getBook_id() { 108 | return book_id; 109 | } 110 | 111 | public void setBook_id(String book_id) { 112 | this.book_id = book_id; 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/db/GreenDaoHelper.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.db; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | 6 | /** 7 | * Created by ChinaLHR on 2017/1/8. 8 | * Email:13435500980@163.com 9 | */ 10 | 11 | public class GreenDaoHelper { 12 | private final static String dbName = "jiandou_db"; 13 | private static SQLiteDatabase db; 14 | private static GreenDaoHelper mInstance; 15 | private DaoMaster.DevOpenHelper openHelper; 16 | private Context context; 17 | private static DaoMaster mDaoMaster; 18 | private static DaoSession mDaoSession; 19 | 20 | private GreenDaoHelper (Context context){ 21 | this.context = context; 22 | openHelper = new DaoMaster.DevOpenHelper(context, dbName, null); 23 | db = openHelper.getWritableDatabase(); 24 | mDaoMaster = new DaoMaster(db); 25 | mDaoSession = mDaoMaster.newSession(); 26 | } 27 | 28 | public static GreenDaoHelper getInstance(Context context){ 29 | if (mInstance == null) { 30 | synchronized (GreenDaoHelper.class) { 31 | if (mInstance == null) { 32 | mInstance = new GreenDaoHelper(context); 33 | } 34 | } 35 | } 36 | return mInstance; 37 | } 38 | 39 | /** 40 | * 获取DaoSession 41 | * @return 42 | */ 43 | public DaoSession getDaoSession() { 44 | return mDaoSession; 45 | } 46 | /** 47 | * 获取数据库 48 | * 49 | * @return 50 | */ 51 | public SQLiteDatabase getDb() { 52 | return db; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/db/Movie_db.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.db; 2 | 3 | import org.greenrobot.greendao.annotation.Entity; 4 | import org.greenrobot.greendao.annotation.Generated; 5 | import org.greenrobot.greendao.annotation.Id; 6 | import org.greenrobot.greendao.annotation.NotNull; 7 | 8 | /** 9 | * Created by ChinaLHR on 2017/1/8. 10 | * Email:13435500980@163.com 11 | */ 12 | @Entity 13 | public class Movie_db { 14 | @Id(autoincrement = true) 15 | private Long id; 16 | @NotNull 17 | private String movieId; 18 | @NotNull 19 | private String title; 20 | @NotNull 21 | private String imgurl; 22 | 23 | private float rating; 24 | 25 | private String genres; 26 | 27 | private String year; 28 | 29 | private String time; 30 | 31 | @Generated(hash = 525101028) 32 | public Movie_db(Long id, @NotNull String movieId, @NotNull String title, 33 | @NotNull String imgurl, float rating, String genres, String year, 34 | String time) { 35 | this.id = id; 36 | this.movieId = movieId; 37 | this.title = title; 38 | this.imgurl = imgurl; 39 | this.rating = rating; 40 | this.genres = genres; 41 | this.year = year; 42 | this.time = time; 43 | } 44 | 45 | @Generated(hash = 1012879875) 46 | public Movie_db() { 47 | } 48 | 49 | public Long getId() { 50 | return id; 51 | } 52 | 53 | public void setId(Long id) { 54 | this.id = id; 55 | } 56 | 57 | public String getTitle() { 58 | return title; 59 | } 60 | 61 | public void setTitle(String title) { 62 | this.title = title; 63 | } 64 | 65 | public String getImgurl() { 66 | return imgurl; 67 | } 68 | 69 | public void setImgurl(String imgurl) { 70 | this.imgurl = imgurl; 71 | } 72 | 73 | public float getRating() { 74 | return rating; 75 | } 76 | 77 | public void setRating(float rating) { 78 | this.rating = rating; 79 | } 80 | 81 | public String getGenres() { 82 | return genres; 83 | } 84 | 85 | public void setGenres(String genres) { 86 | this.genres = genres; 87 | } 88 | 89 | public String getYear() { 90 | return year; 91 | } 92 | 93 | public void setYear(String year) { 94 | this.year = year; 95 | } 96 | 97 | public String getTime() { 98 | return time; 99 | } 100 | 101 | public void setTime(String time) { 102 | this.time = time; 103 | } 104 | 105 | public String getMovieId() { 106 | return movieId; 107 | } 108 | 109 | public void setMovieId(String movieId) { 110 | this.movieId = movieId; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/dbinterface/DbObservrt.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.dbinterface; 2 | 3 | /** 4 | * Created by ChinaLHR on 2017/1/9. 5 | * Email:13435500980@163.com 6 | */ 7 | 8 | public interface DbObservrt { 9 | 10 | void updateMovie(); 11 | 12 | void updateBook(); 13 | 14 | void updateActor(); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/dbinterface/DbSubject.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.dbinterface; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Created by ChinaLHR on 2017/1/9. 7 | * Email:13435500980@163.com 8 | */ 9 | 10 | public abstract class DbSubject { 11 | protected ArrayList observers = new ArrayList<>(); 12 | 13 | public void attach(DbObservrt dbo) { 14 | if (dbo == null) throw new NullPointerException(); 15 | if (!observers.contains(dbo)) { 16 | observers.add(dbo); 17 | } 18 | } 19 | 20 | public void detach(DbObservrt dbo) { 21 | observers.remove(dbo); 22 | } 23 | 24 | public abstract void notifyUpdateMovie(); 25 | public abstract void notifyUpdateBook(); 26 | public abstract void notifyUpdateActor(); 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/model/httputils/CachingControlInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.model.httputils; 2 | 3 | import com.lhr.jiandou.MyApplication; 4 | 5 | import java.io.IOException; 6 | 7 | import okhttp3.Interceptor; 8 | import okhttp3.Request; 9 | 10 | /** 11 | * Created by ChinaLHR on 2016/12/18. 12 | * Email:13435500980@163.com 13 | */ 14 | 15 | public class CachingControlInterceptor { 16 | /** 17 | * 拦截器 18 | */ 19 | private static final int TIMEOUT_CONNECT = 5; //5秒 20 | private static final int TIMEOUT_DISCONNECT = 60 * 60 * 24 * 7; //7天 21 | public static final Interceptor REWRITE_RESPONSE_INTERCEPTOR = new Interceptor() { 22 | @Override 23 | public okhttp3.Response intercept(Chain chain) throws IOException { 24 | 25 | String cache = chain.request().header("cache"); 26 | okhttp3.Response originalResponse = chain.proceed(chain.request()); 27 | String cacheControl = originalResponse.header("Cache-Control"); 28 | if (cacheControl == null) { 29 | if (cache == null || "".equals(cache)) { 30 | cache = TIMEOUT_CONNECT + ""; 31 | } 32 | originalResponse = originalResponse.newBuilder() 33 | .header("Cache-Control", "public, max-age=" + cache) 34 | .build(); 35 | return originalResponse; 36 | } else { 37 | return originalResponse; 38 | } 39 | } 40 | }; 41 | public static final Interceptor REWRITE_RESPONSE_INTERCEPTOR_OFFLINE = new Interceptor() { 42 | @Override 43 | public okhttp3.Response intercept(Chain chain) throws IOException { 44 | Request request = chain.request(); 45 | if (!MyApplication.isNetworkAvailable(MyApplication.getContext())) { 46 | request = request.newBuilder() 47 | .header("Cache-Control", "public, only-if-cached, max-stale=" + TIMEOUT_DISCONNECT) 48 | .build(); 49 | } 50 | return chain.proceed(request); 51 | } 52 | }; 53 | 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/CacheUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.FileOutputStream; 8 | import java.io.IOException; 9 | import java.io.ObjectInputStream; 10 | import java.io.ObjectOutputStream; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by ChinaLHR on 2016/12/18. 15 | * Email:13435500980@163.com 16 | *

17 | * 序列化缓存List 18 | */ 19 | 20 | public class CacheUtils { 21 | public static final String DataCache_movie = "Cache_File_movie"; 22 | public static final String DataCache_book = "Cache_File_book"; 23 | 24 | /** 25 | * 序列化List 26 | */ 27 | public static void savebean(Context context, List list, String Cache_type, String name) { 28 | if (context == null) { 29 | return; 30 | } 31 | File file; 32 | if (!Cache_type.isEmpty()) { 33 | File fileDir = new File(context.getFilesDir(), Cache_type); 34 | if (!fileDir.exists() || !fileDir.isDirectory()) { 35 | fileDir.mkdir(); 36 | } 37 | file = new File(fileDir, name); 38 | } else { 39 | file = new File(context.getFilesDir(), name); 40 | } 41 | if (file.exists()) { 42 | file.delete(); 43 | } 44 | try { 45 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file)); 46 | oos.writeObject(list); 47 | oos.flush(); 48 | 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | 53 | } 54 | 55 | /** 56 | * 反序列化 57 | * 58 | * @param context 59 | * @param name 60 | * @param 61 | * @return 62 | */ 63 | public static List readbean(Context context, String Cache_type, String name) { 64 | if (name == null) { 65 | return null; 66 | } else { 67 | File file; 68 | if (!Cache_type.isEmpty()) { 69 | File fileDir = new File(context.getFilesDir(), Cache_type); 70 | if (!fileDir.exists() || !fileDir.isDirectory()) { 71 | fileDir.mkdir(); 72 | } 73 | 74 | file = new File(fileDir, name); 75 | 76 | } else { 77 | file = new File(context.getFilesDir(), name); 78 | } 79 | try { 80 | ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file)); 81 | List list = (List) ois.readObject(); 82 | ois.close(); 83 | return list; 84 | } catch (Exception e) { 85 | e.printStackTrace(); 86 | return null; 87 | } 88 | } 89 | 90 | 91 | } 92 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/ClearCacheUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import com.lhr.jiandou.MyApplication; 4 | 5 | import java.io.File; 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | * Created by ChinaLHR on 2017/1/2. 10 | * Email:13435500980@163.com 11 | */ 12 | 13 | public class ClearCacheUtils { 14 | /** 15 | * 获取缓存 16 | * @return 17 | */ 18 | public static String getCacheSize() { 19 | return getFormatSize(getFolderSize(MyApplication.getContext().getCacheDir())); 20 | } 21 | 22 | /** 23 | * 删除缓存 24 | * @param dir 25 | * @return 26 | */ 27 | public static boolean deleteDir(File dir) { 28 | if (dir != null && dir.isDirectory()) { 29 | String[] children = dir.list(); 30 | for (String aChildren : children) { 31 | boolean success = deleteDir(new File(dir, aChildren)); 32 | if (!success) { 33 | return false; 34 | } 35 | } 36 | } 37 | assert dir != null; 38 | return dir.delete(); 39 | } 40 | 41 | private static long getFolderSize(File file) { 42 | long size = 0; 43 | try { 44 | File[] fileList = file.listFiles(); 45 | for (File aFileList : fileList) { 46 | // 如果下面还有文件 47 | if (aFileList.isDirectory()) { 48 | size = size + getFolderSize(aFileList); 49 | } else { 50 | size = size + aFileList.length(); 51 | } 52 | } 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | } 56 | return size; 57 | } 58 | private static String getFormatSize(double size) { 59 | double kiloByte = size / 1024; 60 | if (kiloByte < 1) { 61 | return "0K"; 62 | } 63 | 64 | double megaByte = kiloByte / 1024; 65 | if (megaByte < 1) { 66 | BigDecimal result1 = new BigDecimal(Double.toString(kiloByte)); 67 | return result1.setScale(2, BigDecimal.ROUND_HALF_UP) 68 | .toPlainString() + "KB"; 69 | } 70 | 71 | double gigaByte = megaByte / 1024; 72 | if (gigaByte < 1) { 73 | BigDecimal result2 = new BigDecimal(Double.toString(megaByte)); 74 | return result2.setScale(2, BigDecimal.ROUND_HALF_UP) 75 | .toPlainString() + "MB"; 76 | } 77 | 78 | double teraBytes = gigaByte / 1024; 79 | if (teraBytes < 1) { 80 | BigDecimal result3 = new BigDecimal(Double.toString(gigaByte)); 81 | return result3.setScale(2, BigDecimal.ROUND_HALF_UP) 82 | .toPlainString() + "GB"; 83 | } 84 | BigDecimal result4 = new BigDecimal(teraBytes); 85 | return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() 86 | + "TB"; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | /** 4 | * Created by ChinaLHR on 2016/12/13. 5 | * Email:13435500980@163.com 6 | */ 7 | 8 | public class Constants { 9 | public static final String MOVIE = "电影"; 10 | public static final String BOOK = "图书"; 11 | public static final String LIST = "电影榜单"; 12 | public static final String COLLECTION = "我的收藏"; 13 | public static final String CHANGESECTION = "更改标签"; 14 | public static final String SETTING = "设置"; 15 | public static boolean CHANGELABEL_MOVIE = false; 16 | public static boolean CHANGELABEL_BOOK = false; 17 | public static String[] MOVIETITLE = {"爱情", "喜剧", "动画", "科幻", "动作", "经典"}; 18 | 19 | public static String[] BOOKTITLE = {"小说", "名著", "科幻", "历史", "爱情", "编程"}; 20 | 21 | public static String[] LEADERBOARD = {"正在热映", "即将上映", "Top250"}; 22 | public static String[] ALLMOVIE = { 23 | "爱情", "喜剧", "动画", "剧情", 24 | "科幻", "动作", "经典", "悬疑", 25 | "青春", "犯罪", "惊悚", "文艺", 26 | "搞笑", "纪录片", "励志", "恐怖", 27 | "战争", "短片", "黑色幽默", "魔幻", 28 | "传记", "情色", "感人", "暴力", 29 | "动画", "短片家庭", "音乐", "童年", 30 | "浪漫", "黑帮", "女性", "同志", 31 | "史诗", "童话", "烂片", "cult" 32 | }; 33 | 34 | public static String[] ALLBOOK = { 35 | "小说", "日本", "历史", "外国文学", 36 | "漫画", "文学", "中国", "心理学", 37 | "随笔", "哲学", "绘本", "中国文学", 38 | "推理", "美国", "爱情", "经典 ", 39 | "传记", "日本文学", "散文", "文化", 40 | "青春", "旅行", "社会学", "英国", 41 | "言情", "科幻", "科普", "生活 ", 42 | "东野圭吾", "村上春树", "艺术", "悬疑", 43 | "成长", "台湾", "经济学", "设计", 44 | "管理", "励志", "法国", "武侠", 45 | "社会", "政治", "思维", "心理", 46 | "奇幻", "经济", "诗歌", "童话", 47 | "韩寒", "摄影", "日本漫画", "建筑", 48 | "耽美", "商业", "亦舒", "金融", 49 | "女性", "宗教", "电影", "人生", "编程", 50 | "杂文", "互联网", "王小波", "三毛 ", 51 | "英国文学", "儿童文学", "计算机", "古典文学 ", 52 | "数学", "投资", "推理小说", "网络小说", 53 | "职场", "张爱玲", "安妮宝贝", "政治学", 54 | "美国文学", "名著", "香港", "余华", 55 | "美食", "教育", "郭敬明", "穿越", 56 | "个人管理", "金庸", "工具书", "德国 ", 57 | 58 | }; 59 | /** 60 | * KEY 61 | */ 62 | public static String MOVIEKEY = "moviekey"; 63 | public static String BOOKKEY = "bookkey"; 64 | public static String NAVKEY = "navkey"; 65 | 66 | /** 67 | * SP key 68 | */ 69 | public static String PREF_KEY_THEME = "pref_key_theme"; 70 | public static String PREF_KEY_AUTO_IMG = "pref_key_auto_img"; 71 | public static String PREF_KEY_CACHE = "pref_key_cache"; 72 | public static String PREF_KEY_CODE = "pref_key_code"; 73 | public static String PREF_KEY_PROTOCOL = "pref_key_protocol"; 74 | public static String PREF_KEY_FEEDBACK = "pref_key_feedback"; 75 | 76 | /** 77 | * Collect 78 | */ 79 | public static String[] COLLECTION_TYPE = {"电影","图书","影人"}; 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/ImageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.graphics.Bitmap; 4 | import android.support.v7.graphics.Palette; 5 | 6 | import com.lhr.jiandou.MyApplication; 7 | import com.lhr.jiandou.R; 8 | 9 | /** 10 | * Created by ChinaLHR on 2016/12/19. 11 | * Email:13435500980@163.com 12 | */ 13 | 14 | public class ImageUtils { 15 | 16 | /** 17 | * 根据bitmap提取颜色 18 | * 19 | * @param bitmap 20 | * @return 21 | */ 22 | public static int getColor(Bitmap bitmap) { 23 | if (bitmap != null) { 24 | Palette p = Palette.from(bitmap).generate(); 25 | Palette.Swatch s_dm = p.getDarkMutedSwatch(); 26 | Palette.Swatch s_dv = p.getDarkVibrantSwatch(); 27 | if (s_dm != null) { 28 | return s_dm.getRgb(); 29 | } else { 30 | if (s_dv != null) { 31 | return s_dv.getRgb(); 32 | } else { 33 | return UIUtils.getColor(MyApplication.getContext(), R.color.colorPrimary); 34 | } 35 | } 36 | } else { 37 | return UIUtils.getColor(MyApplication.getContext(), R.color.colorPrimary); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by ChinaLHR on 2016/12/13. 7 | * Email:13435500980@163.com 8 | */ 9 | 10 | public class LogUtils { 11 | private LogUtils() 12 | { 13 | throw new UnsupportedOperationException("cannot be instantiated"); 14 | } 15 | // 是否需要打印bug,可以在application的onCreate函数里面初始化 16 | public static boolean isDebug = true; 17 | private static final String TAG = "ChinaLHR"; 18 | 19 | // 下面四个是默认tag的函数 20 | public static void i(String msg) 21 | { 22 | if (isDebug) 23 | Log.i(TAG, msg); 24 | } 25 | 26 | public static void d(String msg) 27 | { 28 | if (isDebug) 29 | Log.d(TAG, msg); 30 | } 31 | 32 | public static void e(String msg) 33 | { 34 | if (isDebug) 35 | Log.e(TAG, msg); 36 | } 37 | 38 | public static void v(String msg) 39 | { 40 | if (isDebug) 41 | Log.v(TAG, msg); 42 | } 43 | 44 | // 下面是传入自定义tag的函数 45 | public static void i(String tag, String msg) 46 | { 47 | if (isDebug) 48 | Log.i(tag, msg); 49 | } 50 | 51 | public static void d(String tag, String msg) 52 | { 53 | if (isDebug) 54 | Log.i(tag, msg); 55 | } 56 | 57 | public static void e(String tag, String msg) 58 | { 59 | if (isDebug) 60 | Log.i(tag, msg); 61 | } 62 | 63 | public static void v(String tag, String msg) 64 | { 65 | if (isDebug) 66 | Log.i(tag, msg); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/PreferncesUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | /** 7 | * Created by ChinaLHR on 2017/1/1. 8 | * Email:13435500980@163.com 9 | */ 10 | 11 | public class PreferncesUtils { 12 | 13 | private static SharedPreferences sp; 14 | 15 | private static final String Catch_file = "com.lhr.jiandou_preferences"; 16 | 17 | public static String getString(Context ctx, String key, String defValue) { 18 | if (sp == null) { 19 | sp = ctx.getSharedPreferences(Catch_file, Context.MODE_PRIVATE); 20 | } 21 | return sp.getString(key, defValue); 22 | } 23 | 24 | public static Boolean getBoolean(Context ctx, String key, boolean defValue) { 25 | if (sp == null) { 26 | sp = ctx.getSharedPreferences(Catch_file, Context.MODE_PRIVATE); 27 | } 28 | return sp.getBoolean(key, defValue); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/SnackBarUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.support.design.widget.CoordinatorLayout; 4 | import android.support.design.widget.Snackbar; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by ChinaLHR on 2016/12/19. 9 | * Email:13435500980@163.com 10 | */ 11 | 12 | public class SnackBarUtils { 13 | public static Snackbar mSnackbar; 14 | public static void showSnackBar(View v, String str) { 15 | 16 | if (v instanceof CoordinatorLayout) { 17 | mSnackbar = Snackbar.make(v,str,Snackbar.LENGTH_SHORT).setAction("确定", new View.OnClickListener() { 18 | @Override 19 | public void onClick(View view) { 20 | mSnackbar.dismiss(); 21 | } 22 | }); 23 | mSnackbar.show(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.widget.TextView; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by ChinaLHR on 2016/12/25. 10 | * Email:13435500980@163.com 11 | */ 12 | 13 | public class StringUtils { 14 | 15 | public static void addViewString(List list, TextView view) { 16 | for (int i = 0; i < list.size(); i++) { 17 | if (i == list.size() - 1) { 18 | view.append(list.get(i)); 19 | } else { 20 | view.append(list.get(i) + "/"); 21 | } 22 | } 23 | } 24 | 25 | @NonNull 26 | public static String SpliceString(List list) { 27 | StringBuilder sb = new StringBuilder(); 28 | for (int i = 0; i < list.size(); i++) { 29 | if (i == list.size() - 1) { 30 | sb.append(list.get(i)); 31 | } else { 32 | sb.append(list.get(i) + "/"); 33 | } 34 | } 35 | return sb.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/ToastUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | import android.widget.Toast; 8 | 9 | import com.lhr.jiandou.R; 10 | 11 | /** 12 | * Created by ChinaLHR on 2016/12/13. 13 | * Email:13435500980@163.com 14 | */ 15 | 16 | public class ToastUtils { 17 | 18 | private ToastUtils() { 19 | throw new UnsupportedOperationException("cannot be instantiated"); 20 | } 21 | 22 | public static boolean isShow = true; 23 | public static Toast toast = null; 24 | 25 | /** 26 | * 显示Toast 27 | * 28 | * @param context 29 | * @param message 30 | */ 31 | public static void show(Context context, String message) { 32 | if (isShow) { 33 | toast = new Toast(context); 34 | LayoutInflater inflater = LayoutInflater.from(context); 35 | View view = inflater.inflate(R.layout.mtoast_layout, null); 36 | TextView tv = (TextView) view.findViewById(R.id.toast_tv); 37 | if (message != null) { 38 | tv.setText(message); 39 | } 40 | toast.setView(view); 41 | toast.setDuration(Toast.LENGTH_SHORT); 42 | toast.show(); 43 | } 44 | } 45 | 46 | public static void cancel() { 47 | if (toast != null) { 48 | toast.cancel(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/UIUtils.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.graphics.drawable.Drawable; 6 | 7 | /** 8 | * Created by ChinaLHR on 2016/12/13. 9 | * Email:13435500980@163.com 10 | */ 11 | 12 | public class UIUtils { 13 | 14 | 15 | /** 16 | * 加载资源文件=================== 17 | */ 18 | // 获取字符串 19 | public static String getString(Context context,int id) { 20 | return context.getResources().getString(id); 21 | } 22 | 23 | // 获取字符串数组 24 | public static String[] getStringArray(Context context,int id) { 25 | return context.getResources().getStringArray(id); 26 | } 27 | 28 | // 获取图片 29 | public static Drawable getDrawable(Context context,int id) { 30 | return context.getResources().getDrawable(id); 31 | } 32 | 33 | // 获取颜色 34 | public static int getColor(Context context,int id) { 35 | return context.getResources().getColor(id); 36 | } 37 | 38 | // 根据id获取颜色的状态选择器 39 | public static ColorStateList getColorStateList(Context context,int id) { 40 | return context.getResources().getColorStateList(id); 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/jsoupUtils/GetActor.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils.jsoupUtils; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.select.Elements; 6 | 7 | import java.io.IOException; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.regex.Matcher; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * Created by ChinaLHR on 2016/12/22. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class GetActor { 19 | public String url = "https://movie.douban.com/celebrity/"; 20 | public Document doc; 21 | 22 | public GetActor(String id) { 23 | try { 24 | url = url + id + "/"; 25 | doc = Jsoup.connect(url).get(); 26 | } catch (IOException e) { 27 | e.printStackTrace(); 28 | } 29 | } 30 | 31 | /** 32 | * 获取影人图片 33 | * 34 | * @return 35 | */ 36 | public List getActorImage() { 37 | List list = new ArrayList<>(); 38 | String text; 39 | Pattern pattern = Pattern 40 | .compile("[http|https]+[://]+[0-9A-Za-z:/[-]_#[?][=][.][&]]*"); 41 | Elements select = doc.select("[class=pic-col5]"); 42 | Elements elements = select.select("img[src$=.jpg]"); 43 | for (int i = 0; i < elements.size(); i++) { 44 | text = elements.get(i).toString(); 45 | Matcher matcher = pattern.matcher(text); 46 | while (matcher.find()) { 47 | list.add(matcher.group()); 48 | } 49 | } 50 | return list; 51 | } 52 | 53 | /** 54 | * 获得影人简介 55 | */ 56 | public String getActorSummary() { 57 | String text; 58 | Elements select = doc.select("div.bd"); 59 | Elements selecthid = doc.select("[class=all hidden]"); 60 | if (selecthid.text().trim()!=null&&!selecthid.text().trim().equals("")){ 61 | text = doc.select("[class=all hidden]").text(); 62 | }else{ 63 | text = select.get(1).text(); 64 | } 65 | return text; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/jsoupUtils/GetLikeMovie.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils.jsoupUtils; 2 | 3 | 4 | import org.jsoup.Jsoup; 5 | import org.jsoup.nodes.Document; 6 | import org.jsoup.select.Elements; 7 | 8 | import java.io.IOException; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.regex.Matcher; 12 | import java.util.regex.Pattern; 13 | 14 | /** 15 | * Created by ChinaLHR on 2016/12/20. 16 | * Email:13435500980@163.com 17 | */ 18 | 19 | public class GetLikeMovie { 20 | public String url = "https://movie.douban.com/subject/"; 21 | public Document doc; 22 | 23 | public GetLikeMovie(String id) { 24 | try { 25 | url = url + id + "/"; 26 | doc = Jsoup.connect(url).get(); 27 | } catch (IOException e) { 28 | // TODO Auto-generated catch block 29 | e.printStackTrace(); 30 | } 31 | } 32 | 33 | /** 34 | * 获得相关电源的id 35 | * 36 | * @return 37 | */ 38 | public List getmovieId() { 39 | List list = new ArrayList<>(); 40 | // 获取id 41 | Elements select = doc.select("[class=recommendations-bd] dd"); 42 | Elements link = select.select("a"); 43 | for (int i = 0; i < link.size(); i++) { 44 | String movieId = link.get(i).toString().replaceAll("[^(0-9)]", ""); 45 | 46 | list.add(movieId); 47 | 48 | } 49 | 50 | return list; 51 | 52 | } 53 | 54 | /** 55 | * 获取相关电源的img链接 56 | * 57 | * @return 58 | */ 59 | public List getmovieimg() { 60 | List list = new ArrayList<>(); 61 | Pattern pattern = Pattern 62 | .compile("[http|https]+[://]+[0-9A-Za-z:/[-]_#[?][=][.][&]]*"); 63 | Elements select = doc.select("[class=recommendations-bd]"); 64 | Elements img = select.select("img[src$=.jpg]"); 65 | 66 | for (int i = 0; i < img.size(); i++) { 67 | Matcher matcher = pattern.matcher(img.get(i).toString()); 68 | while (matcher.find()) { 69 | list.add(matcher.group()); 70 | } 71 | } 72 | 73 | return list; 74 | } 75 | 76 | /** 77 | * 获取电影的title 78 | * 79 | * @return 80 | */ 81 | public List getMovieTitle() { 82 | List list = new ArrayList<>(); 83 | Elements select = doc.select("[class=recommendations-bd]"); 84 | Elements title = select.select("dd a[href]"); 85 | for (int i = 0; i < title.size(); i++) { 86 | list.add(title.get(i).text()); 87 | } 88 | 89 | return list; 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/jsoupUtils/GetNavImage.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils.jsoupUtils; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.select.Elements; 6 | 7 | import java.io.IOException; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | public class GetNavImage { 12 | private String url = "http://www.bjp.org.cn/col/col89/index.html"; 13 | private String defulturl = "http://www.bjp.org.cn"; 14 | private Document doc; 15 | 16 | public GetNavImage() { 17 | try { 18 | doc = Jsoup.connect(url).get(); 19 | } catch (IOException e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | 24 | public List getImage() { 25 | List mList = new ArrayList<>(); 26 | if (doc != null) { 27 | Elements s1 = doc.select("td"); 28 | Elements s2 = s1.select("b"); 29 | Elements s3 = s2.select("a"); 30 | //获取每日一图的描述 31 | if (!s3.get(0).text().trim().equals("")) { 32 | mList.add(s3.get(0).text()); 33 | } 34 | // 获取到每日一图的html文件 35 | String html = defulturl + s3.get(0).attr("href"); 36 | try { 37 | doc = Jsoup.connect(html).get(); 38 | if (doc != null) { 39 | Elements s4 = doc.select("[id=oneday]"); 40 | Elements s5 = s4.select("a"); 41 | String imageUrl = defulturl + s5.attr("href"); 42 | if (!imageUrl.trim().equals("")) { 43 | mList.add(imageUrl); 44 | } 45 | return mList; 46 | } 47 | } catch (IOException e) { 48 | e.printStackTrace(); 49 | return mList; 50 | } 51 | } 52 | return mList; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/utils/jsoupUtils/GetVPImage.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.utils.jsoupUtils; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.select.Elements; 6 | 7 | import java.io.IOException; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.regex.Matcher; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * Created by ChinaLHR on 2016/12/29. 15 | * Email:13435500980@163.com 16 | */ 17 | 18 | public class GetVPImage { 19 | private String url = "http://www.mtime.com/"; 20 | private Document doc; 21 | 22 | public GetVPImage() { 23 | try { 24 | doc = Jsoup.connect(url).get(); 25 | } catch (IOException e) { 26 | e.printStackTrace(); 27 | } 28 | } 29 | 30 | public List getImage() { 31 | List mList = new ArrayList<>(); 32 | Pattern pattern = Pattern 33 | .compile("[http|https]+[://]+[0-9A-Za-z:/[-]_#[?][=][.][&]]*"); 34 | if (doc != null) { 35 | if (doc != null) { 36 | Elements s1 = doc.select("[id = indexTopSlide]"); 37 | Elements s2 = s1.select("dl"); 38 | Elements s3 = s2.select("dd"); 39 | Elements s4 = s3.select("div"); 40 | for (int i = 0; i < s4.size(); i++) { 41 | Matcher matcher = pattern.matcher(s4.get(i).attr("style")); 42 | while (matcher.find()) { 43 | mList.add(matcher.group()); 44 | } 45 | } 46 | return mList; 47 | } else { 48 | return mList; 49 | } 50 | 51 | } else { 52 | return null; 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/view/NoScrollViewPager.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.view; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.AttributeSet; 6 | import android.view.MotionEvent; 7 | 8 | /** 9 | * Created by ChinaLHR on 2016/12/23. 10 | * Email:13435500980@163.com 11 | */ 12 | 13 | public class NoScrollViewPager extends ViewPager { 14 | private boolean isPagingEnabled = false; 15 | 16 | public NoScrollViewPager(Context context) { 17 | super(context); 18 | } 19 | 20 | public NoScrollViewPager(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | @Override 25 | public boolean onTouchEvent(MotionEvent event) { 26 | return this.isPagingEnabled && super.onTouchEvent(event); 27 | } 28 | 29 | @Override 30 | public boolean onInterceptTouchEvent(MotionEvent event) { 31 | return this.isPagingEnabled && super.onInterceptTouchEvent(event); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/view/ScrollAwareFABBehavior.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.view; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.v4.view.ViewCompat; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | 10 | /** 11 | * Created by ChinaLHR on 2016/12/13. 12 | * Email:13435500980@163.com 13 | */ 14 | 15 | public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { 16 | 17 | public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { 18 | super(); 19 | } 20 | 21 | /** 22 | * 处理垂直方向上的滚动事件 23 | */ 24 | @Override 25 | public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, 26 | View directTargetChild, View target, int nestedScrollAxes) { 27 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || 28 | super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, 29 | nestedScrollAxes); 30 | } 31 | 32 | /** 33 | * 检测Y的位置,并决定按钮动画是否进入或退出 34 | */ 35 | @Override 36 | public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { 37 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); 38 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { 39 | // User scrolled down and the FAB is currently visible -> hide the FAB 40 | child.hide(); 41 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { 42 | child.show(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/view/animation/DepthPageTransformer.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.view.animation; 2 | 3 | import android.support.v4.view.ViewPager; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by ChinaLHR on 2016/12/31. 8 | * Email:13435500980@163.com 9 | */ 10 | 11 | public class DepthPageTransformer implements ViewPager.PageTransformer { 12 | private static final float MIN_SCALE = 0.75f; 13 | 14 | @Override 15 | public void transformPage(View page, float position) { 16 | int pageWidth = page.getWidth(); 17 | float scaleFactor = MIN_SCALE 18 | + (1 - MIN_SCALE) * (1 - Math.abs(position)); 19 | if (position < -1) { 20 | page.setAlpha(0); 21 | } else if (position <= 0) { 22 | page.setAlpha(1); 23 | page.setTranslationX(0); 24 | page.setScaleX(scaleFactor); 25 | page.setScaleY(scaleFactor); 26 | } else if (position <= 1) { // (0,1] 27 | page.setAlpha(1 - position); 28 | page.setTranslationX(pageWidth * -position); 29 | page.setScaleX(scaleFactor); 30 | page.setScaleY(scaleFactor); 31 | 32 | } else { 33 | page.setAlpha(0); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/lhr/jiandou/view/mProgressdialog.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou.view; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Context; 5 | 6 | /** 7 | * Created by ChinaLHR on 2016/12/17. 8 | * Email:13435500980@163.com 9 | */ 10 | 11 | public class mProgressdialog { 12 | private ProgressDialog mProgressDialog; 13 | 14 | public static boolean isFirst = true; 15 | 16 | public void showProgressdialog(Context context) { 17 | if (isFirst) { 18 | isFirst = false; 19 | mProgressDialog = new ProgressDialog(context); 20 | mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 21 | mProgressDialog.setCancelable(false); 22 | mProgressDialog.show(); 23 | 24 | } 25 | } 26 | 27 | public void cancelProgressdialog() { 28 | if (mProgressDialog!=null){ 29 | mProgressDialog.cancel(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_channel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_channel_n.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_channel_p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/collection_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/collection_false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/collection_false.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/collection_true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/collection_true.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cancel_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dehaze_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fab_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_movie_toweb_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_webview_close_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_webview_go_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_webview_refresh_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_webview_to_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/myratingbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/nav_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/search_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/search_book.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/search_close_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/search_movie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/drawable/search_movie.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/search_open_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_bg_point.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_bg_point_disable.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_bg_point_enable.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_actor_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_book_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/tab_movie_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toast_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 33 | 34 | 35 | 36 | 39 | 43 | 50 | 51 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 25 | 28 | 32 | 40 | 46 | 52 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_book.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_changelabel.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_collection.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | 19 | 20 | 21 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_leaderboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 28 | 29 | 30 | 31 | 36 | 37 | 47 | 48 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 25 | 26 | 27 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_actor.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 28 | 29 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_actor_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 20 | 21 | 33 | 34 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_basepager.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 21 | 22 | 29 | 30 | 34 | 35 | 42 | 43 | 50 | 51 | 57 | 58 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_footer.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 17 | 18 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_likemovie.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_my_label_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 24 | 25 | 37 | 38 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_mylabel.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_other_label_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_otherlabel.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/mtoast_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pagefragment_collection.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pagefragment_leaderboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pagefragment_top250.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 19 | 20 | 28 | 29 | 30 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pagerfragment_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pagerfragment_labelm.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_category_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/preference_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 17 | 18 | 28 | 29 | 36 | 37 | 38 | 39 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_moviedetails_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 |

5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/nav_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 19 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/Collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/Collection.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/books.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/books.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/jb_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/jb_ico.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/label.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/list.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/movie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/movie.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/rb1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/rb1.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/rb2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/rb2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/rb3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/rb3.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/search.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/setting.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/toast_ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-hdpi/toast_ico.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_channel_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-xhdpi/ic_channel_edit.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v19/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 白天 5 | 夜间 6 | 7 | 8 | 9 | 1 10 | 2 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #009688 4 | #004d40 5 | #ff9800 6 | #ffffff 7 | #121212 8 | #00bfa5 9 | 10 | #77424242 11 | #ffffff 12 | 13 | #757575 14 | #77C2C2C2 15 | 16 | #9c9c9c 17 | #DDDDDD 18 | #ef4836 19 | 20 | #212121 21 | #000000 22 | #e65600 23 | 24 | #77eaeaea 25 | 26 | 27 | #ffffff 28 | #8bc64a 29 | #cddc39 30 | 31 | 32 | #E5E5E5 33 | #838B83 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 简豆 5 | 电影 6 | 图书 7 | 电影榜单 8 | 我的收藏 9 | 系统 10 | 更改标签 11 | 设置 12 | 13 | 加载出错 14 | 15 | 更多 16 | 收起 17 | 电影类型: 18 | 上映国家: 19 | 上映时间: 20 | 原名: 21 | 简介 22 | 影人 23 | 人评价 24 | 影人 25 | 喜欢这部电影的人也喜欢... 26 | 加载失败... 27 | 加载中... 28 | 29 | 30 | 暂时没有简介... 31 | 个人简介 32 | 代表作品 33 | 性别: 34 | 出生地: 35 | 36 | 37 | 作者: 38 | 出版社: 39 | 副标题: 40 | 页数: 41 | 作者简介 42 | 目录/试读 43 | 喜欢读这本书的人也喜欢... 44 | 45 | 46 | 47 | 长按编辑,点击删添,拖拽排序 48 | 我的标签 49 | 其他标签 50 | 编辑 51 | 完成 52 | 53 | 54 | 收藏成功! 55 | 收藏失败! 56 | 取消收藏成功! 57 | 取消收藏失败! 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 29 | 30 | 31 | 37 | 38 | 44 | 45 | 46 | 49 | 50 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/res/xml/bottombar_tabs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 15 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/xml/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 16 | 24 | 25 | 26 | 27 | 31 | 36 | 37 | 38 | 42 | 48 | 51 | 52 | 58 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/test/java/com/lhr/jiandou/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lhr.jiandou; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app_display_apk/JianDou1.2.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_apk/JianDou1.2.apk -------------------------------------------------------------------------------- /app_display_jpg/p1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p1.jpg -------------------------------------------------------------------------------- /app_display_jpg/p2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p2.jpg -------------------------------------------------------------------------------- /app_display_jpg/p3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p3.jpg -------------------------------------------------------------------------------- /app_display_jpg/p4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p4.jpg -------------------------------------------------------------------------------- /app_display_jpg/p5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p5.jpg -------------------------------------------------------------------------------- /app_display_jpg/p6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p6.jpg -------------------------------------------------------------------------------- /app_display_jpg/p7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p7.jpg -------------------------------------------------------------------------------- /app_display_jpg/p8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p8.jpg -------------------------------------------------------------------------------- /app_display_jpg/p9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/app_display_jpg/p9.jpg -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.0' 9 | classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | jcenter() 16 | } 17 | } 18 | 19 | task clean(type: Delete) { 20 | delete rootProject.buildDir 21 | } 22 | -------------------------------------------------------------------------------- /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 | org.gradle.jvmargs=-Xmx1536m -XX:MaxPermSize=512m 13 | org.gradle.parallel=true 14 | org.gradle.daemon=true 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChinaLHR/JianDou/107f93ad09afcfb50c3e8dc69d79ad0bac52323e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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.14.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------