├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── AisenForAndroid.iml
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── changelog.txt
├── library.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── org
│ │ └── aisen
│ │ └── android
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── aisen
│ │ └── android
│ │ ├── common
│ │ ├── context
│ │ │ └── GlobalContext.java
│ │ ├── md
│ │ │ ├── DrawableWrapper.java
│ │ │ └── MDHelper.java
│ │ ├── setting
│ │ │ ├── Setting.java
│ │ │ ├── SettingArray.java
│ │ │ ├── SettingBean.java
│ │ │ ├── SettingExtra.java
│ │ │ ├── SettingUtil.java
│ │ │ ├── SettingUtility.java
│ │ │ └── SettingsXmlParser.java
│ │ └── utils
│ │ │ ├── ActivityHelper.java
│ │ │ ├── BitmapUtil.java
│ │ │ ├── CacheTimeUtils.java
│ │ │ ├── Consts.java
│ │ │ ├── CrashHandler.java
│ │ │ ├── DateUtils.java
│ │ │ ├── FileUtils.java
│ │ │ ├── HprofUtils.java
│ │ │ ├── ImagePickerUtils.java
│ │ │ ├── KeyGenerator.java
│ │ │ ├── Logger.java
│ │ │ ├── Logger2File.java
│ │ │ ├── PhotoChoice.java
│ │ │ ├── SdcardUtils.java
│ │ │ ├── SystemBarUtils.java
│ │ │ ├── SystemUtils.java
│ │ │ ├── Utils.java
│ │ │ └── ViewUtils.java
│ │ ├── component
│ │ ├── bitmaploader
│ │ │ ├── BitmapLoader.java
│ │ │ ├── core
│ │ │ │ ├── ArrayDeque.java
│ │ │ │ ├── BitmapCache.java
│ │ │ │ ├── BitmapCommonUtils.java
│ │ │ │ ├── BitmapCompress.java
│ │ │ │ ├── BitmapDecoder.java
│ │ │ │ ├── BitmapOwner.java
│ │ │ │ ├── BitmapProcess.java
│ │ │ │ ├── BitmapTask.java
│ │ │ │ ├── Deque.java
│ │ │ │ ├── FileDisk.java
│ │ │ │ ├── IBitmapCompress.java
│ │ │ │ ├── ImageConfig.java
│ │ │ │ ├── LruDiskCache.java
│ │ │ │ ├── LruMemoryCache.java
│ │ │ │ └── MyBitmap.java
│ │ │ ├── display
│ │ │ │ ├── DefaultDisplayer.java
│ │ │ │ ├── Displayer.java
│ │ │ │ └── FadeInDisplayer.java
│ │ │ ├── download
│ │ │ │ ├── AssetsDownloader.java
│ │ │ │ ├── ContentProviderDownloader.java
│ │ │ │ ├── DownloadProcess.java
│ │ │ │ ├── Downloader.java
│ │ │ │ ├── DrawableDownloader.java
│ │ │ │ ├── SdcardDownloader.java
│ │ │ │ └── WebDownloader.java
│ │ │ └── view
│ │ │ │ └── MyDrawable.java
│ │ ├── cardmenu
│ │ │ ├── CardMenuBuilder.java
│ │ │ ├── CardMenuOptions.java
│ │ │ └── CardMenuPresenter.java
│ │ └── orm
│ │ │ ├── SqliteUtility.java
│ │ │ ├── SqliteUtilityBuilder.java
│ │ │ ├── annotation
│ │ │ ├── AutoIncrementPrimaryKey.java
│ │ │ ├── PrimaryKey.java
│ │ │ └── TableName.java
│ │ │ ├── extra
│ │ │ ├── AutoIncrementTableColumn.java
│ │ │ ├── Extra.java
│ │ │ ├── TableColumn.java
│ │ │ └── TableInfo.java
│ │ │ └── utils
│ │ │ ├── FieldUtils.java
│ │ │ ├── SqlUtils.java
│ │ │ └── TableInfoUtils.java
│ │ ├── network
│ │ ├── biz
│ │ │ ├── ABizLogic.java
│ │ │ └── IResult.java
│ │ ├── cache
│ │ │ └── ICacheUtility.java
│ │ ├── http
│ │ │ ├── DefHttpUtility.java
│ │ │ ├── HttpConfig.java
│ │ │ ├── IHttpUtility.java
│ │ │ ├── OnFileProgress.java
│ │ │ ├── Params.java
│ │ │ └── ParamsUtil.java
│ │ └── task
│ │ │ ├── IExceptionDeclare.java
│ │ │ ├── ITaskManager.java
│ │ │ ├── ParamsUtil.java
│ │ │ ├── TaskException.java
│ │ │ ├── TaskManager.java
│ │ │ └── WorkTask.java
│ │ ├── support
│ │ ├── action
│ │ │ └── IAction.java
│ │ ├── bean
│ │ │ ├── ResultBean.java
│ │ │ └── TabItem.java
│ │ ├── inject
│ │ │ ├── EventListener.java
│ │ │ ├── InjectUtility.java
│ │ │ ├── Select.java
│ │ │ └── ViewInject.java
│ │ ├── paging
│ │ │ ├── IPaging.java
│ │ │ └── PageIndexPaging.java
│ │ ├── permissions
│ │ │ ├── APermissionsAction.java
│ │ │ ├── DefPermissionsSubject.java
│ │ │ ├── IPermissionsObserver.java
│ │ │ └── IPermissionsSubject.java
│ │ └── textspan
│ │ │ ├── ClickableTextViewMentionLinkOnTouchListener.java
│ │ │ ├── LongClickableLinkMovementMethod.java
│ │ │ ├── MyLinkMovementMethod.java
│ │ │ ├── MyLinkMovementMethod_.java
│ │ │ ├── MyLinkify.java
│ │ │ ├── MyPatterns.java
│ │ │ └── MyURLSpan.java
│ │ └── ui
│ │ ├── activity
│ │ ├── basic
│ │ │ ├── BaseActivity.java
│ │ │ └── BaseActivityHelper.java
│ │ └── container
│ │ │ ├── FragmentArgs.java
│ │ │ └── FragmentContainerActivity.java
│ │ ├── fragment
│ │ ├── ABaseFragment.java
│ │ ├── AGridFragment.java
│ │ ├── AGridSwipyRefreshFragment.java
│ │ ├── AListFragment.java
│ │ ├── AListSwipeRefreshFragment.java
│ │ ├── APagingFragment.java
│ │ ├── ARecycleViewFragment.java
│ │ ├── ARecycleViewSwipeRefreshFragment.java
│ │ ├── ATabsFragment.java
│ │ ├── ATabsSlidingTabLayoutFragment.java
│ │ ├── ATabsTabLayoutFragment.java
│ │ ├── AWaterfallFragment.java
│ │ ├── AWaterfallSwipeRefreshFragment.java
│ │ ├── adapter
│ │ │ ├── ABasicItemView.java
│ │ │ ├── ARecycleViewItemView.java
│ │ │ ├── BasicListAdapter.java
│ │ │ ├── BasicRecycleViewAdapter.java
│ │ │ ├── FragmentPagerAdapter.java
│ │ │ ├── FragmentPagerChangeListener.java
│ │ │ └── IPagingAdapter.java
│ │ └── itemview
│ │ │ ├── AFooterItemView.java
│ │ │ ├── AHeaderItemViewCreator.java
│ │ │ ├── BasicFooterView.java
│ │ │ ├── DefDividerItemView.java
│ │ │ ├── IITemView.java
│ │ │ ├── IItemViewCreator.java
│ │ │ └── OnFooterViewListener.java
│ │ └── widget
│ │ ├── AsToolbar.java
│ │ ├── CircleImageView.java
│ │ ├── FitWindowsFrameLayout.java
│ │ ├── ForegroundLinearLayout.java
│ │ ├── MDButton.java
│ │ ├── MToast.java
│ │ ├── RoundImageView.java
│ │ ├── ScrimInsetsFrameLayout.java
│ │ ├── SlidingTabLayout.java
│ │ ├── SlidingTabStrip.java
│ │ ├── pla
│ │ ├── PLAAbsListView.java
│ │ ├── PLAAdapterView.java
│ │ ├── PLAHeaderViewListAdapter.java
│ │ ├── PLAImageView.java
│ │ ├── PLAListView.java
│ │ ├── PLAMultiColumnListView.java
│ │ └── ParcelableSparseIntArray.java
│ │ └── swipyrefresh
│ │ ├── CircleImageView.java
│ │ ├── MaterialProgressDrawable.java
│ │ ├── SwipyRefreshLayout.java
│ │ └── SwipyRefreshLayoutDirection.java
│ └── res
│ ├── color
│ └── comm_tab_text_color.xml
│ ├── drawable-xhdpi
│ └── comm_loading.png
│ ├── layout
│ ├── comm_lay_dragsort_list.xml
│ ├── comm_lay_emptyview.xml
│ ├── comm_lay_footerview.xml
│ ├── comm_lay_loadfailed.xml
│ ├── comm_lay_loading.xml
│ ├── comm_lay_tab_indicator.xml
│ ├── comm_lay_toolbar.xml
│ ├── comm_ui_fragment_container.xml
│ ├── comm_ui_gridview.xml
│ ├── comm_ui_list.xml
│ ├── comm_ui_list_swiperefresh.xml
│ ├── comm_ui_recycleview.xml
│ ├── comm_ui_recycleview_swiperefresh.xml
│ ├── comm_ui_swipy_grid.xml
│ ├── comm_ui_tabs.xml
│ ├── comm_ui_tabs_slidingtablayout.xml
│ ├── comm_ui_tabs_tablayout.xml
│ ├── comm_ui_waterfall.xml
│ ├── comm_ui_waterfall_swiperefresh.xml
│ └── sheetfab_dim_overlay.xml
│ ├── raw
│ └── settings.xml
│ ├── values-v21
│ ├── comm_styles.xml
│ └── sheetfab_refs.xml
│ └── values
│ ├── comm_abslist_attrs.xml
│ ├── comm_attrs.xml
│ ├── comm_colors.xml
│ ├── comm_dimens.xml
│ ├── comm_exception.xml
│ ├── comm_ids.xml
│ ├── comm_strings.xml
│ ├── comm_styles.xml
│ ├── dslv_attrs.xml
│ ├── sheetfab_refs.xml
│ ├── swipyrefresh_attrs.xml
│ └── theme_colors.xml
├── library_wen
├── .gitignore
├── build.gradle
├── library_wen.iml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── org
│ │ └── aisen
│ │ └── wen
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── org
│ │ │ └── aisen
│ │ │ └── wen
│ │ │ ├── base
│ │ │ ├── Consts.java
│ │ │ └── GlobalContext.java
│ │ │ ├── component
│ │ │ ├── bitmaploader
│ │ │ │ ├── BitmapLoader.java
│ │ │ │ ├── core
│ │ │ │ │ ├── ArrayDeque.java
│ │ │ │ │ ├── BitmapCache.java
│ │ │ │ │ ├── BitmapCommonUtils.java
│ │ │ │ │ ├── BitmapCompress.java
│ │ │ │ │ ├── BitmapDecoder.java
│ │ │ │ │ ├── BitmapOwner.java
│ │ │ │ │ ├── BitmapProcess.java
│ │ │ │ │ ├── BitmapTask.java
│ │ │ │ │ ├── Deque.java
│ │ │ │ │ ├── FileDisk.java
│ │ │ │ │ ├── IBitmapCompress.java
│ │ │ │ │ ├── ImageConfig.java
│ │ │ │ │ ├── LruDiskCache.java
│ │ │ │ │ ├── LruMemoryCache.java
│ │ │ │ │ └── MyBitmap.java
│ │ │ │ ├── display
│ │ │ │ │ ├── DefaultDisplayer.java
│ │ │ │ │ ├── Displayer.java
│ │ │ │ │ └── FadeInDisplayer.java
│ │ │ │ ├── download
│ │ │ │ │ ├── AssetsDownloader.java
│ │ │ │ │ ├── ContentProviderDownloader.java
│ │ │ │ │ ├── DownloadProcess.java
│ │ │ │ │ ├── Downloader.java
│ │ │ │ │ ├── DrawableDownloader.java
│ │ │ │ │ ├── SdcardDownloader.java
│ │ │ │ │ └── WebDownloader.java
│ │ │ │ └── view
│ │ │ │ │ └── MyDrawable.java
│ │ │ ├── cardmenu
│ │ │ │ ├── CardMenuBuilder.java
│ │ │ │ ├── CardMenuOptions.java
│ │ │ │ ├── CardMenuPopupHelper.java
│ │ │ │ └── CardMenuPresenter.java
│ │ │ ├── network
│ │ │ │ ├── biz
│ │ │ │ │ ├── ABizLogic.java
│ │ │ │ │ └── IResult.java
│ │ │ │ ├── cache
│ │ │ │ │ └── ICacheUtility.java
│ │ │ │ ├── http
│ │ │ │ │ ├── DefHttpUtility.java
│ │ │ │ │ ├── HttpConfig.java
│ │ │ │ │ ├── IHttpUtility.java
│ │ │ │ │ ├── OnMultiFileProgress.java
│ │ │ │ │ └── Params.java
│ │ │ │ ├── setting
│ │ │ │ │ ├── BaseSetting.java
│ │ │ │ │ ├── Setting.java
│ │ │ │ │ └── SettingExtra.java
│ │ │ │ └── task
│ │ │ │ │ ├── IExceptionDelegate.java
│ │ │ │ │ ├── ITaskManager.java
│ │ │ │ │ ├── IWorkTask.java
│ │ │ │ │ ├── TaskException.java
│ │ │ │ │ ├── TaskManager.java
│ │ │ │ │ └── WorkTask.java
│ │ │ └── orm
│ │ │ │ ├── SqliteUtility.java
│ │ │ │ ├── SqliteUtilityBuilder.java
│ │ │ │ ├── annotation
│ │ │ │ ├── AutoIncrementPrimaryKey.java
│ │ │ │ ├── PrimaryKey.java
│ │ │ │ └── TableName.java
│ │ │ │ ├── extra
│ │ │ │ ├── AutoIncrementTableColumn.java
│ │ │ │ ├── Extra.java
│ │ │ │ ├── TableColumn.java
│ │ │ │ └── TableInfo.java
│ │ │ │ └── utils
│ │ │ │ ├── FieldUtils.java
│ │ │ │ ├── SqlUtils.java
│ │ │ │ └── TableInfoUtils.java
│ │ │ ├── support
│ │ │ ├── action
│ │ │ │ └── IAction.java
│ │ │ ├── bean
│ │ │ │ ├── ResultBean.java
│ │ │ │ └── TabItem.java
│ │ │ ├── paging
│ │ │ │ ├── IPaging.java
│ │ │ │ └── PageIndexPaging.java
│ │ │ ├── permissions
│ │ │ │ ├── APermissionsAction.java
│ │ │ │ ├── DefPermissionsSubject.java
│ │ │ │ ├── IPermissionsObserver.java
│ │ │ │ └── IPermissionsSubject.java
│ │ │ ├── textspan
│ │ │ │ ├── ClickableTextViewMentionLinkOnTouchListener.java
│ │ │ │ ├── LongClickableLinkMovementMethod.java
│ │ │ │ ├── MyLinkMovementMethod.java
│ │ │ │ ├── MyLinkMovementMethod_.java
│ │ │ │ ├── MyLinkify.java
│ │ │ │ ├── MyPatterns.java
│ │ │ │ └── MyURLSpan.java
│ │ │ └── utils
│ │ │ │ ├── BitmapUtil.java
│ │ │ │ ├── CrashHandler.java
│ │ │ │ ├── DateUtils.java
│ │ │ │ ├── FileUtils.java
│ │ │ │ ├── HprofUtils.java
│ │ │ │ ├── KeyGenerator.java
│ │ │ │ ├── Logger.java
│ │ │ │ ├── Logger2File.java
│ │ │ │ ├── SharedPreferencesUtils.java
│ │ │ │ ├── SystemUtils.java
│ │ │ │ ├── Utils.java
│ │ │ │ ├── ViewUtils.java
│ │ │ │ └── md
│ │ │ │ ├── DrawableWrapper.java
│ │ │ │ └── MDHelper.java
│ │ │ └── ui
│ │ │ ├── activity
│ │ │ ├── BaseActivity.java
│ │ │ ├── BaseActivityHelper.java
│ │ │ ├── FragmentArgs.java
│ │ │ └── FragmentContainerActivity.java
│ │ │ ├── adapter
│ │ │ ├── ABasicItemView.java
│ │ │ ├── ARecycleViewItemView.java
│ │ │ ├── BasicListAdapter.java
│ │ │ ├── BasicRecycleViewAdapter.java
│ │ │ ├── FragmentPagerAdapter.java
│ │ │ ├── FragmentPagerChangeListener.java
│ │ │ └── IPagingAdapter.java
│ │ │ ├── fragment
│ │ │ ├── ABaseFragment.java
│ │ │ ├── APagingPresenterFragment.java
│ │ │ ├── APresenterFragment.java
│ │ │ ├── ATabsFragment.java
│ │ │ └── ATabsTabLayoutFragment.java
│ │ │ ├── itemview
│ │ │ ├── AFooterItemView.java
│ │ │ ├── AHeaderItemViewCreator.java
│ │ │ ├── BasicFooterView.java
│ │ │ ├── DefDividerItemView.java
│ │ │ ├── IITemView.java
│ │ │ └── IItemViewCreator.java
│ │ │ ├── model
│ │ │ ├── IModel.java
│ │ │ ├── IPagingModel.java
│ │ │ ├── impl
│ │ │ │ ├── AContentModel.java
│ │ │ │ └── APagingModel.java
│ │ │ └── listener
│ │ │ │ ├── IModelListener.java
│ │ │ │ ├── ModelListenerParam.java
│ │ │ │ └── PagingModelListenerParam.java
│ │ │ ├── presenter
│ │ │ ├── IContentPresenter.java
│ │ │ ├── ILifecycleBridge.java
│ │ │ ├── IPagingPresenter.java
│ │ │ └── IPresenter.java
│ │ │ ├── view
│ │ │ ├── IContentView.java
│ │ │ ├── IPaingView.java
│ │ │ ├── IView.java
│ │ │ └── impl
│ │ │ │ ├── AContentView.java
│ │ │ │ ├── AGridView.java
│ │ │ │ ├── AListView.java
│ │ │ │ ├── AListViewSwipeRefreshVIew.java
│ │ │ │ ├── APagingView.java
│ │ │ │ ├── ARecycleView.java
│ │ │ │ ├── ARecycleViewSwipeRefreshVIew.java
│ │ │ │ └── ARecycleViewSwipeRefreshView.java
│ │ │ └── widget
│ │ │ ├── AsToolbar.java
│ │ │ ├── FitWindowsFrameLayout.java
│ │ │ └── MDButton.java
│ └── res
│ │ ├── layout
│ │ ├── comm_lay_emptyview.xml
│ │ ├── comm_lay_footerview.xml
│ │ ├── comm_lay_loadfailed.xml
│ │ ├── comm_lay_loading.xml
│ │ ├── comm_lay_toolbar.xml
│ │ ├── comm_ui_fragment_container.xml
│ │ ├── comm_ui_gridview.xml
│ │ ├── comm_ui_list.xml
│ │ ├── comm_ui_list_swiperefresh.xml
│ │ ├── comm_ui_recycleview.xml
│ │ ├── comm_ui_recycleview_swiperefresh.xml
│ │ ├── comm_ui_tabs.xml
│ │ └── comm_ui_tabs_tablayout.xml
│ │ └── values
│ │ ├── comm_attrs.xml
│ │ ├── comm_colors.xml
│ │ ├── comm_dimens.xml
│ │ ├── comm_exception.xml
│ │ ├── comm_ids.xml
│ │ ├── comm_strings.xml
│ │ ├── comm_styles.xml
│ │ └── theme_colors.xml
│ └── test
│ └── java
│ └── org
│ └── aisen
│ └── wen
│ └── ExampleUnitTest.java
├── sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
├── sample.iml
└── src
│ ├── androidTest
│ ├── androidTest1.iml
│ └── java
│ │ └── com
│ │ └── m
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── aisen
│ │ └── sample
│ │ ├── base
│ │ └── MyApplication.java
│ │ ├── support
│ │ ├── bean
│ │ │ ├── BaseBean.java
│ │ │ ├── MenuBean.java
│ │ │ ├── NeihanduanziBean.java
│ │ │ └── NeihanduanziBeans.java
│ │ ├── sdk
│ │ │ ├── BaseSDK.java
│ │ │ ├── YoutubeSDK.java
│ │ │ └── bean
│ │ │ │ ├── VideoStreamBean.java
│ │ │ │ └── VideoStreamsBean.java
│ │ └── utils
│ │ │ └── SystemBarUtils.java
│ │ └── ui
│ │ ├── activity
│ │ └── MainActivity.java
│ │ └── fragment
│ │ ├── BaseFragmentModel.java
│ │ ├── BaseFragmentSample.java
│ │ ├── BaseFragmentView.java
│ │ ├── MenuFragment.java
│ │ └── SwipeRefreshListFragment.java
│ ├── main.iml
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ ├── ic_down.png
│ └── ic_launcher.png
│ ├── layout
│ ├── comm_lay_spinner.xml
│ ├── comm_lay_toolbar_spinner.xml
│ ├── item_main.xml
│ ├── item_youtube.xml
│ ├── ui_a_base.xml
│ └── ui_main.xml
│ ├── raw
│ └── settings.xml
│ ├── values-v19
│ └── themes.xml
│ ├── values-v21
│ ├── styles.xml
│ └── themes.xml
│ └── values
│ ├── attrs.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── themes.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 | /.idea
9 | bintray.properties
10 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | AisenForAndroid
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.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 | Android API 22 Platform
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AisenForAndroid.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AisenForAndroid - 重构中
2 | ----
3 |
4 | Aisen一个免费开源、面向AOP、遵循Apache2开源协议发布的Android轻量级快速开发框架。初衷是将面向互联网应用开发过程中大部分重复工作抽象出来,基于反射注入的方式实现具体业务逻辑,让开发人员更专注于项目的业务或者UI特效,不需要关注架构方面的SDK业务接口封装、网络协议、缓存管理之间的耦合关联,以及UI层面常见刷新控件、分页加载、图片OOM、Adapter优化等最常见的UI工作;
5 |
6 | Aisen微博是个人实验性项目,依赖AisenForAndroid开发,UI遵循Material Design,也会在部分功能实现上依赖Github上其他优秀的开源组件或者框架,作为范例让感兴趣的同志更加了解AisenForAndroid或者其他项目的使用。
7 |
8 | ## 分支更新
9 |
10 | 2.0.0.200
11 |
12 | 适配4.2、4.4、5.0状态栏变色
13 |
14 | ## License
15 |
16 | Copyright (c) 2014 Jeff Wang
17 |
18 | Licensed under the [Apache License, Version 3.0](http://opensource.org/licenses/GPL-3.0)
19 |
20 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | mavenCentral()
7 | maven {
8 | url "/Users/wangdan/Documents/github/mvn-repo-aiwen/repository/"
9 | }
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:2.1.0'
13 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
14 | classpath 'com.github.dcendents:android-maven-plugin:1.2'
15 | classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
16 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
17 | // NOTE: Do not place your application dependencies here; they belong
18 | // in the individual module build.gradle files
19 | }
20 | }
21 |
22 | allprojects {
23 | repositories {
24 | jcenter()
25 | mavenCentral()
26 | maven {
27 | url "http://dl.bintray.com/fir/maven"
28 | }
29 | maven {
30 | url "/Users/wangdan/Documents/github/mvn-repo-aiwen/repository/"
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Apr 12 23:42:09 CST 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | #distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
8 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion '24.0.2'
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0.1"
12 | }
13 |
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | debug {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | compile 'com.alibaba:fastjson:1.2.6'
29 | compile 'com.android.support:appcompat-v7:24.2.0'
30 | compile 'com.android.support:design:24.2.0'
31 | compile 'com.squareup.okhttp:okhttp:2.6.0'
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/library/changelog.txt:
--------------------------------------------------------------------------------
1 | version 1.0.1
2 | 1、新增一个本地文件保存工具类Logger2File
3 | 2、新增一个CrashHandler,保存Crash日志,OOM输入Hprof文件
--------------------------------------------------------------------------------
/library/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 /Users/wangdan/software/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library/src/androidTest/java/org/aisen/android/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/context/GlobalContext.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.context;
2 |
3 | import android.app.Application;
4 | import android.os.Handler;
5 |
6 | import com.squareup.okhttp.OkHttpClient;
7 |
8 | import java.util.concurrent.TimeUnit;
9 |
10 | public class GlobalContext extends Application {
11 |
12 | private static GlobalContext _context;
13 |
14 | public final static int CONN_TIMEOUT = 30000;
15 | public final static int READ_TIMEOUT = 30000;
16 |
17 | private final static OkHttpClient mOkHttpClient = new OkHttpClient();;
18 |
19 | static {
20 | // 初始化OkHttpClient
21 | configOkHttpClient(CONN_TIMEOUT, READ_TIMEOUT);
22 | }
23 |
24 | @Override
25 | public void onCreate() {
26 | super.onCreate();
27 |
28 | _context = this;
29 | }
30 |
31 | public static GlobalContext getInstance() {
32 | return _context;
33 | }
34 |
35 | public Handler getHandler() {
36 | return mHandler;
37 | }
38 |
39 | Handler mHandler = new Handler() {
40 |
41 | };
42 |
43 | public static OkHttpClient getOkHttpClient() {
44 | return mOkHttpClient;
45 | }
46 |
47 | public static void configOkHttpClient(int connTimeout, int socketTimeout) {
48 | if (mOkHttpClient != null) {
49 | mOkHttpClient.setConnectTimeout(connTimeout, TimeUnit.MILLISECONDS);
50 | mOkHttpClient.setReadTimeout(socketTimeout, TimeUnit.MILLISECONDS);
51 | }
52 | }
53 |
54 | }
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/setting/Setting.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.setting;
2 |
3 | import com.alibaba.fastjson.JSON;
4 |
5 | import java.io.Serializable;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | public class Setting extends SettingBean implements Serializable {
10 |
11 | private static final long serialVersionUID = 4801654811733634325L;
12 |
13 | private Map extras;
14 |
15 | public Setting() {
16 | extras = new HashMap();
17 | }
18 |
19 | public Map getExtras() {
20 | return extras;
21 | }
22 |
23 | public void setExtras(Map extras) {
24 | this.extras = extras;
25 | }
26 |
27 | public Setting copy() {
28 | return JSON.parseObject(JSON.toJSONString(this), Setting.class);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/setting/SettingArray.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.setting;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | public class SettingArray extends SettingBean implements Serializable {
8 |
9 | private static final long serialVersionUID = 6482515166206579219L;
10 |
11 | private List settingArray;
12 |
13 | private int index;
14 |
15 | public SettingArray() {
16 | settingArray = new ArrayList();
17 | }
18 |
19 | public List getSettingArray() {
20 | return settingArray;
21 | }
22 |
23 | public void setSettingArray(List settingArray) {
24 | this.settingArray = settingArray;
25 | }
26 |
27 | public int getIndex() {
28 | return index;
29 | }
30 |
31 | public void setIndex(int index) {
32 | this.index = index;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/setting/SettingBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.setting;
2 |
3 | import java.io.Serializable;
4 |
5 | class SettingBean implements Serializable {
6 |
7 | private static final long serialVersionUID = -3694407301270573142L;
8 |
9 | private String description;
10 |
11 | private String type;
12 |
13 | private String value;
14 |
15 | public String getDescription() {
16 | return description;
17 | }
18 |
19 | public void setDescription(String description) {
20 | this.description = description;
21 | }
22 |
23 | public String getType() {
24 | return type;
25 | }
26 |
27 | public void setType(String type) {
28 | this.type = type;
29 | }
30 |
31 | public String getValue() {
32 | return value;
33 | }
34 |
35 | public void setValue(String value) {
36 | this.value = value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/setting/SettingExtra.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.setting;
2 |
3 | import java.io.Serializable;
4 |
5 | public class SettingExtra extends SettingBean implements Serializable {
6 |
7 | private static final long serialVersionUID = 4608815242740722900L;
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/setting/SettingUtil.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.setting;
2 |
3 | public class SettingUtil {
4 |
5 | public static String getSettingValue(Setting setting, String type) {
6 | if (setting.getExtras().get(type) != null)
7 | return setting.getExtras().get(type).getValue();
8 | else {
9 | return SettingUtility.getStringSetting(type);
10 | }
11 | }
12 |
13 | /**
14 | * 首先在指定的Setting的Extra中寻找type值,如果没有,则在所有的Setting中寻找
15 | *
16 | * @param setting
17 | * @param type
18 | * @return
19 | */
20 | public static int getSettingValueAsInt(Setting setting, String type) {
21 | if (setting.getExtras().containsKey(type))
22 | return Integer.parseInt(setting.getExtras().get(type).getValue());
23 | else {
24 | return SettingUtility.getIntSetting(type);
25 | }
26 | }
27 |
28 | /**
29 | * 获取缓存有效时间
30 | *
31 | * @param setting
32 | * @return 单位:(s)
33 | */
34 | public static int getValidTime(Setting setting) {
35 | int validTime = 0;
36 |
37 | String validTimeStr = null;
38 | if (setting.getExtras().containsKey("cache_validtime"))
39 | validTimeStr = setting.getExtras().get("cache_validtime").getValue();
40 | else
41 | validTimeStr = SettingUtility.getStringSetting("cache_validtime");
42 | if ("max_date".equals(validTimeStr))
43 | validTime = Integer.MAX_VALUE;
44 | else
45 | validTime = Integer.parseInt(validTimeStr);
46 |
47 | return validTime;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/CacheTimeUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | /**
7 | * Created by wangdan on 15/8/29.
8 | */
9 | public class CacheTimeUtils {
10 |
11 | public static void saveTime(Context context, String key) {
12 | String time = String.valueOf(System.currentTimeMillis() / 1000);
13 |
14 | ActivityHelper.putShareData(context, key, time);
15 |
16 | Logger.d("CacheTimeUtils", String.format("保存缓存 %s, saveTime = %s", key, time));
17 | }
18 |
19 | public static long getSaveTime(Context context, String key) {
20 | String time = ActivityHelper.getShareData(context, key, "");
21 | long saveTime = Long.parseLong(TextUtils.isEmpty(time) ? "0" : time);
22 | return saveTime;
23 | }
24 |
25 | public static boolean isOutofdate(Context context, String key, long refreshInterval) {
26 | try {
27 | long saveTime = getSaveTime(context, key);
28 |
29 | boolean expired = Math.abs((System.currentTimeMillis() / 1000 - saveTime) * 1000) >= refreshInterval;
30 |
31 | Logger.d("CacheTimeUtils", String.format("缓存有效性 %s, expired = %s", key, String.valueOf(expired)));
32 |
33 | return expired;
34 | } catch (Throwable e) {
35 | Logger.printExc(CacheTimeUtils.class, e);
36 |
37 | return true;
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | public class Consts {
4 |
5 | // 缓存开关
6 | public static final String CACHE_ENABLE = "cache_enable";
7 |
8 | // 内存缓存
9 | public static final String MEMORY_CACHE_UTILITY = "memory_cache_utility";
10 |
11 | // 内存缓存有效时间
12 | public static final String MEMORY_CACHE_VALIDITY = "memory_cache_validity";
13 |
14 | }
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Calendar;
6 |
7 | public class DateUtils {
8 |
9 | // yyyy-MM-dd hh:mm:ss 12小时制
10 | // yyyy-MM-dd HH:mm:ss 24小时制
11 |
12 | public static final String TYPE_01 = "yyyy-MM-dd HH:mm:ss";
13 |
14 | public static final String TYPE_02 = "yyyy-MM-dd";
15 |
16 | public static final String TYPE_03 = "HH:mm:ss";
17 |
18 | public static final String TYPE_04 = "yyyy年MM月dd日";
19 |
20 | public static String formatDate(long time, String format) {
21 | Calendar cal = Calendar.getInstance();
22 | cal.setTimeInMillis(time);
23 | return new SimpleDateFormat(format).format(cal.getTime());
24 | }
25 |
26 | public static String formatDate(String longStr, String format) {
27 | try {
28 | return formatDate(Long.parseLong(longStr), format);
29 | } catch (Exception e) {
30 | }
31 | return "";
32 | }
33 |
34 | public static long formatStr(String timeStr, String pattern) {
35 | SimpleDateFormat sdf = new SimpleDateFormat(pattern);
36 | try {
37 | return sdf.parse(timeStr).getTime();
38 | } catch (ParseException e) {
39 | e.printStackTrace();
40 | }
41 |
42 | return 0;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/HprofUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | import android.os.Debug;
4 |
5 | import java.io.File;
6 | import java.text.SimpleDateFormat;
7 | import java.util.Calendar;
8 |
9 | /**
10 | * Created by wangdan on 15/4/21.
11 | */
12 | public class HprofUtils {
13 |
14 | private final static String OOM_SUFFIX = ".hprof";
15 |
16 | public static void dumpHprof(String path) {
17 | try {
18 | String name = getDate() + OOM_SUFFIX;
19 | path = path + File.separator + name;
20 | File file = path != null ? new File(path) : null;
21 | if (!file.getParentFile().exists())
22 | file.getParentFile().mkdirs();
23 | Debug.dumpHprofData(path);
24 | } catch (Throwable t) {
25 | t.printStackTrace();
26 | }
27 | }
28 |
29 | private static String getDate() {
30 | return new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(Calendar.getInstance().getTime());
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/KeyGenerator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | public class KeyGenerator {
7 |
8 | private KeyGenerator() {
9 |
10 | }
11 |
12 | public static String generateMD5(String key) {
13 | try {
14 | final MessageDigest mDigest = MessageDigest.getInstance("MD5");
15 | mDigest.update(key.getBytes());
16 | byte[] bytes = mDigest.digest();
17 | StringBuilder sb = new StringBuilder();
18 | for (int i = 0; i < bytes.length; i++) {
19 | String hex = Integer.toHexString(0xFF & bytes[i]);
20 | if (hex.length() == 1) {
21 | sb.append('0');
22 | }
23 | sb.append(hex);
24 | }
25 | return sb.toString();
26 | } catch (NoSuchAlgorithmException e) {
27 | return String.valueOf(key.hashCode());
28 | }
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/common/utils/SdcardUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.common.utils;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Environment;
5 | import android.os.StatFs;
6 |
7 | public class SdcardUtils {
8 |
9 | public static boolean hasSDCard() {
10 | boolean mHasSDcard = false;
11 | if (Environment.MEDIA_MOUNTED.endsWith(Environment.getExternalStorageState())) {
12 | mHasSDcard = true;
13 | } else {
14 | mHasSDcard = false;
15 | }
16 |
17 | return mHasSDcard;
18 | }
19 |
20 | @SuppressLint("SdCardPath") public static String getSdcardPath() {
21 |
22 | if (hasSDCard())
23 | return Environment.getExternalStorageDirectory().getAbsolutePath();
24 |
25 | return "/sdcard/";
26 | }
27 |
28 | private static boolean sdcardCanWrite() {
29 | return Environment.getExternalStorageDirectory().canWrite();
30 | }
31 |
32 | public static boolean hasSdcardAndCanWrite() {
33 | return hasSDCard() && sdcardCanWrite();
34 | }
35 |
36 | /**
37 | * 获取SDCARD的可用大小,单位字节
38 | *
39 | * @return
40 | */
41 | public long getSdcardtAvailableStore() {
42 |
43 | if (hasSdcardAndCanWrite()) {
44 | String path = getSdcardPath();
45 | if (path != null) {
46 | StatFs statFs = new StatFs(path);
47 |
48 | @SuppressWarnings("deprecation")
49 | long blocSize = statFs.getBlockSize();
50 |
51 | @SuppressWarnings("deprecation")
52 | long availaBlock = statFs.getAvailableBlocks();
53 |
54 | return availaBlock * blocSize;
55 | }
56 | }
57 |
58 | return 0;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/core/BitmapCache.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.core;
2 |
3 | import org.aisen.android.common.utils.KeyGenerator;
4 | import org.aisen.android.component.bitmaploader.BitmapLoader;
5 |
6 |
7 | public class BitmapCache {
8 | private LruMemoryCache mMemoryCache;
9 |
10 | public BitmapCache(int memCacheSize) {
11 | init(memCacheSize);
12 | }
13 |
14 | private void init(int memCacheSize) {
15 | mMemoryCache = new LruMemoryCache(memCacheSize) {
16 | @Override
17 | protected int sizeOf(String key, MyBitmap bitmap) {
18 | return BitmapCommonUtils.getBitmapSize(bitmap.getBitmap()) * 4;
19 | }
20 | };
21 |
22 | }
23 |
24 | public void addBitmapToMemCache(String url, ImageConfig config, MyBitmap bitmap) {
25 | if (url == null || bitmap == null) {
26 | return;
27 | }
28 |
29 | if (mMemoryCache != null) {
30 | mMemoryCache.put(KeyGenerator.generateMD5(BitmapLoader.getKeyByConfig(url, config)), bitmap);
31 | }
32 | }
33 |
34 | public MyBitmap getBitmapFromMemCache(String url, ImageConfig config) {
35 | if (mMemoryCache != null) {
36 | final MyBitmap memBitmap = mMemoryCache.get(KeyGenerator.generateMD5(BitmapLoader.getKeyByConfig(url, config)));
37 | if (memBitmap != null) {
38 | return memBitmap;
39 | }
40 | }
41 | return null;
42 | }
43 |
44 | public void clearMemCache() {
45 | if (mMemoryCache != null) {
46 | mMemoryCache.evictAll();
47 | }
48 | }
49 |
50 | public void clearMemHalfCache() {
51 | if (mMemoryCache != null) {
52 | mMemoryCache.evictHalf();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/core/BitmapCompress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.core;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 |
6 | import org.aisen.android.common.utils.Logger;
7 | import org.aisen.android.component.bitmaploader.BitmapLoader;
8 |
9 | import java.io.File;
10 |
11 | public class BitmapCompress implements IBitmapCompress {
12 |
13 | @Override
14 | public MyBitmap compress(byte[] bitmapBytes, File file, String url, ImageConfig config, int origW, int origH) throws Exception {
15 | Bitmap bitmap = null;
16 | try {
17 | if (config.getMaxHeight() > 0 && config.getMaxWidth() > 0) {
18 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxWidth(), config.getMaxHeight());
19 | }
20 | else if (config.getMaxHeight() > 0) {
21 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxHeight(), config.getMaxHeight());
22 | }
23 | else if (config.getMaxWidth() > 0) {
24 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxWidth(), config.getMaxWidth());
25 | }
26 | else {
27 | bitmap = BitmapFactory.decodeByteArray(bitmapBytes, 0, bitmapBytes.length);
28 | }
29 | } catch (OutOfMemoryError e) {
30 | e.printStackTrace();
31 | }
32 |
33 | Logger.d(BitmapLoader.TAG, String.format("原始尺寸是%dX%d, 压缩后尺寸是%dX%d", origW, origH, bitmap.getWidth(), bitmap.getHeight()));
34 |
35 | return new MyBitmap(bitmap, url);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/core/BitmapOwner.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.core;
2 |
3 | public interface BitmapOwner {
4 |
5 | boolean canDisplay();
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/core/IBitmapCompress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.core;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import java.io.File;
6 |
7 | public interface IBitmapCompress {
8 |
9 | /**
10 | * 压缩图片
11 | *
12 | * @param bitmapBytes
13 | * 图片的byte数据流
14 | * @param file
15 | * 图片存储的文件
16 | * @param url
17 | * 图片加载地址
18 | * @param config
19 | * 加载图片设置
20 | * @param origW
21 | * 图片宽度
22 | * @param origH
23 | * 图片高度
24 | * @return null-不压缩
25 | * @throws Exception
26 | */
27 | public MyBitmap compress(byte[] bitmapBytes, File file, String url, ImageConfig config, int origW, int origH) throws Exception;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/display/DefaultDisplayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.widget.ImageView;
5 |
6 | public class DefaultDisplayer implements Displayer {
7 |
8 | @Override
9 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable) {
10 | imageView.setImageDrawable(drawable);
11 | }
12 |
13 | @Override
14 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable) {
15 | imageView.setImageDrawable(drawable);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/display/Displayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.widget.ImageView;
5 |
6 | public interface Displayer {
7 |
8 | /**
9 | * 图片加载完成 回调的函数
10 | *
11 | * @param imageView
12 | * @param bitmap
13 | * @param config
14 | */
15 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable);
16 |
17 | /**
18 | * 图片加载失败回调的函数
19 | *
20 | * @param imageView
21 | * @param bitmap
22 | */
23 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/display/FadeInDisplayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.graphics.drawable.Drawable;
5 | import android.graphics.drawable.TransitionDrawable;
6 | import android.widget.ImageView;
7 |
8 | public class FadeInDisplayer implements Displayer {
9 |
10 | @Override
11 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable) {
12 | // PhotoView不设置
13 | if (imageView.getClass().getSimpleName().indexOf("PhotoView") != -1)
14 | return;
15 |
16 | if (imageView.getDrawable() != null) {
17 | final TransitionDrawable td = new TransitionDrawable(new Drawable[] { imageView.getDrawable(), drawable });
18 | imageView.setImageDrawable(td);
19 | td.startTransition(300);
20 | }
21 | else {
22 | imageView.setImageDrawable(drawable);
23 | }
24 | }
25 |
26 | @Override
27 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable) {
28 | imageView.setImageDrawable(drawable);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/download/AssetsDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.android.component.bitmaploader.core.ImageConfig;
6 |
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.InputStream;
9 |
10 | public class AssetsDownloader implements Downloader {
11 |
12 | @Override
13 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
14 | try {
15 | DownloadProcess progress = config.getProgress();
16 |
17 | if (progress != null)
18 | progress.sendPrepareDownload(url);
19 |
20 | ByteArrayOutputStream out = new ByteArrayOutputStream();
21 |
22 | // 加载assets目录
23 | InputStream in = context.getAssets().open(url);
24 |
25 | if (progress != null)
26 | progress.receiveLength(in.available());
27 |
28 | if (in == null)
29 | return null;
30 |
31 | // 获取图片数据
32 | byte[] buffer = new byte[1024 * 128];
33 | int readLen = -1;
34 | int readBytes = 0;
35 | while ((readLen = in.read(buffer)) != -1) {
36 | readBytes += readLen;
37 | if (progress != null)
38 | progress.sendProgress(readBytes);
39 | out.write(buffer, 0, readLen);
40 | }
41 |
42 | byte[] bs = out.toByteArray();
43 | in.close();
44 | out.close();
45 |
46 | return bs;
47 | } catch (Exception e) {
48 | if(config.getProgress()!=null)
49 | config.getProgress().sendException(e);
50 | throw new Exception(e.getCause());
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/download/ContentProviderDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | import org.aisen.android.common.context.GlobalContext;
7 | import org.aisen.android.common.utils.FileUtils;
8 | import org.aisen.android.component.bitmaploader.core.ImageConfig;
9 |
10 | import java.io.InputStream;
11 |
12 | public class ContentProviderDownloader implements Downloader {
13 |
14 | @Override
15 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
16 |
17 | try {
18 | InputStream is = context.getContentResolver().openInputStream(Uri.parse(url));
19 | byte[] datas = FileUtils.readStreamToBytes(is);
20 | return datas;
21 | } catch (Exception e) {
22 | if (config.getProgress() != null)
23 | config.getProgress().downloadFailed(e);
24 | e.printStackTrace();
25 | throw e;
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/download/Downloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.android.component.bitmaploader.core.ImageConfig;
6 | import org.aisen.android.network.task.TaskException;
7 |
8 | public interface Downloader {
9 |
10 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception;
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/download/DrawableDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.android.common.context.GlobalContext;
6 | import org.aisen.android.common.utils.BitmapUtil;
7 | import org.aisen.android.component.bitmaploader.core.ImageConfig;
8 |
9 | import java.io.ByteArrayOutputStream;
10 | import java.io.InputStream;
11 |
12 | public class DrawableDownloader implements Downloader {
13 |
14 | @Override
15 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
16 | try {
17 | ByteArrayOutputStream out = new ByteArrayOutputStream();
18 |
19 | if (config.getProgress() != null)
20 | config.getProgress().sendPrepareDownload(url);
21 |
22 | InputStream in = null;
23 |
24 | try {
25 | // in = GlobalContext.getInstance().getResources().openRawResource(id)
26 | in = BitmapUtil.getFromDrawableAsStream(context, url);
27 | } catch (OutOfMemoryError e) {
28 | e.printStackTrace();
29 | }
30 |
31 | if (in == null)
32 | return null;
33 |
34 | if (config.getProgress() != null)
35 | config.getProgress().receiveLength(in.available());
36 |
37 | byte[] buffer = new byte[1024 * 128];
38 | int readLen = -1;
39 | int readBytes = 0;
40 | while ((readLen = in.read(buffer)) != -1) {
41 | readBytes += readLen;
42 | if (config.getProgress() != null)
43 | config.getProgress().sendProgress(readBytes);
44 | out.write(buffer, 0, readLen);
45 | }
46 |
47 | byte[] bs = out.toByteArray();
48 | in.close();
49 | out.close();
50 | return bs;
51 | } catch (Exception e) {
52 | if(config.getProgress()!=null)
53 | config.getProgress().sendException(e);
54 | throw new Exception(e.getCause());
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/bitmaploader/view/MyDrawable.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.bitmaploader.view;
2 |
3 | import java.lang.ref.WeakReference;
4 |
5 | import android.content.res.Resources;
6 | import android.graphics.Bitmap;
7 | import android.graphics.drawable.BitmapDrawable;
8 |
9 | import org.aisen.android.component.bitmaploader.BitmapLoader.MyBitmapLoaderTask;
10 | import org.aisen.android.component.bitmaploader.core.ImageConfig;
11 | import org.aisen.android.component.bitmaploader.core.MyBitmap;
12 |
13 | public class MyDrawable extends BitmapDrawable {
14 |
15 | private MyBitmap myBitmap;
16 | private ImageConfig config;
17 | private WeakReference task;
18 |
19 | public MyDrawable(Resources res, MyBitmap myBitmap, ImageConfig config, WeakReference task) {
20 | this(res, myBitmap.getBitmap());
21 | this.myBitmap = myBitmap;
22 | this.config = config;
23 | this.task = task;
24 | }
25 |
26 | public MyBitmap getMyBitmap() {
27 | return myBitmap;
28 | }
29 |
30 | public void setMyBitmap(MyBitmap myBitmap) {
31 | this.myBitmap = myBitmap;
32 | }
33 |
34 | public MyDrawable(Resources res, Bitmap bitmap) {
35 | super(res, bitmap);
36 | }
37 |
38 | public ImageConfig getConfig() {
39 | return config;
40 | }
41 |
42 | public void setConfig(ImageConfig config) {
43 | this.config = config;
44 | }
45 |
46 | public WeakReference getTask() {
47 | return task;
48 | }
49 |
50 | public void setTask(WeakReference task) {
51 | this.task = task;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/cardmenu/CardMenuOptions.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.cardmenu;
2 |
3 | /**
4 | * Created by wangdan on 16/9/13.
5 | */
6 | public class CardMenuOptions {
7 |
8 | int dropDownGravity = -1;
9 | // 设置ListPopup的Offset
10 | int dropDownHorizontalOffset;
11 | int dropDownVerticalOffset;
12 | int themeRes;
13 | int popupStyleAttr;
14 | int actionMenuLayoutRes;
15 | int actionMenuItemLayoutRes;
16 |
17 | public CardMenuOptions(int themeRes, int popupStyleAttr, int actionMenuLayoutRes, int actionMenuItemLayoutRes) {
18 | this.themeRes = themeRes;
19 | this.popupStyleAttr = popupStyleAttr;
20 | this.actionMenuLayoutRes = actionMenuLayoutRes;
21 | this.actionMenuItemLayoutRes = actionMenuItemLayoutRes;
22 | }
23 |
24 | public CardMenuOptions setGravity(int gravity) {
25 | dropDownGravity = gravity;
26 | return this;
27 | }
28 |
29 | public CardMenuOptions setDropDownHorizontalOffset(int offset) {
30 | dropDownHorizontalOffset = offset;
31 | return this;
32 | }
33 |
34 | public CardMenuOptions setDropDownVerticalOffset(int offset) {
35 | dropDownVerticalOffset = offset;
36 | return this;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/annotation/AutoIncrementPrimaryKey.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface AutoIncrementPrimaryKey {
11 |
12 | public String column() default "id";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/annotation/PrimaryKey.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface PrimaryKey {
11 |
12 | public String column() default "primary_key";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/annotation/TableName.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.TYPE)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface TableName {
11 |
12 | public String table();
13 |
14 | }
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/extra/AutoIncrementTableColumn.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.extra;
2 |
3 | public class AutoIncrementTableColumn extends TableColumn {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/extra/Extra.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.extra;
2 |
3 |
4 | public class Extra {
5 |
6 | private String owner;// 数据拥有者
7 |
8 | private String key;// 数据的key
9 |
10 | public Extra() {
11 |
12 | }
13 |
14 | public Extra(String owner, String key) {
15 | this.key = key;
16 | this.owner = owner;
17 | }
18 |
19 | public String getOwner() {
20 | return owner;
21 | }
22 |
23 | public void setOwner(String owner) {
24 | this.owner = owner;
25 | }
26 |
27 | public String getKey() {
28 | return key;
29 | }
30 |
31 | public void setKey(String key) {
32 | this.key = key;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/extra/TableColumn.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.extra;
2 |
3 | import java.lang.reflect.Field;
4 |
5 | public class TableColumn {
6 |
7 | private String dataType;
8 |
9 | private Field field;
10 |
11 | private String column;
12 |
13 | private String columnType;
14 |
15 | public String getDataType() {
16 | return dataType;
17 | }
18 |
19 | public void setDataType(String dataType) {
20 | this.dataType = dataType;
21 | }
22 |
23 | public Field getField() {
24 | return field;
25 | }
26 |
27 | public void setField(Field field) {
28 | this.field = field;
29 | }
30 |
31 | public String getColumn() {
32 | return column;
33 | }
34 |
35 | public void setColumn(String column) {
36 | this.column = column;
37 | }
38 |
39 | public String getColumnType() {
40 | return columnType;
41 | }
42 |
43 | public void setColumnType(String columnType) {
44 | this.columnType = columnType;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/component/orm/utils/FieldUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.component.orm.utils;
2 |
3 | import org.aisen.android.component.orm.extra.TableColumn;
4 |
5 | public class FieldUtils {
6 |
7 | public static final String OWNER = "com_m_common_owner";
8 |
9 | public static final String KEY = "com_m_common_key";
10 |
11 | public static final String CREATEAT = "com_m_common_createat";
12 |
13 | public static TableColumn getOwnerColumn() {
14 | TableColumn column = new TableColumn();
15 | column.setColumn(OWNER);
16 | return column;
17 | }
18 |
19 | public static TableColumn getKeyColumn() {
20 | TableColumn column = new TableColumn();
21 | column.setColumn(KEY);
22 | return column;
23 | }
24 |
25 | public static TableColumn getCreateAtColumn() {
26 | TableColumn column = new TableColumn();
27 | column.setColumn(CREATEAT);
28 | return column;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/biz/IResult.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.biz;
2 |
3 | public interface IResult {
4 |
5 | /**
6 | * 缓存过期
7 | *
8 | * @return
9 | */
10 | boolean outofdate();
11 |
12 | /**
13 | * 是否是缓存数据
14 | *
15 | * @return
16 | */
17 | boolean fromCache();
18 |
19 | /**
20 | * 没有更多数据了
21 | *
22 | * @return
23 | */
24 | boolean endPaging();
25 |
26 | /**
27 | * 页码信息
28 | *
29 | * @return
30 | */
31 | String[] pagingIndex();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/cache/ICacheUtility.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.cache;
2 |
3 | import org.aisen.android.common.setting.Setting;
4 | import org.aisen.android.network.biz.IResult;
5 | import org.aisen.android.network.http.Params;
6 |
7 |
8 | /**
9 | * 缓存接口
10 | *
11 | * @author wangdan
12 | *
13 | */
14 | public interface ICacheUtility {
15 |
16 | IResult findCacheData(Setting action, Params params);
17 |
18 | void addCacheData(Setting action, Params params, IResult result);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/http/HttpConfig.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.http;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class HttpConfig {
7 |
8 | public String cookie;
9 |
10 | public String baseUrl;// 服务器地址
11 |
12 | public Map headerMap = new HashMap<>();
13 |
14 | @Override
15 | public HttpConfig clone() throws CloneNotSupportedException {
16 | super.clone();
17 | HttpConfig httpConfig = new HttpConfig();
18 | httpConfig.cookie = cookie;
19 | httpConfig.baseUrl = baseUrl;
20 | httpConfig.headerMap = headerMap;
21 | return httpConfig;
22 | }
23 |
24 | public void addHeader(String key, String value) {
25 | headerMap.put(key, value);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/http/OnFileProgress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.http;
2 |
3 | /**
4 | * Created by wangdan on 16/8/29.
5 | */
6 | public interface OnFileProgress {
7 |
8 | void onProgress(long progress, long total);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/task/IExceptionDeclare.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.task;
2 |
3 | public interface IExceptionDeclare {
4 |
5 | void checkResponse(String response) throws TaskException;
6 |
7 | String checkCode(String code);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/network/task/ITaskManager.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.network.task;
2 |
3 | public interface ITaskManager {
4 |
5 | void addTask(WorkTask task);
6 |
7 | void removeTask(String taskId, boolean cancelIfRunning);
8 |
9 | void removeAllTask(boolean cancelIfRunning);
10 |
11 | int getTaskCount(String taskId);
12 |
13 | void clearTaskCount(String taskId);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/action/IAction.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.action;
2 |
3 | import android.app.Activity;
4 |
5 | /**
6 | * Created by wangdan on 15-3-11.
7 | */
8 | public abstract class IAction {
9 |
10 | private Activity context;
11 |
12 | private IAction parent;
13 |
14 | private IAction child;
15 |
16 | public IAction(Activity context, IAction parent) {
17 | this.context = context;
18 | this.parent = parent;
19 | if (parent != null)
20 | parent.setChild(this);
21 | }
22 |
23 | protected boolean interrupt() {
24 | return false;
25 | }
26 |
27 | public void doInterrupt() {
28 |
29 | }
30 |
31 | public void run() {
32 | if (parent == null || !parent.interrupt()) {
33 | doAction();
34 | }
35 | }
36 |
37 | final protected void setChild(IAction child) {
38 | this.child = child;
39 | }
40 |
41 | final public IAction getChild() {
42 | return child;
43 | }
44 |
45 | final public IAction getParent() {
46 | return parent;
47 | }
48 |
49 | final protected Activity getContext() {
50 | return context;
51 | }
52 |
53 | public void doAction() {
54 | if (getChild() != null) {
55 | getChild().run();
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/bean/ResultBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.bean;
2 |
3 | import org.aisen.android.network.biz.IResult;
4 |
5 | /**
6 | *
7 | * Created by wangdan on 15/12/20.
8 | */
9 | public class ResultBean implements IResult {
10 |
11 | private boolean outofdate;
12 |
13 | private boolean fromCache;
14 |
15 | private boolean endPaging;
16 |
17 | private String[] pagingIndex;
18 |
19 | @Override
20 | public boolean outofdate() {
21 | return isOutofdate();
22 | }
23 |
24 | @Override
25 | public boolean fromCache() {
26 | return isFromCache();
27 | }
28 |
29 | @Override
30 | public boolean endPaging() {
31 | return isEndPaging();
32 | }
33 |
34 | @Override
35 | public String[] pagingIndex() {
36 | return getPagingIndex();
37 | }
38 |
39 | public boolean isOutofdate() {
40 | return outofdate;
41 | }
42 |
43 | public void setOutofdate(boolean outofdate) {
44 | this.outofdate = outofdate;
45 | }
46 |
47 | public boolean isFromCache() {
48 | return fromCache;
49 | }
50 |
51 | public void setFromCache(boolean fromCache) {
52 | this.fromCache = fromCache;
53 | }
54 |
55 | public boolean isEndPaging() {
56 | return endPaging;
57 | }
58 |
59 | public void setEndPaging(boolean endPaging) {
60 | this.endPaging = endPaging;
61 | }
62 |
63 | public String[] getPagingIndex() {
64 | return pagingIndex;
65 | }
66 |
67 | public void setPagingIndex(String[] pagingIndex) {
68 | this.pagingIndex = pagingIndex;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/bean/TabItem.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * ViewPager的Tab页标签
7 | *
8 | * Created by wangdan on 15/12/22.
9 | */
10 | public class TabItem implements Serializable {
11 |
12 | private static final long serialVersionUID = -1162756298239591517L;
13 |
14 | private String type;
15 |
16 | private String title;
17 |
18 | private Serializable tag;
19 |
20 | public TabItem() {
21 |
22 | }
23 |
24 | public TabItem(String type, String title) {
25 | this.type = type;
26 | this.title = title;
27 | }
28 |
29 | public String getType() {
30 | return type;
31 | }
32 |
33 | public void setType(String type) {
34 | this.type = type;
35 | }
36 |
37 | public String getTitle() {
38 | return title;
39 | }
40 |
41 | public void setTitle(String title) {
42 | this.title = title;
43 | }
44 |
45 | public Serializable getTag() {
46 | return tag;
47 | }
48 |
49 | public void setTag(Serializable tag) {
50 | this.tag = tag;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/inject/Select.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.inject;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface Select {
11 |
12 | public String selected();
13 | public String noSelected() default "";
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/inject/ViewInject.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.inject;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface ViewInject {
11 | public int id() default 0;
12 | public String idStr() default "";
13 | public String click() default "";
14 | public String longClick() default "";
15 | public String itemClick() default "";
16 | public String itemLongClick() default "";
17 | public Select select() default @Select(selected="") ;
18 | }
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/paging/IPaging.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.paging;
2 |
3 | import java.io.Serializable;
4 |
5 | public interface IPaging extends Serializable {
6 |
7 | /**
8 | * 处理数据
9 | *
10 | * @param newDatas
11 | * 新获取的数据集合
12 | * @param firstData
13 | * adapter数据集中的第一条数据
14 | * @param lastData
15 | * adapter数据集中的最后一条数据
16 | */
17 | public void processData(Ts newDatas, T firstData, T lastData);
18 |
19 | public String getPreviousPage();
20 |
21 | public String getNextPage();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/paging/PageIndexPaging.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.paging;
2 |
3 | import android.text.TextUtils;
4 |
5 | import org.aisen.android.network.biz.IResult;
6 |
7 | import java.io.Serializable;
8 | import java.lang.reflect.Field;
9 |
10 | /**
11 | * 始终自增,但是有最大分页页码,根据配置的属性获取
12 | *
13 | * @author Jeff.Wang
14 | *
15 | * @date 2014年9月22日
16 | */
17 | public class PageIndexPaging implements IPaging {
18 |
19 | private static final long serialVersionUID = 8485595687197548908L;
20 |
21 | int pageTotal = -1;
22 | int pageIndex = 1;
23 |
24 | String pageTotalField;
25 |
26 | public PageIndexPaging(String pageTotalField) {
27 | this.pageTotalField = pageTotalField;
28 | }
29 |
30 | public PageIndexPaging() {
31 | }
32 |
33 | @Override
34 | public void processData(Ts newDatas, T firstData, T lastData) {
35 | pageIndex++;
36 | if (newDatas instanceof IResult) {
37 | IResult iResult = (IResult) newDatas;
38 | if (iResult.fromCache() && iResult.pagingIndex() != null) {
39 | pageIndex = Integer.parseInt(iResult.pagingIndex()[1]);
40 | }
41 | }
42 | if (!TextUtils.isEmpty(pageTotalField)) {
43 | Class clazz = newDatas.getClass();
44 | while (clazz != Object.class) {
45 | try {
46 | Field field = clazz.getDeclaredField(pageTotalField);
47 | field.setAccessible(true);
48 | pageTotal = Integer.parseInt(field.get(newDatas).toString());
49 | break;
50 | } catch (Exception e) {
51 | clazz = clazz.getSuperclass();
52 | }
53 | }
54 | }
55 | }
56 |
57 | @Override
58 | public String getPreviousPage() {
59 | return String.valueOf(pageIndex - 1);
60 | }
61 |
62 | @Override
63 | public String getNextPage() {
64 | return String.valueOf(pageIndex);
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/permissions/DefPermissionsSubject.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.permissions;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by wangdan on 16/2/26.
8 | */
9 | public class DefPermissionsSubject implements IPermissionsSubject {
10 |
11 | private List observers;
12 |
13 | public DefPermissionsSubject() {
14 | observers = new ArrayList<>();
15 | }
16 |
17 | @Override
18 | public void attach(IPermissionsObserver observer) {
19 | if (observer != null && !observers.contains(observer))
20 | observers.add(observer);
21 | }
22 |
23 | @Override
24 | public void detach(IPermissionsObserver observer) {
25 | if (observer != null && !observers.contains(observer))
26 | observers.remove(observer);
27 | }
28 |
29 | @Override
30 | public void notifyActivityResult(int requestCode, String[] permissions, int[] grantResults) {
31 | for (IPermissionsObserver observer : observers) {
32 | observer.onRequestPermissionsResult(requestCode, permissions, grantResults);
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/permissions/IPermissionsObserver.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.permissions;
2 |
3 | /**
4 | * Created by wangdan on 16/2/26.
5 | */
6 | public interface IPermissionsObserver {
7 |
8 | void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/support/permissions/IPermissionsSubject.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.support.permissions;
2 |
3 | /**
4 | * Created by wangdan on 16/2/26.
5 | */
6 | public interface IPermissionsSubject {
7 |
8 | void attach(IPermissionsObserver observer);
9 |
10 | void detach(IPermissionsObserver observer);
11 |
12 | void notifyActivityResult(int requestCode, String[] permissions, int[] grantResults);
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/activity/container/FragmentArgs.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.activity.container;
2 |
3 | import android.os.Bundle;
4 | import android.text.TextUtils;
5 |
6 | import java.io.Serializable;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.Set;
10 |
11 | public class FragmentArgs implements Serializable {
12 |
13 | private static final long serialVersionUID = 5526514482404853100L;
14 |
15 | private Map values = new HashMap();
16 |
17 | public FragmentArgs add(String key, Serializable value) {
18 | if (!TextUtils.isEmpty(key) && value != null)
19 | values.put(key, value);
20 | return this;
21 | }
22 |
23 | public Serializable get(String key) {
24 | return values.get(key);
25 | }
26 |
27 | public static void setToBundle(Bundle bundle, FragmentArgs args) {
28 | Set keys = args.values.keySet();
29 | for (String key : keys) {
30 | Serializable value = args.get(key);
31 | if (value == null)
32 | continue;
33 | bundle.putSerializable(key, value);
34 | }
35 | }
36 |
37 | public static FragmentArgs transToArgs(Bundle bundle) {
38 | FragmentArgs args = new FragmentArgs();
39 | for (String s : bundle.keySet()) {
40 | Object o = bundle.get(s);
41 | if (o == null) continue;
42 | args.add(s, (Serializable) o);
43 | }
44 | return args;
45 | }
46 |
47 | public static Bundle transToBundle(FragmentArgs args) {
48 | Bundle bundle = new Bundle();
49 | setToBundle(bundle, args);
50 | return bundle;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/ATabsSlidingTabLayoutFragment.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment;
2 |
3 | /**
4 | * Created by wangdan on 15/12/22.
5 | */
6 | public class ATabsSlidingTabLayoutFragment {
7 | }
8 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/ATabsTabLayoutFragment.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.design.widget.TabLayout;
7 |
8 | import org.aisen.android.R;
9 | import org.aisen.android.support.bean.TabItem;
10 | import org.aisen.android.support.inject.ViewInject;
11 |
12 | /**
13 | * 对TabLayout的封装
14 | *
15 | * Created by wangdan on 15/12/22.
16 | */
17 | public abstract class ATabsTabLayoutFragment extends ATabsFragment {
18 |
19 | @ViewInject(idStr = "tabLayout")
20 | TabLayout mTabLayout;
21 |
22 | @Override
23 | public int inflateContentView() {
24 | return R.layout.comm_ui_tabs_tablayout;
25 | }
26 |
27 | @Override
28 | final protected void setupViewPager(Bundle savedInstanceSate) {
29 | setupTabLayout(savedInstanceSate, mTabLayout);
30 | }
31 |
32 | protected void setupTabLayout(Bundle savedInstanceSate, final TabLayout tabLayout) {
33 | super.setupViewPager(savedInstanceSate);
34 |
35 | tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
36 | tabLayout.setTabTextColors(Color.parseColor("#b3ffffff"), Color.WHITE);
37 | tabLayout.setupWithViewPager(getViewPager());
38 | new Handler().postDelayed(new Runnable() {
39 |
40 | @Override
41 | public void run() {
42 | tabLayout.setScrollPosition(mCurrentPosition, 0, true);
43 | }
44 |
45 | }, 150);
46 | }
47 |
48 | public TabLayout getTablayout() {
49 | return mTabLayout;
50 | }
51 |
52 | protected void setTabLayout(TabLayout tabLayout) {
53 | mTabLayout = tabLayout;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/adapter/ABasicItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.adapter;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.View;
6 |
7 | import org.aisen.android.support.inject.InjectUtility;
8 | import org.aisen.android.ui.fragment.itemview.IITemView;
9 |
10 | import java.io.Serializable;
11 |
12 | /**
13 | * Created by wangdan on 16/1/5.
14 | */
15 | public abstract class ABasicItemView implements IITemView {
16 |
17 | private final Activity context;
18 |
19 | private int size;
20 |
21 | private int position;
22 |
23 | private final View convertView;
24 |
25 | public ABasicItemView(Activity context, View convertView) {
26 | this.context = context;
27 | this.convertView = convertView;
28 | }
29 |
30 | @Override
31 | public void onBindView(View convertView) {
32 | InjectUtility.initInjectedView(context, this, convertView);
33 | }
34 |
35 | @Override
36 | public int itemPosition() {
37 | return position;
38 | }
39 |
40 | @Override
41 | public void reset(int size, int position) {
42 | this.size = size;
43 | this.position = position;
44 | }
45 |
46 | @Override
47 | public int itemSize() {
48 | return size;
49 | }
50 |
51 | @Override
52 | public View getConvertView() {
53 | return convertView;
54 | }
55 |
56 | public Context getContext() {
57 | return context;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/adapter/ARecycleViewItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.adapter;
2 |
3 | import android.app.Activity;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | import org.aisen.android.support.inject.InjectUtility;
8 | import org.aisen.android.ui.fragment.itemview.IITemView;
9 |
10 | import java.io.Serializable;
11 |
12 | /**
13 | * Created by wangdan on 16/1/5.
14 | */
15 | public abstract class ARecycleViewItemView extends RecyclerView.ViewHolder implements IITemView {
16 |
17 | private int size;
18 |
19 | private int position;
20 |
21 | private final View convertView;
22 |
23 | private final Activity context;
24 |
25 | public ARecycleViewItemView(Activity context, View itemView) {
26 | super(itemView);
27 |
28 | this.context = context;
29 | this.convertView = itemView;
30 | }
31 |
32 | @Override
33 | public void onBindView(View convertView) {
34 | InjectUtility.initInjectedView(getContext(), this, convertView);
35 | }
36 |
37 | @Override
38 | public void reset(int size, int position) {
39 | this.size = size;
40 | this.position = position;
41 | }
42 |
43 | @Override
44 | public int itemSize() {
45 | return size;
46 | }
47 |
48 | @Override
49 | public int itemPosition() {
50 | return position;
51 | }
52 |
53 | @Override
54 | public View getConvertView() {
55 | return convertView;
56 | }
57 |
58 | public Activity getContext() {
59 | return context;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/adapter/FragmentPagerChangeListener.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.adapter;
2 |
3 | public interface FragmentPagerChangeListener {
4 |
5 | void instantiate(String fragmentName);
6 |
7 | void destroy(String fragmentName);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/itemview/AFooterItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.itemview;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.View;
6 |
7 | import org.aisen.android.ui.fragment.adapter.ARecycleViewItemView;
8 |
9 | import java.io.Serializable;
10 |
11 | /**
12 | * FooterView
13 | *
14 | * Created by wangdan on 16/1/9.
15 | */
16 | public abstract class AFooterItemView extends ARecycleViewItemView
17 | implements OnFooterViewListener {
18 |
19 | private OnFooterViewCallback onFooterViewCallback;
20 |
21 | public AFooterItemView(Activity context, View itemView, OnFooterViewCallback callback) {
22 | super(context, itemView);
23 |
24 | this.onFooterViewCallback = callback;
25 | }
26 |
27 | protected OnFooterViewCallback getCallback() {
28 | return onFooterViewCallback;
29 | }
30 |
31 | public interface OnFooterViewCallback {
32 |
33 | void onLoadMore();
34 |
35 | boolean canLoadMore();
36 |
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/itemview/AHeaderItemViewCreator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.itemview;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | *
11 | * Created by wangdan on 16/1/9.
12 | */
13 | public abstract class AHeaderItemViewCreator implements IItemViewCreator {
14 |
15 | @Override
16 | public View newContentView(LayoutInflater inflater, ViewGroup parent, int viewType) {
17 | for (int[] headerLayoutRes : setHeaders()) {
18 | if (viewType == headerLayoutRes[1]) {
19 | return inflater.inflate(headerLayoutRes[0], parent, false);
20 | }
21 | }
22 | return null;
23 | }
24 |
25 | /**
26 | *
27 | * @return position 0:layoutRes,1:viewType
28 | */
29 | abstract public int[][] setHeaders();
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/itemview/IITemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.itemview;
2 |
3 | import android.view.View;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by wangdan on 16/1/5.
9 | */
10 | public interface IITemView {
11 |
12 | /**
13 | * 将View绑定到属性
14 | *
15 | * @param convertView
16 | */
17 | void onBindView(View convertView);
18 |
19 | /**
20 | * 将Data绑定到View
21 | *
22 | * @param convertView
23 | * @param data
24 | * @param position
25 | */
26 | void onBindData(View convertView, T data, int position);
27 |
28 | /**
29 | * Item的Position
30 | *
31 | * @return
32 | */
33 | int itemPosition();
34 |
35 | /**
36 | * 重置数据
37 | *
38 | * @return
39 | */
40 | void reset(int size, int position);
41 |
42 | /**
43 | * Item的数据size
44 | *
45 | * @return
46 | */
47 | int itemSize();
48 |
49 | /**
50 | * Item的ConvertView
51 | *
52 | * @return
53 | */
54 | View getConvertView();
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/itemview/IItemViewCreator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.itemview;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * Created by wangdan on 16/1/9.
11 | */
12 | public interface IItemViewCreator {
13 |
14 | /**
15 | * 遇到一个先有鸡还是先有蛋的问题,操蛋的RecycleView.Adapter,新增这个方法来处理,返回ItemView的LayoutRes
16 | *
17 | * @param inflater
18 | * @param viewType
19 | * @return
20 | */
21 | View newContentView(LayoutInflater inflater, ViewGroup parent, int viewType);
22 |
23 | IITemView newItemView(View convertView, int viewType);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/fragment/itemview/OnFooterViewListener.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.fragment.itemview;
2 |
3 | import org.aisen.android.network.task.TaskException;
4 | import org.aisen.android.ui.fragment.ABaseFragment;
5 | import org.aisen.android.ui.fragment.APagingFragment;
6 |
7 | /**
8 | * Created by wangdan on 16/1/9.
9 | */
10 | public interface OnFooterViewListener {
11 |
12 | void onTaskStateChanged(AFooterItemView> footerItemView, ABaseFragment.ABaseTaskState state, TaskException exception, APagingFragment.RefreshMode mode);
13 |
14 | void setFooterViewToRefreshing();
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/widget/MToast.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.widget;
2 |
3 | import android.content.Context;
4 | import android.widget.Toast;
5 |
6 | import org.aisen.android.common.context.GlobalContext;
7 |
8 | /**
9 | * Created by wangdan on 15/4/15.
10 | */
11 | public class MToast {
12 |
13 | public static void showMessage(Context context, String text) {
14 | Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/library/src/main/java/org/aisen/android/ui/widget/swipyrefresh/SwipyRefreshLayoutDirection.java:
--------------------------------------------------------------------------------
1 | package org.aisen.android.ui.widget.swipyrefresh;
2 |
3 | /**
4 | * Created by oliviergoutay on 1/23/15.
5 | */
6 | public enum SwipyRefreshLayoutDirection {
7 |
8 | TOP(0),
9 | BOTTOM(1),
10 | BOTH(2);
11 |
12 | private int mValue;
13 |
14 | SwipyRefreshLayoutDirection(int value) {
15 | this.mValue = value;
16 | }
17 |
18 | public static SwipyRefreshLayoutDirection getFromInt(int value) {
19 | for (SwipyRefreshLayoutDirection direction : SwipyRefreshLayoutDirection.values()) {
20 | if (direction.mValue == value) {
21 | return direction;
22 | }
23 | }
24 | return BOTH;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/library/src/main/res/color/comm_tab_text_color.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/library/src/main/res/drawable-xhdpi/comm_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/library/src/main/res/drawable-xhdpi/comm_loading.png
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_dragsort_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
12 |
14 |
16 |
17 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_emptyview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
14 |
15 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_footerview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
13 |
14 |
17 |
18 |
19 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_loadfailed.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
16 |
29 |
30 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_lay_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_fragment_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_gridview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
12 |
13 |
14 |
17 |
18 |
21 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_recycleview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
10 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_recycleview_swiperefresh.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
14 |
15 |
16 |
17 |
20 |
21 |
24 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_swipy_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
16 |
17 |
18 |
19 |
22 |
23 |
26 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_tabs_slidingtablayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
11 |
12 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_tabs_tablayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
12 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/comm_ui_waterfall.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/library/src/main/res/layout/sheetfab_dim_overlay.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/library/src/main/res/values-v21/comm_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values-v21/sheetfab_refs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - @android:interpolator/fast_out_slow_in
4 |
5 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_attrs.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 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #FFffffff
5 | #FF000000
6 | #FF888888
7 | #FF52A0DB
8 | #FFFF0000
9 | #00000000
10 |
11 | #ffffffff
12 |
13 | #44000000
14 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dip
4 | 16dip
5 | 10dip
6 | 10dip
7 |
8 |
9 | 58dip
10 |
11 |
14 | 320dp
15 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_exception.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 没有网络连接
4 | 数据解析出错
5 | 网络不给力
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_ids.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 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 正在加载...
5 | 加载更多
6 | 加载失败,重新加载
7 | 全部加载完了
8 | 刷新看看
9 | 数据为空
10 | 已经复制 %s
11 |
12 |
13 | - 0
14 | - 1
15 | - 2
16 | - 3
17 | - 4
18 | - 5
19 | - 6
20 | - 7
21 | - 8
22 | - 9
23 | - 10
24 | - 11
25 | - 12
26 | - 13
27 | - 14
28 | - 15
29 | - 16
30 |
31 |
32 |
--------------------------------------------------------------------------------
/library/src/main/res/values/comm_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/res/values/dslv_attrs.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 |
--------------------------------------------------------------------------------
/library/src/main/res/values/sheetfab_refs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - @android:interpolator/decelerate_cubic
4 |
5 |
--------------------------------------------------------------------------------
/library/src/main/res/values/swipyrefresh_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/library_wen/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | library_wen.iml
3 |
--------------------------------------------------------------------------------
/library_wen/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.jakewharton.butterknife'
3 | apply plugin: 'android-apt'
4 |
5 | android {
6 | compileSdkVersion 24
7 | buildToolsVersion "24.0.2"
8 |
9 | defaultConfig {
10 | minSdkVersion 14
11 | targetSdkVersion 24
12 | versionCode 1
13 | versionName "1.0"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | compile 'com.alibaba:fastjson:1.2.6'
25 | compile 'com.android.support:appcompat-v7:24.2.0'
26 | compile 'com.android.support:design:24.2.0'
27 | compile 'com.squareup.okhttp:okhttp:2.6.0'
28 | compile 'com.jakewharton:butterknife:8.4.0'
29 | apt 'com.jakewharton:butterknife-compiler:8.4.0'
30 | }
31 |
--------------------------------------------------------------------------------
/library_wen/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 /Users/wangdan/software/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/library_wen/src/androidTest/java/org/aisen/wen/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/library_wen/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/base/Consts.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.base;
2 |
3 | /**
4 | * Created by wangdan on 16/10/10.
5 | */
6 | final public class Consts {
7 |
8 | public static final String KEY_PREFIX = "org.aisen.wen";
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/base/GlobalContext.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.base;
2 |
3 | import android.app.Application;
4 |
5 | import com.squareup.okhttp.OkHttpClient;
6 |
7 | import java.util.concurrent.TimeUnit;
8 |
9 | /**
10 | * Application的上下文
11 | *
12 | * Created by wangdan on 16/9/29.
13 | */
14 | public class GlobalContext {
15 |
16 | public final static int CONN_TIMEOUT = 30000;
17 | public final static int READ_TIMEOUT = 30000;
18 |
19 | private final static OkHttpClient mOkHttpClient = new OkHttpClient();;
20 |
21 | static {
22 | // 初始化OkHttpClient
23 | configOkHttpClient(CONN_TIMEOUT, READ_TIMEOUT);
24 | }
25 |
26 | private GlobalContext() {
27 | }
28 |
29 | private static Application _context;
30 |
31 | public static void onCreate(Application context) {
32 | _context = context;
33 | }
34 |
35 | public static Application getInstance() {
36 | return _context;
37 | }
38 |
39 | public static OkHttpClient getOkHttpClient() {
40 | return mOkHttpClient;
41 | }
42 |
43 | public static void configOkHttpClient(int connTimeout, int socketTimeout) {
44 | if (mOkHttpClient != null) {
45 | mOkHttpClient.setConnectTimeout(connTimeout, TimeUnit.MILLISECONDS);
46 | mOkHttpClient.setReadTimeout(socketTimeout, TimeUnit.MILLISECONDS);
47 | }
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/core/BitmapCache.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.core;
2 |
3 | import org.aisen.wen.component.bitmaploader.BitmapLoader;
4 | import org.aisen.wen.support.utils.KeyGenerator;
5 |
6 |
7 | public class BitmapCache {
8 | private LruMemoryCache mMemoryCache;
9 |
10 | public BitmapCache(int memCacheSize) {
11 | init(memCacheSize);
12 | }
13 |
14 | private void init(int memCacheSize) {
15 | mMemoryCache = new LruMemoryCache(memCacheSize) {
16 | @Override
17 | protected int sizeOf(String key, MyBitmap bitmap) {
18 | return BitmapCommonUtils.getBitmapSize(bitmap.getBitmap()) * 4;
19 | }
20 | };
21 |
22 | }
23 |
24 | public void addBitmapToMemCache(String url, ImageConfig config, MyBitmap bitmap) {
25 | if (url == null || bitmap == null) {
26 | return;
27 | }
28 |
29 | if (mMemoryCache != null) {
30 | mMemoryCache.put(KeyGenerator.generateMD5(BitmapLoader.getKeyByConfig(url, config)), bitmap);
31 | }
32 | }
33 |
34 | public MyBitmap getBitmapFromMemCache(String url, ImageConfig config) {
35 | if (mMemoryCache != null) {
36 | final MyBitmap memBitmap = mMemoryCache.get(KeyGenerator.generateMD5(BitmapLoader.getKeyByConfig(url, config)));
37 | if (memBitmap != null) {
38 | return memBitmap;
39 | }
40 | }
41 | return null;
42 | }
43 |
44 | public void clearMemCache() {
45 | if (mMemoryCache != null) {
46 | mMemoryCache.evictAll();
47 | }
48 | }
49 |
50 | public void clearMemHalfCache() {
51 | if (mMemoryCache != null) {
52 | mMemoryCache.evictHalf();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/core/BitmapCompress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.core;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 |
6 | import org.aisen.wen.component.bitmaploader.BitmapLoader;
7 | import org.aisen.wen.support.utils.Logger;
8 |
9 | import java.io.File;
10 |
11 | public class BitmapCompress implements IBitmapCompress {
12 |
13 | @Override
14 | public MyBitmap compress(byte[] bitmapBytes, File file, String url, ImageConfig config, int origW, int origH) throws Exception {
15 | Bitmap bitmap = null;
16 | try {
17 | if (config.getMaxHeight() > 0 && config.getMaxWidth() > 0) {
18 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxWidth(), config.getMaxHeight());
19 | }
20 | else if (config.getMaxHeight() > 0) {
21 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxHeight(), config.getMaxHeight());
22 | }
23 | else if (config.getMaxWidth() > 0) {
24 | bitmap = BitmapDecoder.decodeSampledBitmapFromByte(bitmapBytes, config.getMaxWidth(), config.getMaxWidth());
25 | }
26 | else {
27 | bitmap = BitmapFactory.decodeByteArray(bitmapBytes, 0, bitmapBytes.length);
28 | }
29 | } catch (OutOfMemoryError e) {
30 | e.printStackTrace();
31 | }
32 |
33 | Logger.d(BitmapLoader.TAG, String.format("原始尺寸是%dX%d, 压缩后尺寸是%dX%d", origW, origH, bitmap.getWidth(), bitmap.getHeight()));
34 |
35 | return new MyBitmap(bitmap, url);
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/core/BitmapOwner.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.core;
2 |
3 | public interface BitmapOwner {
4 |
5 | boolean canDisplay();
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/core/IBitmapCompress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.core;
2 |
3 | import java.io.File;
4 |
5 | public interface IBitmapCompress {
6 |
7 | /**
8 | * 压缩图片
9 | *
10 | * @param bitmapBytes
11 | * 图片的byte数据流
12 | * @param file
13 | * 图片存储的文件
14 | * @param url
15 | * 图片加载地址
16 | * @param config
17 | * 加载图片设置
18 | * @param origW
19 | * 图片宽度
20 | * @param origH
21 | * 图片高度
22 | * @return null-不压缩
23 | * @throws Exception
24 | */
25 | public MyBitmap compress(byte[] bitmapBytes, File file, String url, ImageConfig config, int origW, int origH) throws Exception;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/display/DefaultDisplayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.widget.ImageView;
5 |
6 | public class DefaultDisplayer implements Displayer {
7 |
8 | @Override
9 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable) {
10 | imageView.setImageDrawable(drawable);
11 | }
12 |
13 | @Override
14 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable) {
15 | imageView.setImageDrawable(drawable);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/display/Displayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.widget.ImageView;
5 |
6 | public interface Displayer {
7 |
8 | /**
9 | * 图片加载完成 回调的函数
10 | *
11 | * @param imageView
12 | * @param bitmap
13 | * @param config
14 | */
15 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable);
16 |
17 | /**
18 | * 图片加载失败回调的函数
19 | *
20 | * @param imageView
21 | * @param bitmap
22 | */
23 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/display/FadeInDisplayer.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.display;
2 |
3 | import android.graphics.drawable.BitmapDrawable;
4 | import android.graphics.drawable.Drawable;
5 | import android.graphics.drawable.TransitionDrawable;
6 | import android.widget.ImageView;
7 |
8 | public class FadeInDisplayer implements Displayer {
9 |
10 | @Override
11 | public void loadCompletedisplay(ImageView imageView, BitmapDrawable drawable) {
12 | // PhotoView不设置
13 | if (imageView.getClass().getSimpleName().indexOf("PhotoView") != -1)
14 | return;
15 |
16 | if (imageView.getDrawable() != null) {
17 | final TransitionDrawable td = new TransitionDrawable(new Drawable[] { imageView.getDrawable(), drawable });
18 | imageView.setImageDrawable(td);
19 | td.startTransition(300);
20 | }
21 | else {
22 | imageView.setImageDrawable(drawable);
23 | }
24 | }
25 |
26 | @Override
27 | public void loadFailDisplay(ImageView imageView, BitmapDrawable drawable) {
28 | imageView.setImageDrawable(drawable);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/download/AssetsDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.wen.component.bitmaploader.core.ImageConfig;
6 |
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.InputStream;
9 |
10 | public class AssetsDownloader implements Downloader {
11 |
12 | @Override
13 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
14 | try {
15 | DownloadProcess progress = config.getProgress();
16 |
17 | if (progress != null)
18 | progress.sendPrepareDownload(url);
19 |
20 | ByteArrayOutputStream out = new ByteArrayOutputStream();
21 |
22 | // 加载assets目录
23 | InputStream in = context.getAssets().open(url);
24 |
25 | if (progress != null)
26 | progress.receiveLength(in.available());
27 |
28 | if (in == null)
29 | return null;
30 |
31 | // 获取图片数据
32 | byte[] buffer = new byte[1024 * 128];
33 | int readLen = -1;
34 | int readBytes = 0;
35 | while ((readLen = in.read(buffer)) != -1) {
36 | readBytes += readLen;
37 | if (progress != null)
38 | progress.sendProgress(readBytes);
39 | out.write(buffer, 0, readLen);
40 | }
41 |
42 | byte[] bs = out.toByteArray();
43 | in.close();
44 | out.close();
45 |
46 | return bs;
47 | } catch (Exception e) {
48 | if(config.getProgress()!=null)
49 | config.getProgress().sendException(e);
50 | throw new Exception(e.getCause());
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/download/ContentProviderDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | import org.aisen.wen.component.bitmaploader.core.ImageConfig;
7 | import org.aisen.wen.support.utils.FileUtils;
8 |
9 | import java.io.InputStream;
10 |
11 | public class ContentProviderDownloader implements Downloader {
12 |
13 | @Override
14 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
15 |
16 | try {
17 | InputStream is = context.getContentResolver().openInputStream(Uri.parse(url));
18 | byte[] datas = FileUtils.readStreamToBytes(is);
19 | return datas;
20 | } catch (Exception e) {
21 | if (config.getProgress() != null)
22 | config.getProgress().downloadFailed(e);
23 | e.printStackTrace();
24 | throw e;
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/download/Downloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.wen.component.bitmaploader.core.ImageConfig;
6 |
7 | public interface Downloader {
8 |
9 | byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception;
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/download/DrawableDownloader.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.download;
2 |
3 | import android.content.Context;
4 |
5 | import org.aisen.wen.component.bitmaploader.core.ImageConfig;
6 | import org.aisen.wen.support.utils.BitmapUtil;
7 |
8 | import java.io.ByteArrayOutputStream;
9 | import java.io.InputStream;
10 |
11 | public class DrawableDownloader implements Downloader {
12 |
13 | @Override
14 | public byte[] downloadBitmap(Context context, String url, ImageConfig config) throws Exception {
15 | try {
16 | ByteArrayOutputStream out = new ByteArrayOutputStream();
17 |
18 | if (config.getProgress() != null)
19 | config.getProgress().sendPrepareDownload(url);
20 |
21 | InputStream in = null;
22 |
23 | try {
24 | // in = GlobalContext.getInstance().getResources().openRawResource(id)
25 | in = BitmapUtil.getFromDrawableAsStream(context, url);
26 | } catch (OutOfMemoryError e) {
27 | e.printStackTrace();
28 | }
29 |
30 | if (in == null)
31 | return null;
32 |
33 | if (config.getProgress() != null)
34 | config.getProgress().receiveLength(in.available());
35 |
36 | byte[] buffer = new byte[1024 * 128];
37 | int readLen = -1;
38 | int readBytes = 0;
39 | while ((readLen = in.read(buffer)) != -1) {
40 | readBytes += readLen;
41 | if (config.getProgress() != null)
42 | config.getProgress().sendProgress(readBytes);
43 | out.write(buffer, 0, readLen);
44 | }
45 |
46 | byte[] bs = out.toByteArray();
47 | in.close();
48 | out.close();
49 | return bs;
50 | } catch (Exception e) {
51 | if(config.getProgress()!=null)
52 | config.getProgress().sendException(e);
53 | throw new Exception(e.getCause());
54 | }
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/bitmaploader/view/MyDrawable.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.bitmaploader.view;
2 |
3 | import android.content.res.Resources;
4 | import android.graphics.Bitmap;
5 | import android.graphics.drawable.BitmapDrawable;
6 |
7 | import org.aisen.wen.component.bitmaploader.BitmapLoader.MyBitmapLoaderTask;
8 | import org.aisen.wen.component.bitmaploader.core.ImageConfig;
9 | import org.aisen.wen.component.bitmaploader.core.MyBitmap;
10 |
11 | import java.lang.ref.WeakReference;
12 |
13 | public class MyDrawable extends BitmapDrawable {
14 |
15 | private MyBitmap myBitmap;
16 | private ImageConfig config;
17 | private WeakReference task;
18 |
19 | public MyDrawable(Resources res, MyBitmap myBitmap, ImageConfig config, WeakReference task) {
20 | this(res, myBitmap.getBitmap());
21 | this.myBitmap = myBitmap;
22 | this.config = config;
23 | this.task = task;
24 | }
25 |
26 | public MyBitmap getMyBitmap() {
27 | return myBitmap;
28 | }
29 |
30 | public void setMyBitmap(MyBitmap myBitmap) {
31 | this.myBitmap = myBitmap;
32 | }
33 |
34 | public MyDrawable(Resources res, Bitmap bitmap) {
35 | super(res, bitmap);
36 | }
37 |
38 | public ImageConfig getConfig() {
39 | return config;
40 | }
41 |
42 | public void setConfig(ImageConfig config) {
43 | this.config = config;
44 | }
45 |
46 | public WeakReference getTask() {
47 | return task;
48 | }
49 |
50 | public void setTask(WeakReference task) {
51 | this.task = task;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/cardmenu/CardMenuOptions.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.cardmenu;
2 |
3 | /**
4 | * Created by wangdan on 16/9/13.
5 | */
6 | public class CardMenuOptions {
7 |
8 | int dropDownGravity = -1;
9 | // 设置ListPopup的Offset
10 | int dropDownHorizontalOffset;
11 | int dropDownVerticalOffset;
12 | int themeRes;
13 | int popupStyleAttr;
14 | int actionMenuLayoutRes;
15 | int actionMenuItemLayoutRes;
16 |
17 | public CardMenuOptions(int themeRes, int popupStyleAttr, int actionMenuLayoutRes, int actionMenuItemLayoutRes) {
18 | this.themeRes = themeRes;
19 | this.popupStyleAttr = popupStyleAttr;
20 | this.actionMenuLayoutRes = actionMenuLayoutRes;
21 | this.actionMenuItemLayoutRes = actionMenuItemLayoutRes;
22 | }
23 |
24 | public CardMenuOptions setGravity(int gravity) {
25 | dropDownGravity = gravity;
26 | return this;
27 | }
28 |
29 | public CardMenuOptions setDropDownHorizontalOffset(int offset) {
30 | dropDownHorizontalOffset = offset;
31 | return this;
32 | }
33 |
34 | public CardMenuOptions setDropDownVerticalOffset(int offset) {
35 | dropDownVerticalOffset = offset;
36 | return this;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/biz/IResult.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.biz;
2 |
3 | public interface IResult {
4 |
5 | /**
6 | * 缓存过期
7 | *
8 | * @return
9 | */
10 | boolean outofdate();
11 |
12 | /**
13 | * 是否是缓存数据
14 | *
15 | * @return
16 | */
17 | boolean fromCache();
18 |
19 | /**
20 | * 没有更多数据了
21 | *
22 | * @return
23 | */
24 | boolean endPaging();
25 |
26 | /**
27 | * 页码信息
28 | *
29 | * @return
30 | */
31 | String[] pagingIndex();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/cache/ICacheUtility.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.cache;
2 |
3 |
4 | import org.aisen.wen.component.network.biz.IResult;
5 | import org.aisen.wen.component.network.http.Params;
6 | import org.aisen.wen.component.network.setting.Setting;
7 |
8 | /**
9 | * 缓存切面
10 | *
11 | * @author wangdan
12 | *
13 | */
14 | public interface ICacheUtility {
15 |
16 | IResult findCacheData(Setting action, Params params);
17 |
18 | void addCacheData(Setting action, Params params, IResult result);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/http/HttpConfig.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.http;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class HttpConfig {
7 |
8 | public String cookie;
9 |
10 | public String baseUrl;// 服务器地址
11 |
12 | public Map headerMap = new HashMap<>();
13 |
14 | public void addHeader(String key, String value) {
15 | headerMap.put(key, value);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/http/OnMultiFileProgress.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.http;
2 |
3 | /**
4 | * 上传文件的进度回到
5 | *
6 | * Created by wangdan on 16/8/29.
7 | */
8 | public interface OnMultiFileProgress {
9 |
10 | void onProgress(long progress, long total);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/setting/BaseSetting.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.setting;
2 |
3 | import java.io.Serializable;
4 |
5 | class BaseSetting implements Serializable {
6 |
7 | private static final long serialVersionUID = -3694407301270573142L;
8 |
9 | private String description;
10 |
11 | private String type;
12 |
13 | private String value;
14 |
15 | public String getDescription() {
16 | return description;
17 | }
18 |
19 | public void setDescription(String description) {
20 | this.description = description;
21 | }
22 |
23 | public String getType() {
24 | return type;
25 | }
26 |
27 | public void setType(String type) {
28 | this.type = type;
29 | }
30 |
31 | public String getValue() {
32 | return value;
33 | }
34 |
35 | public void setValue(String value) {
36 | this.value = value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/setting/Setting.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.setting;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class Setting extends BaseSetting {
7 |
8 | private static final long serialVersionUID = 4801654811733634325L;
9 |
10 | private final Map extras;
11 |
12 | public Setting() {
13 | extras = new HashMap<>();
14 | }
15 |
16 | public Map getExtras() {
17 | return extras;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/setting/SettingExtra.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.setting;
2 |
3 | public class SettingExtra extends BaseSetting {
4 |
5 | private static final long serialVersionUID = 4608815242740722900L;
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/task/IExceptionDelegate.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.task;
2 |
3 | public interface IExceptionDelegate {
4 |
5 | void verifyResponse(String response) throws TaskException;
6 |
7 | String code2msg(String code);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/task/ITaskManager.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.task;
2 |
3 | public interface ITaskManager {
4 |
5 | void addTask(IWorkTask task);
6 |
7 | void removeTask(String taskId, boolean cancelIfRunning);
8 |
9 | void removeAllTask(boolean cancelIfRunning);
10 |
11 | int getTaskCount(String taskId);
12 |
13 | void clearTaskCount(String taskId);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/network/task/IWorkTask.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.network.task;
2 |
3 | /**
4 | * 执行线程
5 | *
6 | * Created by wangdan on 16/10/13.
7 | */
8 | public interface IWorkTask {
9 |
10 | /**
11 | * 线程ID
12 | *
13 | * @return
14 | */
15 | String getTaskId();
16 |
17 | boolean cancel(boolean mayInterruptIfRunning);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/annotation/AutoIncrementPrimaryKey.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface AutoIncrementPrimaryKey {
11 |
12 | public String column() default "id";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/annotation/PrimaryKey.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.FIELD)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface PrimaryKey {
11 |
12 | public String column() default "primary_key";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/annotation/TableName.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.TYPE)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface TableName {
11 |
12 | public String table();
13 |
14 | }
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/extra/AutoIncrementTableColumn.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.extra;
2 |
3 | public class AutoIncrementTableColumn extends TableColumn {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/extra/Extra.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.extra;
2 |
3 |
4 | public class Extra {
5 |
6 | private String owner;// 数据拥有者
7 |
8 | private String key;// 数据的key
9 |
10 | public Extra() {
11 |
12 | }
13 |
14 | public Extra(String owner, String key) {
15 | this.key = key;
16 | this.owner = owner;
17 | }
18 |
19 | public String getOwner() {
20 | return owner;
21 | }
22 |
23 | public void setOwner(String owner) {
24 | this.owner = owner;
25 | }
26 |
27 | public String getKey() {
28 | return key;
29 | }
30 |
31 | public void setKey(String key) {
32 | this.key = key;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/extra/TableColumn.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.extra;
2 |
3 | import java.lang.reflect.Field;
4 |
5 | public class TableColumn {
6 |
7 | private String dataType;
8 |
9 | private Field field;
10 |
11 | private String column;
12 |
13 | private String columnType;
14 |
15 | public String getDataType() {
16 | return dataType;
17 | }
18 |
19 | public void setDataType(String dataType) {
20 | this.dataType = dataType;
21 | }
22 |
23 | public Field getField() {
24 | return field;
25 | }
26 |
27 | public void setField(Field field) {
28 | this.field = field;
29 | }
30 |
31 | public String getColumn() {
32 | return column;
33 | }
34 |
35 | public void setColumn(String column) {
36 | this.column = column;
37 | }
38 |
39 | public String getColumnType() {
40 | return columnType;
41 | }
42 |
43 | public void setColumnType(String columnType) {
44 | this.columnType = columnType;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/component/orm/utils/FieldUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.component.orm.utils;
2 |
3 | import org.aisen.wen.component.orm.extra.TableColumn;
4 |
5 | public class FieldUtils {
6 |
7 | public static final String OWNER = "com_m_common_owner";
8 |
9 | public static final String KEY = "com_m_common_key";
10 |
11 | public static final String CREATEAT = "com_m_common_createat";
12 |
13 | public static TableColumn getOwnerColumn() {
14 | TableColumn column = new TableColumn();
15 | column.setColumn(OWNER);
16 | return column;
17 | }
18 |
19 | public static TableColumn getKeyColumn() {
20 | TableColumn column = new TableColumn();
21 | column.setColumn(KEY);
22 | return column;
23 | }
24 |
25 | public static TableColumn getCreateAtColumn() {
26 | TableColumn column = new TableColumn();
27 | column.setColumn(CREATEAT);
28 | return column;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/action/IAction.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.action;
2 |
3 | import android.app.Activity;
4 |
5 | /**
6 | * Created by wangdan on 15-3-11.
7 | */
8 | public abstract class IAction {
9 |
10 | private Activity context;
11 |
12 | private IAction parent;
13 |
14 | private IAction child;
15 |
16 | public IAction(Activity context, IAction parent) {
17 | this.context = context;
18 | this.parent = parent;
19 | if (parent != null)
20 | parent.setChild(this);
21 | }
22 |
23 | protected boolean interrupt() {
24 | return false;
25 | }
26 |
27 | public void doInterrupt() {
28 |
29 | }
30 |
31 | public void run() {
32 | if (parent == null || !parent.interrupt()) {
33 | doAction();
34 | }
35 | }
36 |
37 | final protected void setChild(IAction child) {
38 | this.child = child;
39 | }
40 |
41 | final public IAction getChild() {
42 | return child;
43 | }
44 |
45 | final public IAction getParent() {
46 | return parent;
47 | }
48 |
49 | final protected Activity getContext() {
50 | return context;
51 | }
52 |
53 | public void doAction() {
54 | if (getChild() != null) {
55 | getChild().run();
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/bean/ResultBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.bean;
2 |
3 | import org.aisen.wen.component.network.biz.IResult;
4 |
5 | /**
6 | *
7 | * Created by wangdan on 15/12/20.
8 | */
9 | public class ResultBean implements IResult {
10 |
11 | private boolean outofdate;
12 |
13 | private boolean fromCache;
14 |
15 | private boolean endPaging;
16 |
17 | private String[] pagingIndex;
18 |
19 | @Override
20 | public boolean outofdate() {
21 | return isOutofdate();
22 | }
23 |
24 | @Override
25 | public boolean fromCache() {
26 | return isFromCache();
27 | }
28 |
29 | @Override
30 | public boolean endPaging() {
31 | return isEndPaging();
32 | }
33 |
34 | @Override
35 | public String[] pagingIndex() {
36 | return getPagingIndex();
37 | }
38 |
39 | public boolean isOutofdate() {
40 | return outofdate;
41 | }
42 |
43 | public void setOutofdate(boolean outofdate) {
44 | this.outofdate = outofdate;
45 | }
46 |
47 | public boolean isFromCache() {
48 | return fromCache;
49 | }
50 |
51 | public void setFromCache(boolean fromCache) {
52 | this.fromCache = fromCache;
53 | }
54 |
55 | public boolean isEndPaging() {
56 | return endPaging;
57 | }
58 |
59 | public void setEndPaging(boolean endPaging) {
60 | this.endPaging = endPaging;
61 | }
62 |
63 | public String[] getPagingIndex() {
64 | return pagingIndex;
65 | }
66 |
67 | public void setPagingIndex(String[] pagingIndex) {
68 | this.pagingIndex = pagingIndex;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/bean/TabItem.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * ViewPager的Tab页标签
7 | *
8 | * Created by wangdan on 15/12/22.
9 | */
10 | public class TabItem implements Serializable {
11 |
12 | private static final long serialVersionUID = -1162756298239591517L;
13 |
14 | private String type;
15 |
16 | private String title;
17 |
18 | private Serializable tag;
19 |
20 | public TabItem() {
21 |
22 | }
23 |
24 | public TabItem(String type, String title) {
25 | this.type = type;
26 | this.title = title;
27 | }
28 |
29 | public String getType() {
30 | return type;
31 | }
32 |
33 | public void setType(String type) {
34 | this.type = type;
35 | }
36 |
37 | public String getTitle() {
38 | return title;
39 | }
40 |
41 | public void setTitle(String title) {
42 | this.title = title;
43 | }
44 |
45 | public Serializable getTag() {
46 | return tag;
47 | }
48 |
49 | public void setTag(Serializable tag) {
50 | this.tag = tag;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/paging/IPaging.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.paging;
2 |
3 | import java.io.Serializable;
4 |
5 | public interface IPaging- extends Serializable {
6 |
7 | /**
8 | * 处理数据
9 | *
10 | * @param newDatas
11 | * 新获取的数据集合
12 | * @param firstData
13 | * adapter数据集中的第一条数据
14 | * @param lastData
15 | * adapter数据集中的最后一条数据
16 | */
17 | void processData(Result newDatas, Item firstData, Item lastData);
18 |
19 | String getPreviousPage();
20 |
21 | String getNextPage();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/paging/PageIndexPaging.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.paging;
2 |
3 | import android.text.TextUtils;
4 |
5 | import org.aisen.wen.component.network.biz.IResult;
6 |
7 | import java.io.Serializable;
8 | import java.lang.reflect.Field;
9 |
10 | /**
11 | * 始终自增,但是有最大分页页码,根据配置的属性获取
12 | *
13 | * @author Jeff.Wang
14 | *
15 | * @date 2014年9月22日
16 | */
17 | public class PageIndexPaging
- implements IPaging
- {
18 |
19 | private static final long serialVersionUID = 8485595687197548908L;
20 |
21 | int pageTotal = -1;
22 | int pageIndex = 1;
23 |
24 | String pageTotalField;
25 |
26 | public PageIndexPaging(String pageTotalField) {
27 | this.pageTotalField = pageTotalField;
28 | }
29 |
30 | public PageIndexPaging() {
31 | }
32 |
33 | @Override
34 | public void processData(Result newDatas, Item firstData, Item lastData) {
35 | pageIndex++;
36 | if (newDatas instanceof IResult) {
37 | IResult iResult = (IResult) newDatas;
38 | if (iResult.fromCache() && iResult.pagingIndex() != null) {
39 | pageIndex = Integer.parseInt(iResult.pagingIndex()[1]);
40 | }
41 | }
42 | if (!TextUtils.isEmpty(pageTotalField)) {
43 | Class clazz = newDatas.getClass();
44 | while (clazz != Object.class) {
45 | try {
46 | Field field = clazz.getDeclaredField(pageTotalField);
47 | field.setAccessible(true);
48 | pageTotal = Integer.parseInt(field.get(newDatas).toString());
49 | break;
50 | } catch (Exception e) {
51 | clazz = clazz.getSuperclass();
52 | }
53 | }
54 | }
55 | }
56 |
57 | @Override
58 | public String getPreviousPage() {
59 | return String.valueOf(pageIndex - 1);
60 | }
61 |
62 | @Override
63 | public String getNextPage() {
64 | return String.valueOf(pageIndex);
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/permissions/DefPermissionsSubject.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.permissions;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by wangdan on 16/2/26.
8 | */
9 | public class DefPermissionsSubject implements IPermissionsSubject {
10 |
11 | private List observers;
12 |
13 | public DefPermissionsSubject() {
14 | observers = new ArrayList<>();
15 | }
16 |
17 | @Override
18 | public void attach(IPermissionsObserver observer) {
19 | if (observer != null && !observers.contains(observer))
20 | observers.add(observer);
21 | }
22 |
23 | @Override
24 | public void detach(IPermissionsObserver observer) {
25 | if (observer != null && !observers.contains(observer))
26 | observers.remove(observer);
27 | }
28 |
29 | @Override
30 | public void notifyActivityResult(int requestCode, String[] permissions, int[] grantResults) {
31 | for (IPermissionsObserver observer : observers) {
32 | observer.onRequestPermissionsResult(requestCode, permissions, grantResults);
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/permissions/IPermissionsObserver.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.permissions;
2 |
3 | /**
4 | * Created by wangdan on 16/2/26.
5 | */
6 | public interface IPermissionsObserver {
7 |
8 | void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/permissions/IPermissionsSubject.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.permissions;
2 |
3 | /**
4 | * Created by wangdan on 16/2/26.
5 | */
6 | public interface IPermissionsSubject {
7 |
8 | void attach(IPermissionsObserver observer);
9 |
10 | void detach(IPermissionsObserver observer);
11 |
12 | void notifyActivityResult(int requestCode, String[] permissions, int[] grantResults);
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.utils;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Calendar;
6 |
7 | public class DateUtils {
8 |
9 | // yyyy-MM-dd hh:mm:ss 12小时制
10 | // yyyy-MM-dd HH:mm:ss 24小时制
11 |
12 | public static final String TYPE_01 = "yyyy-MM-dd HH:mm:ss";
13 |
14 | public static final String TYPE_02 = "yyyy-MM-dd";
15 |
16 | public static final String TYPE_03 = "HH:mm:ss";
17 |
18 | public static final String TYPE_04 = "yyyy年MM月dd日";
19 |
20 | public static String formatDate(long time, String format) {
21 | Calendar cal = Calendar.getInstance();
22 | cal.setTimeInMillis(time);
23 | return new SimpleDateFormat(format).format(cal.getTime());
24 | }
25 |
26 | public static String formatDate(String longStr, String format) {
27 | try {
28 | return formatDate(Long.parseLong(longStr), format);
29 | } catch (Exception e) {
30 | }
31 | return "";
32 | }
33 |
34 | public static long formatStr(String timeStr, String pattern) {
35 | SimpleDateFormat sdf = new SimpleDateFormat(pattern);
36 | try {
37 | return sdf.parse(timeStr).getTime();
38 | } catch (ParseException e) {
39 | e.printStackTrace();
40 | }
41 |
42 | return 0;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/utils/HprofUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.utils;
2 |
3 | import android.os.Debug;
4 |
5 | import java.io.File;
6 | import java.text.SimpleDateFormat;
7 | import java.util.Calendar;
8 |
9 | /**
10 | * Created by wangdan on 15/4/21.
11 | */
12 | public class HprofUtils {
13 |
14 | private final static String OOM_SUFFIX = ".hprof";
15 |
16 | public static void dumpHprof(String path) {
17 | try {
18 | String name = getDate() + OOM_SUFFIX;
19 | path = path + File.separator + name;
20 | File file = path != null ? new File(path) : null;
21 | if (!file.getParentFile().exists())
22 | file.getParentFile().mkdirs();
23 | Debug.dumpHprofData(path);
24 | } catch (Throwable t) {
25 | t.printStackTrace();
26 | }
27 | }
28 |
29 | private static String getDate() {
30 | return new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(Calendar.getInstance().getTime());
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/support/utils/KeyGenerator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.support.utils;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | public class KeyGenerator {
7 |
8 | private KeyGenerator() {
9 |
10 | }
11 |
12 | public static String generateMD5(String key) {
13 | try {
14 | final MessageDigest mDigest = MessageDigest.getInstance("MD5");
15 | mDigest.update(key.getBytes());
16 | byte[] bytes = mDigest.digest();
17 | StringBuilder sb = new StringBuilder();
18 | for (int i = 0; i < bytes.length; i++) {
19 | String hex = Integer.toHexString(0xFF & bytes[i]);
20 | if (hex.length() == 1) {
21 | sb.append('0');
22 | }
23 | sb.append(hex);
24 | }
25 | return sb.toString();
26 | } catch (NoSuchAlgorithmException e) {
27 | return String.valueOf(key.hashCode());
28 | }
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/activity/FragmentArgs.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.activity;
2 |
3 | import android.os.Bundle;
4 | import android.text.TextUtils;
5 |
6 | import java.io.Serializable;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.Set;
10 |
11 | public class FragmentArgs implements Serializable {
12 |
13 | private static final long serialVersionUID = 5526514482404853100L;
14 |
15 | private Map values = new HashMap();
16 |
17 | public FragmentArgs add(String key, Serializable value) {
18 | if (!TextUtils.isEmpty(key) && value != null)
19 | values.put(key, value);
20 | return this;
21 | }
22 |
23 | public Serializable get(String key) {
24 | return values.get(key);
25 | }
26 |
27 | public static void setToBundle(Bundle bundle, FragmentArgs args) {
28 | Set keys = args.values.keySet();
29 | for (String key : keys) {
30 | Serializable value = args.get(key);
31 | if (value == null)
32 | continue;
33 | bundle.putSerializable(key, value);
34 | }
35 | }
36 |
37 | public static FragmentArgs transToArgs(Bundle bundle) {
38 | FragmentArgs args = new FragmentArgs();
39 | for (String s : bundle.keySet()) {
40 | Object o = bundle.get(s);
41 | if (o == null) continue;
42 | args.add(s, (Serializable) o);
43 | }
44 | return args;
45 | }
46 |
47 | public static Bundle transToBundle(FragmentArgs args) {
48 | Bundle bundle = new Bundle();
49 | setToBundle(bundle, args);
50 | return bundle;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/adapter/ABasicItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.adapter;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | import org.aisen.wen.ui.itemview.IITemView;
7 |
8 | import java.io.Serializable;
9 |
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * Created by wangdan on 16/1/5.
14 | */
15 | public abstract class ABasicItemView implements IITemView {
16 |
17 | private final Activity context;
18 |
19 | private int size;
20 |
21 | private int position;
22 |
23 | private final View convertView;
24 |
25 | public ABasicItemView(Activity context, View convertView) {
26 | this.context = context;
27 | this.convertView = convertView;
28 | }
29 |
30 | @Override
31 | public void onBindView(View convertView) {
32 | ButterKnife.bind(this, convertView);
33 | }
34 |
35 | @Override
36 | public int itemPosition() {
37 | return position;
38 | }
39 |
40 | @Override
41 | public void reset(int size, int position) {
42 | this.size = size;
43 | this.position = position;
44 | }
45 |
46 | @Override
47 | public int itemSize() {
48 | return size;
49 | }
50 |
51 | @Override
52 | public View getConvertView() {
53 | return convertView;
54 | }
55 |
56 | public Activity getContext() {
57 | return context;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/adapter/ARecycleViewItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.adapter;
2 |
3 | import android.app.Activity;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | import org.aisen.wen.ui.itemview.IITemView;
8 |
9 | import java.io.Serializable;
10 |
11 | import butterknife.ButterKnife;
12 |
13 | /**
14 | * Created by wangdan on 16/1/5.
15 | */
16 | public abstract class ARecycleViewItemView extends RecyclerView.ViewHolder implements IITemView {
17 |
18 | private int size;
19 |
20 | private int position;
21 |
22 | private final View convertView;
23 |
24 | private final Activity context;
25 |
26 | public ARecycleViewItemView(Activity context, View itemView) {
27 | super(itemView);
28 |
29 | this.context = context;
30 | this.convertView = itemView;
31 | }
32 |
33 | @Override
34 | public void onBindView(View convertView) {
35 | ButterKnife.bind(this, convertView);
36 | }
37 |
38 | @Override
39 | public void reset(int size, int position) {
40 | this.size = size;
41 | this.position = position;
42 | }
43 |
44 | @Override
45 | public int itemSize() {
46 | return size;
47 | }
48 |
49 | @Override
50 | public int itemPosition() {
51 | return position;
52 | }
53 |
54 | @Override
55 | public View getConvertView() {
56 | return convertView;
57 | }
58 |
59 | public Activity getContext() {
60 | return context;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/adapter/FragmentPagerChangeListener.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.adapter;
2 |
3 | public interface FragmentPagerChangeListener {
4 |
5 | void instantiate(String fragmentName);
6 |
7 | void destroy(String fragmentName);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/fragment/ATabsTabLayoutFragment.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.fragment;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.design.widget.TabLayout;
7 |
8 | import org.aisen.wen.R;
9 | import org.aisen.wen.R2;
10 | import org.aisen.wen.support.bean.TabItem;
11 |
12 | import butterknife.BindView;
13 |
14 | /**
15 | * 对TabLayout的封装
16 | *
17 | * Created by wangdan on 15/12/22.
18 | */
19 | public abstract class ATabsTabLayoutFragment extends ATabsFragment {
20 |
21 | @BindView(R2.id.tabLayout)
22 | TabLayout mTabLayout;
23 |
24 | @Override
25 | public int setLayoutId() {
26 | return R.layout.comm_ui_tabs_tablayout;
27 | }
28 |
29 | @Override
30 | final protected void setupViewPager(Bundle savedInstanceSate) {
31 | setupTabLayout(savedInstanceSate, mTabLayout);
32 | }
33 |
34 | protected void setupTabLayout(Bundle savedInstanceSate, final TabLayout tabLayout) {
35 | super.setupViewPager(savedInstanceSate);
36 |
37 | tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
38 | tabLayout.setTabTextColors(Color.parseColor("#b3ffffff"), Color.WHITE);
39 | tabLayout.setupWithViewPager(getViewPager());
40 | new Handler().postDelayed(new Runnable() {
41 |
42 | @Override
43 | public void run() {
44 | tabLayout.setScrollPosition(mCurrentPosition, 0, true);
45 | }
46 |
47 | }, 150);
48 | }
49 |
50 | public TabLayout getTablayout() {
51 | return mTabLayout;
52 | }
53 |
54 | protected void setTabLayout(TabLayout tabLayout) {
55 | mTabLayout = tabLayout;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/itemview/AFooterItemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.itemview;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | import org.aisen.wen.ui.adapter.ARecycleViewItemView;
7 | import org.aisen.wen.ui.model.listener.PagingModelListenerParam;
8 |
9 | import java.io.Serializable;
10 |
11 | /**
12 | * FooterView
13 | *
14 | * Created by wangdan on 16/1/9.
15 | */
16 | public abstract class AFooterItemView
- extends ARecycleViewItemView
- {
17 |
18 | private OnFooterViewCallback onFooterViewCallback;
19 |
20 | public AFooterItemView(Activity context, View itemView, OnFooterViewCallback callback) {
21 | super(context, itemView);
22 |
23 | this.onFooterViewCallback = callback;
24 | }
25 |
26 | protected OnFooterViewCallback getCallback() {
27 | return onFooterViewCallback;
28 | }
29 |
30 | abstract public void onTaskStateChanged(PagingModelListenerParam param);
31 |
32 | abstract public void setFooterViewToRefreshing();
33 |
34 | public interface OnFooterViewCallback {
35 |
36 | void onFooterViewLoadMore();
37 |
38 | boolean footerViewLoadMoreAbility();
39 |
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/itemview/AHeaderItemViewCreator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.itemview;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | *
11 | * Created by wangdan on 16/1/9.
12 | */
13 | public abstract class AHeaderItemViewCreator implements IItemViewCreator {
14 |
15 | @Override
16 | public View newContentView(LayoutInflater inflater, ViewGroup parent, int viewType) {
17 | for (int[] headerLayoutRes : setHeaders()) {
18 | if (viewType == headerLayoutRes[1]) {
19 | return inflater.inflate(headerLayoutRes[0], parent, false);
20 | }
21 | }
22 | return null;
23 | }
24 |
25 | /**
26 | *
27 | * @return position 0:layoutRes,1:viewType
28 | */
29 | abstract public int[][] setHeaders();
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/itemview/IITemView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.itemview;
2 |
3 | import android.view.View;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by wangdan on 16/1/5.
9 | */
10 | public interface IITemView {
11 |
12 | /**
13 | * 将View绑定到属性
14 | *
15 | * @param convertView
16 | */
17 | void onBindView(View convertView);
18 |
19 | /**
20 | * 将Data绑定到View
21 | *
22 | * @param convertView
23 | * @param data
24 | * @param position
25 | */
26 | void onBindData(View convertView, T data, int position);
27 |
28 | /**
29 | * Item的Position
30 | *
31 | * @return
32 | */
33 | int itemPosition();
34 |
35 | /**
36 | * 重置数据
37 | *
38 | * @return
39 | */
40 | void reset(int size, int position);
41 |
42 | /**
43 | * Item的数据size
44 | *
45 | * @return
46 | */
47 | int itemSize();
48 |
49 | /**
50 | * Item的ConvertView
51 | *
52 | * @return
53 | */
54 | View getConvertView();
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/itemview/IItemViewCreator.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.itemview;
2 |
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * Created by wangdan on 16/1/9.
11 | */
12 | public interface IItemViewCreator {
13 |
14 | /**
15 | * 遇到一个先有鸡还是先有蛋的问题,操蛋的RecycleView.Adapter,新增这个方法来处理,返回ItemView的LayoutRes
16 | *
17 | * @param inflater
18 | * @param viewType
19 | * @return
20 | */
21 | View newContentView(LayoutInflater inflater, ViewGroup parent, int viewType);
22 |
23 | IITemView newItemView(View convertView, int viewType);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/model/IModel.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.model;
2 |
3 | import org.aisen.wen.ui.model.listener.IModelListener;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by wangdan on 16/9/30.
9 | */
10 | public interface IModel {
11 |
12 | void setCallback(IModelListener listener);
13 |
14 | IModelListener getCallback();
15 |
16 | /**
17 | * 这个Model绑定的IWorkTask的TaskID
18 | *
19 | * @return
20 | */
21 | String getTaskId();
22 |
23 | void execute();
24 |
25 | boolean isRunning();
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/model/IPagingModel.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.model;
2 |
3 | import org.aisen.wen.support.paging.IPaging;
4 | import org.aisen.wen.ui.presenter.IPagingPresenter;
5 |
6 | import java.io.Serializable;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by wangdan on 16/10/11.
11 | */
12 | public interface IPagingModel
-
14 | extends IModel {
15 |
16 | void execute(IPagingPresenter.RefreshMode mode, IPaging
- paging);
17 |
18 | /**
19 | * 将Ts转换成List(T)
20 | *
21 | * @param result
22 | * List(T)
23 | * @return
24 | */
25 | List
- parseResult(Result result);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/model/listener/IModelListener.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.model.listener;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by wangdan on 16/9/30.
7 | */
8 | public interface IModelListener {
9 |
10 | void onPrepare(ModelListenerParam param);
11 |
12 | void onSuccess(ModelListenerParam param);
13 |
14 | void onFailure(ModelListenerParam param);
15 |
16 | void onFinished(ModelListenerParam param);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/model/listener/ModelListenerParam.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.model.listener;
2 |
3 | import org.aisen.wen.component.network.task.TaskException;
4 | import org.aisen.wen.ui.presenter.IContentPresenter;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * Created by wangdan on 16/10/12.
10 | */
11 | public class ModelListenerParam {
12 |
13 | private final IContentPresenter.TaskState taskState;
14 |
15 | private final TaskException exception;
16 |
17 | private final Result result;
18 |
19 | public ModelListenerParam(IContentPresenter.TaskState taskState, Result result, TaskException exception) {
20 | this.taskState = taskState;
21 | this.exception = exception;
22 | this.result = result;
23 | }
24 |
25 | public IContentPresenter.TaskState getTaskState() {
26 | return taskState;
27 | }
28 |
29 | public TaskException getException() {
30 | return exception;
31 | }
32 |
33 | public Result getResult() {
34 | return result;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/model/listener/PagingModelListenerParam.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.model.listener;
2 |
3 | import org.aisen.wen.component.network.task.TaskException;
4 | import org.aisen.wen.ui.presenter.IContentPresenter;
5 | import org.aisen.wen.ui.presenter.IPagingPresenter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * Created by wangdan on 16/10/12.
11 | */
12 | public class PagingModelListenerParam extends ModelListenerParam {
13 |
14 | private final IPagingPresenter.RefreshMode mode;
15 |
16 | public PagingModelListenerParam(IContentPresenter.TaskState taskState, Result result, TaskException exception, IPagingPresenter.RefreshMode mode) {
17 | super(taskState, result, exception);
18 |
19 | this.mode = mode;
20 | }
21 |
22 | public IPagingPresenter.RefreshMode getRefreshMode() {
23 | return mode;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/presenter/IContentPresenter.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.presenter;
2 |
3 | import org.aisen.wen.component.network.task.ITaskManager;
4 | import org.aisen.wen.ui.model.IModel;
5 | import org.aisen.wen.ui.view.IContentView;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * 根据Mode的回调方法,自动切换4种视图的切换
11 | * 管理Task的生命周期
12 | *
13 | */
14 | public interface IContentPresenter, View extends IContentView>
15 | extends IPresenter, ITaskManager {
16 |
17 | /**
18 | * ContentView对应Mode的四种状态
19 | */
20 | enum TaskState {
21 | prepare, falid, success, finished
22 | }
23 |
24 | /**
25 | * 缓存数据过期时,再次请求数据
26 | */
27 | void requestDataOutofdate();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/presenter/ILifecycleBridge.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.presenter;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * 生命周期
11 | *
12 | * Created by wangdan on 16/9/30.
13 | */
14 | public interface ILifecycleBridge {
15 |
16 | void setBridgeContext(Activity context);
17 |
18 | Activity getBridgeContext();
19 |
20 | void onBridgeCreate(Bundle savedInstanceState);
21 |
22 | View onBridgeCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);
23 |
24 | void onBridgeActivityCreate(Activity activity, Bundle savedInstanceState);
25 |
26 | void onBridgeStart();
27 |
28 | void onBridgeResume();
29 |
30 | void onBridgePause();
31 |
32 | void onBridgeStop();
33 |
34 | void onBridgeDestory();
35 |
36 | void onBridgeSaveInstanceState(Bundle outState);
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/presenter/IPagingPresenter.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.presenter;
2 |
3 | import android.view.ViewGroup;
4 |
5 | import org.aisen.wen.support.paging.IPaging;
6 | import org.aisen.wen.ui.model.IModel;
7 | import org.aisen.wen.ui.view.IPaingView;
8 |
9 | import java.io.Serializable;
10 |
11 | /**
12 | * Created by wangdan on 16/10/11.
13 | */
14 | public interface IPagingPresenter
- ,// Model
19 | View extends IPaingView
- >// View
20 | extends IContentPresenter {
21 |
22 | enum RefreshMode {
23 | /**
24 | * 重设数据
25 | */
26 | reset,
27 | /**
28 | * 上拉,加载更多
29 | */
30 | update,
31 | /**
32 | * 下拉,刷新最新
33 | */
34 | refresh
35 | }
36 |
37 | IPaging
- newPaging();
38 |
39 | IPaging
- getPaging();
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/presenter/IPresenter.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.presenter;
2 |
3 | import org.aisen.wen.ui.model.IModel;
4 | import org.aisen.wen.ui.view.IView;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * Created by wangdan on 16/10/9.
10 | */
11 | public interface IPresenter, PView extends IView> {
12 |
13 | /**
14 | * 请求数据
15 | *
16 | */
17 | void requestData();
18 |
19 | PModel getPModel();
20 |
21 | PView getPView();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/view/IContentView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.view;
2 |
3 | import android.view.View;
4 |
5 | import org.aisen.wen.ui.presenter.IContentPresenter;
6 | import org.aisen.wen.ui.presenter.ILifecycleBridge;
7 |
8 | /**
9 | * 控制4种基本视图的页面刷新
10 | *
11 | * Created by wangdan on 16/10/10.
12 | */
13 | public interface IContentView extends IView, ILifecycleBridge {
14 |
15 | View findViewById(int id);
16 |
17 | int setLayoutId();
18 |
19 | boolean isContentEmpty();
20 |
21 | void setContentLayout(boolean empty);
22 |
23 | View getLoadingLayout();
24 |
25 | View getEmptyLayout();
26 |
27 | View getContentLayout();
28 |
29 | View getFailureLayout();
30 |
31 | void setFailureHint(String hint);
32 |
33 | void setEmptyHind(String hint);
34 |
35 | void setPresenter(IContentPresenter presenter);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/library_wen/src/main/java/org/aisen/wen/ui/view/IView.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen.ui.view;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | /**
8 | * Created by wangdan on 16/9/30.
9 | */
10 | public interface IView {
11 |
12 | Activity getViewContext();
13 |
14 | void setViewContext(Activity context);
15 |
16 | View getContentView();
17 |
18 | void bindView(View contentView, Bundle savedInstanceState);
19 |
20 | void bindEvent(View contentView, Bundle savedInstanceState);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_lay_emptyview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
14 |
15 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_lay_footerview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
13 |
14 |
17 |
18 |
19 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_lay_loadfailed.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_lay_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_lay_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_fragment_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_gridview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
12 |
13 |
14 |
17 |
18 |
21 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_recycleview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
10 |
13 |
14 |
15 |
18 |
19 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_recycleview_swiperefresh.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
14 |
15 |
16 |
17 |
20 |
21 |
24 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/layout/comm_ui_tabs_tablayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
12 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_attrs.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 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #FFffffff
5 | #FF000000
6 | #FF888888
7 | #FF52A0DB
8 | #FFFF0000
9 | #00000000
10 |
11 | #ffffffff
12 |
13 | #44000000
14 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dip
4 | 16dip
5 | 10dip
6 | 10dip
7 |
8 |
9 | 58dip
10 |
11 |
14 | 320dp
15 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_exception.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 没有网络连接
4 | 数据解析出错
5 | 网络不给力
6 |
7 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_ids.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 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 正在加载...
5 | 加载更多
6 | 加载失败,重新加载
7 | 全部加载完了
8 | 刷新看看
9 | 数据为空
10 | 已经复制 %s
11 |
12 |
13 | - 0
14 | - 1
15 | - 2
16 | - 3
17 | - 4
18 | - 5
19 | - 6
20 | - 7
21 | - 8
22 | - 9
23 | - 10
24 | - 11
25 | - 12
26 | - 13
27 | - 14
28 | - 15
29 | - 16
30 |
31 |
32 |
--------------------------------------------------------------------------------
/library_wen/src/main/res/values/comm_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/library_wen/src/test/java/org/aisen/wen/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.aisen.wen;
2 |
3 | /**
4 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
5 | */
6 | public class ExampleUnitTest {
7 | }
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'android-apt'
3 |
4 | android {
5 | compileSdkVersion 24
6 | buildToolsVersion '24.0.2'
7 |
8 | defaultConfig {
9 | applicationId "org.aisen.sample"
10 | minSdkVersion 16
11 | targetSdkVersion 24
12 | versionCode 1
13 | versionName "1.0.0"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | compile fileTree(dir: 'libs', include: ['*.jar'])
25 | compile project(':library_wen')
26 | compile 'io.reactivex:rxandroid:1.2.1'
27 | compile 'io.reactivex:rxjava:1.1.6'
28 | compile 'com.jakewharton:butterknife:8.4.0'
29 | apt 'com.jakewharton:butterknife-compiler:8.4.0'
30 | }
--------------------------------------------------------------------------------
/sample/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 /Users/wangdan/software/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sample/src/androidTest/androidTest1.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/com/m/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.m;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/base/MyApplication.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.base;
2 |
3 | import android.app.Application;
4 |
5 | import org.aisen.wen.base.GlobalContext;
6 |
7 | /**
8 | * Created by wangdan on 15/4/23.
9 | */
10 | public class MyApplication extends Application {
11 |
12 | @Override
13 | public void onCreate() {
14 | super.onCreate();
15 |
16 | GlobalContext.onCreate(this);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/bean/BaseBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.bean;
2 |
3 | import org.aisen.wen.component.network.biz.IResult;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by wangdan on 15/4/24.
9 | */
10 | public class BaseBean implements IResult, Serializable {
11 |
12 | private static final long serialVersionUID = 5953570312045069353L;
13 |
14 | @Override
15 | public boolean outofdate() {
16 | return false;
17 | }
18 |
19 | @Override
20 | public boolean fromCache() {
21 | return false;
22 | }
23 |
24 | @Override
25 | public boolean endPaging() {
26 | return false;
27 | }
28 |
29 | @Override
30 | public String[] pagingIndex() {
31 | return new String[0];
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/bean/MenuBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | public class MenuBean implements Serializable {
6 |
7 | private static final long serialVersionUID = 6761310516837802125L;
8 |
9 | private int iconRes;
10 |
11 | private int titleRes;// ac的标题
12 |
13 | private int menuTitleRes; // 菜单的标题
14 |
15 | private String type;
16 |
17 | public MenuBean() {
18 |
19 | }
20 |
21 | public MenuBean(int iconRes, int menuRes, int titleRes, String type) {
22 | this.iconRes = iconRes;
23 | this.menuTitleRes = menuRes;
24 | this.titleRes = titleRes;
25 | this.type = type;
26 | }
27 |
28 | public int getIconRes() {
29 | return iconRes;
30 | }
31 |
32 | public void setIconRes(int iconRes) {
33 | this.iconRes = iconRes;
34 | }
35 |
36 | public int getTitleRes() {
37 | return titleRes;
38 | }
39 |
40 | public void setTitleRes(int titleRes) {
41 | this.titleRes = titleRes;
42 | }
43 |
44 | public String getType() {
45 | return type;
46 | }
47 |
48 | public void setType(String type) {
49 | this.type = type;
50 | }
51 |
52 | public int getMenuTitleRes() {
53 | return menuTitleRes;
54 | }
55 |
56 | public void setMenuTitleRes(int menuTitleRes) {
57 | this.menuTitleRes = menuTitleRes;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/bean/NeihanduanziBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by wangdan on 15/4/24.
7 | */
8 | public class NeihanduanziBean implements Serializable {
9 | }
10 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/bean/NeihanduanziBeans.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.bean;
2 |
3 | import org.aisen.sample.support.bean.BaseBean;
4 |
5 | /**
6 | * Created by wangdan on 15/4/24.
7 | */
8 | public class NeihanduanziBeans extends BaseBean {
9 | }
10 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/sdk/YoutubeSDK.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.sdk;
2 |
3 | import org.aisen.sample.support.sdk.bean.VideoStreamsBean;
4 | import org.aisen.wen.component.network.http.Params;
5 | import org.aisen.wen.component.network.setting.Setting;
6 | import org.aisen.wen.component.network.task.TaskException;
7 |
8 | /**
9 | * Youtube SDK
10 | *
11 | * Created by wangdan on 16/10/7.
12 | */
13 | public class YoutubeSDK extends BaseSDK {
14 |
15 | private YoutubeSDK() {
16 |
17 | }
18 |
19 | public static YoutubeSDK newInstance() {
20 | return new YoutubeSDK();
21 | }
22 |
23 | public VideoStreamsBean getVideoStreams(double maxBehotTime) throws TaskException {
24 | Setting action = newSetting("getVideoStreams", "/api/237/stream", "获取Video列表");
25 |
26 | Params params = new Params();
27 | if (maxBehotTime > 0D) {
28 | params.add("max_behot_time", Double.toString(maxBehotTime));
29 | }
30 | else {
31 | params.add("min_behot_time", Double.toString(System.currentTimeMillis() / 1000));
32 | }
33 | params.add("category", "13");
34 | params.add("category_parameter", "");
35 | params.add("count", "20");
36 |
37 | return doGet(action, basicParams(params), VideoStreamsBean.class);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/sdk/bean/VideoStreamBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.sdk.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by wangdan on 16/10/7.
7 | */
8 | public class VideoStreamBean implements Serializable {
9 |
10 | private static final long serialVersionUID = 7726941201737942601L;
11 |
12 | private String title;
13 |
14 | private long display_time;
15 |
16 | public String getTitle() {
17 | return title;
18 | }
19 |
20 | public void setTitle(String title) {
21 | this.title = title;
22 | }
23 |
24 | public long getDisplay_time() {
25 | return display_time;
26 | }
27 |
28 | public void setDisplay_time(long display_time) {
29 | this.display_time = display_time;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/sdk/bean/VideoStreamsBean.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.sdk.bean;
2 |
3 | import org.aisen.wen.support.bean.ResultBean;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by wangdan on 16/10/7.
10 | */
11 | public class VideoStreamsBean extends ResultBean implements Serializable {
12 |
13 | private static final long serialVersionUID = 5085818113047864156L;
14 |
15 | private int login_status;
16 |
17 | private int total_number;
18 |
19 | private boolean has_more;
20 |
21 | private String tip;
22 |
23 | private int duration;
24 |
25 | private List items;
26 |
27 | public int getLogin_status() {
28 | return login_status;
29 | }
30 |
31 | public void setLogin_status(int login_status) {
32 | this.login_status = login_status;
33 | }
34 |
35 | public int getTotal_number() {
36 | return total_number;
37 | }
38 |
39 | public void setTotal_number(int total_number) {
40 | this.total_number = total_number;
41 | }
42 |
43 | public boolean isHas_more() {
44 | return has_more;
45 | }
46 |
47 | public void setHas_more(boolean has_more) {
48 | this.has_more = has_more;
49 | }
50 |
51 | public String getTip() {
52 | return tip;
53 | }
54 |
55 | public void setTip(String tip) {
56 | this.tip = tip;
57 | }
58 |
59 | public int getDuration() {
60 | return duration;
61 | }
62 |
63 | public void setDuration(int duration) {
64 | this.duration = duration;
65 | }
66 |
67 | public List getItems() {
68 | return items;
69 | }
70 |
71 | public void setItems(List items) {
72 | this.items = items;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/support/utils/SystemBarUtils.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.support.utils;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.view.View;
7 | import android.view.Window;
8 | import android.view.WindowManager;
9 |
10 | /**
11 | * Created by wangdan on 15/8/19.
12 | */
13 | public class SystemBarUtils {
14 |
15 | public static void setStatusBar(Activity activity) {
16 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
17 | activity.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
18 | Window window = activity.getWindow();
19 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
20 | | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
21 | window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
22 | );//| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
23 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
24 | // window.setStatusBarColor(Utils.resolveColor(activity, R.attr.theme_statusbar_color, Color.BLUE));
25 | window.setStatusBarColor(Color.parseColor("#00000000"));
26 | // window.setNavigationBarColor(activity.getResources().getColor(ThemeUtils.themeColorArr[AppSettings.getThemeColor()][1]));
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/ui/fragment/BaseFragmentModel.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.ui.fragment;
2 |
3 | import org.aisen.sample.support.sdk.YoutubeSDK;
4 | import org.aisen.sample.support.sdk.bean.VideoStreamBean;
5 | import org.aisen.sample.support.sdk.bean.VideoStreamsBean;
6 | import org.aisen.wen.component.network.task.TaskException;
7 | import org.aisen.wen.support.paging.IPaging;
8 | import org.aisen.wen.ui.model.impl.APagingModel;
9 | import org.aisen.wen.ui.presenter.IPagingPresenter;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Created by wangdan on 16/10/13.
15 | */
16 | public class BaseFragmentModel extends APagingModel {
17 |
18 | @Override
19 | protected VideoStreamsBean workInBackground(IPagingPresenter.RefreshMode mode, IPaging paging) throws TaskException {
20 | return YoutubeSDK.newInstance().getVideoStreams(0l);
21 | }
22 |
23 | @Override
24 | public List parseResult(VideoStreamsBean videoStreamsBean) {
25 | return videoStreamsBean.getItems();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/ui/fragment/BaseFragmentSample.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.ui.fragment;
2 |
3 | import android.app.Fragment;
4 |
5 | import org.aisen.wen.ui.fragment.APresenterFragment;
6 | import org.aisen.wen.ui.model.IModel;
7 | import org.aisen.wen.ui.view.IContentView;
8 |
9 | /**
10 | * Created by wangdan on 15/4/23.
11 | */
12 | public class BaseFragmentSample extends APresenterFragment {
13 |
14 | public static Fragment newInstance() {
15 | return new BaseFragmentSample();
16 | }
17 |
18 | @Override
19 | protected IModel setPresenterModel() {
20 | return new BaseFragmentModel();
21 | }
22 |
23 | @Override
24 | protected IContentView setPresenterView() {
25 | return new BaseFragmentView();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/aisen/sample/ui/fragment/SwipeRefreshListFragment.java:
--------------------------------------------------------------------------------
1 | package org.aisen.sample.ui.fragment;
2 |
3 | /**
4 | * Created by wangdan on 15/4/24.
5 | */
6 | public class SwipeRefreshListFragment {
7 | // extends ARecycleViewSwipeRefreshFragment {
8 | //
9 | //
10 | // @Override
11 | // public IItemViewCreator configItemViewCreator() {
12 | // return null;
13 | // }
14 | //
15 | // @Override
16 | // public void requestData(RefreshMode mode) {
17 | //
18 | // }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/sample/src/main/main.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/sample/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/sample/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/sample/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/ic_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/sample/src/main/res/drawable-xxhdpi/ic_down.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdan/AisenForAndroid/5d5a8d0d26e4bde5d9817356257cc959c52364e8/sample/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/layout/comm_lay_spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/comm_lay_toolbar_spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/item_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/item_youtube.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/ui_a_base.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
13 |
14 |
17 |
18 |
19 |
20 |
22 |
23 |
26 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-v19/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/values-v21/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
13 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | AisenSample
4 |
5 | 打开
6 | 关闭
7 |
8 | ABaseFragment
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
20 |
22 |
23 |
25 |
26 |
29 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':sample', ':library', ':library_wen', ':sinaweibo'
2 |
--------------------------------------------------------------------------------