├── app
├── .gitignore
├── libs
│ ├── zxing.jar
│ └── universal-image-loader-1.9.3-with-sources.jar
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── raw
│ │ │ │ └── beep.ogg
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── bg.png
│ │ │ │ ├── banner1.jpg
│ │ │ │ ├── banner3.jpg
│ │ │ │ ├── ic_add.png
│ │ │ │ ├── icon_del.png
│ │ │ │ ├── icon_err.png
│ │ │ │ ├── icon_me.png
│ │ │ │ ├── icon_wx.png
│ │ │ │ ├── icon_zfb.png
│ │ │ │ ├── icon_back.png
│ │ │ │ ├── icon_home.png
│ │ │ │ ├── icon_nonet.png
│ │ │ │ ├── no_image.9.png
│ │ │ │ ├── fail_image.9.png
│ │ │ │ ├── icon_home_act.png
│ │ │ │ ├── icon_me_act.png
│ │ │ │ ├── icon_message.png
│ │ │ │ ├── icon_network.png
│ │ │ │ ├── icon_no_order.png
│ │ │ │ ├── icon_waybill.png
│ │ │ │ ├── icon_scan_qcode.png
│ │ │ │ ├── icon_mesaage_act.png
│ │ │ │ └── icon_waybill_act.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── capture.9.png
│ │ │ │ ├── loading.png
│ │ │ │ ├── scan_line.png
│ │ │ │ ├── scan_mask.png
│ │ │ │ ├── load_failed.png
│ │ │ │ ├── load_succeed.png
│ │ │ │ └── pull_icon_big.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── drawable
│ │ │ │ ├── shape_point_red.xml
│ │ │ │ ├── banner_dot_focused.xml
│ │ │ │ ├── btn_buttom_tab_text_selector.xml
│ │ │ │ ├── linerlayout_bg_slecter.xml
│ │ │ │ ├── shape_gray_bg.xml
│ │ │ │ ├── shape_white_bg.xml
│ │ │ │ ├── shape_corner_10dp_bg_white.xml
│ │ │ │ ├── shape_corner_5dp_bg_orange.xml
│ │ │ │ ├── shape_btn_corner_10dp_bg_red.xml
│ │ │ │ ├── shape_btn_corner_10dp_bg_theme.xml
│ │ │ │ ├── shape_corner_5dp_bg_gray.xml
│ │ │ │ ├── shape_corner_5dp_bg_white.xml
│ │ │ │ ├── banner_dot_normal.xml
│ │ │ │ ├── bg_white_selector.xml
│ │ │ │ ├── shape_gray_bg_top_round.xml
│ │ │ │ ├── shape_white_bg_top_round.xml
│ │ │ │ ├── shape_gray_bg_bottom_round.xml
│ │ │ │ ├── shape_white_bg_bottom_round.xml
│ │ │ │ ├── bg_white_top_round_selector.xml
│ │ │ │ ├── shape_corner_5dp_bg_whtie_with_border.xml
│ │ │ │ ├── bg_white_bottom_round_selector.xml
│ │ │ │ ├── ic_notifications_black_24dp.xml
│ │ │ │ ├── item_message_bg.xml
│ │ │ │ ├── ripple_one_item_bg.xml
│ │ │ │ └── progressbar_mini.xml
│ │ │ ├── layout
│ │ │ │ ├── pager_third.xml
│ │ │ │ ├── banner_dot.xml
│ │ │ │ ├── activity_test.xml
│ │ │ │ ├── pager_second.xml
│ │ │ │ ├── pager_first.xml
│ │ │ │ ├── item_recyclerview_head.xml
│ │ │ │ ├── activity_photo_preview_more.xml
│ │ │ │ ├── pager_base_recycleview.xml
│ │ │ │ ├── pager_img.xml
│ │ │ │ ├── activity_detail.xml
│ │ │ │ ├── rxbus_activity.xml
│ │ │ │ ├── activity_splash.xml
│ │ │ │ ├── activity_photo_preview.xml
│ │ │ │ ├── activity_hotoppick.xml
│ │ │ │ ├── img_pick_grid_item.xml
│ │ │ │ ├── item_home_grid.xml
│ │ │ │ ├── pager_message.xml
│ │ │ │ ├── activity_base_webview.xml
│ │ │ │ ├── dialog_progress.xml
│ │ │ │ ├── activity_base_tab.xml
│ │ │ │ ├── activity_base.xml
│ │ │ │ ├── pager_home.xml
│ │ │ │ ├── menu_item.xml
│ │ │ │ ├── dialog_msg.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── fragment_discover_cardview_item.xml
│ │ │ │ ├── tab_indicator.xml
│ │ │ │ ├── dialog_choose_img.xml
│ │ │ │ ├── activity_login.xml
│ │ │ │ ├── refresh_head.xml
│ │ │ │ └── banner.xml
│ │ │ ├── anim
│ │ │ │ ├── push_bottom_in.xml
│ │ │ │ ├── alpha.xml
│ │ │ │ ├── push_bottom_out.xml
│ │ │ │ ├── reverse_anim.xml
│ │ │ │ ├── rotating.xml
│ │ │ │ ├── popup_bottombar_out.xml
│ │ │ │ ├── push_left_out.xml
│ │ │ │ ├── push_right_in.xml
│ │ │ │ ├── push_top_out.xml
│ │ │ │ ├── push_left_in.xml
│ │ │ │ ├── push_right_out.xml
│ │ │ │ ├── push_top_in.xml
│ │ │ │ └── popup_bottombar_in.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── ids.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── color.xml
│ │ │ └── menu
│ │ │ │ └── menu_base.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ ├── gan
│ │ │ │ └── base
│ │ │ │ │ ├── constant
│ │ │ │ │ ├── BroadcastActions.java
│ │ │ │ │ ├── UrlConstant.java
│ │ │ │ │ └── Constant.java
│ │ │ │ │ ├── net
│ │ │ │ │ ├── progress
│ │ │ │ │ │ ├── ProgressCancelListener.java
│ │ │ │ │ │ └── ProgressDialogHandler.java
│ │ │ │ │ ├── rx
│ │ │ │ │ │ ├── RxCodeConstants.java
│ │ │ │ │ │ ├── RxBusBaseMessage.java
│ │ │ │ │ │ └── RxBus.java
│ │ │ │ │ ├── subscribers
│ │ │ │ │ │ ├── SubscriberOnNextListener.java
│ │ │ │ │ │ └── RecycleviewSubscriberOnNextListener.java
│ │ │ │ │ ├── resultbean
│ │ │ │ │ │ ├── VerSionInfo.java
│ │ │ │ │ │ ├── ImagesBean.java
│ │ │ │ │ │ ├── RatingBean.java
│ │ │ │ │ │ ├── PersonBean.java
│ │ │ │ │ │ ├── UserInfoResult.java
│ │ │ │ │ │ └── HttpResult.java
│ │ │ │ │ ├── requestbean
│ │ │ │ │ │ ├── BaseRequest.java
│ │ │ │ │ │ ├── BaseRequest4List.java
│ │ │ │ │ │ └── MovieInfo.java
│ │ │ │ │ ├── utils
│ │ │ │ │ │ ├── LogUtils.java
│ │ │ │ │ │ ├── MD5.java
│ │ │ │ │ │ ├── CustomGsonRequestBodyConverter.java
│ │ │ │ │ │ ├── CustomGsonConverterFactory.java
│ │ │ │ │ │ ├── CustomGsonResponseBodyConverter.java
│ │ │ │ │ │ ├── SerializableOkHttpCookies.java
│ │ │ │ │ │ └── RetrofitUtils.java
│ │ │ │ │ ├── service
│ │ │ │ │ │ └── NetService.java
│ │ │ │ │ ├── apiexception
│ │ │ │ │ │ └── ApiException.java
│ │ │ │ │ └── networks
│ │ │ │ │ │ └── NetWorks.java
│ │ │ │ │ ├── viewhelper
│ │ │ │ │ └── Pullable.java
│ │ │ │ │ ├── activity
│ │ │ │ │ ├── UrlConstant.java
│ │ │ │ │ ├── RxBusActivity.java
│ │ │ │ │ ├── MyTabActivity.java
│ │ │ │ │ ├── TestActivity.java
│ │ │ │ │ ├── DetailActivity.java
│ │ │ │ │ ├── BaseTabActivity.java
│ │ │ │ │ ├── RecycleviewActivity.java
│ │ │ │ │ └── RecycleviewWithHeadActivity.java
│ │ │ │ │ ├── util
│ │ │ │ │ ├── PermisssionConstant.java
│ │ │ │ │ ├── image
│ │ │ │ │ │ ├── SimpleImageDisplayer.java
│ │ │ │ │ │ ├── ImageInfo.java
│ │ │ │ │ │ ├── PhotoPreviewActivity.java
│ │ │ │ │ │ ├── BitmapUtil.java
│ │ │ │ │ │ ├── RotateGestureDetector.java
│ │ │ │ │ │ └── PhotoPreviewMoreActivity.java
│ │ │ │ │ ├── dialog
│ │ │ │ │ │ └── FileInfo.java
│ │ │ │ │ ├── KeyBoardUtils.java
│ │ │ │ │ ├── StringFormatUtil.java
│ │ │ │ │ ├── ToastUtil.java
│ │ │ │ │ ├── DensityUtils.java
│ │ │ │ │ └── PrefUtils.java
│ │ │ │ │ ├── view
│ │ │ │ │ ├── NoScrollViewPager.java
│ │ │ │ │ ├── PullableScrollView.java
│ │ │ │ │ ├── MyGridView.java
│ │ │ │ │ ├── SlideLayout.java
│ │ │ │ │ ├── TabIndicatorView.java
│ │ │ │ │ └── MyDialogSimple.java
│ │ │ │ │ ├── application
│ │ │ │ │ └── MyApplication.java
│ │ │ │ │ ├── pagers
│ │ │ │ │ ├── slide
│ │ │ │ │ │ ├── FirstPager.java
│ │ │ │ │ │ ├── ThirdPager.java
│ │ │ │ │ │ └── SecondPager.java
│ │ │ │ │ ├── ContentBasePager.java
│ │ │ │ │ └── MessagePager.java
│ │ │ │ │ ├── banner
│ │ │ │ │ ├── BannerData.java
│ │ │ │ │ └── NoactionViewPager.java
│ │ │ │ │ └── adapter
│ │ │ │ │ └── ContentAdapter.java
│ │ │ │ └── zxing
│ │ │ │ ├── decode
│ │ │ │ ├── DecodeFormatManager.java
│ │ │ │ └── DecodeThread.java
│ │ │ │ └── camera
│ │ │ │ ├── PreviewCallback.java
│ │ │ │ └── open
│ │ │ │ └── OpenCameraInterface.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── tms
│ │ │ └── yunpai
│ │ │ └── com
│ │ │ └── yunpaitms
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── tms
│ │ └── yunpai
│ │ └── com
│ │ └── yunpaitms
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── myrecycleview
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── no_data.png
│ │ │ └── layout
│ │ │ │ ├── myrecycle_footview.xml
│ │ │ │ ├── myrecycle_nodata_view.xml
│ │ │ │ ├── mycycle_foot_default_loading.xml
│ │ │ │ ├── mycycleview_firstload.xml
│ │ │ │ └── mycycleview_err.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── gan
│ │ │ └── myrecycleview
│ │ │ ├── utils
│ │ │ └── WrapperUtils.java
│ │ │ └── CommonAdapter.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── gan
│ │ │ └── myrecycleview
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── gan
│ │ └── myrecycleview
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── README.md
├── .idea
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── runConfigurations.xml
├── modules.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── appdownloadlibrary
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── gan
│ │ │ └── appdownload
│ │ │ ├── DownLoadBroadcastReceiver.java
│ │ │ └── UpdataBroadcastReceiver.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── appdownloadlibrary
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── appdownloadlibrary
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/myrecycleview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':myrecycleview', ':appdownloadlibrary'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RetrofitAndRxjavaforRecyclerview
2 | 使用介绍看这里http://blog.csdn.net/u012402940/article/details/64439417
3 |
--------------------------------------------------------------------------------
/app/libs/zxing.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/libs/zxing.jar
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MyRecycleView
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/raw/beep.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/raw/beep.ogg
--------------------------------------------------------------------------------
/appdownloadlibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AppDownLoadLibrary
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/constant/BroadcastActions.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.constant;
2 |
3 |
4 | public class BroadcastActions {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/capture.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/capture.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/loading.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/scan_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/scan_line.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/scan_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/scan_mask.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/banner1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/banner1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/banner3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/banner3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/ic_add.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_del.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_del.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_err.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_err.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_me.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_me.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_wx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_wx.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_zfb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_zfb.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/load_failed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/load_failed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_home.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_nonet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_nonet.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/no_image.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/no_image.9.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/load_succeed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/load_succeed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/pull_icon_big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xhdpi/pull_icon_big.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/fail_image.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/fail_image.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_home_act.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_home_act.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_me_act.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_me_act.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_message.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_network.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_no_order.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_no_order.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_waybill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_waybill.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_scan_qcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_scan_qcode.png
--------------------------------------------------------------------------------
/app/libs/universal-image-loader-1.9.3-with-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/libs/universal-image-loader-1.9.3-with-sources.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_mesaage_act.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_mesaage_act.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_waybill_act.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/app/src/main/res/drawable-xxhdpi/icon_waybill_act.png
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/drawable-xhdpi/no_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/971638267/RetrofitAndRxjavaforRecyclerview/HEAD/myrecycleview/src/main/res/drawable-xhdpi/no_data.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/progress/ProgressCancelListener.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.progress;
2 |
3 | /**
4 | */
5 | public interface ProgressCancelListener {
6 | void onCancelProgress();
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/rx/RxCodeConstants.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.rx;
2 |
3 | public class RxCodeConstants {
4 | public static final int JUMP_TYPE = 0;//
5 | public static final int JUMP_TYPE_TO_ONE = 1;
6 | }
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/subscribers/SubscriberOnNextListener.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.subscribers;
2 |
3 | /**
4 | * Created by liukun on 16/3/10.
5 | */
6 | public interface SubscriberOnNextListener {
7 | void onNext(T t);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/VerSionInfo.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * Created by gan on 2017/5/22.
5 | */
6 | public class VerSionInfo {
7 | public String version;
8 | public String url;
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/constant/UrlConstant.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.constant;
2 |
3 | public class UrlConstant {
4 | //自己的服务器
5 | public static String BASEURL = "https://api.douban.com/v2/movie/";
6 | public static boolean CACHE = true;
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_point_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_third.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner_dot.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/viewhelper/Pullable.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.viewhelper;
2 |
3 | public interface Pullable
4 | {
5 | /**
6 | * 判断是否可以下拉,如果不需要下拉功能可以直接return false
7 | *
8 | * @return true如果可以下拉否则返回false
9 | */
10 | boolean canPullDown();
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/ImagesBean.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * Created by gan on 2017/9/11.
5 | */
6 | public class ImagesBean {
7 | public String small;
8 | public String large;
9 | public String medium;
10 | }
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/banner_dot_focused.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/RatingBean.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * Created by gan on 2017/9/11.
5 | */
6 | public class RatingBean {
7 | public int max;
8 | public double average;
9 | public String stars;
10 | public int min;
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_buttom_tab_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/subscribers/RecycleviewSubscriberOnNextListener.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.subscribers;
2 |
3 | /**
4 | * Created by liukun on 16/3/10.
5 | */
6 | public interface RecycleviewSubscriberOnNextListener {
7 | void onNext(T t);
8 |
9 | void onErr(int drawable, String msg);
10 | }
11 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/alpha.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/PersonBean.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * Created by gan on 2017/9/11.
5 | */
6 | public class PersonBean {
7 | public String alt;
8 | public String type;
9 | public ImagesBean avatars;
10 | public String name;
11 | public String id;
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/linerlayout_bg_slecter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_gray_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/appdownloadlibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/layout/myrecycle_footview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_white_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_10dp_bg_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_5dp_bg_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_btn_corner_10dp_bg_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_btn_corner_10dp_bg_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_5dp_bg_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_5dp_bg_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/requestbean/BaseRequest.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.requestbean;
2 |
3 |
4 | import com.gan.base.util.Utils;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * Created by gan on 2017/4/18.
10 | */
11 | public class BaseRequest {
12 | public Map toMap() {
13 | return Utils.objectToMap(this);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/banner_dot_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/reverse_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/rotating.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @dimen/dp45
4 |
5 | 16dp
6 | 16dp
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/activity/UrlConstant.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.activity;
2 |
3 | public class UrlConstant {
4 | //自己的服务器
5 | //public static String BASEURL = "http://118.178.33.25:8080/";
6 | public static String BASEURL = "http://192.168.1.37:8099";
7 | // public static String BASEURL = "http://121.196.244.191:8090";
8 | public static boolean CACHE = false;
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_white_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_gray_bg_top_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_white_bg_top_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/popup_bottombar_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_gray_bg_bottom_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_white_bg_bottom_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_left_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_right_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_top_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_right_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_top_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_white_top_round_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_corner_5dp_bg_whtie_with_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_white_bottom_round_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/popup_bottombar_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/rx/RxBusBaseMessage.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.rx;
2 |
3 |
4 | public class RxBusBaseMessage {
5 | private int code;
6 | private Object object;
7 | public RxBusBaseMessage(int code, Object object){
8 | this.code=code;
9 | this.object=object;
10 | }
11 | public RxBusBaseMessage(){}
12 |
13 | public int getCode() {
14 | return code;
15 | }
16 |
17 | public Object getObject() {
18 | return object;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_recyclerview_head.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
11 |
--------------------------------------------------------------------------------
/app/src/test/java/tms/yunpai/com/yunpaitms/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package tms.yunpai.com.yunpaitms;
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 | }
--------------------------------------------------------------------------------
/myrecycleview/src/test/java/com/gan/myrecycleview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.gan.myrecycleview;
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/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_photo_preview_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_base_recycleview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/appdownloadlibrary/src/test/java/com/example/appdownloadlibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.appdownloadlibrary;
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/src/main/java/com/gan/base/util/PermisssionConstant.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
2 |
3 | /**
4 | * Created by gan on 2017/4/18.
5 | */
6 |
7 | public class PermisssionConstant {
8 | final public static int REQUEST_CODE_ASK_CALL_PHONE = 111;
9 | final public static int REQUEST_CODE_ASK_CANER = 112;
10 | final public static int REQUEST_CODE_ADK_AUDIO = 113;
11 | final public static int REQUEST_CODE_WRITE_CONTACT = 114;
12 | final public static int REQUEST_CODE_READ_LOCATION = 115;
13 | final public static int REQUEST_CODE_EXTERNAL_STORAGE = 116;
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/LogUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import android.util.Log;
4 |
5 | import com.gan.base.constant.Constant;
6 |
7 |
8 | /**
9 | * 用途: 日志管理类
10 | * 创建者:ganyufei
11 | * 时间: 2017/2/23
12 | */
13 |
14 | public class LogUtils {
15 | public static void D(String tag,String msg){
16 | if (Constant.DEBUG){
17 | Log.d(tag,msg);
18 | }
19 | }
20 | public static void D(String msg){
21 | if (Constant.DEBUG){
22 | Log.d("gan-yunpai-tms====>",msg);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/item_message_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 |
9 |
10 |
11 | -
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
12 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rxbus_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ripple_one_item_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 | -
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_photo_preview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/activity/RxBusActivity.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.activity;
2 |
3 | import android.view.View;
4 |
5 | import com.gan.base.R;
6 | import com.gan.base.net.rx.RxBus;
7 | import com.gan.base.net.rx.RxCodeConstants;
8 |
9 | /**
10 | * Created by gan on 2017/9/11.
11 | */
12 | public class RxBusActivity extends BaseActivity{
13 | @Override
14 | protected int getContentView() {
15 | return R.layout.rxbus_activity;
16 | }
17 |
18 | @Override
19 | protected void afterView() {
20 |
21 | }
22 | public void jump(View view){
23 | RxBus.getDefault().post(RxCodeConstants.JUMP_TYPE, "跳转到消息页");
24 | finish();
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/layout/myrecycle_nodata_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
--------------------------------------------------------------------------------
/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 E:\ganyufei\android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/myrecycleview/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:\andriod\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 |
--------------------------------------------------------------------------------
/appdownloadlibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\gan\android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/layout/mycycle_foot_default_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_hotoppick.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/requestbean/BaseRequest4List.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.requestbean;
2 |
3 |
4 | import com.gan.base.util.Utils;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * Created by gan on 2017/4/17.
10 | */
11 |
12 | public class BaseRequest4List {
13 |
14 | private int start=1;
15 | private int count=10;
16 |
17 | public int getStart() {
18 | return start;
19 | }
20 |
21 | public void setStart(int start) {
22 | this.start = start;
23 | }
24 |
25 | public int getCount() {
26 | return count;
27 | }
28 |
29 | public void setCount(int count) {
30 | this.count = count;
31 | }
32 |
33 | public Map toMap() {
34 | return Utils.objectToMap(this);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/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
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/UserInfoResult.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * 登录的返回结果
5 | */
6 | public class UserInfoResult {
7 | private int companyId;
8 | private String tokenId;
9 | private int userId;
10 |
11 | public int getCompanyId() {
12 | return companyId;
13 | }
14 |
15 | public void setCompanyId(int companyId) {
16 | this.companyId = companyId;
17 | }
18 |
19 | public String getTokenId() {
20 | return tokenId;
21 | }
22 |
23 | public void setTokenId(String tokenId) {
24 | this.tokenId = tokenId;
25 | }
26 |
27 | public int getUserId() {
28 | return userId;
29 | }
30 |
31 | public void setUserId(int userId) {
32 | this.userId = userId;
33 | }
34 | }
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/constant/Constant.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.constant;
2 |
3 |
4 | import android.os.Environment;
5 |
6 | public class Constant {
7 | //是否允许弹出toast
8 | public static final boolean TOAST = true;
9 | public static boolean UPLOAD_VERSION =false ;
10 | //调试模式
11 | public static boolean DEBUG = true;//调试模式开关
12 | // 缓存图片路径(imageLoder用)
13 |
14 | // 缓存图片路径(imageLoder用)
15 | public static final String BASE_PATH = "gan/";
16 | public static final String BASE_IMAGE_CACHE = BASE_PATH + "cache/images/";//图片缓存路径
17 | public static final String SD_CARD = Environment.getExternalStorageDirectory().getAbsolutePath() +"/"+ BASE_PATH;
18 | public static final String DOWNLOAD_APK = "download/apk/";//下载路径
19 | public static final String IMG_PATH = SD_CARD + "images/";
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/img_pick_grid_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/requestbean/MovieInfo.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.requestbean;
2 |
3 | import com.gan.base.net.resultbean.ImagesBean;
4 | import com.gan.base.net.resultbean.PersonBean;
5 | import com.gan.base.net.resultbean.RatingBean;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by gan on 2017/5/18.
11 | */
12 |
13 | public class MovieInfo {
14 |
15 | public RatingBean rating;
16 | public String title;
17 | public int collect_count;
18 | public String original_title;
19 | public String subtype;
20 | public String year;
21 | public ImagesBean images;
22 | public String alt;
23 | public String id;
24 | public List genres;
25 | public List casts;
26 | public List directors;
27 |
28 | public MovieInfo() {
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/layout/mycycleview_firstload.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
12 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/service/NetService.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.service;
2 |
3 |
4 |
5 | import com.gan.base.net.requestbean.MovieInfo;
6 | import com.gan.base.net.resultbean.HttpResult;
7 | import com.gan.base.net.resultbean.UserInfoResult;
8 |
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | import retrofit2.http.Field;
13 | import retrofit2.http.FieldMap;
14 | import retrofit2.http.FormUrlEncoded;
15 | import retrofit2.http.POST;
16 | import rx.Observable;
17 |
18 | public interface NetService {
19 |
20 | @FormUrlEncoded
21 | @POST("in_theaters")
22 | Observable>> inTheaters(@FieldMap Map map);
23 |
24 |
25 | @FormUrlEncoded
26 | @POST("login")
27 | Observable> postLogin(@Field("lgiName") String loginName, @Field("lgiPwd") String loginPwd);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/image/SimpleImageDisplayer.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.image;
2 |
3 | import com.nostra13.universalimageloader.core.assist.LoadedFrom;
4 | import com.nostra13.universalimageloader.core.display.BitmapDisplayer;
5 | import com.nostra13.universalimageloader.core.imageaware.ImageAware;
6 |
7 | import android.graphics.Bitmap;
8 |
9 | public class SimpleImageDisplayer implements BitmapDisplayer {
10 |
11 | private int targetWidth;
12 |
13 | public SimpleImageDisplayer(int targetWidth) {
14 | this.targetWidth = targetWidth;
15 | }
16 | @Override
17 | public void display(Bitmap bitmap, ImageAware imageAware,
18 | LoadedFrom loadedFrom) {
19 | // TODO Auto-generated method stub
20 | if (bitmap != null) {
21 | bitmap =BitmapUtil.resizeImageByWidth(bitmap, targetWidth);
22 | }
23 | imageAware.setImageBitmap(bitmap);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/view/NoScrollViewPager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.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 | * 不能左右划的ViewPager
10 | *
11 | * @author ganyufei
12 | *
13 | */
14 | public class NoScrollViewPager extends ViewPager {
15 |
16 | public NoScrollViewPager(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public NoScrollViewPager(Context context) {
21 | super(context);
22 | }
23 |
24 | // 表示事件是否拦截, 返回false表示不拦截, 可以让嵌套在内部的viewpager相应左右划的事件
25 | @Override
26 | public boolean onInterceptTouchEvent(MotionEvent arg0) {
27 | return false;
28 | }
29 |
30 | /**
31 | * 重写onTouchEvent事件,什么都不用做
32 | */
33 | @Override
34 | public boolean onTouchEvent(MotionEvent arg0) {
35 | return false;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_home_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
18 |
19 |
24 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/tms/yunpai/com/yunpaitms/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package tms.yunpai.com.yunpaitms;
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("tms.yunpai.com.yunpaitms", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/myrecycleview/src/androidTest/java/com/gan/myrecycleview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.gan.myrecycleview;
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.gan.myrecycleview.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_base.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 |
--------------------------------------------------------------------------------
/appdownloadlibrary/src/androidTest/java/com/example/appdownloadlibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.appdownloadlibrary;
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.example.appdownloadlibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/appdownloadlibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion '25.0.0'
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:23.4.0'
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/dialog/FileInfo.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.dialog;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by gan on 2017/4/18.
7 | */
8 |
9 | public class FileInfo implements Serializable {
10 | public static final long serialVersionUID = 1L;
11 | private String path;
12 | //0:本地照片 1.本地视频 2.网上照片 3.网上视频,4.默认添加的图片
13 | private int type;
14 | //0.上传失败 1.上传成功 2.未上传 3.正在上传
15 | private String type2 = "2";
16 |
17 | public String getPath() {
18 | return path;
19 | }
20 |
21 | public void setPath(String path) {
22 | this.path = path;
23 | }
24 |
25 | public int getType() {
26 | return type;
27 | }
28 |
29 | public void setType(int type) {
30 | this.type = type;
31 | }
32 |
33 | public String getType2() {
34 | return type2;
35 | }
36 |
37 | public void setType2(String type2) {
38 | this.type2 = type2;
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/view/PullableScrollView.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ScrollView;
6 |
7 | import com.gan.base.viewhelper.Pullable;
8 |
9 | /**
10 | *可以下拉刷新的ScrollView
11 | * @ClassName: PullableScrollView
12 | * @Description: TODO
13 | * @author 甘玉飞
14 | * @date 2016年7月6日 下午2:16:08
15 | *
16 | */
17 | public class PullableScrollView extends ScrollView implements Pullable
18 | {
19 |
20 | public PullableScrollView(Context context)
21 | {
22 | super(context);
23 | }
24 |
25 | public PullableScrollView(Context context, AttributeSet attrs)
26 | {
27 | super(context, attrs);
28 | }
29 |
30 | public PullableScrollView(Context context, AttributeSet attrs, int defStyle)
31 | {
32 | super(context, attrs, defStyle);
33 | }
34 |
35 | @Override
36 | public boolean canPullDown()
37 | {
38 | if (getScrollY() == 0)
39 | return true;
40 | else
41 | return false;
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/myrecycleview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:23.4.0'
30 | testCompile 'junit:junit:4.12'
31 | compile 'com.android.support:recyclerview-v7:23.4.0'
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/application/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.application;
2 |
3 | import android.support.multidex.MultiDexApplication;
4 |
5 | import com.squareup.leakcanary.LeakCanary;
6 | import com.gan.base.constant.Constant;
7 | import com.gan.base.util.image.ImageLoaderConfig;
8 |
9 |
10 | /**
11 | * 作者:Create on 2017/1/10 16:00 by gan
12 | * 邮箱:
13 | * 描述:当前Application,用来初始化数据
14 | * 最近修改:2017/1/10 16:00 modify by gan
15 | */
16 |
17 | public class MyApplication extends MultiDexApplication{
18 | private static MyApplication instance;
19 | @Override
20 | public void onCreate() {
21 | super.onCreate();
22 | if(!Constant.DEBUG)//如果不是在调试,将启用异常扑捉器
23 | CrashHandler.getInstance().init(getApplicationContext());//初始化全局异常扑捉器
24 | ImageLoaderConfig.initImageLoader(this, (Constant.BASE_IMAGE_CACHE));
25 | this.instance = this;
26 | LeakCanary.install(this);
27 | }
28 | public static MyApplication getInstance() {
29 | return instance;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/pagers/slide/FirstPager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.pagers.slide;
2 |
3 | import android.app.Activity;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.gan.base.R;
7 | import com.gan.base.pagers.ContentBasePager;
8 |
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * 页面(朋友)的实现
13 | *
14 | * @ClassName: FirstPager
15 | * @Description: TODO
16 | * @author 甘玉飞
17 | * @date 2016年6月21日 下午4:48:37
18 | *
19 | */
20 | public class FirstPager extends ContentBasePager {
21 |
22 | public FirstPager(AppCompatActivity activity) {
23 | super(activity);
24 | ButterKnife.bind(this, mRootView);
25 | initView();
26 | }
27 |
28 | @Override
29 | public void initData() {
30 | //ToastUtil.ToastCenter(mActivity,"进入FisrtPager");
31 | }
32 |
33 | @Override
34 | public void outData() {
35 | //ToastUtil.ToastCenter(mActivity,"离开FisrtPager");
36 | }
37 |
38 | @Override
39 | public int getContentView() {
40 | return R.layout.pager_first;
41 | }
42 |
43 | private void initView() {
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/pagers/slide/ThirdPager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.pagers.slide;
2 |
3 | import android.app.Activity;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.gan.base.R;
7 | import com.gan.base.pagers.ContentBasePager;
8 |
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * 页面(朋友)的实现
13 | *
14 | * @ClassName: FirstPager
15 | * @Description: TODO
16 | * @author 甘玉飞
17 | * @date 2016年6月21日 下午4:48:37
18 | *
19 | */
20 | public class ThirdPager extends ContentBasePager {
21 |
22 | public ThirdPager(AppCompatActivity activity) {
23 | super(activity);
24 | ButterKnife.bind(this, mRootView);
25 | initView();
26 | }
27 |
28 | @Override
29 | public void initData() {
30 | //ToastUtil.ToastCenter(mActivity,"进入ThirdPager");
31 | }
32 |
33 | @Override
34 | public void outData() {
35 | //ToastUtil.ToastCenter(mActivity,"离开ThirdPager");
36 | }
37 |
38 | @Override
39 | public int getContentView() {
40 | return R.layout.pager_third;
41 | }
42 |
43 | private void initView() {
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_message.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
13 |
17 |
18 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/pagers/slide/SecondPager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.pagers.slide;
2 |
3 | import android.app.Activity;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.gan.base.R;
7 | import com.gan.base.pagers.ContentBasePager;
8 |
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * 页面(朋友)的实现
13 | *
14 | * @ClassName: FirstPager
15 | * @Description: TODO
16 | * @author 甘玉飞
17 | * @date 2016年6月21日 下午4:48:37
18 | *
19 | */
20 | public class SecondPager extends ContentBasePager {
21 |
22 | public SecondPager(AppCompatActivity activity) {
23 | super(activity);
24 | ButterKnife.bind(this, mRootView);
25 | initView();
26 | }
27 |
28 | @Override
29 | public void initData() {
30 | //ToastUtil.ToastCenter(mActivity,"进入SecondPager");
31 | }
32 |
33 | @Override
34 | public void outData() {
35 | //ToastUtil.ToastCenter(mActivity,"离开SecondPager");
36 | }
37 |
38 | @Override
39 | public int getContentView() {
40 | return R.layout.pager_second;
41 | }
42 | private void initView() {
43 |
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/view/MyGridView.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.GridView;
6 | /**
7 | * 全部展开的grid
8 | * @ClassName: MyGridView
9 | * @Description: TODO
10 | * @author 甘玉飞
11 | * @date 2016年7月20日 下午12:52:58
12 | *
13 | */
14 | public class MyGridView extends GridView{
15 | public MyGridView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public MyGridView(Context context) {
20 | super(context);
21 | }
22 |
23 | public MyGridView(Context context, AttributeSet attrs, int defStyle) {
24 | super(context, attrs, defStyle);
25 | }
26 |
27 | @Override
28 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
29 |
30 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
31 | MeasureSpec.AT_MOST);
32 | super.onMeasure(widthMeasureSpec, expandSpec);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/MD5.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.math.BigInteger;
5 | import java.security.MessageDigest;
6 | import java.security.NoSuchAlgorithmException;
7 |
8 | public class MD5 {
9 | public static String md5(String input){
10 | String result = input;
11 | if(input != null) {
12 | MessageDigest md;
13 | try {
14 | md = MessageDigest.getInstance("MD5");
15 | try {
16 | md.update(input.getBytes("UTF-8"));
17 | } catch (UnsupportedEncodingException e) {
18 | e.printStackTrace();
19 | }
20 | BigInteger hash = new BigInteger(1, md.digest());
21 | result = hash.toString(16);
22 | if ((result.length() % 2) != 0) {
23 | result = "0" + result;
24 | }
25 | }catch (NoSuchAlgorithmException e) {
26 | e.printStackTrace();
27 | return null;
28 | }
29 | }
30 | return result;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_base_webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
22 |
23 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/activity/MyTabActivity.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.activity;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 |
5 | import com.gan.base.R;
6 | import com.gan.base.pagers.ContentBasePager;
7 |
8 | /**
9 | * Created by gan on 2017/5/18.
10 | */
11 | public class MyTabActivity extends BaseTabActivity{
12 | @Override
13 | public String[] getTitles() {
14 | setTitle("tab演示页面");
15 | return new String[]{"tab1","tab2"};
16 | }
17 |
18 | @Override
19 | public void getPager() {
20 | pagerlist.add(new TestPager(this));
21 | pagerlist.add(new TestPager(this));
22 | }
23 |
24 | class TestPager extends ContentBasePager{
25 |
26 | public TestPager(AppCompatActivity activity) {
27 | super(activity);
28 | }
29 |
30 | @Override
31 | public void initData() {
32 |
33 | }
34 |
35 | @Override
36 | public void outData() {
37 |
38 | }
39 |
40 | @Override
41 | public int getContentView() {
42 | return R.layout.activity_test;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
15 |
19 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_base_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
17 |
18 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/res/layout/mycycleview_err.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
22 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/resultbean/HttpResult.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.resultbean;
2 |
3 | /**
4 | * Created by liukun on 16/3/5.
5 | * 所有返回结果的公共部分
6 | */
7 | public class HttpResult {
8 | public int count;
9 | public int start;
10 | public int total;
11 | public String title;
12 | public T subjects;
13 |
14 | public int getCount() {
15 | return count;
16 | }
17 |
18 | public void setCount(int count) {
19 | this.count = count;
20 | }
21 |
22 | public int getStart() {
23 | return start;
24 | }
25 |
26 | public void setStart(int start) {
27 | this.start = start;
28 | }
29 |
30 | public int getTotal() {
31 | return total;
32 | }
33 |
34 | public void setTotal(int total) {
35 | this.total = total;
36 | }
37 |
38 | public String getTitle() {
39 | return title;
40 | }
41 |
42 | public void setTitle(String title) {
43 | this.title = title;
44 | }
45 |
46 | public T getSubjects() {
47 | return subjects;
48 | }
49 |
50 | public void setSubjects(T subjects) {
51 | this.subjects = subjects;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/banner/BannerData.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.banner;
2 |
3 | /**
4 | * Created by Administrator on 2015/8/17.
5 | */
6 | public class BannerData {
7 |
8 | private int Id;
9 | private String Title;
10 | private String url;
11 | private String Image;
12 | private int PositionId;
13 |
14 | public String getUrl() {
15 | return url;
16 | }
17 |
18 | public void setUrl(String url) {
19 | this.url = url;
20 | }
21 |
22 | //region getter and setter
23 | public int getId() {
24 | return Id;
25 | }
26 |
27 | public void setId(int id) {
28 | Id = id;
29 | }
30 |
31 | public String getTitle() {
32 | return Title;
33 | }
34 |
35 | public void setTitle(String title) {
36 | Title = title;
37 | }
38 |
39 | public String getImage() {
40 | return Image;
41 | }
42 |
43 | public void setImage(String image) {
44 | Image = image;
45 | }
46 |
47 | public int getPositionId() {
48 | return PositionId;
49 | }
50 |
51 | public void setPositionId(int positionId) {
52 | PositionId = positionId;
53 | }
54 | //endregion
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_base.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/image/ImageInfo.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.image;
2 |
3 | import android.graphics.PointF;
4 | import android.graphics.RectF;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * 图片信息,用于放大缩小
9 | * @ClassName: ImageInfo
10 | * @Description: TODO
11 | * @author 甘玉飞
12 | * @date 2016年7月13日 上午11:19:23
13 | *
14 | */
15 | public class ImageInfo {
16 |
17 | // 内部图片在整个手机界面的位置
18 | public RectF mRect = new RectF();
19 |
20 | // 控件在窗口的位置
21 | public RectF mImgRect = new RectF();
22 |
23 | public RectF mWidgetRect = new RectF();
24 |
25 | public RectF mBaseRect = new RectF();
26 |
27 | public PointF mScreenCenter = new PointF();
28 |
29 | public float mScale;
30 |
31 | public float mDegrees;
32 |
33 | public ImageView.ScaleType mScaleType;
34 |
35 | public ImageInfo(RectF rect, RectF img, RectF widget, RectF base, PointF screenCenter, float scale, float degrees, ImageView.ScaleType scaleType) {
36 | mRect.set(rect);
37 | mImgRect.set(img);
38 | mWidgetRect.set(widget);
39 | mScale = scale;
40 | mScaleType = scaleType;
41 | mDegrees = degrees;
42 | mBaseRect.set(base);
43 | mScreenCenter.set(screenCenter);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/pagers/ContentBasePager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.pagers;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | /**
8 | *
9 | * @ClassName: ContentBasePager
10 | * @Description: 4个页面的基类
11 | * @author 甘玉飞
12 | * @date 2017年02月21日
13 | *
14 | */
15 | public abstract class ContentBasePager {
16 |
17 | public AppCompatActivity mActivity;// Mainactivity的引用
18 | public View mRootView;// 布局对象
19 |
20 | public ContentBasePager(AppCompatActivity activity) {
21 | mActivity = activity;
22 | int layoutId=getContentView();
23 | if (layoutId==0 ) {
24 | throw new NullPointerException("no mRootView!");
25 | }
26 | mRootView = View.inflate(mActivity, layoutId, null);
27 | }
28 |
29 |
30 |
31 | /**
32 | * 进入该界面
33 | */
34 | public abstract void initData();
35 | /**
36 | * 离开该界面
37 | */
38 | public abstract void outData();
39 |
40 | public abstract int getContentView();
41 |
42 | /**
43 | * 页面销毁
44 | */
45 | public void onDestroy() {
46 |
47 | }
48 |
49 | /**
50 | * 刷新数据
51 | */
52 | public void refreshData(T t) {
53 |
54 | }
55 |
56 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/activity/TestActivity.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.activity;
2 |
3 | import android.support.v7.widget.Toolbar;
4 | import android.view.Menu;
5 | import android.view.MenuItem;
6 |
7 | import com.gan.base.R;
8 | import com.gan.base.util.ToastUtil;
9 |
10 | /**
11 | * Created by gan on 2017/5/18.
12 | * 基础页面
13 | */
14 | public class TestActivity extends BaseActivity{
15 | @Override
16 | protected int getContentView() {
17 | return R.layout.activity_test;
18 | }
19 |
20 | @Override
21 | protected void afterView() {
22 | setTitle("基本页");
23 |
24 | toolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
25 | @Override
26 | public boolean onMenuItemClick(MenuItem item) {
27 | switch (item.getItemId()){
28 | case R.id.action_settings:
29 | ToastUtil.ToastCenter("点击了设置");
30 | break;
31 | default:break;
32 | }
33 | return true;
34 | }
35 | });
36 | }
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getMenuInflater().inflate(R.menu.menu_base, menu);//加载menu文件到布局
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/apiexception/ApiException.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.apiexception;
2 |
3 | /**
4 | * Created by gan on 16/3/10.
5 | */
6 | public class ApiException extends RuntimeException {
7 | public static final int errData = 0;
8 | public static final int USER_NOT_EXIST = 100;
9 | public static final int WRONG_PASSWORD = 101;
10 |
11 |
12 | public ApiException(int resultCode) {
13 | this(getApiExceptionMessage(resultCode));
14 | }
15 |
16 | public ApiException(String detailMessage) {
17 | super(detailMessage);
18 | }
19 |
20 | /**
21 | * 由于服务器传递过来的错误信息直接给用户看的话,用户未必能够理解
22 | * 需要根据错误码对错误信息进行一个转换,在显示给用户
23 | * @param code
24 | * @return
25 | */
26 | private static String getApiExceptionMessage(int code){
27 | String message = "";
28 | switch (code) {
29 | case USER_NOT_EXIST:
30 | message = "用户名不存在";
31 | break;
32 | case WRONG_PASSWORD:
33 | message = "密码错误";
34 | break;
35 | case errData:
36 | message = "服务端返回数据格式不正确";
37 | break;
38 | default:
39 | message = "未知错误";
40 | }
41 | return message;
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 模块汇总
3 | 个人中心
4 | 订单
5 | 首页
6 | 电影
7 | 退出账号
8 | 将二维码图片对准扫描框即可自动扫描
9 | 确定
10 | 取消
11 | 下拉刷新
12 | 释放立即刷新
13 | 正在刷新…
14 | 刷新成功
15 | 刷新失败
16 | ._0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLIMNOPQRSTUVWXYZ
17 |
18 | 从相册选择
19 | 拍照
20 | 取消
21 |
22 |
23 | 已是最新版本
24 | 版本更新(发现新版本)
25 | 版本更新
26 | 发现您有新的版本未更新。
27 | 立即更新
28 | 稍后再说
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/view/SlideLayout.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.view;
2 |
3 |
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 | import android.widget.LinearLayout;
8 |
9 | public class SlideLayout extends LinearLayout {
10 | private DragLayout dl;
11 |
12 | public SlideLayout(Context context) {
13 | super(context);
14 | }
15 |
16 | public SlideLayout(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public SlideLayout(Context context, AttributeSet attrs, int defStyle) {
21 | super(context, attrs, defStyle);
22 | }
23 |
24 | public void setDragLayout(DragLayout dl) {
25 | this.dl = dl;
26 | }
27 |
28 | @Override
29 | public boolean onInterceptTouchEvent(MotionEvent event) {
30 | if (dl.getStatus() != DragLayout.Status.Close) {
31 | return true;
32 | }
33 | return super.onInterceptTouchEvent(event);
34 | }
35 |
36 | @Override
37 | public boolean onTouchEvent(MotionEvent event) {
38 | if (dl.getStatus() != DragLayout.Status.Close) {
39 | if (event.getAction() == MotionEvent.ACTION_UP) {
40 | dl.close();
41 | }
42 | return true;
43 | }
44 | return super.onTouchEvent(event);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
21 |
22 |
26 |
27 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/image/PhotoPreviewActivity.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.image;
2 |
3 | import android.view.View;
4 |
5 | import com.nostra13.universalimageloader.core.ImageLoader;
6 | import com.gan.base.R;
7 | import com.gan.base.activity.BaseActivity;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * Created by gan on 2017/4/18.
14 | */
15 |
16 | public class PhotoPreviewActivity extends BaseActivity {
17 |
18 | @BindView(R.id.photo_preview_head_pv)
19 | PhotoView mPhotoView;
20 |
21 |
22 | @Override
23 | protected int getContentView() {
24 | return R.layout.activity_photo_preview;
25 | }
26 |
27 | @Override
28 | protected void afterView() {
29 | ButterKnife.bind(this);
30 | setTitle("图片预览");
31 | mPhotoView.enable();
32 | String photoPath=getIntent().getStringExtra("photoPath");
33 | if (photoPath.contains("http") || photoPath.contains("drawable")) {
34 | ImageLoader.getInstance().displayImage(photoPath, mPhotoView);
35 | }
36 | else{
37 | ImageLoader.getInstance().displayImage("file://"+photoPath, mPhotoView);
38 | }
39 | mPhotoView.setOnClickListener(new View.OnClickListener() {
40 |
41 | @Override
42 | public void onClick(View v) {
43 | finish();
44 | }
45 | });
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/menu_item.xml:
--------------------------------------------------------------------------------
1 |
6 |
12 |
21 |
30 |
37 |
--------------------------------------------------------------------------------
/appdownloadlibrary/src/main/java/com/gan/appdownload/DownLoadBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.gan.appdownload;
2 |
3 | import android.app.DownloadManager;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.SharedPreferences;
8 | import android.net.Uri;
9 |
10 | /**
11 | * Created by gan on 2016/6/16.
12 | */
13 |
14 | public class DownLoadBroadcastReceiver extends BroadcastReceiver {
15 |
16 | @Override
17 | public void onReceive(Context context, Intent intent) {
18 | long myDwonloadID = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
19 |
20 | SharedPreferences sPreferences = context.getSharedPreferences("downloadplato", 0);
21 |
22 | long refernece = sPreferences.getLong("plato", 0);
23 |
24 | if (refernece == myDwonloadID) {
25 |
26 | String serviceString = Context.DOWNLOAD_SERVICE;
27 |
28 | DownloadManager dManager = (DownloadManager) context.getSystemService(serviceString);
29 |
30 | Intent install = new Intent(Intent.ACTION_VIEW);
31 |
32 | Uri downloadFileUri = dManager.getUriForDownloadedFile(myDwonloadID);
33 |
34 | install.setDataAndType(downloadFileUri, "application/vnd.android.package-archive");
35 |
36 | install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
37 |
38 | context.startActivity(install);
39 |
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/adapter/ContentAdapter.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.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 |
8 |
9 | import com.gan.base.pagers.ContentBasePager;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * viewpager适配器
15 | *
16 | * @ClassName: ContentAdapter
17 | * @Description:
18 | * @author 甘玉飞
19 | * @date 2016年6月21日 下午4:51:47
20 | *
21 | */
22 |
23 | public class ContentAdapter extends PagerAdapter {
24 | private final Context mContext;
25 | private List mPagerList;
26 | public ContentAdapter(Context mContext, List mPagerList){
27 | this.mContext=mContext;
28 | this.mPagerList=mPagerList;
29 | }
30 |
31 | @Override
32 | public int getCount() {
33 | return mPagerList.size();
34 | }
35 |
36 | @Override
37 | public boolean isViewFromObject(View arg0, Object arg1) {
38 | return arg0 == arg1;
39 | }
40 |
41 | @Override
42 | public Object instantiateItem(ViewGroup container, int position) {
43 | ContentBasePager pager = mPagerList.get(position);
44 | container.addView(pager.mRootView);
45 | return pager.mRootView;
46 | }
47 |
48 | @Override
49 | public void destroyItem(ViewGroup container, int position, Object object) {
50 | container.removeView((View) object);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/KeyBoardUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.inputmethod.InputMethodManager;
6 | import android.widget.EditText;
7 |
8 | public class KeyBoardUtils {
9 | /**
10 | * 打卡软键盘
11 | *
12 | * @param mEditText
13 | * 输入框
14 | * @param mContext
15 | * 上下文
16 | */
17 | public static void openKeybord(EditText mEditText, Context mContext) {
18 | InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
19 | imm.showSoftInput(mEditText, InputMethodManager.RESULT_SHOWN);
20 | imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
21 | }
22 |
23 | /**
24 | * 关闭软键盘
25 | *
26 | * @param mEditText
27 | * 输入框
28 | * @param mContext
29 | * 上下文
30 | */
31 | public static void closeKeybord(EditText mEditText, Context mContext) {
32 | InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
33 | imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
34 | }
35 |
36 | public static void closeKeybord(Activity activity) {
37 | InputMethodManager inputMethodManager = (InputMethodManager) activity
38 | .getSystemService(Activity.INPUT_METHOD_SERVICE);
39 | inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/CustomGsonRequestBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.TypeAdapter;
5 | import com.google.gson.stream.JsonWriter;
6 |
7 | import java.io.IOException;
8 | import java.io.OutputStreamWriter;
9 | import java.io.Writer;
10 | import java.nio.charset.Charset;
11 |
12 | import okhttp3.MediaType;
13 | import okhttp3.RequestBody;
14 | import okio.Buffer;
15 | import retrofit2.Converter;
16 |
17 | /**
18 | * Created by gan on 2017/4/18.
19 | */
20 |
21 | final class CustomGsonRequestBodyConverter implements Converter {
22 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
23 | private static final Charset UTF_8 = Charset.forName("UTF-8");
24 |
25 | private final Gson gson;
26 | private final TypeAdapter adapter;
27 |
28 | CustomGsonRequestBodyConverter(Gson gson, TypeAdapter adapter) {
29 | this.gson = gson;
30 | this.adapter = adapter;
31 | }
32 |
33 | @Override
34 | public RequestBody convert(T value) throws IOException {
35 | Buffer buffer = new Buffer();
36 | Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
37 | JsonWriter jsonWriter = gson.newJsonWriter(writer);
38 | adapter.write(jsonWriter, value);
39 | jsonWriter.close();
40 | return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_msg.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
25 |
26 |
30 |
31 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/StringFormatUtil.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
2 |
3 |
4 | import com.gan.base.net.resultbean.PersonBean;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by jingbin on 2016/11/26.
10 | */
11 |
12 | public class StringFormatUtil {
13 |
14 | /**
15 | * 格式化导演、主演名字
16 | */
17 | public static String formatName(List casts) {
18 | if (casts != null && casts.size() > 0) {
19 | StringBuilder stringBuilder = new StringBuilder();
20 | for (int i = 0; i < casts.size(); i++) {
21 | if (i < casts.size() - 1) {
22 | stringBuilder.append(casts.get(i).name).append(" / ");
23 | } else {
24 | stringBuilder.append(casts.get(i).name);
25 | }
26 | }
27 | return stringBuilder.toString();
28 |
29 | } else {
30 | return "佚名";
31 | }
32 | }
33 |
34 | /**
35 | * 格式化电影类型
36 | */
37 | public static String formatGenres(List genres) {
38 | if (genres != null && genres.size() > 0) {
39 | StringBuilder stringBuilder = new StringBuilder();
40 | for (int i = 0; i < genres.size(); i++) {
41 | if (i < genres.size() - 1) {
42 | stringBuilder.append(genres.get(i)).append(" / ");
43 | } else {
44 | stringBuilder.append(genres.get(i));
45 | }
46 | }
47 | return stringBuilder.toString();
48 |
49 | } else {
50 | return "不知名类型";
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
import android.app.ProgressDialog;
import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;
import com.gan.base.application.MyApplication;
import com.gan.base.constant.Constant;
import java.lang.reflect.Method;
/**
* Toast
*
* @author Swain
*
*/
public class ToastUtil {
public static Method showMethod;
public static Method hideMethod;
public static Object obj;
public static ProgressDialog pd;
private static Toast toast;
/**
* 屏幕中间弹窗
*
* @param msg
*/
public static void ToastCenter(String msg) {
if (!Constant.TOAST)
return;
if (null == toast)
{
toast = Toast.makeText(MyApplication.getInstance(), msg, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
}
else
toast.setText(msg);
toast.show();
}
/**
* 屏幕底端
*
* @param msg
*/
public static void ToastBottow( String msg) {
if (!Constant.TOAST)
return;
if (null == toast)
{
toast = Toast.makeText(MyApplication.getInstance(), msg, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
}
else
toast.setText(msg);
toast.show();
}
/**
* 默认位置
*
* @param msg
*/
public static void ToastDefult( String msg) {
if (!Constant.TOAST)
return;
if (null == toast)
{
toast = Toast.makeText(MyApplication.getInstance(), msg, Toast.LENGTH_SHORT);
}
else
toast.setText(msg);
toast.show();
}
/**
* 等待
*
* @param context
* @param msg
*/
public static void DialogHttp(Context context, String msg) {
pd = new ProgressDialog(context);
pd.setCanceledOnTouchOutside(false);
pd.setMessage(msg);
pd.show();
}
}
--------------------------------------------------------------------------------
/app/src/main/res/drawable/progressbar_mini.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
27 |
28 |
29 |
30 |
31 | -
32 |
33 |
34 |
35 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
14 |
15 |
18 |
19 |
24 |
29 |
34 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/activity/DetailActivity.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.activity;
2 |
3 | import android.widget.TextView;
4 |
5 | import com.gan.base.R;
6 | import com.gan.base.net.networks.NetWorks;
7 | import com.gan.base.net.requestbean.BaseRequest4List;
8 | import com.gan.base.net.requestbean.MovieInfo;
9 | import com.gan.base.net.subscribers.ProgressSubscriber;
10 | import com.gan.base.net.subscribers.SubscriberOnNextListener;
11 |
12 | import java.util.List;
13 |
14 | import butterknife.BindView;
15 | import butterknife.ButterKnife;
16 |
17 | /**
18 | * 用途: TODO
19 | * 创建者:ganyufei
20 | * 时间: 2017/3/20
21 | */
22 | public class DetailActivity extends BaseActivity {
23 | @BindView(R.id.text)
24 | TextView textView;
25 | SubscriberOnNextListener lisenter=new SubscriberOnNextListener>() {
26 | @Override
27 | public void onNext(List o) {
28 | initView(o);
29 | }
30 | };
31 | private ProgressSubscriber subscriber;
32 |
33 | private void initView(List o) {
34 | if (o!=null && !o.isEmpty())
35 | textView.setText(o.toString());
36 | }
37 |
38 | @Override
39 | protected int getContentView() {
40 | return R.layout.activity_detail;
41 | }
42 |
43 | @Override
44 | protected void afterView() {
45 | setTitle("网络请求");
46 | ButterKnife.bind(this);
47 | subscriber=new ProgressSubscriber>(lisenter,this,true,false);
48 | NetWorks.getInstance().inTheaters(subscriber,new BaseRequest4List());
49 | }
50 |
51 | @Override
52 | protected void onDestroy() {
53 | if (subscriber!=null)subscriber.unsubscribe();
54 | super.onDestroy();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/DensityUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
2 |
3 | import android.content.Context;
4 | import android.util.TypedValue;
5 |
6 | public class DensityUtils
7 | {
8 | private DensityUtils()
9 | {
10 | /* cannot be instantiated */
11 | throw new UnsupportedOperationException("cannot be instantiated");
12 | }
13 |
14 | /**
15 | * dp转px
16 | *
17 | * @param context
18 | * @param dpVal
19 | * @return
20 | */
21 | public static int dp2px(Context context, float dpVal)
22 | {
23 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
24 | dpVal, context.getResources().getDisplayMetrics());
25 | }
26 |
27 | /**
28 | * sp转px
29 | *
30 | * @param context
31 | * @param spVal
32 | * @return
33 | */
34 | public static int sp2px(Context context, float spVal)
35 | {
36 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
37 | spVal, context.getResources().getDisplayMetrics());
38 | }
39 |
40 | /**
41 | * px转dp
42 | *
43 | * @param context
44 | * @param pxVal
45 | * @return
46 | */
47 | public static float px2dp(Context context, float pxVal)
48 | {
49 | final float scale = context.getResources().getDisplayMetrics().density;
50 | return (pxVal / scale);
51 | }
52 |
53 | /**
54 | * px转sp
55 | *
56 | * @param pxVal
57 | * @return
58 | */
59 | public static float px2sp(Context context, float pxVal)
60 | {
61 | return (pxVal / context.getResources().getDisplayMetrics().scaledDensity);
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/CustomGsonConverterFactory.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.TypeAdapter;
5 | import com.google.gson.reflect.TypeToken;
6 |
7 | import java.lang.annotation.Annotation;
8 | import java.lang.reflect.Type;
9 |
10 | import okhttp3.RequestBody;
11 | import okhttp3.ResponseBody;
12 | import retrofit2.Converter;
13 | import retrofit2.Converter.Factory;
14 | import retrofit2.Retrofit;
15 |
16 | /**
17 | * Created by gan on 2017/4/18.
18 | */
19 |
20 | public class CustomGsonConverterFactory extends Factory {
21 | private final Gson gson;
22 |
23 | private CustomGsonConverterFactory(Gson gson) {
24 | if (gson == null) throw new NullPointerException("gson == null");
25 | this.gson = gson;
26 | }
27 |
28 | public static CustomGsonConverterFactory create() {
29 | return create(new Gson());
30 | }
31 |
32 | public static CustomGsonConverterFactory create(Gson gson) {
33 | return new CustomGsonConverterFactory(gson);
34 | }
35 |
36 | @Override
37 | public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
38 | TypeAdapter> adapter = gson.getAdapter(TypeToken.get(type));
39 | return new CustomGsonResponseBodyConverter<>(gson, adapter);
40 | }
41 |
42 | @Override
43 | public Converter, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
44 | TypeAdapter> adapter = gson.getAdapter(TypeToken.get(type));
45 | return new CustomGsonRequestBodyConverter<>(gson, adapter);
46 | //return super.requestBodyConverter(type,parameterAnnotations,methodAnnotations,retrofit);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/image/BitmapUtil.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.image;
2 |
3 | import java.util.List;
4 |
5 | import android.graphics.Bitmap;
6 | import android.graphics.Matrix;
7 |
8 | public class BitmapUtil {
9 |
10 | private static class LazyHolder {
11 | private static final BitmapUtil INSTANCE = new BitmapUtil();
12 | }
13 | private BitmapUtil(){}
14 |
15 | /**
16 | * 获取BitmapUtil实例
17 | * @return
18 | */
19 | public static final BitmapUtil init(){
20 | return LazyHolder.INSTANCE;
21 | }
22 |
23 | private static List bitmaps;
24 |
25 |
26 | /**
27 | * 读取Asset文件夹中的图片,图片丢失引用,需自行释放
28 | * @param context
29 | * @param fileName
30 | * @return
31 | */
32 | /*
33 | public Bitmap getImageFromAssetsFile(Context context ,String fileName)
34 | {
35 | Bitmap image = null;
36 | AssetManager am = context.getResources().getAssets();
37 | try {
38 | InputStream is = am.open(fileName);
39 | image = BitmapFactory.decodeStream(is);
40 | is.close();
41 | } catch (IOException e) {
42 | e.printStackTrace();
43 | }
44 |
45 | return image;
46 | }*/
47 |
48 | /**
49 | * 根据宽度等比例缩放图片
50 | *
51 | * @param defaultBitmap
52 | * @param targetWidth
53 | * @return
54 | */
55 | public static Bitmap resizeImageByWidth(Bitmap defaultBitmap,
56 | int targetWidth) {
57 | int rawWidth = defaultBitmap.getWidth();
58 | int rawHeight = defaultBitmap.getHeight();
59 | float targetHeight = targetWidth * (float) rawHeight / (float) rawWidth;
60 | float scaleWidth = targetWidth / (float) rawWidth;
61 | float scaleHeight = targetHeight / (float) rawHeight;
62 | Matrix localMatrix = new Matrix();
63 | localMatrix.postScale(scaleHeight, scaleWidth);
64 | return Bitmap.createBitmap(defaultBitmap, 0, 0, rawWidth, rawHeight,
65 | localMatrix, true);
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/banner/NoactionViewPager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.banner;
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 | * 嵌套中滑动自由的ViewPager
10 | *
11 | * @author 95
12 | *
13 | */
14 | public class NoactionViewPager extends ViewPager {
15 |
16 |
17 |
18 | int startX;
19 | int startY;
20 |
21 | public NoactionViewPager(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public NoactionViewPager(Context context) {
26 | super(context);
27 | }
28 |
29 |
30 |
31 | /**
32 | * 事件分发, 请求父控件及祖宗控件是否拦截事件 1. 右划, 而且是第一个页面, 需要父控件拦截 2. 左划, 而且是最后一个页面, 需要父控件拦截
33 | * 3. 上下滑动, 需要父控件拦截
34 | */
35 | @Override
36 | public boolean dispatchTouchEvent(MotionEvent ev) {
37 | switch (ev.getAction()) {
38 | case MotionEvent.ACTION_DOWN:
39 | getParent().requestDisallowInterceptTouchEvent(true);// 不要拦截,
40 | // 这样是为了保证ACTION_MOVE调用
41 | startX = (int) ev.getRawX();
42 | startY = (int) ev.getRawY();
43 | break;
44 | case MotionEvent.ACTION_MOVE:
45 |
46 | int endX = (int) ev.getRawX();
47 | int endY = (int) ev.getRawY();
48 |
49 | if (Math.abs(endX - startX) > Math.abs(endY - startY)) {// 左右滑动
50 | if (endX > startX) {// 右划
51 | if (getCurrentItem() == 0) {// 第一个页面, 需要父控件拦截
52 | getParent().requestDisallowInterceptTouchEvent(false);
53 | }
54 | } else {// 左划
55 | if (getCurrentItem() == getAdapter().getCount() - 1) {// 最后一个页面,
56 | // 需要拦截
57 | getParent().requestDisallowInterceptTouchEvent(false);
58 | }
59 | }
60 | } else {// 上下滑动
61 | getParent().requestDisallowInterceptTouchEvent(false);
62 | }
63 |
64 | break;
65 |
66 | default:
67 | break;
68 | }
69 |
70 | return super.dispatchTouchEvent(ev);
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zxing/decode/DecodeFormatManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 ZXing authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.zxing.decode;
18 |
19 | import java.util.Collection;
20 | import java.util.EnumSet;
21 | import java.util.Set;
22 |
23 | import com.google.zxing.BarcodeFormat;
24 |
25 | public class DecodeFormatManager {
26 |
27 | // 1D解码
28 | private static final Set PRODUCT_FORMATS;
29 | private static final Set INDUSTRIAL_FORMATS;
30 | private static final Set ONE_D_FORMATS;
31 |
32 | // 二维码解码
33 | private static final Set QR_CODE_FORMATS;
34 |
35 | static {
36 | PRODUCT_FORMATS = EnumSet.of(BarcodeFormat.UPC_A, BarcodeFormat.UPC_E, BarcodeFormat.EAN_13, BarcodeFormat.EAN_8, BarcodeFormat.RSS_14, BarcodeFormat.RSS_EXPANDED);
37 | INDUSTRIAL_FORMATS = EnumSet.of(BarcodeFormat.CODE_39, BarcodeFormat.CODE_93, BarcodeFormat.CODE_128, BarcodeFormat.ITF, BarcodeFormat.CODABAR);
38 | ONE_D_FORMATS = EnumSet.copyOf(PRODUCT_FORMATS);
39 | ONE_D_FORMATS.addAll(INDUSTRIAL_FORMATS);
40 |
41 | QR_CODE_FORMATS = EnumSet.of(BarcodeFormat.QR_CODE);
42 | }
43 |
44 | public static Collection getQrCodeFormats() {
45 | return QR_CODE_FORMATS;
46 | }
47 |
48 | public static Collection getBarCodeFormats() {
49 | return ONE_D_FORMATS;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/CustomGsonResponseBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.TypeAdapter;
5 | import com.google.gson.stream.JsonReader;
6 | import com.gan.base.net.resultbean.HttpResult;
7 |
8 | import java.io.ByteArrayInputStream;
9 | import java.io.IOException;
10 | import java.io.InputStream;
11 | import java.io.InputStreamReader;
12 | import java.io.Reader;
13 | import java.nio.charset.Charset;
14 |
15 | import okhttp3.MediaType;
16 | import okhttp3.ResponseBody;
17 | import retrofit2.Converter;
18 |
19 | import static okhttp3.internal.Util.UTF_8;
20 |
21 | /**
22 | * Created by gan on 2017/4/18.
23 | */
24 |
25 | final class CustomGsonResponseBodyConverter implements Converter {
26 | private final Gson gson;
27 | private final TypeAdapter adapter;
28 |
29 | CustomGsonResponseBodyConverter(Gson gson, TypeAdapter adapter) {
30 | this.gson = gson;
31 | this.adapter = adapter;
32 | }
33 |
34 | @Override
35 | public T convert(ResponseBody value) throws IOException {
36 | String response = value.string();
37 | LogUtils.D("gan-retrofit-okhttp3","responseBody=====>"+response);
38 | HttpResult httpResult = gson.fromJson(response, HttpResult.class);
39 | //这里可以统一处理访问失败的异常
40 | /* if (!httpResult.isSuccess()) {
41 | value.close();
42 | throw new ApiException(httpResult.getMsg());
43 | }*/
44 | MediaType contentType = value.contentType();
45 | Charset charset = contentType != null ? contentType.charset(UTF_8) : UTF_8;
46 | InputStream inputStream = new ByteArrayInputStream(response.getBytes());
47 | Reader reader = new InputStreamReader(inputStream, charset);
48 | JsonReader jsonReader = gson.newJsonReader(reader);
49 | try {
50 | return adapter.read(jsonReader);
51 | } finally {
52 | value.close();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/networks/NetWorks.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.networks;
2 |
3 |
4 | import com.gan.base.net.requestbean.BaseRequest4List;
5 | import com.gan.base.net.requestbean.MovieInfo;
6 | import com.gan.base.net.resultbean.HttpResult;
7 | import com.gan.base.net.resultbean.UserInfoResult;
8 | import com.gan.base.net.subscribers.ProgressSubscriber;
9 | import com.gan.base.net.utils.RetrofitUtils;
10 |
11 | import java.util.List;
12 |
13 | import rx.Observable;
14 | import rx.Subscriber;
15 | import rx.functions.Func1;
16 |
17 |
18 | /**
19 | * Created by gan on 2017/2/20 0003.
20 | */
21 | public class NetWorks extends RetrofitUtils {
22 | private NetWorks() {
23 | super();
24 | }
25 |
26 | public void inTheaters(Subscriber> subscriber, BaseRequest4List requset) {
27 | Observable observable = service.inTheaters(requset.toMap()).map(new HttpResultFunc>());
28 | setSubscribe(observable, subscriber);
29 | }
30 |
31 | /**
32 | * 登录
33 | * @param subscriber
34 | * @param loginName
35 | * @param loginPwd
36 | */
37 | public void postLogin(ProgressSubscriber subscriber, String loginName, String loginPwd) {
38 | Observable observable = service.postLogin(loginName,loginPwd).map(new HttpResultFunc());
39 | setSubscribe(observable, subscriber);
40 | }
41 | /**
42 | * 用来统一处理Http的resultCode,并将HttpResult的Data部分剥离出来返回给subscriber
43 | */
44 | private class HttpResultFunc implements Func1, T> {
45 |
46 | @Override
47 | public T call(HttpResult httpResult) {
48 | return httpResult.getSubjects();
49 | }
50 | }
51 |
52 |
53 | //在访问HttpMethods时创建单例
54 | private static class SingletonHolder {
55 | private static final NetWorks INSTANCE = new NetWorks();
56 | }
57 |
58 | //获取单例
59 | public static NetWorks getInstance() {
60 | return SingletonHolder.INSTANCE;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/myrecycleview/src/main/java/com/gan/myrecycleview/utils/WrapperUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.myrecycleview.utils;
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.view.ViewGroup;
7 |
8 | public class WrapperUtils
9 | {
10 | public interface SpanSizeCallback
11 | {
12 | int getSpanSize(GridLayoutManager layoutManager, GridLayoutManager.SpanSizeLookup oldLookup, int position);
13 | }
14 |
15 | public static void onAttachedToRecyclerView(RecyclerView.Adapter innerAdapter, RecyclerView recyclerView, final SpanSizeCallback callback)
16 | {
17 | innerAdapter.onAttachedToRecyclerView(recyclerView);
18 |
19 | RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
20 | if (layoutManager instanceof GridLayoutManager)
21 | {
22 | final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
23 | final GridLayoutManager.SpanSizeLookup spanSizeLookup = gridLayoutManager.getSpanSizeLookup();
24 |
25 | gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup()
26 | {
27 | @Override
28 | public int getSpanSize(int position)
29 | {
30 | return callback.getSpanSize(gridLayoutManager, spanSizeLookup, position);
31 | }
32 | });
33 | gridLayoutManager.setSpanCount(gridLayoutManager.getSpanCount());
34 | }
35 | }
36 |
37 | public static void setFullSpan(RecyclerView.ViewHolder holder)
38 | {
39 | ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
40 |
41 | if (lp != null
42 | && lp instanceof StaggeredGridLayoutManager.LayoutParams)
43 | {
44 |
45 | StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
46 |
47 | p.setFullSpan(true);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zxing/camera/PreviewCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 ZXing authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.zxing.camera;
18 |
19 | import android.graphics.Point;
20 | import android.hardware.Camera;
21 | import android.os.Handler;
22 | import android.os.Message;
23 | import android.util.Log;
24 |
25 | public class PreviewCallback implements Camera.PreviewCallback {
26 |
27 | private static final String TAG = PreviewCallback.class.getSimpleName();
28 |
29 | private final CameraConfigurationManager configManager;
30 | private Handler previewHandler;
31 | private int previewMessage;
32 |
33 | public PreviewCallback(CameraConfigurationManager configManager) {
34 | this.configManager = configManager;
35 | }
36 |
37 | public void setHandler(Handler previewHandler, int previewMessage) {
38 | this.previewHandler = previewHandler;
39 | this.previewMessage = previewMessage;
40 | }
41 |
42 | @Override
43 | public void onPreviewFrame(byte[] data, Camera camera) {
44 | Point cameraResolution = configManager.getCameraResolution();
45 | Handler thePreviewHandler = previewHandler;
46 | if (cameraResolution != null && thePreviewHandler != null) {
47 | Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data);
48 | message.sendToTarget();
49 | previewHandler = null;
50 | } else {
51 | Log.d(TAG, "Got preview callback, but no handler or resolution available");
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_discover_cardview_item.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
25 |
31 |
32 |
39 |
40 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/image/RotateGestureDetector.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util.image;
2 |
3 | import android.view.MotionEvent;
4 |
5 | /**
6 | * Created by q2366 on 2015/10/12.
7 | */
8 | public class RotateGestureDetector {
9 |
10 | private static final int MAX_DEGREES_STEP = 120;
11 |
12 | private OnRotateListener mListener;
13 |
14 | private float mPrevSlope;
15 | private float mCurrSlope;
16 |
17 | private float x1;
18 | private float y1;
19 | private float x2;
20 | private float y2;
21 |
22 | public RotateGestureDetector(OnRotateListener l) {
23 | mListener = l;
24 | }
25 |
26 | public void onTouchEvent(MotionEvent event) {
27 |
28 | final int Action = event.getActionMasked();
29 |
30 | switch (Action) {
31 | case MotionEvent.ACTION_POINTER_DOWN:
32 | case MotionEvent.ACTION_POINTER_UP:
33 | if (event.getPointerCount() == 2) mPrevSlope = caculateSlope(event);
34 | break;
35 | case MotionEvent.ACTION_MOVE:
36 | if (event.getPointerCount() > 1) {
37 | mCurrSlope = caculateSlope(event);
38 |
39 | double currDegrees = Math.toDegrees(Math.atan(mCurrSlope));
40 | double prevDegrees = Math.toDegrees(Math.atan(mPrevSlope));
41 |
42 | double deltaSlope = currDegrees - prevDegrees;
43 |
44 | if (Math.abs(deltaSlope) <= MAX_DEGREES_STEP) {
45 | mListener.onRotate((float) deltaSlope, (x2 + x1) / 2, (y2 + y1) / 2);
46 | }
47 | mPrevSlope = mCurrSlope;
48 | }
49 | break;
50 | default:
51 | break;
52 | }
53 | }
54 |
55 | private float caculateSlope(MotionEvent event) {
56 | x1 = event.getX(0);
57 | y1 = event.getY(0);
58 | x2 = event.getX(1);
59 | y2 = event.getY(1);
60 | return (y2 - y1) / (x2 - x1);
61 | }
62 | }
63 |
64 | interface OnRotateListener {
65 | void onRotate(float degrees, float focusX, float focusY);
66 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
27 |
28 |
44 |
45 |
53 |
54 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'android-apt'
3 | apply plugin: 'com.neenbedankt.android-apt'
4 |
5 | android {
6 | compileSdkVersion 23
7 | buildToolsVersion "23.0.1"
8 | defaultConfig {
9 | applicationId "com.gan.base"
10 | minSdkVersion 15
11 | targetSdkVersion 23
12 | versionCode 1
13 | versionName "1.0"
14 | multiDexEnabled true //防止方法数 dex 达到上线 64K
15 | vectorDrawables.useSupportLibrary = true
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | sourceSets {
25 | main {
26 | jniLibs.srcDirs = ['libs']
27 | }
28 | }
29 | }
30 |
31 | dependencies {
32 | compile fileTree(include: ['*.jar'], dir: 'libs')
33 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
34 | exclude group: 'com.android.support', module: 'support-annotations'
35 | })
36 | compile files('libs/nineoldandroids-2.4.0.jar')
37 | compile 'com.jakewharton:butterknife:8.4.0'
38 | testCompile 'junit:junit:4.12'
39 | apt 'com.jakewharton:butterknife-compiler:8.4.0'
40 | compile 'com.android.support:appcompat-v7:23.4.0'
41 | compile 'com.android.support:cardview-v7:23.4.0'
42 | compile 'com.android.support:design:23.4.0'
43 | compile 'com.android.support:support-v4:23.4.0'
44 | compile project(':myrecycleview')
45 | compile 'com.squareup.retrofit2:retrofit:2.1.0'
46 | compile 'com.squareup.retrofit2:converter-gson:2.1.0'
47 | compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
48 | compile 'io.reactivex:rxjava:1.2.6'
49 | compile 'io.reactivex:rxandroid:1.2.1'
50 | compile files('libs/universal-image-loader-1.9.3-with-sources.jar')
51 | compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
52 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
53 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
54 | compile files('libs/zxing.jar')
55 | compile project(':appdownloadlibrary')
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_choose_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
29 |
30 |
34 |
35 |
46 |
47 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/.idea/misc.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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/util/PrefUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.util;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import com.gan.base.application.MyApplication;
7 |
8 |
9 | /**
10 | * 作者:Create on 2017/1/19 13:34 by gan
11 | * 邮箱:
12 | * 描述:shareprefrence的类工具
13 | * 最近修改:2017/1/19 13:34 modify by gan
14 | */
15 |
16 | public class PrefUtils {
17 | public static boolean getBoolean( String key, boolean defalt){
18 | SharedPreferences sp= MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
19 | Boolean b=sp.getBoolean(key, defalt);
20 | return b;
21 | }
22 |
23 | public static void setBoolean(String key,Boolean value) {
24 | SharedPreferences sp= MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
25 | sp.edit().putBoolean(key, value).commit();
26 | }
27 |
28 | public static String getString(String key,String defalt){
29 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
30 | String s=sp.getString(key, defalt);
31 | return s;
32 | }
33 |
34 | public static void SetString(String key,String value){
35 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
36 | sp.edit().putString(key, value).commit();
37 |
38 | }
39 |
40 | public static int getInt(String key,int defalt){
41 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
42 | int l=sp.getInt(key, defalt);
43 | return l;
44 | }
45 |
46 | public static void SetInt(String key,int value){
47 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
48 | sp.edit().putInt(key, value).commit();
49 |
50 | }
51 | public static long getLong(String key,long defalt){
52 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
53 | long l=sp.getLong(key, defalt);
54 | return l;
55 | }
56 |
57 | public static void SetLong(String key,long value){
58 | SharedPreferences sp=MyApplication.getInstance().getSharedPreferences("config",Context.MODE_PRIVATE);
59 | sp.edit().putLong(key, value).commit();
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/SerializableOkHttpCookies.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 | import java.io.IOException;
4 | import java.io.ObjectInputStream;
5 | import java.io.ObjectOutputStream;
6 | import java.io.Serializable;
7 |
8 | import okhttp3.Cookie;
9 |
10 | /**
11 | * Created by Administrator on 2016-5-4.
12 | */
13 | public class SerializableOkHttpCookies implements Serializable {
14 |
15 | private transient final Cookie cookies;
16 | private transient Cookie clientCookies;
17 |
18 | public SerializableOkHttpCookies(Cookie cookies) {
19 | this.cookies = cookies;
20 | }
21 |
22 | public Cookie getCookies() {
23 | Cookie bestCookies = cookies;
24 | if (null != clientCookies) {
25 | bestCookies = clientCookies;
26 | }
27 | return bestCookies;
28 | }
29 |
30 | private void writeObject(ObjectOutputStream out) throws IOException {
31 | out.writeObject(cookies.name());
32 | out.writeObject(cookies.value());
33 | out.writeLong(cookies.expiresAt());
34 | out.writeObject(cookies.domain());
35 | out.writeObject(cookies.path());
36 | out.writeBoolean(cookies.secure());
37 | out.writeBoolean(cookies.httpOnly());
38 | out.writeBoolean(cookies.hostOnly());
39 | out.writeBoolean(cookies.persistent());
40 | }
41 |
42 | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
43 | String name = (String) in.readObject();
44 | String value = (String) in.readObject();
45 | long expiresAt = in.readLong();
46 | String domain = (String) in.readObject();
47 | String path = (String) in.readObject();
48 | boolean secure = in.readBoolean();
49 | boolean httpOnly = in.readBoolean();
50 | boolean hostOnly = in.readBoolean();
51 | boolean persistent = in.readBoolean();
52 | Cookie.Builder builder = new Cookie.Builder();
53 | builder = builder.name(name);
54 | builder = builder.value(value);
55 | builder = builder.expiresAt(expiresAt);
56 | builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain);
57 | builder = builder.path(path);
58 | builder = secure ? builder.secure() : builder;
59 | builder = httpOnly ? builder.httpOnly() : builder;
60 | clientCookies = builder.build();
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
22 |
23 |
24 |
25 |
37 |
38 |
49 |
50 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/progress/ProgressDialogHandler.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.progress;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.content.DialogInterface;
6 | import android.graphics.drawable.ColorDrawable;
7 | import android.os.Handler;
8 | import android.os.Message;
9 |
10 | import com.gan.base.R;
11 |
12 |
13 | /**
14 | * Created by liukun on 16/3/10.
15 | */
16 | public class ProgressDialogHandler extends Handler {
17 |
18 | public static final int SHOW_PROGRESS_DIALOG = 1;
19 | public static final int DISMISS_PROGRESS_DIALOG = 2;
20 |
21 | private ProgressDialog pd;
22 |
23 | private Context context;
24 | private boolean cancelable;
25 | private ProgressCancelListener mProgressCancelListener;
26 |
27 | public ProgressDialogHandler(Context context, ProgressCancelListener mProgressCancelListener,
28 | boolean cancelable) {
29 | super();
30 | this.context = context;
31 | this.mProgressCancelListener = mProgressCancelListener;
32 | this.cancelable = cancelable;
33 | }
34 |
35 | private void initProgressDialog(){
36 | if (pd == null) {
37 | pd = new ProgressDialog(context);
38 | pd.setCancelable(cancelable);
39 |
40 | if (cancelable) {
41 | pd.setOnCancelListener(new DialogInterface.OnCancelListener() {
42 | @Override
43 | public void onCancel(DialogInterface dialogInterface) {
44 | mProgressCancelListener.onCancelProgress();
45 | }
46 | });
47 | }
48 | if (!pd.isShowing()) {
49 | pd.show();
50 | pd.setContentView(R.layout.dialog_progress);
51 | pd.getWindow().setBackgroundDrawable(new ColorDrawable(0));
52 | }
53 | }
54 | }
55 |
56 | private void dismissProgressDialog(){
57 | if (pd != null) {
58 | pd.dismiss();
59 | pd = null;
60 | }
61 | }
62 |
63 | @Override
64 | public void handleMessage(Message msg) {
65 | switch (msg.what) {
66 | case SHOW_PROGRESS_DIALOG:
67 | initProgressDialog();
68 | break;
69 | case DISMISS_PROGRESS_DIALOG:
70 | dismissProgressDialog();
71 | break;
72 | }
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/pagers/MessagePager.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.pagers;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.support.v7.widget.StaggeredGridLayoutManager;
5 | import android.widget.ImageView;
6 |
7 |
8 | import com.gan.myrecycleview.base.ViewHolder;
9 | import com.nostra13.universalimageloader.core.ImageLoader;
10 | import com.gan.base.R;
11 | import com.gan.base.net.networks.NetWorks;
12 | import com.gan.base.net.requestbean.BaseRequest4List;
13 | import com.gan.base.net.requestbean.MovieInfo;
14 | import com.gan.base.net.subscribers.RecycleviewSubscriber;
15 |
16 | /**
17 | * @author 甘玉飞
18 | * @ClassName: MessagePager
19 | * @Description: 页面(消息)的实现
20 | * @date 2017年02月21日
21 | */
22 | public class MessagePager extends BaseRecycleviewPager {
23 |
24 | public MessagePager(AppCompatActivity activity){
25 | super(activity);
26 | }
27 |
28 | @Override
29 | public boolean setRecyclerViewField() {
30 | //设置布局管理
31 |
32 | StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
33 | // GridLayoutManager layoutManager= new GridLayoutManager(mActivity, 2);
34 | recycleView.setLayoutManager(layoutManager);
35 | return true;
36 | }
37 |
38 | @Override
39 | protected int getItemLayoutId() {
40 | return R.layout.fragment_discover_cardview_item;
41 | }
42 |
43 | @Override
44 | protected void doItemUI(ViewHolder viewHolder, MovieInfo o, int position) {
45 | viewHolder.setText(R.id.activity_title,o.title);
46 | viewHolder.setText(R.id.activity_date,o.year);
47 | ImageView iv=viewHolder.getView(R.id.img_iv);
48 | ImageLoader.getInstance().displayImage(o.images.large,iv);
49 | }
50 |
51 | @Override
52 | protected BaseRequest4List getNetRequest() {
53 | return new BaseRequest4List();
54 | }
55 |
56 | @Override
57 | protected String getNoDataString() {
58 | return "暂无消息";
59 | }
60 |
61 | @Override
62 | protected int getNoDataDrawable() {
63 | return R.drawable.no_data;
64 | }
65 |
66 | @Override
67 | protected void getNetData(RecycleviewSubscriber subscriber, BaseRequest4List request) {
68 | NetWorks.getInstance().inTheaters(subscriber,request);
69 | }
70 |
71 | @Override
72 | public int getContentView() {
73 | return R.layout.pager_message;
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/refresh_head.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
28 |
29 |
37 |
38 |
47 |
48 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
11 |
12 |
16 |
17 |
21 |
22 |
30 |
31 |
38 |
39 |
48 |
49 |
50 |
51 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/utils/RetrofitUtils.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.utils;
2 |
3 |
4 |
5 |
6 | import com.gan.base.constant.UrlConstant;
7 | import com.gan.base.net.service.NetService;
8 |
9 | import okhttp3.MediaType;
10 | import okhttp3.OkHttpClient;
11 | import okhttp3.RequestBody;
12 | import retrofit2.Retrofit;
13 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
14 | import rx.Observable;
15 | import rx.Observer;
16 | import rx.android.schedulers.AndroidSchedulers;
17 | import rx.schedulers.Schedulers;
18 |
19 | /**
20 | * retrofit工具类
21 | */
22 | public abstract class RetrofitUtils {
23 |
24 | private static Retrofit mRetrofit;
25 | private static OkHttpClient mOkHttpClient;
26 |
27 | protected static final NetService service = getRetrofit().create(NetService.class);
28 | /**
29 | * 获取Retrofit对象
30 | *
31 | * @return
32 | */
33 | protected static Retrofit getRetrofit() {
34 |
35 | if (null == mRetrofit) {
36 | if (null == mOkHttpClient) {
37 | mOkHttpClient = OkHttp3Utils.getOkHttpClient();
38 | // mOkHttpClient = new OkHttpClient();
39 | }
40 |
41 | //Retrofit2后使用build设计模式
42 | mRetrofit = new Retrofit.Builder()
43 | //设置服务器路径
44 | .baseUrl(UrlConstant.BASEURL)
45 | //添加转化库,默认是Gson
46 | .addConverterFactory(CustomGsonConverterFactory.create())
47 | //添加回调库,采用RxJava
48 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
49 | //设置使用okhttp网络请求
50 | .client(mOkHttpClient)
51 | .build();
52 | }
53 |
54 | return mRetrofit;
55 | }
56 |
57 |
58 | /**
59 | * 线程调度
60 | * 插入观察者-泛型
61 | * @param observable
62 | * @param observer
63 | * @param
64 | */
65 | public static void setSubscribe(Observable observable, Observer observer) {
66 | observable.subscribeOn(Schedulers.io())
67 | .unsubscribeOn(Schedulers.io())
68 | .observeOn(AndroidSchedulers.mainThread())
69 | .subscribe(observer);
70 | }
71 |
72 | /**
73 | * 参数转为RequestBody
74 | * @param value
75 | * @return
76 | */
77 |
78 | public static RequestBody toRequestBody(String value) {
79 | RequestBody body=RequestBody.create(MediaType.parse("text/plain") ,value);
80 | return body;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/view/TabIndicatorView.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.view;
2 |
3 |
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.ImageView;
8 | import android.widget.RelativeLayout;
9 | import android.widget.TextView;
10 |
11 | import com.gan.base.R;
12 |
13 |
14 | public class TabIndicatorView extends RelativeLayout {
15 | private ImageView ivTabIcon;
16 | private View warnIcon;
17 | private TextView tvTabHint;
18 | private TextView tvTabUnRead;
19 |
20 | private int normalIconId;
21 | private int focusIconId;
22 |
23 | public TabIndicatorView(Context context) {
24 | this(context, null);
25 | }
26 |
27 | public TabIndicatorView(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 |
30 | // 将布局文件和 代码进行绑定
31 | View.inflate(context, R.layout.tab_indicator, this);
32 |
33 | ivTabIcon = (ImageView) findViewById(R.id.tab_indicator_icon);
34 | tvTabHint = (TextView) findViewById(R.id.tab_indicator_hint);
35 | tvTabUnRead = (TextView) findViewById(R.id.tab_indicator_unread);
36 | warnIcon=findViewById(R.id.tab_indicator_warn);
37 | setTabUnreadCount(0);
38 | }
39 |
40 | // 设置tab的title
41 | public void setTabTitle(String title) {
42 | tvTabHint.setText(title);
43 | }
44 |
45 | public void setTabTitle(int titleId) {
46 | tvTabHint.setText(titleId);
47 | }
48 |
49 | // 初始化图标
50 | public void setTabIcon(int normalIconId, int focusIconId) {
51 | this.normalIconId = normalIconId;
52 | this.focusIconId = focusIconId;
53 | ivTabIcon.setImageResource(normalIconId);
54 | }
55 |
56 | // 设置未读数
57 | public void setTabUnreadCount(int unreadCount) {
58 | warnIcon.setVisibility(View.GONE);
59 | if (unreadCount <= 0) {
60 | tvTabUnRead.setVisibility(View.GONE);
61 | } else {
62 | if (unreadCount <= 99) {
63 | tvTabUnRead.setText(unreadCount + "");
64 | } else {
65 | tvTabUnRead.setText("99+");
66 | }
67 |
68 | tvTabUnRead.setVisibility(View.VISIBLE);
69 | }
70 | }
71 |
72 | /**
73 | * 设置提醒小红点
74 | */
75 | public void setWarn(boolean visble){
76 | tvTabUnRead.setVisibility(View.GONE);
77 | if (visble) {
78 | warnIcon.setVisibility(View.VISIBLE);
79 | }else {
80 | warnIcon.setVisibility(View.GONE);
81 | }
82 | }
83 |
84 | // 设置选中
85 | public void setTabSelected(boolean selected) {
86 | if (selected) {
87 | ivTabIcon.setImageResource(focusIconId);
88 | tvTabHint.setSelected(true);
89 | } else {
90 | ivTabIcon.setImageResource(normalIconId);
91 | tvTabHint.setSelected(false);
92 | }
93 | }
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zxing/camera/open/OpenCameraInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 ZXing authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.zxing.camera.open;
18 |
19 | import android.hardware.Camera;
20 | import android.util.Log;
21 |
22 | public class OpenCameraInterface {
23 |
24 | private static final String TAG = OpenCameraInterface.class.getName();
25 |
26 | /**
27 | * Opens the requested camera with {@link Camera#open(int)}, if one exists.
28 | *
29 | * @param cameraId
30 | * camera ID of the camera to use. A negative value means
31 | * "no preference"
32 | * @return handle to {@link Camera} that was opened
33 | */
34 | public static Camera open(int cameraId) {
35 |
36 | int numCameras = Camera.getNumberOfCameras();
37 | if (numCameras == 0) {
38 | Log.w(TAG, "No cameras!");
39 | return null;
40 | }
41 |
42 | boolean explicitRequest = cameraId >= 0;
43 |
44 | if (!explicitRequest) {
45 | // Select a camera if no explicit camera requested
46 | int index = 0;
47 | while (index < numCameras) {
48 | Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
49 | Camera.getCameraInfo(index, cameraInfo);
50 | if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
51 | break;
52 | }
53 | index++;
54 | }
55 |
56 | cameraId = index;
57 | }
58 |
59 | Camera camera;
60 | if (cameraId < numCameras) {
61 | Log.i(TAG, "Opening camera #" + cameraId);
62 | camera = Camera.open(cameraId);
63 | } else {
64 | if (explicitRequest) {
65 | Log.w(TAG, "Requested camera does not exist: " + cameraId);
66 | camera = null;
67 | } else {
68 | Log.i(TAG, "No camera facing back; returning camera #0");
69 | camera = Camera.open(0);
70 | }
71 | }
72 |
73 | return camera;
74 | }
75 |
76 | /**
77 | * Opens a rear-facing camera with {@link Camera#open(int)}, if one exists,
78 | * or opens camera 0.
79 | *
80 | * @return handle to {@link Camera} that was opened
81 | */
82 | public static Camera open() {
83 | return open(-1);
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/gan/base/net/rx/RxBus.java:
--------------------------------------------------------------------------------
1 | package com.gan.base.net.rx;
2 |
3 | import rx.Observable;
4 | import rx.functions.Func1;
5 | import rx.subjects.PublishSubject;
6 | import rx.subjects.SerializedSubject;
7 | import rx.subjects.Subject;
8 |
9 |
10 | public class RxBus {
11 |
12 | private static volatile RxBus mDefaultInstance;
13 |
14 | private RxBus() {
15 | }
16 |
17 | public static RxBus getDefault() {
18 | if (mDefaultInstance == null) {
19 | synchronized (RxBus.class) {
20 | if (mDefaultInstance == null) {
21 | mDefaultInstance = new RxBus();
22 | }
23 | }
24 | }
25 | return mDefaultInstance;
26 | }
27 |
28 | private final Subject