├── MyApplication ├── .gitignore ├── .idea │ ├── caches │ │ └── build_file_checksums.ser │ ├── codeStyles │ │ └── Project.xml │ ├── gradle.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── john │ │ │ └── myapplication │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── john │ │ │ │ └── myapplication │ │ │ │ ├── Bean │ │ │ │ ├── Category.java │ │ │ │ ├── RefreshModel.java │ │ │ │ └── User.kt │ │ │ │ ├── MyConstants.java │ │ │ │ ├── activity │ │ │ │ ├── DatabindingListViewActivity.java │ │ │ │ ├── DatabindingRecyclerActivity.java │ │ │ │ ├── GoogleVRActivity.java │ │ │ │ ├── KotlinAndDataBindingActivity.kt │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── OpenGlActivity.java │ │ │ │ ├── RecycleViewRefreshActivity.java │ │ │ │ ├── StepViewActivity.java │ │ │ │ └── WebViewActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── DataBindingListViewAdapter.java │ │ │ │ ├── DatabindingRecycleViewAdapter.java │ │ │ │ ├── RecyclerRefreshViewAdapter.java │ │ │ │ └── SimpleRecucleAdapter.java │ │ │ │ └── application │ │ │ │ └── MyApplication.java │ │ └── res │ │ │ ├── anim │ │ │ ├── anim_rotate.xml │ │ │ ├── fade_in.xml │ │ │ ├── fade_out.xml │ │ │ ├── pop_btn_in.xml │ │ │ ├── pop_btn_in2.xml │ │ │ ├── popupwindow_in.xml │ │ │ └── popupwindow_out.xml │ │ │ ├── drawable │ │ │ ├── andes.jpg │ │ │ ├── ic_action_accept.png │ │ │ ├── ic_action_cancel.png │ │ │ ├── imgbug.jpg │ │ │ ├── imggugong.jpg │ │ │ ├── selector_btn_red.xml │ │ │ └── selector_item.xml │ │ │ ├── layout │ │ │ ├── activity_databinding.xml │ │ │ ├── activity_databinding_recycler.xml │ │ │ ├── activity_google_vr.xml │ │ │ ├── activity_issue_selector.xml │ │ │ ├── activity_issue_selector2.xml │ │ │ ├── activity_listview_databinding.xml │ │ │ ├── activity_login.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_open_gl.xml │ │ │ ├── activity_recycle_refresh.xml │ │ │ ├── activity_step_view.xml │ │ │ ├── activity_web_view.xml │ │ │ ├── fabu_popwindow_layout.xml │ │ │ ├── item_databinding.xml │ │ │ ├── item_databinding_2.xml │ │ │ ├── item_listview.xml │ │ │ ├── item_normal.xml │ │ │ └── view_custom_header.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── bga_refresh_stickiness.png │ │ │ ├── fabu.png │ │ │ ├── fabuquxiao.png │ │ │ ├── holder.png │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── info.jpg │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ ├── s11.jpg │ │ │ └── s12.jpg │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── john │ │ └── myapplication │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── librarys │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── john │ │ │ └── librarys │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── john │ │ │ │ └── librarys │ │ │ │ ├── databinding │ │ │ │ └── adapter │ │ │ │ │ ├── DataBindingListAdapter.java │ │ │ │ │ ├── DataBindingPagerAdapter.java │ │ │ │ │ ├── DataBindingRecyclerAdapter.java │ │ │ │ │ └── ListRecyclerAdapter.java │ │ │ │ ├── floatwindow │ │ │ │ ├── FloatWindowService.java │ │ │ │ ├── FloatWindowSmallView.java │ │ │ │ └── MyWindowManager.java │ │ │ │ ├── net │ │ │ │ ├── Constants.java │ │ │ │ ├── core │ │ │ │ │ ├── ApiCallback.java │ │ │ │ │ ├── ApiClient.java │ │ │ │ │ ├── ApiHelper.java │ │ │ │ │ ├── ApiHttpClient.java │ │ │ │ │ ├── ApiJsonModelCallback.java │ │ │ │ │ ├── CountingRequestBody.java │ │ │ │ │ └── OkHttpStack.java │ │ │ │ └── interf │ │ │ │ │ ├── Callback.java │ │ │ │ │ ├── ProgressCallback.java │ │ │ │ │ └── ServiceTask.java │ │ │ │ ├── pulltorefresh │ │ │ │ ├── ILoadingLayout.java │ │ │ │ ├── IPullToRefresh.java │ │ │ │ ├── LoadingLayoutProxy.java │ │ │ │ ├── OverscrollHelper.java │ │ │ │ ├── PullToRefreshAdapterViewBase.java │ │ │ │ ├── PullToRefreshBase.java │ │ │ │ ├── PullToRefreshExpandableListView.java │ │ │ │ ├── PullToRefreshFrameLayout.java │ │ │ │ ├── PullToRefreshGridView.java │ │ │ │ ├── PullToRefreshHorizontalScrollView.java │ │ │ │ ├── PullToRefreshListView.java │ │ │ │ ├── PullToRefreshScrollView.java │ │ │ │ ├── PullToRefreshWebView.java │ │ │ │ ├── extras │ │ │ │ │ ├── PullToRefreshWebView2.java │ │ │ │ │ └── SoundPullEventListener.java │ │ │ │ └── internal │ │ │ │ │ ├── EmptyViewMethodAccessor.java │ │ │ │ │ ├── FlipLoadingLayout.java │ │ │ │ │ ├── IndicatorLayout.java │ │ │ │ │ ├── LoadingLayout.java │ │ │ │ │ ├── RotateLoadingLayout.java │ │ │ │ │ ├── Utils.java │ │ │ │ │ └── ViewCompat.java │ │ │ │ ├── uikit │ │ │ │ ├── Tagcloudlayout │ │ │ │ │ ├── TagBaseAdapter.java │ │ │ │ │ ├── TagCloudConfiguration.java │ │ │ │ │ └── TagCloudLayout.java │ │ │ │ ├── activity │ │ │ │ │ └── BaseActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── CheckableListAdapter.java │ │ │ │ │ ├── DynamicListAdapter.java │ │ │ │ │ ├── DynamicListDataSet.java │ │ │ │ │ ├── DynamicPagerAdapter.java │ │ │ │ │ ├── LoopViewPagerAdapter.java │ │ │ │ │ └── baseadapter │ │ │ │ │ │ ├── MyBaseAdapterViewAdapter.java │ │ │ │ │ │ ├── MyBaseAdapterViewHolder.java │ │ │ │ │ │ ├── MyBaseBindingRecyclerViewAdapter.java │ │ │ │ │ │ ├── MyBaseBindingViewHolder.java │ │ │ │ │ │ ├── MyBaseHeaderAndFooterAdapter.java │ │ │ │ │ │ ├── MyBaseOnItemChildCheckedChangeListener.java │ │ │ │ │ │ ├── MyBaseOnItemChildClickListener.java │ │ │ │ │ │ ├── MyBaseOnItemChildLongClickListener.java │ │ │ │ │ │ ├── MyBaseOnNoDoubleClickListener.java │ │ │ │ │ │ ├── MyBaseOnRVItemChildTouchListener.java │ │ │ │ │ │ ├── MyBaseOnRVItemClickListener.java │ │ │ │ │ │ ├── MyBaseOnRVItemLongClickListener.java │ │ │ │ │ │ ├── MyBaseRecyclerViewAdapter.java │ │ │ │ │ │ ├── MyBaseRecyclerViewHolder.java │ │ │ │ │ │ ├── MyBaseViewBindingAdapter.java │ │ │ │ │ │ └── MyBaseViewHolderHelper.java │ │ │ │ ├── dialog │ │ │ │ │ ├── BaseDialogFragment.java │ │ │ │ │ ├── CustomDateTimePickerDialog.java │ │ │ │ │ └── LoadingDialogFragment.java │ │ │ │ ├── entity │ │ │ │ │ └── PageResult.java │ │ │ │ ├── fragment │ │ │ │ │ ├── BaseFragment.java │ │ │ │ │ ├── PullToRefreshDetailFragment.java │ │ │ │ │ ├── PullToRefreshListFragment.java │ │ │ │ │ └── PullToRefreshPageFragment.java │ │ │ │ ├── helper │ │ │ │ │ ├── MessageHelper.java │ │ │ │ │ ├── PullToRefreshHelper.java │ │ │ │ │ └── PullToRefreshPageHelper.java │ │ │ │ ├── waveswiperefreshlayout │ │ │ │ │ ├── AnimationImageView.java │ │ │ │ │ ├── DisplayUtil.java │ │ │ │ │ ├── DropBounceInterpolator.java │ │ │ │ │ ├── MaterialProgressDrawable.java │ │ │ │ │ ├── WaveSwipeRefreshLayout.java │ │ │ │ │ └── WaveView.java │ │ │ │ └── widget │ │ │ │ │ ├── AlbumContentView.java │ │ │ │ │ ├── AlbumPicView.java │ │ │ │ │ ├── AlbumView.java │ │ │ │ │ ├── AlbumViewPager.java │ │ │ │ │ ├── AlbumViewPagerAdapter.java │ │ │ │ │ ├── AlumPicProgressBarDrawable.java │ │ │ │ │ ├── AutoHeightGridView.java │ │ │ │ │ ├── AutoHeightListView.java │ │ │ │ │ ├── AutoRadioGroup.java │ │ │ │ │ ├── BadgeItemView.java │ │ │ │ │ ├── BadgeView.java │ │ │ │ │ ├── CheckableLayout.java │ │ │ │ │ ├── CircleIndicator.java │ │ │ │ │ ├── CountDownView.java │ │ │ │ │ ├── Divider.java │ │ │ │ │ ├── DraweeView.java │ │ │ │ │ ├── EditTextWithDel.java │ │ │ │ │ ├── FlowLayout.java │ │ │ │ │ ├── LoopCircleIndicator.java │ │ │ │ │ ├── LoopViewPager.java │ │ │ │ │ ├── MyCatLoadingView.java │ │ │ │ │ ├── NavIconView.java │ │ │ │ │ ├── NavLayout.java │ │ │ │ │ ├── NumberPicker.java │ │ │ │ │ ├── PullToRefreshXGridView.java │ │ │ │ │ ├── SlideView.java │ │ │ │ │ ├── SquareFrameLayout.java │ │ │ │ │ ├── TopBar.java │ │ │ │ │ ├── WrapContentLinearLayoutManager.java │ │ │ │ │ ├── XGridView.java │ │ │ │ │ └── ZoomImageView.java │ │ │ │ └── utils │ │ │ │ ├── Constants.java │ │ │ │ ├── ContextManager.java │ │ │ │ ├── annotation │ │ │ │ └── RequireLogin.java │ │ │ │ ├── dispatcher │ │ │ │ ├── AbsLoginDispatcher.java │ │ │ │ └── IntentDispatcher.java │ │ │ │ ├── download │ │ │ │ ├── DownloadHelper.java │ │ │ │ ├── DownloadInfo.java │ │ │ │ └── DownloadListener.java │ │ │ │ ├── permissions │ │ │ │ ├── Permissions.java │ │ │ │ ├── PermissionsHelper.java │ │ │ │ ├── PermissionsManager.java │ │ │ │ ├── PermissionsResultAction.java │ │ │ │ └── RequestPermissionsComponent.java │ │ │ │ └── util │ │ │ │ ├── ACache.java │ │ │ │ ├── AlertUtils.java │ │ │ │ ├── AnimatorProxy.java │ │ │ │ ├── ApkUpgradeHelper.java │ │ │ │ ├── AppHelper.java │ │ │ │ ├── BeanHelper.java │ │ │ │ ├── BitmapHelper.java │ │ │ │ ├── ClassUtil.java │ │ │ │ ├── ClipboardHelper.java │ │ │ │ ├── CrashHandler.java │ │ │ │ ├── DateHelper.java │ │ │ │ ├── DateUtil.java │ │ │ │ ├── ExitHelper.java │ │ │ │ ├── FileUtil.java │ │ │ │ ├── GsonHelper.java │ │ │ │ ├── ImageHelper.java │ │ │ │ ├── LogFileEngineFactory.java │ │ │ │ ├── LogUtilHelper.java │ │ │ │ ├── MarketUtils.java │ │ │ │ ├── MediaHelper.java │ │ │ │ ├── NetworkHelper.java │ │ │ │ ├── PackageHelper.java │ │ │ │ ├── PrefUtils.java │ │ │ │ ├── SDCardUtil.java │ │ │ │ ├── UrlHelper.java │ │ │ │ ├── UtilStorage.java │ │ │ │ ├── VerifyStrHelper.java │ │ │ │ └── ViewHelper.java │ │ └── res │ │ │ ├── anim │ │ │ ├── anim_none.xml │ │ │ ├── marquee_in.xml │ │ │ ├── marquee_out.xml │ │ │ ├── push_bottom_in.xml │ │ │ ├── push_bottom_out.xml │ │ │ ├── push_top_in.xml │ │ │ ├── push_top_out.xml │ │ │ ├── slide_in_from_bottom.xml │ │ │ ├── slide_in_from_top.xml │ │ │ ├── slide_out_to_bottom.xml │ │ │ ├── slide_out_to_top.xml │ │ │ ├── toast_enter.xml │ │ │ ├── toast_exit.xml │ │ │ └── trans_center_2_right.xml │ │ │ ├── animator │ │ │ └── scale_with_alpha.xml │ │ │ ├── drawable-hdpi │ │ │ ├── default_ptr_flip.png │ │ │ ├── default_ptr_rotate.png │ │ │ ├── dialog_left_btn_selector.xml │ │ │ ├── dialog_one_btn_selector.xml │ │ │ ├── dialog_right_btn_selector.xml │ │ │ ├── gaps_line.png │ │ │ ├── indicator_arrow.png │ │ │ ├── input_guest_num_bg.png │ │ │ └── white_shape_h20.xml │ │ │ ├── drawable-mdpi │ │ │ ├── default_ptr_flip.png │ │ │ ├── default_ptr_rotate.png │ │ │ └── indicator_arrow.png │ │ │ ├── drawable-xhdpi │ │ │ ├── default_ptr_flip.png │ │ │ ├── default_ptr_rotate.png │ │ │ └── indicator_arrow.png │ │ │ ├── drawable │ │ │ ├── bg_weiget_number_picker.xml │ │ │ ├── bg_weiget_number_picker_value.xml │ │ │ ├── indicator_bg_bottom.xml │ │ │ ├── indicator_bg_top.xml │ │ │ ├── shape_bakeground_loadingdialog.xml │ │ │ ├── tag_view.xml │ │ │ ├── toast_frame.9.png │ │ │ ├── topbar_bg.xml │ │ │ └── white_radius.xml │ │ │ ├── layout │ │ │ ├── activity_content_fragment.xml │ │ │ ├── base_dialog_layout.xml │ │ │ ├── dialog_custom_datetimepicker.xml │ │ │ ├── dialog_loading.xml │ │ │ ├── float_window_small.xml │ │ │ ├── fragment_web.xml │ │ │ ├── item_album_pic.xml │ │ │ ├── item_databinding_dummy.xml │ │ │ ├── navicon.xml │ │ │ ├── num_input_pop_layout.xml │ │ │ ├── pull_to_refresh_header_horizontal.xml │ │ │ ├── pull_to_refresh_header_vertical.xml │ │ │ ├── tagview.xml │ │ │ ├── top_bar.xml │ │ │ ├── transient_notification.xml │ │ │ ├── widget_album.xml │ │ │ ├── widget_badgeitemview.xml │ │ │ ├── widget_number_picker.xml │ │ │ └── widget_slideview.xml │ │ │ ├── mipmap-xhdpi │ │ │ ├── bg_num.png │ │ │ ├── icon_delete.png │ │ │ ├── icon_delete_blue.png │ │ │ ├── icon_delete_white.png │ │ │ ├── icon_num_add.png │ │ │ ├── icon_num_del.png │ │ │ ├── list_divider.png │ │ │ ├── top_bar_btn_back.png │ │ │ ├── top_bar_btn_back_dark.png │ │ │ ├── top_bar_btn_message.png │ │ │ ├── widget_number_picker_btn_next.png │ │ │ ├── widget_number_picker_btn_next_orange.png │ │ │ ├── widget_number_picker_btn_pre.png │ │ │ └── widget_number_picker_btn_pre_orange.png │ │ │ ├── values-ar │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-cs │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-de │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-en │ │ │ └── strings.xml │ │ │ ├── values-es │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-fi │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-fr │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-he │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-it │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-iw │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-ja │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-ko │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-nl │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-pl │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-pt-rBR │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-pt │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-ro │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-ru │ │ │ └── pull_refresh_strings.xml │ │ │ ├── values-zh │ │ │ └── pull_refresh_strings.xml │ │ │ └── values │ │ │ ├── attrs.xml │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── ids.xml │ │ │ ├── pull_refresh_strings.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── john │ │ └── librarys │ │ └── ExampleUnitTest.java └── settings.gradle └── README.md /MyApplication/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /MyApplication/.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /MyApplication/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /MyApplication/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /MyApplication/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /MyApplication/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | -------------------------------------------------------------------------------- /MyApplication/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /MyApplication/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /MyApplication/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MyApplication/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /MyApplication/app/src/androidTest/java/com/john/myapplication/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.john.myapplication", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/Bean/RefreshModel.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.Bean; 2 | 3 | /** 4 | * 刷新数据实体: 5 | */ 6 | public class RefreshModel { 7 | public String title; 8 | public String detail; 9 | 10 | public RefreshModel() { 11 | } 12 | 13 | public RefreshModel(String title, String detail) { 14 | this.title = title; 15 | this.detail = detail; 16 | } 17 | } -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/Bean/User.kt: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.Bean 2 | 3 | /** 4 | * Created by guqh on 2017/8/2. 5 | */ 6 | class User { 7 | var name : String="" 8 | var photo : String="" 9 | } -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/MyConstants.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication; 2 | 3 | /** 4 | * @author John Gu 5 | * @date 2017/11/23. 6 | * 7 | * 常量类 8 | */ 9 | 10 | public class MyConstants { 11 | 12 | public static final String EXTRA_URL ="url" ; 13 | } 14 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/activity/KotlinAndDataBindingActivity.kt: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.activity 2 | 3 | import android.databinding.DataBindingUtil 4 | import com.john.librarys.uikit.activity.BaseActivity 5 | import com.john.myapplication.Bean.User 6 | import com.john.myapplication.R 7 | import com.john.myapplication.databinding.ActivityDatabindingBinding 8 | 9 | /** 10 | * Created by guqh on 2017/8/2. 11 | 12 | * databinding activty 实例 13 | */ 14 | 15 | class KotlinAndDataBindingActivity : BaseActivity() { 16 | 17 | override fun setBindingContentView() { 18 | val binding : ActivityDatabindingBinding = DataBindingUtil.setContentView(this, R.layout.activity_databinding) 19 | val mUser:User = User() 20 | mUser.name="这是User_Name" 21 | mUser.photo="http://wx.zshisong.com:8085/imgServer/upload/pic/02f3b3322a844014923453e95806f8a2.jpg" 22 | binding.mUser=mUser 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/activity/OpenGlActivity.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.MotionEvent; 5 | import android.view.View; 6 | import android.widget.Toast; 7 | 8 | import com.john.librarys.uikit.activity.BaseActivity; 9 | import com.john.myapplication.R; 10 | import com.zph.glpanorama.GLPanorama; 11 | 12 | import butterknife.Bind; 13 | import butterknife.ButterKnife; 14 | 15 | /** 16 | * @author John Gu 17 | * @date 2017/11/23. 18 | * open GL 全景图像 19 | */ 20 | 21 | public class OpenGlActivity extends BaseActivity{ 22 | 23 | @Bind(R.id.mGLPanorama) 24 | GLPanorama mGLPanorama; 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_open_gl); 29 | ButterKnife.bind(this); 30 | //传入全景图片 31 | mGLPanorama.setGLPanorama(R.drawable.imgbug); 32 | // mGLPanorama.setOnTouchListener(new View.OnTouchListener() { 33 | // @Override 34 | // public boolean onTouch(View view, MotionEvent motionEvent) { 35 | // Toast.makeText(mContext,"点了X"+ motionEvent.getX()+ "Y"+ motionEvent.getY(),Toast.LENGTH_LONG).show(); 36 | // return false; 37 | // } 38 | // }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/adapter/DataBindingListViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.adapter; 2 | 3 | import android.content.Context; 4 | import android.databinding.ViewDataBinding; 5 | import android.view.LayoutInflater; 6 | import android.view.ViewGroup; 7 | 8 | import com.john.librarys.databinding.adapter.DataBindingListAdapter; 9 | import com.john.myapplication.databinding.ItemListviewBinding; 10 | import com.zhy.autolayout.utils.AutoUtils; 11 | 12 | /** 13 | * Created by guqh on 2017/8/3. 14 | */ 15 | 16 | public class DataBindingListViewAdapter extends DataBindingListAdapter { 17 | public DataBindingListViewAdapter(Context context) { 18 | super(context); 19 | } 20 | 21 | @Override 22 | public ViewHolder onCreateViewHolder(int position, ViewGroup parent) { 23 | ItemListviewBinding binding=ItemListviewBinding.inflate(LayoutInflater.from(getContext()),parent,false); 24 | AutoUtils.autoSize(binding.getRoot()); 25 | return new ViewHolder(binding); 26 | } 27 | 28 | @Override 29 | public void onBind(ViewHolder holder, int position, ViewDataBinding binding) { 30 | ItemListviewBinding dataBinding= (ItemListviewBinding) binding; 31 | dataBinding.setData(getItem(position)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/adapter/DatabindingRecycleViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.adapter; 2 | 3 | import android.content.Context; 4 | import android.databinding.ViewDataBinding; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.john.librarys.databinding.adapter.DataBindingRecyclerAdapter; 10 | import com.john.myapplication.BR; 11 | import com.john.myapplication.databinding.ItemDatabindingBinding; 12 | import com.zhy.autolayout.utils.AutoUtils; 13 | 14 | /** 15 | * Created by guqh on 2017/8/2. 16 | * databinding RecycleAdapter 17 | */ 18 | 19 | public class DatabindingRecycleViewAdapter extends DataBindingRecyclerAdapter { 20 | 21 | public DatabindingRecycleViewAdapter(Context context) { 22 | super(context); 23 | } 24 | 25 | 26 | @Override 27 | protected RecyclerView.ViewHolder onCreateDataBindingViewHolder(ViewGroup parent, int viewType) { 28 | ItemDatabindingBinding binding = ItemDatabindingBinding.inflate(LayoutInflater.from(getContext()), parent, false); 29 | AutoUtils.autoSize(binding.getRoot()); //自动适配 30 | return new ViewHolder(binding); 31 | } 32 | @Override 33 | protected void onBinding(RecyclerView.ViewHolder holder, int position) { 34 | ViewHolder mHolder= (ViewHolder) holder; 35 | mHolder.bindData(getItem(position)); 36 | } 37 | 38 | static class ViewHolder extends RecyclerView.ViewHolder { 39 | ViewDataBinding binding; 40 | public ViewHolder(ViewDataBinding binding) { 41 | super(binding.getRoot()); 42 | this.binding=binding; 43 | } 44 | public void bindData(String item){ 45 | binding.setVariable(BR.str,item); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/adapter/RecyclerRefreshViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.adapter; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import com.john.librarys.uikit.adapter.baseadapter.MyBaseRecyclerViewAdapter; 5 | import com.john.librarys.uikit.adapter.baseadapter.MyBaseViewHolderHelper; 6 | import com.john.myapplication.Bean.RefreshModel; 7 | import com.john.myapplication.R; 8 | 9 | /** 10 | * @author John Gu 11 | * @date 2017/11/24. 12 | */ 13 | 14 | public class RecyclerRefreshViewAdapter extends MyBaseRecyclerViewAdapter { 15 | 16 | public RecyclerRefreshViewAdapter(RecyclerView recyclerView) { 17 | super(recyclerView, R.layout.item_normal); 18 | } 19 | 20 | @Override 21 | protected void fillData(MyBaseViewHolderHelper helper, int position, RefreshModel model) { 22 | helper.setText(R.id.tv_item_normal_title, model.title).setText(R.id.tv_item_normal_detail, model.detail); 23 | } 24 | 25 | @Override 26 | protected void setItemChildListener(MyBaseViewHolderHelper helper, int viewType) { 27 | helper.setItemChildClickListener(R.id.tv_item_normal_delete); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/adapter/SimpleRecucleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import com.john.librarys.databinding.adapter.ListRecyclerAdapter; 10 | import com.john.librarys.uikit.widget.DraweeView; 11 | import com.john.myapplication.R; 12 | import com.zhy.autolayout.utils.AutoUtils; 13 | 14 | /** 15 | * Created by guqh on 2017/8/3. 16 | * 普通 RecycleAdapter 17 | */ 18 | 19 | public class SimpleRecucleAdapter extends ListRecyclerAdapter { 20 | 21 | public SimpleRecucleAdapter(Context context) { 22 | super(context); 23 | } 24 | 25 | @Override 26 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 27 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_databinding_2, parent, false); 28 | AutoUtils.autoSize(view); 29 | return new SimpleViewHolder(view); 30 | } 31 | 32 | @Override 33 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { 34 | SimpleViewHolder mholder= (SimpleViewHolder) holder; 35 | mholder.dv.setUrl(getItem(position).toString()); 36 | } 37 | 38 | class SimpleViewHolder extends RecyclerView.ViewHolder{ 39 | public DraweeView dv; 40 | 41 | public SimpleViewHolder(View itemView) { 42 | super(itemView); 43 | dv=itemView.findViewById(R.id.dv); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/john/myapplication/application/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication.application; 2 | 3 | import android.app.Application; 4 | 5 | import com.activeandroid.ActiveAndroid; 6 | import com.apkfuns.logutils.LogUtils; 7 | import com.facebook.drawee.backends.pipeline.Fresco; 8 | import com.john.librarys.net.core.ApiHttpClient; 9 | import com.john.librarys.utils.util.CrashHandler; 10 | import com.john.librarys.utils.util.DialogHelper; 11 | import com.john.myapplication.R; 12 | import com.zhy.autolayout.config.AutoLayoutConifg; 13 | 14 | /** 15 | * Created by guqh on 2017/7/s12. 16 | */ 17 | 18 | public class MyApplication extends Application { 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | 23 | LogUtils.getLogConfig() 24 | .configAllowLog(true) 25 | .configShowBorders(true); //初始化log打印 26 | 27 | CrashHandler.getInstance().init(this,getResources().getString(R.string.app_name)); //初始化异常捕获 28 | 29 | AutoLayoutConifg.getInstance().useDeviceSize(); //初始化自动适配 30 | 31 | Fresco.initialize(this);//初始化图片加载库 32 | 33 | ApiHttpClient.init(this); //初始化网络请求 34 | 35 | ActiveAndroid.initialize(this);//初始化数据库工具 36 | } 37 | @Override 38 | public void onTerminate() { 39 | super.onTerminate(); 40 | ActiveAndroid.dispose(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/anim_rotate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/fade_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/fade_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/pop_btn_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/pop_btn_in2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/popupwindow_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/anim/popupwindow_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/andes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/drawable/andes.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/ic_action_accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/drawable/ic_action_accept.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/ic_action_cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/drawable/ic_action_cancel.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/imgbug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/drawable/imgbug.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/imggugong.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/drawable/imggugong.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/selector_btn_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/drawable/selector_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_databinding.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | 17 | 18 | 25 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_databinding_recycler.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 23 | 28 | 29 | 35 | /> 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_google_vr.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_issue_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_issue_selector2.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 25 | 26 | 38 | 39 | 40 | 41 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_listview_databinding.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_open_gl.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_recycle_refresh.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_step_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_web_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/fabu_popwindow_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 26 | 27 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | 54 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/item_databinding.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/item_databinding_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/item_listview.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 19 | 20 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/item_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 25 | 26 | 39 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/view_custom_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/bga_refresh_stickiness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/bga_refresh_stickiness.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/fabu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/fabu.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/fabuquxiao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/fabuquxiao.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/holder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/holder.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/info.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-hdpi/info.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-mdpi/s11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-mdpi/s11.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-mdpi/s12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-mdpi/s12.jpg -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #90000000 8 | 9 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | My Application 3 | 4 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MyApplication/app/src/test/java/com/john/myapplication/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.john.myapplication; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MyApplication/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.1.2-3' 5 | ext.android_plugin_version = '2.3.2' 6 | repositories { 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:2.3.3' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /MyApplication/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /MyApplication/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MyApplication/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jul 12 09:30:23 GMT+08:00 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MyApplication/librarys/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 C:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/androidTest/java/com/john/librarys/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.john.librarys.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/databinding/adapter/DataBindingListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.databinding.adapter; 2 | 3 | 4 | import android.content.Context; 5 | import android.databinding.ViewDataBinding; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | 10 | import com.john.librarys.R; 11 | import com.john.librarys.uikit.adapter.DynamicListAdapter; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 数据绑定 listAdapter
17 | * 配合 DataBinding使用 18 | * @param 19 | */ 20 | public abstract class DataBindingListAdapter extends DynamicListAdapter { 21 | 22 | public DataBindingListAdapter(Context context) { 23 | super(context); 24 | } 25 | 26 | public DataBindingListAdapter(Context context, List data) { 27 | super(context, data); 28 | } 29 | 30 | @Override 31 | public View getView(int position, View convertView, ViewGroup parent) { 32 | ViewHolder holder = null; 33 | if(convertView == null){ 34 | holder = onCreateViewHolder(position,parent); 35 | convertView = holder.getView(); 36 | convertView.setTag(R.id.dataBindingViewHolder,holder); 37 | }else{ 38 | holder = (ViewHolder)convertView.getTag(R.id.dataBindingViewHolder); 39 | } 40 | onBind(holder,position,holder.getBinding()); 41 | return holder.getView(); 42 | } 43 | 44 | /** 45 | * 创建viewholder 46 | * @param position 47 | * @param parent 48 | * @return 49 | */ 50 | public abstract ViewHolder onCreateViewHolder(int position, ViewGroup parent); 51 | 52 | /** 53 | * 绑定数据 54 | * @param holder 55 | * @param position 56 | * @param binding 57 | */ 58 | public abstract void onBind(ViewHolder holder,int position,ViewDataBinding binding); 59 | 60 | /** 61 | * 绑定用holder 62 | */ 63 | public static class ViewHolder{ 64 | private View mRootView; 65 | private ViewDataBinding mViewDataBinding; 66 | 67 | public ViewHolder(ViewDataBinding binding){ 68 | mViewDataBinding = binding; 69 | mRootView = binding.getRoot(); 70 | } 71 | 72 | public View getView(){ 73 | return mRootView; 74 | } 75 | 76 | public ViewDataBinding getBinding() { 77 | return mViewDataBinding; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/databinding/adapter/DataBindingPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.databinding.adapter; 2 | 3 | 4 | import android.content.Context; 5 | import android.databinding.ViewDataBinding; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | 10 | import com.john.librarys.uikit.adapter.DynamicPagerAdapter; 11 | 12 | import java.util.Collection; 13 | 14 | /** 15 | * 数据绑定 listAdapter
16 | * 配合 DataBinding使用 17 | * 18 | * @param 19 | */ 20 | public abstract class DataBindingPagerAdapter extends DynamicPagerAdapter { 21 | 22 | 23 | public DataBindingPagerAdapter(Context context) { 24 | super(context); 25 | } 26 | 27 | public DataBindingPagerAdapter(Context context, Collection data) { 28 | super(context, data); 29 | } 30 | 31 | @Override 32 | public View instantiateView(ViewGroup container, int position) { 33 | ViewHolder viewHolder = onCreateViewHolder(position, container); 34 | onBind(viewHolder, position, viewHolder.getBinding()); 35 | return viewHolder.getView(); 36 | } 37 | 38 | /** 39 | * 创建viewholder 40 | * 此方法内生成viewhoder 生成view的时候 不要 把view 附加到 parent中 41 | * 42 | * @param position 43 | * @param parent 44 | * @return 45 | */ 46 | public abstract ViewHolder onCreateViewHolder(int position, ViewGroup parent); 47 | 48 | /** 49 | * 绑定数据 50 | * 51 | * @param holder 52 | * @param position 53 | * @param binding 54 | */ 55 | public abstract void onBind(ViewHolder holder, int position, ViewDataBinding binding); 56 | 57 | /** 58 | * 绑定用holder 59 | */ 60 | public static class ViewHolder { 61 | private View mRootView; 62 | private ViewDataBinding mViewDataBinding; 63 | 64 | public ViewHolder(ViewDataBinding binding) { 65 | mViewDataBinding = binding; 66 | mRootView = binding.getRoot(); 67 | } 68 | 69 | public View getView() { 70 | return mRootView; 71 | } 72 | 73 | public ViewDataBinding getBinding() { 74 | return mViewDataBinding; 75 | } 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/databinding/adapter/DataBindingRecyclerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.databinding.adapter; 2 | 3 | 4 | import android.content.Context; 5 | import android.databinding.ViewDataBinding; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.support.v7.widget.RecyclerView.ViewHolder; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * RecyclerAdapter
15 | * 配合 DataBinding使用 16 | * 17 | * @param 18 | */ 19 | public abstract class DataBindingRecyclerAdapter extends ListRecyclerAdapter { 20 | 21 | public DataBindingRecyclerAdapter(Context context) { 22 | super(context); 23 | } 24 | 25 | public DataBindingRecyclerAdapter(Context context, List items) { 26 | super(context, items); 27 | } 28 | 29 | @Override 30 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 31 | ViewHolder holder = onCreateDataBindingViewHolder(parent, viewType); 32 | return holder; 33 | } 34 | 35 | @Override 36 | public void onBindViewHolder(ViewHolder holder, int position) { 37 | onBinding(holder, position); 38 | } 39 | 40 | /** 41 | * 数据绑定动作 42 | * 43 | * @param holder 44 | * @param position 45 | */ 46 | protected abstract void onBinding(ViewHolder holder, int position); 47 | 48 | /** 49 | * 创建 databinding ViewHolder 50 | * 51 | * @param parent 52 | * @param viewType 53 | * @return 54 | */ 55 | protected abstract ViewHolder onCreateDataBindingViewHolder(ViewGroup parent, int viewType); 56 | } 57 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/floatwindow/FloatWindowSmallView.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.floatwindow; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.WindowManager; 7 | import android.widget.LinearLayout; 8 | 9 | import com.john.librarys.R; 10 | 11 | 12 | public class FloatWindowSmallView extends LinearLayout { 13 | 14 | /** 15 | * 记录小悬浮窗的宽度 16 | */ 17 | public static int viewWidth; 18 | 19 | /** 20 | * 记录小悬浮窗的高度 21 | */ 22 | public static int viewHeight; 23 | 24 | 25 | 26 | /** 27 | * 小悬浮窗的参数 28 | */ 29 | private WindowManager.LayoutParams mParams; 30 | 31 | 32 | public FloatWindowSmallView(Context context) { 33 | super(context); 34 | LayoutInflater.from(context).inflate(R.layout.float_window_small, this); 35 | View view = findViewById(R.id.small_window_layout); 36 | viewWidth = view.getLayoutParams().width; 37 | viewHeight = view.getLayoutParams().height; 38 | } 39 | 40 | /** 41 | * 将小悬浮窗的参数传入,用于更新小悬浮窗的位置。 42 | * 43 | * @param params 44 | * 小悬浮窗的参数 45 | */ 46 | public void setParams(WindowManager.LayoutParams params) { 47 | mParams = params; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/Constants.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net; 2 | 3 | /** 4 | * Created by LinYi. 5 | */ 6 | public class Constants { 7 | 8 | 9 | 10 | public static final int STATE_CODE_SUCCESS = 1; 11 | public static final int STATE_CODE_FAILED = -1; 12 | //... 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/core/ApiHelper.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.core; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import com.google.gson.Gson; 7 | import com.john.librarys.utils.util.DateHelper; 8 | import com.john.librarys.utils.util.GsonHelper; 9 | 10 | import java.util.Date; 11 | import java.util.Map; 12 | import java.util.regex.Matcher; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * api工具类 17 | */ 18 | public class ApiHelper { 19 | 20 | public final static String DATE_FORMAT = "yyyyMMddHHmmssSSS"; 21 | 22 | /** 23 | * 获取gson解析 24 | * 25 | * @return 26 | */ 27 | public static Gson getGson() { 28 | return GsonHelper.getGsonForDateFormat(DATE_FORMAT); 29 | } 30 | 31 | public static ApiHttpClient getApiHttpClient(Context context) { 32 | return ApiHttpClient.getInstance(context); 33 | } 34 | 35 | //时间戳转换 36 | public static String getTimestamp(long timestamp) { 37 | return DateHelper.formatDate(DATE_FORMAT, new Date(timestamp)); 38 | } 39 | 40 | //时间戳转换 41 | public static String getTimestamp(Date timestamp) { 42 | return DateHelper.formatDate(DATE_FORMAT, timestamp); 43 | } 44 | 45 | /** 46 | * 格式化 url,处理{xx}包括的url参数 47 | * 转换参数到url中,并把paramsmap中的参数删除 48 | * 49 | * @param url 50 | * @param paramsmap 51 | * @return 52 | */ 53 | public static String formatUrl(String url, Map paramsmap) { 54 | String resultUrl = url; 55 | Pattern regex = Pattern.compile("\\{([^/]+)\\}");//{xxxx} 56 | Matcher matcher = regex.matcher(url); 57 | while (matcher.find()) {//开始逐个匹配 58 | String matchParamName = matcher.group(1);//匹配具体名字 59 | if (paramsmap.containsKey(matchParamName)) { 60 | resultUrl = resultUrl.replaceAll("\\{" + matchParamName + "\\}", paramsmap.get(matchParamName)); 61 | paramsmap.remove(matchParamName); 62 | } else { 63 | Log.w("ApiHelper", "formatUrl params can't find in paramsmap : " + matchParamName); 64 | } 65 | } 66 | return resultUrl; 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/core/ApiJsonModelCallback.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.core; 2 | 3 | 4 | import com.apkfuns.logutils.LogUtils; 5 | import com.google.gson.reflect.TypeToken; 6 | import com.john.librarys.net.Constants; 7 | import com.john.librarys.net.interf.ServiceTask; 8 | 9 | import java.lang.reflect.Type; 10 | 11 | /** 12 | * ApiCallback 13 | * json模型callback 14 | */ 15 | public class ApiJsonModelCallback extends ApiCallback { 16 | boolean DEBUG = false; 17 | private Type mJsonModelType; 18 | 19 | /** 20 | * @param serviceTask 21 | * @param jsonModelType 对应的json模型 class type 22 | */ 23 | public ApiJsonModelCallback(ServiceTask serviceTask, Type jsonModelType) { 24 | super(serviceTask); 25 | mJsonModelType = jsonModelType; 26 | } 27 | 28 | 29 | /** 30 | * @param serviceTask 31 | * @param token 对应的json模型 TypeToken 32 | */ 33 | public ApiJsonModelCallback(ServiceTask serviceTask, TypeToken token) { 34 | this(serviceTask, token.getType()); 35 | } 36 | 37 | @Override 38 | public void onCall(int resultCode,String msg, Object data) { 39 | //增加debug打印 40 | if (DEBUG) { 41 | LogUtils.d("url====",mTag); 42 | LogUtils.json(String.valueOf(data)); 43 | } 44 | 45 | super.onCall(resultCode,msg, data); 46 | } 47 | 48 | @Override 49 | public void onSuccess(Object data, String msg,ServiceTask task) throws Exception { 50 | Object modelForJson = null; 51 | if (data != null) { 52 | modelForJson = ApiHelper.getGson().fromJson(data.toString(), mJsonModelType); 53 | } 54 | task.complete(Constants.STATE_CODE_SUCCESS,msg, modelForJson); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/core/CountingRequestBody.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.core; 2 | 3 | import com.squareup.okhttp.MediaType; 4 | import com.squareup.okhttp.RequestBody; 5 | 6 | import java.io.IOException; 7 | 8 | import okio.Buffer; 9 | import okio.BufferedSink; 10 | import okio.ForwardingSink; 11 | import okio.Okio; 12 | import okio.Sink; 13 | 14 | /** 15 | * Decorates an OkHttp request body to count the number of bytes written when writing it. Can 16 | * decorate any request body, but is most useful for tracking the upload progress of large 17 | * multipart requests. 18 | * 19 | * @author Leo Nikkilä 20 | */ 21 | public class CountingRequestBody extends RequestBody 22 | { 23 | 24 | protected RequestBody delegate; 25 | protected Listener listener; 26 | 27 | protected CountingSink countingSink; 28 | 29 | public CountingRequestBody(RequestBody delegate, Listener listener) 30 | { 31 | this.delegate = delegate; 32 | this.listener = listener; 33 | } 34 | 35 | @Override 36 | public MediaType contentType() 37 | { 38 | return delegate.contentType(); 39 | } 40 | 41 | @Override 42 | public long contentLength() 43 | { 44 | try 45 | { 46 | return delegate.contentLength(); 47 | } catch (IOException e) 48 | { 49 | e.printStackTrace(); 50 | } 51 | return -1; 52 | } 53 | 54 | @Override 55 | public void writeTo(BufferedSink sink) throws IOException 56 | { 57 | BufferedSink bufferedSink; 58 | 59 | countingSink = new CountingSink(sink); 60 | bufferedSink = Okio.buffer(countingSink); 61 | 62 | delegate.writeTo(bufferedSink); 63 | 64 | bufferedSink.flush(); 65 | } 66 | 67 | protected final class CountingSink extends ForwardingSink 68 | { 69 | 70 | private long bytesWritten = 0; 71 | 72 | public CountingSink(Sink delegate) 73 | { 74 | super(delegate); 75 | } 76 | 77 | @Override 78 | public void write(Buffer source, long byteCount) throws IOException 79 | { 80 | super.write(source, byteCount); 81 | 82 | bytesWritten += byteCount; 83 | listener.onRequestProgress(bytesWritten, contentLength()); 84 | } 85 | 86 | } 87 | 88 | public static interface Listener 89 | { 90 | 91 | public void onRequestProgress(long bytesWritten, long contentLength); 92 | 93 | } 94 | 95 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/core/OkHttpStack.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.core; 2 | 3 | import com.android.volley.toolbox.HurlStack; 4 | import com.squareup.okhttp.OkHttpClient; 5 | import com.squareup.okhttp.OkUrlFactory; 6 | 7 | import java.io.IOException; 8 | import java.net.HttpURLConnection; 9 | import java.net.URL; 10 | 11 | /** 12 | * Created by LinYi. 13 | */ 14 | public class OkHttpStack extends HurlStack { 15 | private final OkUrlFactory okUrlFactory; 16 | public OkHttpStack() { 17 | this(new OkHttpClient()); 18 | } 19 | public OkHttpStack(OkHttpClient okHttpClient) { 20 | if (okHttpClient == null) { 21 | throw new NullPointerException("Client must not be null."); 22 | } 23 | this.okUrlFactory = new OkUrlFactory(okHttpClient); 24 | } 25 | @Override 26 | protected HttpURLConnection createConnection(URL url) throws IOException { 27 | return okUrlFactory.open(url); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/interf/Callback.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.interf; 2 | 3 | /** 4 | * Created by LinYi. 5 | * 处理后的callback 6 | * @param 确定onCall返回的类型(JSONObject/JSONArray..) 7 | */ 8 | public interface Callback { 9 | 10 | void onCall(int resultCode,String msg, T t); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/net/interf/ProgressCallback.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.net.interf; 2 | 3 | /** 4 | * Created by LinYi. 5 | * 带进度的回调 6 | */ 7 | public interface ProgressCallback extends Callback{ 8 | 9 | /** 10 | * 11 | * @param progress 0.0~1.0 12 | */ 13 | void onProgress(float progress); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/ILoadingLayout.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.pulltorefresh; 2 | 3 | import android.graphics.Typeface; 4 | import android.graphics.drawable.Drawable; 5 | 6 | public interface ILoadingLayout { 7 | 8 | /** 9 | * Set the Last Updated Text. This displayed under the main label when 10 | * Pulling 11 | * 12 | * @param label - Label to set 13 | */ 14 | public void setLastUpdatedLabel(CharSequence label); 15 | 16 | /** 17 | * Set the drawable used in the loading layout. This is the same as calling 18 | * setLoadingDrawable(drawable, Mode.BOTH) 19 | * 20 | * @param drawable - Drawable to display 21 | */ 22 | public void setLoadingDrawable(Drawable drawable); 23 | 24 | /** 25 | * Set Text to show when the Widget is being Pulled 26 | * setPullLabel(releaseLabel, Mode.BOTH) 27 | * 28 | * @param pullLabel - CharSequence to display 29 | */ 30 | public void setPullLabel(CharSequence pullLabel); 31 | 32 | /** 33 | * Set Text to show when the Widget is refreshing 34 | * setRefreshingLabel(releaseLabel, Mode.BOTH) 35 | * 36 | * @param refreshingLabel - CharSequence to display 37 | */ 38 | public void setRefreshingLabel(CharSequence refreshingLabel); 39 | 40 | /** 41 | * Set Text to show when the Widget is being pulled, and will refresh when 42 | * released. This is the same as calling 43 | * setReleaseLabel(releaseLabel, Mode.BOTH) 44 | * 45 | * @param releaseLabel - CharSequence to display 46 | */ 47 | public void setReleaseLabel(CharSequence releaseLabel); 48 | 49 | /** 50 | * Set's the Sets the typeface and style in which the text should be 51 | * displayed. Please see 52 | * {@link android.widget.TextView#setTypeface(Typeface) 53 | * TextView#setTypeface(Typeface)}. 54 | */ 55 | public void setTextTypeface(Typeface tf); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/LoadingLayoutProxy.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.pulltorefresh; 2 | 3 | import android.graphics.Typeface; 4 | import android.graphics.drawable.Drawable; 5 | 6 | import com.john.librarys.pulltorefresh.internal.LoadingLayout; 7 | 8 | import java.util.HashSet; 9 | 10 | public class LoadingLayoutProxy implements ILoadingLayout { 11 | 12 | private final HashSet mLoadingLayouts; 13 | 14 | LoadingLayoutProxy() { 15 | mLoadingLayouts = new HashSet(); 16 | } 17 | 18 | /** 19 | * This allows you to add extra LoadingLayout instances to this proxy. This 20 | * is only necessary if you keep your own instances, and want to have them 21 | * included in any 22 | * {@link PullToRefreshBase#createLoadingLayoutProxy(boolean, boolean) 23 | * createLoadingLayoutProxy(...)} calls. 24 | * 25 | * @param layout - LoadingLayout to have included. 26 | */ 27 | public void addLayout(LoadingLayout layout) { 28 | if (null != layout) { 29 | mLoadingLayouts.add(layout); 30 | } 31 | } 32 | 33 | @Override 34 | public void setLastUpdatedLabel(CharSequence label) { 35 | for (LoadingLayout layout : mLoadingLayouts) { 36 | layout.setLastUpdatedLabel(label); 37 | } 38 | } 39 | 40 | @Override 41 | public void setLoadingDrawable(Drawable drawable) { 42 | for (LoadingLayout layout : mLoadingLayouts) { 43 | layout.setLoadingDrawable(drawable); 44 | } 45 | } 46 | 47 | @Override 48 | public void setRefreshingLabel(CharSequence refreshingLabel) { 49 | for (LoadingLayout layout : mLoadingLayouts) { 50 | layout.setRefreshingLabel(refreshingLabel); 51 | } 52 | } 53 | 54 | @Override 55 | public void setPullLabel(CharSequence label) { 56 | for (LoadingLayout layout : mLoadingLayouts) { 57 | layout.setPullLabel(label); 58 | } 59 | } 60 | 61 | @Override 62 | public void setReleaseLabel(CharSequence label) { 63 | for (LoadingLayout layout : mLoadingLayouts) { 64 | layout.setReleaseLabel(label); 65 | } 66 | } 67 | 68 | public void setTextTypeface(Typeface tf) { 69 | for (LoadingLayout layout : mLoadingLayouts) { 70 | layout.setTextTypeface(tf); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/PullToRefreshFrameLayout.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.john.librarys.pulltorefresh; 17 | 18 | import android.content.Context; 19 | import android.util.AttributeSet; 20 | import android.view.View; 21 | import android.widget.FrameLayout; 22 | 23 | public class PullToRefreshFrameLayout extends PullToRefreshBase { 24 | 25 | public PullToRefreshFrameLayout(Context context) { 26 | super(context); 27 | } 28 | 29 | public PullToRefreshFrameLayout(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | } 32 | 33 | public PullToRefreshFrameLayout(Context context, Mode mode) { 34 | super(context, mode); 35 | } 36 | 37 | public PullToRefreshFrameLayout(Context context, Mode mode, AnimationStyle style) { 38 | super(context, mode, style); 39 | } 40 | 41 | @Override 42 | public final Orientation getPullToRefreshScrollDirection() { 43 | return Orientation.VERTICAL; 44 | } 45 | 46 | @Override 47 | protected FrameLayout createRefreshableView(Context context, AttributeSet attrs) { 48 | return new FrameLayout(context,attrs); 49 | } 50 | 51 | @Override 52 | protected boolean isReadyForPullStart() { 53 | return mRefreshableView.getScrollY() == 0; 54 | } 55 | 56 | @Override 57 | protected boolean isReadyForPullEnd() { 58 | View firstChild = mRefreshableView.getChildAt(0); 59 | if (null != firstChild) { 60 | return mRefreshableView.getScrollY() >= (firstChild.getHeight() - getHeight()); 61 | } 62 | return false; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/internal/EmptyViewMethodAccessor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.john.librarys.pulltorefresh.internal; 17 | 18 | import android.view.View; 19 | 20 | /** 21 | * Interface that allows PullToRefreshBase to hijack the call to 22 | * AdapterView.setEmptyView() 23 | * 24 | * @author chris 25 | */ 26 | public interface EmptyViewMethodAccessor { 27 | 28 | /** 29 | * Calls upto AdapterView.setEmptyView() 30 | * 31 | * @param emptyView - to set as Empty View 32 | */ 33 | public void setEmptyViewInternal(View emptyView); 34 | 35 | /** 36 | * Should call PullToRefreshBase.setEmptyView() which will then 37 | * automatically call through to setEmptyViewInternal() 38 | * 39 | * @param emptyView - to set as Empty View 40 | */ 41 | public void setEmptyView(View emptyView); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/internal/Utils.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.pulltorefresh.internal; 2 | 3 | import android.util.Log; 4 | 5 | public class Utils { 6 | 7 | static final String LOG_TAG = "PullToRefresh"; 8 | 9 | public static void warnDeprecation(String depreacted, String replacement) { 10 | Log.w(LOG_TAG, "You're using the deprecated " + depreacted + " attr, please switch over to " + replacement); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/pulltorefresh/internal/ViewCompat.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package com.john.librarys.pulltorefresh.internal; 17 | 18 | import android.annotation.TargetApi; 19 | import android.graphics.drawable.Drawable; 20 | import android.os.Build.VERSION; 21 | import android.os.Build.VERSION_CODES; 22 | import android.view.View; 23 | 24 | @SuppressWarnings("deprecation") 25 | public class ViewCompat { 26 | 27 | public static void postOnAnimation(View view, Runnable runnable) { 28 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { 29 | SDK16.postOnAnimation(view, runnable); 30 | } else { 31 | view.postDelayed(runnable, 16); 32 | } 33 | } 34 | 35 | public static void setBackground(View view, Drawable background) { 36 | if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { 37 | SDK16.setBackground(view, background); 38 | } else { 39 | view.setBackgroundDrawable(background); 40 | } 41 | } 42 | 43 | public static void setLayerType(View view, int layerType) { 44 | if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { 45 | SDK11.setLayerType(view, layerType); 46 | } 47 | } 48 | 49 | @TargetApi(11) 50 | static class SDK11 { 51 | 52 | public static void setLayerType(View view, int layerType) { 53 | view.setLayerType(layerType, null); 54 | } 55 | } 56 | 57 | @TargetApi(16) 58 | static class SDK16 { 59 | 60 | public static void postOnAnimation(View view, Runnable runnable) { 61 | view.postOnAnimation(runnable); 62 | } 63 | 64 | public static void setBackground(View view, Drawable background) { 65 | view.setBackground(background); 66 | } 67 | 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/Tagcloudlayout/TagBaseAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.Tagcloudlayout; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.Button; 9 | 10 | import com.john.librarys.R; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @author fyales 16 | * @since 8/26/15. 17 | */ 18 | public class TagBaseAdapter extends BaseAdapter { 19 | 20 | private Context mContext; 21 | private List mList; 22 | 23 | public TagBaseAdapter(Context context, List list) { 24 | mContext = context; 25 | mList = list; 26 | } 27 | 28 | @Override 29 | public int getCount() { 30 | return mList.size(); 31 | } 32 | 33 | @Override 34 | public String getItem(int position) { 35 | return mList.get(position); 36 | } 37 | 38 | @Override 39 | public long getItemId(int position) { 40 | return position; 41 | } 42 | 43 | @Override 44 | public View getView(int position, View convertView, ViewGroup parent) { 45 | ViewHolder holder; 46 | if (convertView == null) { 47 | convertView = LayoutInflater.from(mContext).inflate(R.layout.tagview, null); 48 | holder = new ViewHolder(); 49 | holder.tagBtn = (Button) convertView.findViewById(R.id.tag_btn); 50 | convertView.setTag(holder); 51 | }else{ 52 | holder = (ViewHolder)convertView.getTag(); 53 | } 54 | final String text = getItem(position); 55 | holder.tagBtn.setText(text); 56 | return convertView; 57 | } 58 | 59 | static class ViewHolder { 60 | Button tagBtn; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/Tagcloudlayout/TagCloudConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.Tagcloudlayout; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.util.AttributeSet; 6 | 7 | import com.john.librarys.R; 8 | 9 | /** 10 | * @author fyales 11 | * @since date 11/3/15 12 | */ 13 | public class TagCloudConfiguration { 14 | 15 | private static final int DEFAULT_LINE_SPACING = 5; 16 | private static final int DEFAULT_TAG_SPACING = 10; 17 | private static final int DEFAULT_FIXED_COLUMN_SIZE = 3; //默认列数 18 | 19 | private int lineSpacing; 20 | private int tagSpacing; 21 | private int columnSize; 22 | private boolean isFixed; 23 | 24 | public TagCloudConfiguration(Context context, AttributeSet attrs){ 25 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TagCloudLayout); 26 | try { 27 | lineSpacing = a.getDimensionPixelSize(R.styleable.TagCloudLayout_lineSpacing, DEFAULT_LINE_SPACING); 28 | tagSpacing = a.getDimensionPixelSize(R.styleable.TagCloudLayout_tagSpacing, DEFAULT_TAG_SPACING); 29 | columnSize = a.getInteger(R.styleable.TagCloudLayout_columnSize, DEFAULT_FIXED_COLUMN_SIZE); 30 | isFixed = a.getBoolean(R.styleable.TagCloudLayout_isFixed,false); 31 | } finally { 32 | a.recycle(); 33 | } 34 | } 35 | 36 | public int getLineSpacing() { 37 | return lineSpacing; 38 | } 39 | 40 | public void setLineSpacing(int lineSpacing) { 41 | this.lineSpacing = lineSpacing; 42 | } 43 | 44 | public int getTagSpacing() { 45 | return tagSpacing; 46 | } 47 | 48 | public void setTagSpacing(int tagSpacing) { 49 | this.tagSpacing = tagSpacing; 50 | } 51 | 52 | public int getColumnSize() { 53 | return columnSize; 54 | } 55 | 56 | public void setColumnSize(int columnSize) { 57 | this.columnSize = columnSize; 58 | } 59 | 60 | public boolean isFixed() { 61 | return isFixed; 62 | } 63 | 64 | public void setIsFixed(boolean isFixed) { 65 | this.isFixed = isFixed; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/CheckableListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.AbsListView; 7 | import android.widget.Checkable; 8 | 9 | import java.util.List; 10 | 11 | public abstract class CheckableListAdapter extends DynamicListAdapter { 12 | AbsListView mListView; 13 | 14 | 15 | public CheckableListAdapter(Context context, AbsListView listview) { 16 | this(context, null, listview); 17 | } 18 | 19 | public CheckableListAdapter(Context context, List data, AbsListView listview) { 20 | super(context, data); 21 | mListView = listview; 22 | } 23 | 24 | @Override 25 | public View getView(int position, View convertView, ViewGroup parent) { 26 | convertView = getCheckableView(position, convertView, parent); 27 | 28 | boolean checked = mListView.isItemChecked(position); 29 | if (convertView instanceof Checkable) { 30 | ((Checkable) convertView).setChecked(checked); 31 | } 32 | 33 | setChecked(convertView, checked); 34 | return convertView; 35 | } 36 | 37 | /** 38 | * 生成view 用,这个方法就是封装了 BaseAdapter.getView 方法,里面的实现需要跟 BaseAdapter.getView 一样 39 | * 40 | * @param position 41 | * @param convertView 42 | * @param parent 43 | * @return 44 | */ 45 | public abstract View getCheckableView(int position, View convertView, ViewGroup parent); 46 | 47 | /** 48 | * 设置check状态用 49 | * 如果 itemview 是 checkable 的话 就会自动设置,如果不是就要另外设置,比如这个item 下 还layout了其他多层的checkable的view 50 | * 51 | * @param view 52 | * @param checked 53 | */ 54 | public abstract void setChecked(View view, boolean checked); 55 | 56 | //这个值涉及到 listview.getCheckedItemIds()的取值 57 | @Override 58 | public boolean hasStableIds() { 59 | return true; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/DynamicListDataSet.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.adapter; 2 | 3 | import java.util.Collection; 4 | 5 | /** 6 | * 动态dynamicList 7 | */ 8 | public interface DynamicListDataSet { 9 | 10 | int getCount(); 11 | 12 | T getItem(int position); 13 | 14 | /** 15 | * 添加数据 16 | * 17 | * @param item 18 | */ 19 | void addItem(T item); 20 | 21 | /** 22 | * 添加数据到 position 位置 23 | * 24 | * @param item 25 | * @param position 26 | */ 27 | void addItem(T item, int position); 28 | 29 | /** 30 | * 添加数据到 position 位置 31 | * 32 | * @param items 33 | * @param position 34 | */ 35 | void addItems(Collection items, int position); 36 | 37 | /** 38 | * 添加数据到 最后 39 | * 40 | * @param items 41 | */ 42 | void addItems(Collection items); 43 | 44 | /** 45 | * 删除数据 46 | * 47 | * @param item 48 | */ 49 | void removeItem(T item); 50 | 51 | /** 52 | * 删除 position位置的数据 53 | * 54 | * @param position 55 | */ 56 | void removeItem(int position); 57 | 58 | /** 59 | * 删除数据 60 | * 61 | * @param items 62 | */ 63 | void removeItems(Collection items); 64 | 65 | /** 66 | * 清除数据 67 | */ 68 | void clear(); 69 | 70 | /** 71 | * 通知已经修改 72 | */ 73 | void notifyDataSetChanged(); 74 | } 75 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseAdapterViewHolder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import com.zhy.autolayout.utils.AutoUtils; 23 | 24 | /** 25 | * 作者:王浩 邮件:bingoogolapple@gmail.com 26 | * 创建时间:15/5/21 上午1:00 27 | * 描述:适用于AdapterView的item的ViewHolder 28 | */ 29 | public class MyBaseAdapterViewHolder { 30 | protected View mConvertView; 31 | protected MyBaseViewHolderHelper mViewHolderHelper; 32 | 33 | private MyBaseAdapterViewHolder(ViewGroup parent, int layoutId) { 34 | mConvertView = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false); 35 | AutoUtils.auto(mConvertView); 36 | mConvertView.setTag(this); 37 | mViewHolderHelper = new MyBaseViewHolderHelper(parent, mConvertView); 38 | } 39 | 40 | /** 41 | * 拿到一个可重用的ViewHolder对象 42 | * 43 | * @param convertView 44 | * @param parent 45 | * @param layoutId 46 | * @return 47 | */ 48 | public static MyBaseAdapterViewHolder dequeueReusableAdapterViewHolder(View convertView, ViewGroup parent, int layoutId) { 49 | if (convertView == null) { 50 | return new MyBaseAdapterViewHolder(parent, layoutId); 51 | } 52 | return (MyBaseAdapterViewHolder) convertView.getTag(); 53 | } 54 | 55 | public MyBaseViewHolderHelper getViewHolderHelper() { 56 | return mViewHolderHelper; 57 | } 58 | 59 | public View getConvertView() { 60 | return mConvertView; 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseBindingViewHolder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.databinding.ViewDataBinding; 20 | import android.support.v7.widget.RecyclerView; 21 | import android.view.ViewParent; 22 | import com.zhy.autolayout.utils.AutoUtils; 23 | 24 | /** 25 | * 作者:王浩 邮件:bingoogolapple@gmail.com 26 | * 创建时间:16/11/10 下午9:34 27 | * 描述: 28 | */ 29 | public class MyBaseBindingViewHolder extends RecyclerView.ViewHolder { 30 | private B mBinding; 31 | protected MyBaseBindingRecyclerViewAdapter mBindingRecyclerViewAdapter; 32 | 33 | public MyBaseBindingViewHolder(MyBaseBindingRecyclerViewAdapter bindingRecyclerViewAdapter, B binding) { 34 | super(binding.getRoot()); 35 | AutoUtils.auto(binding.getRoot()); 36 | mBindingRecyclerViewAdapter = bindingRecyclerViewAdapter; 37 | mBinding = binding; 38 | } 39 | 40 | public B getBinding() { 41 | return mBinding; 42 | } 43 | 44 | public RecyclerView getParent() { 45 | ViewParent parent = mBinding.getRoot().getParent(); 46 | if (parent != null) { 47 | return (RecyclerView) parent; 48 | } 49 | return null; 50 | } 51 | 52 | public int getAdapterPositionWrapper() { 53 | if (mBindingRecyclerViewAdapter.getHeadersCount() > 0) { 54 | return getAdapterPosition() - mBindingRecyclerViewAdapter.getHeadersCount(); 55 | } else { 56 | return getAdapterPosition(); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnItemChildCheckedChangeListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.ViewGroup; 20 | import android.widget.CompoundButton; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/10/7 下午8:35 25 | * 描述:AdapterView和RecyclerView的item中子控件选中状态变化事件监听器 26 | */ 27 | public interface MyBaseOnItemChildCheckedChangeListener { 28 | void onItemChildCheckedChanged(ViewGroup parent, CompoundButton childView, int position, boolean isChecked); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnItemChildClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/5/28 上午7:28 25 | * 描述:AdapterView和RecyclerView的item中子控件点击事件监听器 26 | */ 27 | public interface MyBaseOnItemChildClickListener { 28 | void onItemChildClick(ViewGroup parent, View childView, int position); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnItemChildLongClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/5/28 上午7:28 25 | * 描述:AdapterView和RecyclerView的item中子控件长按事件监听器 26 | */ 27 | public interface MyBaseOnItemChildLongClickListener { 28 | boolean onItemChildLongClick(ViewGroup parent, View childView, int position); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnNoDoubleClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.View; 20 | 21 | /** 22 | * 作者:王浩 邮件:bingoogolapple@gmail.com 23 | * 创建时间:16/11/13 上午11:41 24 | * 描述: 25 | */ 26 | public abstract class MyBaseOnNoDoubleClickListener implements View.OnClickListener { 27 | private int mThrottleFirstTime = 1000; 28 | private long mLastClickTime = 0; 29 | 30 | public MyBaseOnNoDoubleClickListener() { 31 | } 32 | 33 | public MyBaseOnNoDoubleClickListener(int throttleFirstTime) { 34 | mThrottleFirstTime = throttleFirstTime; 35 | } 36 | 37 | @Override 38 | public void onClick(View v) { 39 | long currentTime = System.currentTimeMillis(); 40 | if (currentTime - mLastClickTime > mThrottleFirstTime) { 41 | mLastClickTime = currentTime; 42 | onNoDoubleClick(v); 43 | } 44 | } 45 | 46 | public abstract void onNoDoubleClick(View v); 47 | } 48 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnRVItemChildTouchListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.MotionEvent; 20 | import android.view.View; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/5/28 上午7:28 25 | * 描述:RecyclerView的item中子控件触摸事件监听器 26 | */ 27 | public interface MyBaseOnRVItemChildTouchListener { 28 | boolean onRvItemChildTouch(MyBaseRecyclerViewHolder holder, View childView, MotionEvent event); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnRVItemClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/5/28 上午7:28 25 | * 描述:RecyclerView的item点击事件监听器 26 | */ 27 | public interface MyBaseOnRVItemClickListener { 28 | void onRVItemClick(ViewGroup parent, View itemView, int position); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseOnRVItemLongClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:15/5/28 上午7:28 25 | * 描述:RecyclerView的item长按事件监听器 26 | */ 27 | public interface MyBaseOnRVItemLongClickListener { 28 | boolean onRVItemLongClick(ViewGroup parent, View itemView, int position); 29 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/adapter/baseadapter/MyBaseViewBindingAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 bingoogolapple 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.john.librarys.uikit.adapter.baseadapter; 18 | 19 | import android.databinding.BindingAdapter; 20 | import android.view.View; 21 | 22 | /** 23 | * 作者:王浩 邮件:bingoogolapple@gmail.com 24 | * 创建时间:16/11/13 下午3:56 25 | * 描述: 26 | */ 27 | public class MyBaseViewBindingAdapter { 28 | 29 | @BindingAdapter({"onNoDoubleClick"}) 30 | public static void onNoDoubleClick(View view, final View.OnClickListener onClickListener) { 31 | view.setOnClickListener(new MyBaseOnNoDoubleClickListener() { 32 | @Override 33 | public void onNoDoubleClick(View v) { 34 | onClickListener.onClick(v); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/entity/PageResult.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 分页数据 8 | */ 9 | public class PageResult { 10 | Integer pageNo = 0; 11 | Integer totalPages = 0; 12 | Integer totalCount = 0; 13 | List result = new ArrayList(); 14 | 15 | public Integer getPageNo() { 16 | return pageNo; 17 | } 18 | 19 | public void setPageNo(Integer pageNo) { 20 | this.pageNo = pageNo; 21 | } 22 | 23 | public Integer getTotalPages() { 24 | return totalPages; 25 | } 26 | 27 | public void setTotalPages(Integer totalPages) { 28 | this.totalPages = totalPages; 29 | } 30 | 31 | public Integer getTotalCount() { 32 | return totalCount; 33 | } 34 | 35 | public void setTotalCount(Integer totalCount) { 36 | this.totalCount = totalCount; 37 | } 38 | 39 | public List getResult() { 40 | return result; 41 | } 42 | 43 | public void setResult(List result) { 44 | this.result = result; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/waveswiperefreshlayout/AnimationImageView.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.waveswiperefreshlayout; 2 | 3 | import android.content.Context; 4 | import android.view.animation.Animation; 5 | 6 | /** 7 | * @author John Gu 8 | * @date 2017/11/22. 9 | */ 10 | 11 | public class AnimationImageView extends android.support.v7.widget.AppCompatImageView { 12 | 13 | /** 14 | * AnimationのStartとEnd時にListenerにアレする 15 | */ 16 | private Animation.AnimationListener mListener; 17 | 18 | /** 19 | * コンストラクタ 20 | * {@inheritDoc} 21 | */ 22 | public AnimationImageView(Context context) { 23 | super(context); 24 | } 25 | 26 | /** 27 | * {@link AnimationImageView#mListener} のセット 28 | * 29 | * @param listener {@link android.view.animation.Animation.AnimationListener} 30 | */ 31 | public void setAnimationListener(Animation.AnimationListener listener) { 32 | mListener = listener; 33 | } 34 | 35 | /** 36 | * ViewのAnimationのStart時にセットされたListenerの {@link android.view.animation.Animation.AnimationListener#onAnimationStart(Animation)} 37 | * を呼ぶ 38 | */ 39 | @Override public void onAnimationStart() { 40 | super.onAnimationStart(); 41 | if (mListener != null) { 42 | mListener.onAnimationStart(getAnimation()); 43 | } 44 | } 45 | 46 | /** 47 | * ViewのAnimationのEnd時にセットされたListenerの {@link android.view.animation.Animation.AnimationListener#onAnimationEnd(Animation)} 48 | * (Animation)} を呼ぶ 49 | */ 50 | @Override public void onAnimationEnd() { 51 | super.onAnimationEnd(); 52 | if (mListener != null) { 53 | mListener.onAnimationEnd(getAnimation()); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/waveswiperefreshlayout/DisplayUtil.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.waveswiperefreshlayout; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.util.DisplayMetrics; 6 | 7 | /** 8 | * @author John Gu 9 | * @date 2017/11/22. 10 | */ 11 | 12 | public class DisplayUtil { 13 | private DisplayUtil(){} 14 | 15 | /** 16 | * 現在の向きが600dpを超えているかどうか 17 | * 18 | * @param context {@link Context} 19 | * @return 600dpを超えているかどうか 20 | */ 21 | public static boolean isOver600dp(Context context) { 22 | Resources resources = context.getResources(); 23 | DisplayMetrics displayMetrics = resources.getDisplayMetrics(); 24 | return displayMetrics.widthPixels / displayMetrics.density >= 600; 25 | } 26 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/waveswiperefreshlayout/DropBounceInterpolator.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.waveswiperefreshlayout; 2 | 3 | /** 4 | * @author John Gu 5 | * @date 2017/11/22. 6 | */ 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | import android.view.animation.Interpolator; 11 | 12 | /** 13 | * @author amyu 14 | * 15 | * {@link WaveView#mDropBounceHorizontalAnimator} と {@link WaveView#mDropVertexAnimator} にセットするInterpolator 16 | * WavePullToRefresh/DropBounceInterpolator.gcxにグラフの詳細 17 | */ 18 | public class DropBounceInterpolator implements Interpolator { 19 | 20 | public DropBounceInterpolator() { 21 | } 22 | 23 | @SuppressWarnings({"UnusedDeclaration"}) 24 | public DropBounceInterpolator(Context context, AttributeSet attrs) { 25 | } 26 | 27 | /** 28 | * {@inheritDoc} 29 | * 30 | * @param v 31 | * @return 32 | */ 33 | @Override 34 | public float getInterpolation(float v) { 35 | //y = -19 * (x - 0.125)^2 + 1.3 (0 <= x < 0.25) 36 | //y = -6.5 * (x - 0.625)^2 + 1.1 (0.5 <= x < 0.75) 37 | //y = 0 (0.25 <= x < 0.5 && 0.75 <= x <=1) 38 | 39 | if (v < 0.25f) { 40 | return -38.4f * (float) Math.pow(v - 0.125, 2) + 0.6f; 41 | } else if (v >= 0.5 && v < 0.75) { 42 | return -19.2f * (float) Math.pow(v - 0.625, 2) + 0.3f; 43 | } else { 44 | return 0; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AlbumContentView.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.text.Spannable; 7 | import android.text.SpannableStringBuilder; 8 | import android.text.style.AbsoluteSizeSpan; 9 | import android.util.AttributeSet; 10 | import android.widget.TextView; 11 | 12 | public class AlbumContentView extends TextView { 13 | 14 | private int mPosFontSize = 20; 15 | 16 | private int mTotal = 0; 17 | private AlbumView.AlbumPic mAlbumPic; 18 | 19 | public AlbumContentView(Context context) { 20 | super(context); 21 | init(null); 22 | } 23 | 24 | public AlbumContentView(Context context, AttributeSet attrs) { 25 | super(context, attrs); 26 | init(attrs); 27 | } 28 | 29 | public AlbumContentView(Context context, AttributeSet attrs, int defStyleAttr) { 30 | super(context, attrs, defStyleAttr); 31 | init(attrs); 32 | } 33 | 34 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 35 | public AlbumContentView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 36 | super(context, attrs, defStyleAttr, defStyleRes); 37 | init(attrs); 38 | } 39 | 40 | void init(AttributeSet attrs) { 41 | mPosFontSize = (int) (getTextSize() * 1.5); 42 | } 43 | 44 | public void setTotal(int total) { 45 | mTotal = total; 46 | } 47 | 48 | public void setAlbumPic(int pos, AlbumView.AlbumPic pic) { 49 | mAlbumPic = pic; 50 | 51 | SpannableStringBuilder content = null; 52 | if (pic == null) { 53 | content = new SpannableStringBuilder(); 54 | } else { 55 | String s = (pos + 1) + "/" + mTotal; 56 | String desciption = s + ("\t\t" + pic.description); 57 | content = new SpannableStringBuilder(desciption); 58 | content.setSpan(new AbsoluteSizeSpan(mPosFontSize), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 59 | } 60 | 61 | setText(content); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AlbumViewPager.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.MotionEventCompat; 5 | import android.support.v4.view.ViewPager; 6 | import android.util.AttributeSet; 7 | import android.view.MotionEvent; 8 | 9 | public class AlbumViewPager extends ViewPager { 10 | 11 | AlbumPicView mCurrentPicView; 12 | 13 | public AlbumViewPager(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | } 16 | 17 | public AlbumViewPager(Context context) { 18 | super(context); 19 | } 20 | 21 | @Override 22 | public boolean onInterceptTouchEvent(MotionEvent ev) { 23 | final int action = ev.getAction() & MotionEventCompat.ACTION_MASK; 24 | if (action == MotionEvent.ACTION_MOVE && !((AlbumViewPagerAdapter) getAdapter()).getPrimaryItem().viewPageCanScroll(ev)) {//不能滑动的时候就不拦截 25 | return false; 26 | } 27 | return super.onInterceptTouchEvent(ev); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AlbumViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | 7 | import com.john.librarys.R; 8 | import com.john.librarys.uikit.adapter.DynamicPagerAdapter; 9 | 10 | 11 | public class AlbumViewPagerAdapter extends DynamicPagerAdapter implements View.OnClickListener { 12 | private AlbumPicView mCurrentView; 13 | private AlbumView mAlbumView; 14 | 15 | public AlbumViewPagerAdapter(AlbumView albumView) { 16 | super(albumView.getContext()); 17 | mAlbumView = albumView; 18 | } 19 | 20 | @Override 21 | public View instantiateView(ViewGroup container, int position) { 22 | AlbumView.AlbumPic albumPic = getItem(position); 23 | 24 | View view = LayoutInflater.from(getContext()).inflate(R.layout.item_album_pic, container, false); 25 | AlbumPicView imgView = (AlbumPicView) view.findViewById(R.id.album_pic); 26 | imgView.setUrl(albumPic.imgUrl); 27 | imgView.setOnClickListener(this); 28 | return view; 29 | } 30 | 31 | 32 | @Override 33 | public void setPrimaryItem(ViewGroup container, int position, Object object) { 34 | mCurrentView = (AlbumPicView) object; 35 | } 36 | 37 | public AlbumPicView getPrimaryItem() { 38 | return mCurrentView; 39 | } 40 | 41 | //控制 点击 显示,隐藏 contentview 42 | @Override 43 | public void onClick(View v) { 44 | mAlbumView.setContentVisible(mAlbumView.isContentVisible() ? View.GONE : View.VISIBLE); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AutoHeightGridView.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.widget.GridView; 8 | 9 | /** 10 | * 自动高度listview 11 | */ 12 | public class AutoHeightGridView extends GridView { 13 | boolean DEBUG = true; 14 | 15 | String TAG = AutoHeightGridView.class.getSimpleName(); 16 | 17 | public AutoHeightGridView(Context context) { 18 | super(context); 19 | } 20 | 21 | public AutoHeightGridView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public AutoHeightGridView(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | } 28 | 29 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 30 | public AutoHeightGridView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 31 | super(context, attrs, defStyleAttr, defStyleRes); 32 | } 33 | 34 | 35 | @Override 36 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 37 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, 38 | MeasureSpec.AT_MOST); 39 | 40 | super.onMeasure(widthMeasureSpec, expandSpec); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AutoHeightListView.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.widget.ListView; 8 | 9 | /** 10 | * 自动高度listview 11 | */ 12 | public class AutoHeightListView extends ListView { 13 | boolean DEBUG = true; 14 | 15 | String TAG = AutoHeightListView.class.getSimpleName(); 16 | 17 | public AutoHeightListView(Context context) { 18 | super(context); 19 | } 20 | 21 | public AutoHeightListView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public AutoHeightListView(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | } 28 | 29 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 30 | public AutoHeightListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 31 | super(context, attrs, defStyleAttr, defStyleRes); 32 | } 33 | 34 | 35 | @Override 36 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 37 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, 38 | MeasureSpec.AT_MOST); 39 | 40 | super.onMeasure(widthMeasureSpec, expandSpec); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/AutoRadioGroup.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.ViewGroup; 6 | import android.widget.RadioGroup; 7 | 8 | import com.zhy.autolayout.AutoLayoutInfo; 9 | import com.zhy.autolayout.utils.AutoLayoutHelper; 10 | 11 | /** 12 | * Created by hupei on 2016/2/29 9:59. 13 | * 自适应 的 radiogroup 14 | */ 15 | public class AutoRadioGroup extends RadioGroup { 16 | private AutoLayoutHelper mHelper = new AutoLayoutHelper(this); 17 | 18 | public AutoRadioGroup(Context context) 19 | { 20 | super(context); 21 | } 22 | 23 | public AutoRadioGroup(Context context, AttributeSet attrs) 24 | { 25 | super(context, attrs); 26 | } 27 | 28 | 29 | @Override 30 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 31 | if (!isInEditMode()) 32 | mHelper.adjustChildren(); 33 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 34 | } 35 | 36 | @Override 37 | protected void onLayout(boolean changed, int l, int t, int r, int b) 38 | { 39 | super.onLayout(changed, l, t, r, b); 40 | } 41 | 42 | @Override 43 | public LayoutParams generateLayoutParams(AttributeSet attrs) 44 | { 45 | return new LayoutParams(getContext(), attrs); 46 | } 47 | 48 | public static class LayoutParams extends RadioGroup.LayoutParams implements AutoLayoutHelper.AutoLayoutParams { 49 | private AutoLayoutInfo mAutoLayoutInfo; 50 | 51 | public LayoutParams(Context c, AttributeSet attrs) { 52 | super(c, attrs); 53 | mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs); 54 | } 55 | 56 | @Override 57 | public AutoLayoutInfo getAutoLayoutInfo() 58 | { 59 | return mAutoLayoutInfo; 60 | } 61 | 62 | 63 | public LayoutParams(int width, int height) 64 | { 65 | super(width, height); 66 | } 67 | 68 | public LayoutParams(ViewGroup.LayoutParams source) 69 | { 70 | super(source); 71 | } 72 | 73 | public LayoutParams(MarginLayoutParams source) 74 | { 75 | super(source); 76 | } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/CheckableLayout.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.Checkable; 7 | import android.widget.RelativeLayout; 8 | 9 | /** 10 | * 可以提供check属性的RelativeLyaout 11 | * 可以提供给 abs 里面 作为 item使用 12 | * 13 | * @author chenzipeng 14 | */ 15 | public class CheckableLayout extends RelativeLayout implements Checkable { 16 | 17 | public CheckableLayout(Context context) { 18 | super(context); 19 | } 20 | 21 | public CheckableLayout(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public CheckableLayout(Context context, AttributeSet attrs, int defStyle) { 26 | super(context, attrs, defStyle); 27 | } 28 | 29 | protected boolean mChecked = false; 30 | 31 | @Override 32 | public void setChecked(boolean checked) { 33 | if (mChecked != checked) { 34 | mChecked = checked; 35 | drawableStateChanged(); 36 | for (int i = 0; i < getChildCount(); i++) { 37 | View child = getChildAt(i); 38 | if (child instanceof Checkable) { 39 | ((Checkable) child).setChecked(checked); 40 | } 41 | } 42 | } 43 | } 44 | 45 | @Override 46 | public boolean isChecked() { 47 | return mChecked; 48 | } 49 | 50 | @Override 51 | public void toggle() { 52 | setChecked(!mChecked); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/Divider.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Rect; 6 | import android.graphics.drawable.Drawable; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.View; 9 | 10 | import com.john.librarys.R; 11 | 12 | 13 | public class Divider extends RecyclerView.ItemDecoration { 14 | private Drawable mDividerDrawable; 15 | 16 | public Divider(Context context) { 17 | mDividerDrawable = context.getResources().getDrawable(R.mipmap.list_divider); 18 | } 19 | 20 | // 如果等于分割线的宽度或高度的话可以不用重写该方法 21 | @Override 22 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 23 | if (parent.getChildAdapterPosition(view) == parent.getAdapter().getItemCount() - 1) { 24 | outRect.set(0, 0, 0, 0); 25 | } else { 26 | outRect.set(0, 0, 0, mDividerDrawable.getIntrinsicHeight()); 27 | } 28 | } 29 | 30 | @Override 31 | public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { 32 | drawVertical(c, parent); 33 | } 34 | 35 | public void drawVertical(Canvas c, RecyclerView parent) { 36 | int left = parent.getPaddingLeft(); 37 | int right = parent.getWidth() - parent.getPaddingRight(); 38 | View child; 39 | RecyclerView.LayoutParams layoutParams; 40 | int top; 41 | int bottom; 42 | int childCount = parent.getChildCount(); 43 | for (int i = 0; i < childCount - 1; i++) { 44 | child = parent.getChildAt(i); 45 | layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams(); 46 | top = child.getBottom() + layoutParams.bottomMargin; 47 | bottom = top + mDividerDrawable.getIntrinsicHeight(); 48 | mDividerDrawable.setBounds(left, top, right, bottom); 49 | mDividerDrawable.draw(c); 50 | } 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/LoopCircleIndicator.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.AttributeSet; 6 | import android.util.Log; 7 | 8 | public class LoopCircleIndicator extends CircleIndicator { 9 | 10 | LoopViewPager mLoopViewPager; 11 | 12 | public LoopCircleIndicator(Context context) { 13 | super(context); 14 | } 15 | 16 | public LoopCircleIndicator(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | /** 21 | * 设置viewpager,必须是LoopViewPager 22 | * 23 | * @param viewPager 24 | */ 25 | @Override 26 | public void setViewPager(ViewPager viewPager) { 27 | if (viewPager instanceof LoopViewPager) { 28 | mLoopViewPager = (LoopViewPager) viewPager; 29 | super.setViewPager(viewPager); 30 | } else { 31 | Log.e("LoopCircleIndicator", "setViewPager muse be instanceof LoopViewPager"); 32 | } 33 | } 34 | 35 | @Override 36 | protected void onPageSelcted(int position) { 37 | int pos = position; 38 | if (mLoopViewPager != null && mLoopViewPager.getWrappAdapter() != null) { 39 | pos = mLoopViewPager.getWrappAdapter().getActualPosition(position); 40 | } 41 | super.onPageSelcted(pos); 42 | } 43 | 44 | @Override 45 | public int getViewPageCurrentItem() { 46 | return getActualPosition(mLoopViewPager.getCurrentItem()); 47 | } 48 | 49 | @Override 50 | public int getViewPageCount() { 51 | return mLoopViewPager.getAdapter().getCount(); 52 | } 53 | 54 | private int getActualPosition(int position) { 55 | return mLoopViewPager.getWrappAdapter().getActualPosition(position); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/LoopViewPager.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.PagerAdapter; 5 | import android.support.v4.view.ViewPager; 6 | import android.util.AttributeSet; 7 | 8 | import com.john.librarys.uikit.adapter.LoopViewPagerAdapter; 9 | 10 | /** 11 | * 无限循环滚动viewPager 12 | */ 13 | public class LoopViewPager extends ViewPager { 14 | 15 | LoopViewPagerAdapter mWrappPagerAdapter; 16 | 17 | public LoopViewPager(Context context) { 18 | super(context); 19 | } 20 | 21 | public LoopViewPager(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | @Override 26 | public void setAdapter(PagerAdapter adapter) { 27 | if (!(adapter instanceof LoopViewPagerAdapter)) { 28 | LoopViewPagerAdapter wrappAdaper = new LoopViewPagerAdapter(adapter); 29 | adapter = wrappAdaper; 30 | } 31 | 32 | mWrappPagerAdapter = (LoopViewPagerAdapter) adapter; 33 | super.setAdapter(adapter); 34 | 35 | setCurrentItem(mWrappPagerAdapter.getCount() / 2); 36 | } 37 | 38 | public LoopViewPagerAdapter getWrappAdapter() { 39 | return mWrappPagerAdapter; 40 | } 41 | 42 | 43 | public PagerAdapter getAdapter() { 44 | return mWrappPagerAdapter.getActualAdapter(); 45 | } 46 | 47 | protected int getActualPosition(int position){ 48 | return mWrappPagerAdapter.getActualPosition(position); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/NavLayout.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | 8 | import java.util.HashSet; 9 | import java.util.Set; 10 | 11 | /** 12 | * 导航栏控件 13 | * @author chenzipeng 14 | * 15 | */ 16 | public class NavLayout extends LinearLayout { 17 | private Set mNavIcons = new HashSet<>(); 18 | 19 | public NavLayout(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | private OnClickListener mNavClicklistenner; 24 | 25 | public void setOnItemClickListener(OnClickListener listener){ 26 | mNavClicklistenner = listener; 27 | for (int i = 0; i < getChildCount(); i++) { 28 | View child = getChildAt(i); 29 | if (child instanceof NavIconView) { 30 | mNavIcons.add((NavIconView) child); 31 | child.setOnClickListener(mNavClicklistenner); 32 | } 33 | } 34 | } 35 | 36 | @Override 37 | protected void onFinishInflate() { 38 | setOnItemClickListener(mNavClicklistenner); 39 | }; 40 | 41 | /** 42 | * 设置导航栏图标选中状态, 43 | * @param pageId 44 | */ 45 | public void setNavIconSelected(int pageId){ 46 | for (NavIconView icon : mNavIcons) { 47 | icon.setSelected(icon.getPageId() == pageId); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/SquareFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.widget.FrameLayout; 8 | 9 | /** 10 | * 正方形 frameLyaout 11 | * {@link FrameLayout} which forces itself to be laid out as square. 12 | */ 13 | public class SquareFrameLayout extends FrameLayout { 14 | 15 | 16 | public SquareFrameLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public SquareFrameLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | 28 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 29 | public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 30 | super(context, attrs, defStyleAttr, defStyleRes); 31 | } 32 | 33 | @Override 34 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 35 | final int widthSize = MeasureSpec.getSize(widthMeasureSpec); 36 | final int heightSize = MeasureSpec.getSize(heightMeasureSpec); 37 | 38 | if (widthSize == 0 && heightSize == 0) { 39 | // If there are no constraints on size, let FrameLayout measure 40 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 41 | 42 | // Now use the smallest of the measured dimensions for both dimensions 43 | final int minSize = Math.min(getMeasuredWidth(), getMeasuredHeight()); 44 | setMeasuredDimension(minSize, minSize); 45 | return; 46 | } 47 | 48 | final int size; 49 | if (widthSize == 0 || heightSize == 0) { 50 | // If one of the dimensions has no restriction on size, set both dimensions to be the 51 | // on that does 52 | size = Math.max(widthSize, heightSize); 53 | } else { 54 | // Both dimensions have restrictions on size, set both dimensions to be the 55 | // smallest of the two 56 | size = Math.min(widthSize, heightSize); 57 | } 58 | 59 | final int newMeasureSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY); 60 | super.onMeasure(newMeasureSpec, newMeasureSpec); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/uikit/widget/WrapContentLinearLayoutManager.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.uikit.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.util.AttributeSet; 7 | 8 | /** 9 | * Created by guqh on 2017/8/3. 10 | * 复写LinearLayoutManager 设置RecyclerView 11 | */ 12 | 13 | public class WrapContentLinearLayoutManager extends LinearLayoutManager { 14 | public WrapContentLinearLayoutManager(Context context) { 15 | super(context); 16 | } 17 | 18 | public WrapContentLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { 19 | super(context, orientation, reverseLayout); 20 | } 21 | 22 | public WrapContentLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 23 | super(context, attrs, defStyleAttr, defStyleRes); 24 | } 25 | 26 | @Override 27 | public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { 28 | try { 29 | super.onLayoutChildren(recycler, state); 30 | } catch (IndexOutOfBoundsException e) { 31 | e.printStackTrace(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils; 2 | 3 | /** 4 | * Created by Administrator on 2016/1/8. 5 | */ 6 | public class Constants { 7 | //通用无效id 8 | public final static int INVALID_ID = -1; 9 | //状态 10 | public final static int STATE_CODE_SUCCESS = 1; 11 | public final static int STATE_CODE_FAILED = 0; 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/ContextManager.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | 6 | import com.john.librarys.utils.dispatcher.IntentDispatcher; 7 | 8 | import java.util.LinkedList; 9 | import java.util.List; 10 | 11 | /** 12 | * 管理启动context相关的操作,比如启动activity等 13 | * 通过这里启动的activity 可以根据 @RequireLogin 等注解判断拦截 14 | * 15 | * 通过调用 {@link #addIntentIntentDispatcher(IntentDispatcher)} 来增加拦截分发器,比如登录拦截器 16 | */ 17 | public class ContextManager { 18 | 19 | static List mIntentDispatcher = new LinkedList<>(); 20 | 21 | public static void addIntentIntentDispatcher(IntentDispatcher intentDispatcher) { 22 | mIntentDispatcher.add(intentDispatcher); 23 | } 24 | 25 | public static void startActivity(Context context, Class activityClass){ 26 | startActivity(context,new Intent(context,activityClass)); 27 | } 28 | 29 | /** 30 | * 启动activity 31 | * 32 | * @param context 33 | * @param intent 34 | */ 35 | public static void startActivity(Context context, Intent intent) { 36 | 37 | for (IntentDispatcher intentInterceptor : mIntentDispatcher) { 38 | if (intentInterceptor.dispatch(context, intent)) { 39 | return; 40 | } 41 | } 42 | //不用拦截处理 43 | context.startActivity(intent); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/annotation/RequireLogin.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 是否要求登录,标注在 activity,service中 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RequireLogin { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/dispatcher/AbsLoginDispatcher.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.dispatcher; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | 6 | import com.john.librarys.utils.annotation.RequireLogin; 7 | 8 | /** 9 | * 登录拦截器 10 | */ 11 | public abstract class AbsLoginDispatcher implements IntentDispatcher { 12 | 13 | @Override 14 | public boolean dispatch(Context context, Intent intent) { 15 | //检测 注解 16 | if (intent.getComponent() != null) { 17 | String className = intent.getComponent().getClassName(); 18 | try { 19 | Class targetClass = Class.forName(className); 20 | 21 | //需要登录拦截 22 | if (targetClass.isAnnotationPresent(RequireLogin.class)) { 23 | boolean isLogin = isLogin(context); 24 | 25 | if (isLogin) { 26 | return false; 27 | } else { 28 | dispatchToLoginActivity(context, intent); 29 | return true; 30 | } 31 | } 32 | 33 | } catch (ClassNotFoundException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | return false; 38 | } 39 | 40 | /** 41 | * 是否已经登录 42 | * 43 | * @return 44 | */ 45 | public abstract boolean isLogin(Context context); 46 | 47 | /** 48 | * 跳转到登录activity ,{@link #isLogin(Context)}返false && 49 | * 目标activity 含有 {@link RequireLogin} 时生效 50 | * 51 | * @param context 52 | * @param originIntent 原来想去的意图 53 | */ 54 | public abstract void dispatchToLoginActivity(Context context, Intent originIntent); 55 | } 56 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/dispatcher/IntentDispatcher.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.dispatcher; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | 6 | /** 7 | * intent 分发器 8 | */ 9 | public interface IntentDispatcher { 10 | /** 11 | * 分发intent 12 | * 13 | * 返回值:true 代表已经处理完毕,在 {@link com.zthink.ContextManager} 中不会继续后续动作。 14 | * @param context 15 | * @param intent 16 | * @return 17 | */ 18 | boolean dispatch(Context context, Intent intent); 19 | } 20 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/download/DownloadListener.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.download; 2 | 3 | /** 4 | * 下载回调 5 | */ 6 | public interface DownloadListener { 7 | void onSuccess(long downloadId); 8 | 9 | /** 10 | * 发生错误, 11 | * @param downloadId 12 | * @param reason 具体返回 android.app.DownloadManager#ERROR_* 13 | */ 14 | void onFaild(long downloadId, int reason); 15 | 16 | /** 17 | * 进度回调 18 | * 19 | * @param downloadId 20 | * @param progress 进度 0~100 21 | */ 22 | void onPorgress(long downloadId, float progress); 23 | 24 | void onPause(long downloadId); 25 | 26 | void onCancel(long downloadId); 27 | } 28 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/permissions/Permissions.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.permissions; 2 | 3 | /** 4 | * Enum class to handle the different states 5 | * of permissions since the PackageManager only 6 | * has a granted and denied state. 7 | */ 8 | enum Permissions { 9 | GRANTED, 10 | DENIED, 11 | NOT_FOUND 12 | } 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/permissions/RequestPermissionsComponent.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.permissions; 2 | 3 | import android.app.Activity; 4 | 5 | /** 6 | * 要求权限的组件 7 | * 8 | * 配合 {@link ActivityCompat#requestPermissions(Activity, String[], int)}调用起检测权限 9 | * 然后 activity 实现此接口 {@link ActivityCompat.OnRequestPermissionsResultCallback} 然后去获取权限的选择 10 | * 或者 activit 直接继承 {@link android.support.v7.app.AppCompatActivity} 11 | * 12 | * 13 | */ 14 | public interface RequestPermissionsComponent { 15 | String[] getRequestPermissions(); 16 | } 17 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/util/BeanHelper.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.util; 2 | 3 | import java.lang.reflect.InvocationTargetException; 4 | import java.lang.reflect.Method; 5 | 6 | /** 7 | * Bean 工具类 8 | */ 9 | public class BeanHelper { 10 | 11 | /** 12 | * 拷贝属性 从 src 到dest 13 | * @param src 14 | * @param dest 15 | * @return 16 | * @throws Exception 17 | */ 18 | public static Object CopyBeanToBean(Object src, Object dest) { 19 | Method[] method1 = src.getClass().getMethods(); 20 | Method[] method2 = dest.getClass().getMethods(); 21 | String methodName1; 22 | String methodFix1; 23 | String methodName2; 24 | String methodFix2; 25 | for (int i = 0; i < method1.length; i++) { 26 | methodName1 = method1[i].getName(); 27 | methodFix1 = methodName1.substring(3, methodName1.length()); 28 | if (methodName1.startsWith("get")) { 29 | for (int j = 0; j < method2.length; j++) { 30 | methodName2 = method2[j].getName(); 31 | methodFix2 = methodName2.substring(3, methodName2.length()); 32 | if (methodName2.startsWith("set")) { 33 | if (methodFix2.equals(methodFix1)) { 34 | Object[] objs1 = new Object[0]; 35 | Object[] objs2 = new Object[1]; 36 | 37 | try { 38 | objs2[0] = method1[i].invoke(src, objs1);//激活obj1的相应的get的方法,objs1数组存放调用该方法的参数,此例中没有参数,该数组的长度为0 39 | method2[j].invoke(dest, objs2);//激活obj2的相应的set的方法,objs2数组存放调用该方法的参数 40 | } catch (IllegalAccessException e) { 41 | e.printStackTrace(); 42 | } catch (InvocationTargetException e) { 43 | e.printStackTrace(); 44 | } 45 | continue; 46 | 47 | } 48 | } 49 | } 50 | } 51 | } 52 | return dest; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/util/ClipboardHelper.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.util; 2 | 3 | import android.content.ClipboardManager; 4 | import android.content.Context; 5 | import android.text.TextUtils; 6 | import android.widget.Toast; 7 | import com.john.librarys.R; 8 | 9 | /** 10 | * Created by LinYi. 11 | */ 12 | public class ClipboardHelper { 13 | 14 | 15 | private ClipboardHelper() { 16 | 17 | } 18 | 19 | 20 | /** 21 | * 复制到剪贴板 22 | * 23 | * @param content 24 | * @param context 25 | */ 26 | public static void copy(String content, Context context) { 27 | ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); 28 | if(TextUtils.isEmpty(content)){ 29 | content = ""; 30 | } 31 | cmb.setText(content.trim()); 32 | Toast.makeText(context, context.getString(R.string.str_copy_success), Toast.LENGTH_SHORT).show(); 33 | } 34 | 35 | /** 36 | * 粘贴 37 | * 38 | * @param context 39 | * @return 40 | */ 41 | public static String paste(Context context) { 42 | ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); 43 | return cmb.getText().toString().trim(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/util/ExitHelper.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.util; 2 | 3 | 4 | import android.app.Activity; 5 | import android.app.Application; 6 | import android.os.Handler; 7 | 8 | import java.util.LinkedList; 9 | import java.util.List; 10 | 11 | /** 12 | * 用来退出整个应用程序类 13 | * 14 | * @author Administrator 15 | * 16 | */ 17 | public class ExitHelper extends Application { 18 | private List activitys = null; 19 | private static ExitHelper mInstance; 20 | 21 | private ExitHelper() { 22 | activitys = new LinkedList(); 23 | } 24 | 25 | /** 26 | * 单例模式中获取唯一的MysApplication实例 27 | * 28 | * @return 29 | */ 30 | public static ExitHelper getInstance() { 31 | if (null == mInstance) { 32 | mInstance = new ExitHelper(); 33 | } 34 | return mInstance; 35 | 36 | } 37 | 38 | /** 39 | * 把传过来的Activity添加到容器中 40 | * 41 | * @param activity 当前Activity 42 | */ 43 | public void addActivity(Activity activity) { 44 | if (activitys != null && activitys.size() > 0) { 45 | if (!activitys.contains(activity)) { 46 | activitys.add(activity); 47 | } 48 | } else { 49 | activitys.add(activity); 50 | } 51 | 52 | } 53 | 54 | /** 55 | * 遍历所有Activity并finish 56 | * 这里必须要在主线程调用 57 | * 在finshActivites执行过程中,遍历Activit关闭的时候,进程还没全部finish时,就执行了System.exit(0);这个,导致toast不能消失 58 | * 所以把System.exit(0);这句话延迟执行,就能防止这种冲突 59 | */ 60 | public void exit() { 61 | finshActivites(); 62 | new Handler().postDelayed(new Runnable() { 63 | @Override 64 | public void run() { 65 | System.exit(0); 66 | } 67 | }, 50); 68 | } 69 | 70 | /** 71 | * finish 所有 activity 72 | */ 73 | public void finshActivites(){ 74 | if (activitys != null && activitys.size() > 0) { 75 | for (Activity activity : activitys) { 76 | activity.finish(); 77 | } 78 | } 79 | } 80 | /** 81 | * 删除容器 中 activity 82 | * @param activity 83 | */ 84 | public void removeActivity(Activity activity){ 85 | activitys.remove(activity); 86 | } 87 | } 88 | 89 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/util/SDCardUtil.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.util; 2 | 3 | import android.os.Environment; 4 | import android.os.StatFs; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * 作者:林铱 于 2015/10/10 11:37创建 10 | * 邮箱:815777326@qq.com 11 | * SD卡工具类 12 | */ 13 | public class SDCardUtil { 14 | private SDCardUtil() { 15 | throw new UnsupportedOperationException("SDCardUtil is not allowed to be instantiated"); 16 | } 17 | 18 | /** 19 | * 判断SDCard是否可用 20 | * 21 | * @return 22 | */ 23 | public static boolean isSDCardEnable() { 24 | return Environment.getExternalStorageState().equals( 25 | Environment.MEDIA_MOUNTED); 26 | 27 | } 28 | 29 | /** 30 | * 获取SD卡路径 31 | * 32 | * @return 33 | */ 34 | public static String getSDCardPath() { 35 | return Environment.getExternalStorageDirectory().getAbsolutePath() 36 | + File.separator; 37 | } 38 | 39 | /** 40 | * 获取SD卡的剩余容量 单位byte 41 | * 42 | * @return 43 | */ 44 | public static long getSDCardAllSize() { 45 | if (isSDCardEnable()) { 46 | StatFs stat = new StatFs(getSDCardPath()); 47 | // 获取空闲的数据块的数量 48 | long availableBlocks = (long) stat.getAvailableBlocks() - 4; 49 | // 获取单个数据块的大小(byte) 50 | long freeBlocks = stat.getAvailableBlocks(); 51 | return freeBlocks * availableBlocks; 52 | } 53 | return 0; 54 | } 55 | 56 | /** 57 | * 获取指定路径所在空间的剩余可用容量字节数,单位byte 58 | * 59 | * @param filePath 60 | * @return 容量字节 SDCard可用空间,内部存储可用空间 61 | */ 62 | public static long getFreeBytes(String filePath) { 63 | // 如果是sd卡的下的路径,则获取sd卡可用容量 64 | if (filePath.startsWith(getSDCardPath())) { 65 | filePath = getSDCardPath(); 66 | } else {// 如果是内部存储的路径,则获取内存存储的可用容量 67 | filePath = Environment.getDataDirectory().getAbsolutePath(); 68 | } 69 | StatFs stat = new StatFs(filePath); 70 | long availableBlocks = (long) stat.getAvailableBlocks() - 4; 71 | return stat.getBlockSize() * availableBlocks; 72 | } 73 | 74 | /** 75 | * 获取系统存储路径 76 | * 77 | * @return 78 | */ 79 | public static String getRootDirectoryPath() { 80 | return Environment.getRootDirectory().getAbsolutePath(); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/java/com/john/librarys/utils/util/VerifyStrHelper.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys.utils.util; 2 | 3 | import android.text.TextUtils; 4 | 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Created by LinYi. 10 | * 验证字符串是否合格 11 | */ 12 | public class VerifyStrHelper { 13 | 14 | private VerifyStrHelper() { 15 | throw new IllegalArgumentException("VerifyStrHelper can not be instantiated"); 16 | } 17 | 18 | public static final String NICK_NAME_PATTERN = "[\\u4e00-\\u9fa5_a-zA-Z0-9_-]{4,20}"; 19 | public static final String MOBILE_PATTERN = "(13\\d|14[57]|15[^4,\\D]|17[3678]|18\\d)\\d{8}|170[059]\\d{7}"; 20 | 21 | 22 | /** 23 | * 验证昵称是否合法 24 | * 25 | * @param nickName 26 | * @return 27 | */ 28 | public static boolean verifyNickName(String nickName) { 29 | return verify(NICK_NAME_PATTERN, nickName); 30 | } 31 | 32 | /** 33 | * 验证是否为手机号码格式 34 | * 35 | * @param mobile 36 | * @return 37 | */ 38 | public static boolean verifyMobile(String mobile) { 39 | return verify(MOBILE_PATTERN, mobile); 40 | } 41 | 42 | private static boolean verify(String patternStr, String str) { 43 | if (TextUtils.isEmpty(str)) 44 | return false; 45 | Pattern pattern = Pattern.compile(patternStr); 46 | Matcher matcher = pattern.matcher(str); 47 | return matcher.matches(); 48 | } 49 | 50 | /** 51 | * 验证密码是否正确,字母,特殊符号,数字,三者要有包含其中两者, 判断密码不能是纯字母和纯数字, 长度要大于8并且小于16, 52 | * 53 | * @param password 54 | * @return 55 | */ 56 | public static boolean verifyPwd(String password) { 57 | if (password != null && password.length() <= 16 && password.length() >= 6) { 58 | boolean b1 = regex(password, "^.*[\\d]+.*$"); 59 | boolean b2 = regex(password, "^.*[A-Za-z]+.*$"); 60 | boolean b3 = regex(password, "^.*[_@#%&^+-/*\\/]+.*$"); 61 | if ((b1 && b2) || (b1 && b3) || (b2 && b3)) { 62 | return true; 63 | } 64 | } 65 | return false; 66 | } 67 | 68 | public static boolean regex(String value, String regex) { 69 | Pattern pattern = Pattern.compile(regex); 70 | Matcher matcher = pattern.matcher(value); 71 | return matcher.matches(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/anim_none.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/marquee_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/marquee_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/push_bottom_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/push_bottom_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/push_top_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/push_top_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/slide_in_from_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/slide_in_from_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/slide_out_to_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/slide_out_to_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/toast_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/toast_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/anim/trans_center_2_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/animator/scale_with_alpha.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/default_ptr_flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-hdpi/default_ptr_flip.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/default_ptr_rotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-hdpi/default_ptr_rotate.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/dialog_left_btn_selector.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 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/dialog_one_btn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/dialog_right_btn_selector.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 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/gaps_line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-hdpi/gaps_line.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/indicator_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-hdpi/indicator_arrow.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/input_guest_num_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-hdpi/input_guest_num_bg.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-hdpi/white_shape_h20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-mdpi/default_ptr_flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-mdpi/default_ptr_flip.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-mdpi/default_ptr_rotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-mdpi/default_ptr_rotate.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-mdpi/indicator_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-mdpi/indicator_arrow.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-xhdpi/default_ptr_flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-xhdpi/default_ptr_flip.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-xhdpi/default_ptr_rotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-xhdpi/default_ptr_rotate.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable-xhdpi/indicator_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable-xhdpi/indicator_arrow.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/bg_weiget_number_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/bg_weiget_number_picker_value.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/indicator_bg_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 17 | 18 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/indicator_bg_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 17 | 18 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/shape_bakeground_loadingdialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/tag_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/toast_frame.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/drawable/toast_frame.9.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/topbar_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/drawable/white_radius.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/activity_content_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/base_dialog_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 23 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/transient_notification.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/widget_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/widget_badgeitemview.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/widget_number_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 20 | 21 | 27 | 28 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/layout/widget_slideview.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 19 | 20 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/bg_num.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/bg_num.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete_blue.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_delete_white.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_num_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_num_add.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_num_del.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/icon_num_del.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/list_divider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/list_divider.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_back.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_back_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_back_dark.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/top_bar_btn_message.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_next.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_next_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_next_orange.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_pre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_pre.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_pre_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guqh/Android-Librarys/c7065309cc81b7ea4b7a80547a90296dd976b8d5/MyApplication/librarys/src/main/res/mipmap-xhdpi/widget_number_picker_btn_pre_orange.png -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-ar/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | اسحب للتحديث… 4 | اترك للتحديث… 5 | تحميل… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-cs/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tažením aktualizujete… 4 | Uvolněním aktualizujete… 5 | Načítání… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-de/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ziehen zum Aktualisieren… 4 | Loslassen zum Aktualisieren… 5 | Laden… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | Cancel 16 | Confirm 17 | An unknown erro. 18 | Network access error. 19 | Current network is unavailable. 20 | 21 | Modifies the number 22 | 23 | tag 24 | 25 | Network timeout, please try again later. 26 | Your network has entered the ISO. 27 | R & D partners are working hard to fix it 28 | 29 | Suspension window 30 | One more exit 31 | Desperately in loading. 32 | Copy success 33 | I am sorry, the program is abnormal and is about to close. 34 | 35 | 36 | Sunday 37 | Monday 38 | Tuesday 39 | Wednesday 40 | Thursday 41 | Friday 42 | Saturday 43 | 44 | 45 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-es/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tirar para actualizar… 4 | Soltar para actualizar… 5 | Cargando… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-fi/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Päivitä vetämällä alas… 5 | Päivitä vapauttamalla… 6 | Päivitetään… 7 | 8 | 9 | Päivitä vetämällä ylös… 10 | @string/pull_to_refresh_release_label 11 | @string/pull_to_refresh_refreshing_label 12 | 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-fr/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tirez pour rafraîchir… 4 | Relâcher pour rafraîchir… 5 | Chargement… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-he/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | משוך לרענון… 4 | שחרר לרענון… 5 | טוען… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-it/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tira per aggiornare… 4 | Rilascia per aggionare… 5 | Caricamento… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-iw/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | משוך לרענון… 4 | שחרר לרענון… 5 | טוען… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-ja/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 画面を引っ張って… 4 | 指を離して更新… 5 | 読み込み中… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-ko/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 당겨서 새로 고침… 4 | 놓아서 새로 고침… 5 | 로드 중… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-nl/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sleep om te vernieuwen… 4 | Loslaten om te vernieuwen… 5 | Laden… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-pl/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pociągnij, aby odświeżyć… 4 | Puść, aby odświeżyć… 5 | Wczytywanie… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-pt-rBR/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Puxe para atualizar… 4 | Libere para atualizar… 5 | Carregando… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-pt/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Puxe para atualizar… 4 | Liberação para atualizar… 5 | A carregar… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-ro/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Trage pentru a reîmprospăta… 4 | Eliberează pentru a reîmprospăta… 5 | Încărcare… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-ru/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Потяните для обновления… 4 | Отпустите для обновления… 5 | Загрузка… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values-zh/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 下拉刷新… 4 | 放开以刷新… 5 | 正在载入… 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #242424 4 | #757575 5 | #fff 6 | #F44336 7 | #D32F2F 8 | #FFCDD2 9 | #03A9F4 10 | #2a2a2a 11 | #727272 12 | #F8F8F8 13 | #B6B6B6 14 | #0000 15 | 16 | #666666 17 | #58bfe7 18 | #58bfe7 19 | #ff7575 20 | #fc4d01 21 | 22 | #bd615959 23 | #bd615959 24 | 25 | #ffffff 26 | #efeff4 27 | #63C613 28 | #F15A25 29 | 30 | #000 31 | 32 | #eb4700 33 | #eb4700 34 | 35 | 36 | @android:color/darker_gray 37 | 38 | 39 | #e6e6e6 40 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10dp 5 | 12dp 6 | 4dp 7 | 24dp 8 | 12dp 9 | 10 | 14sp 11 | 16sp 12 | 20sp 13 | 14 | 15 | 30dp 16 | 30dp 17 | 30dp 18 | 19 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values/pull_refresh_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pull to refresh… 5 | Release to refresh… 6 | Loading… 7 | 8 | 9 | @string/pull_to_refresh_pull_label 10 | @string/pull_to_refresh_release_label 11 | @string/pull_to_refresh_refreshing_label 12 | 13 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Librarys 3 | 4 | 取消 5 | 确定 6 | 发生未知错误 7 | 网络访问出错 8 | 当前网络不可用 9 | 10 | 修改数量 11 | 12 | tag 13 | 14 | 网络超时,请稍后重试 15 | 您的网络已经进入异次元 16 | 研发的小伙伴们,正在拼命修复 17 | 18 | 19 | 悬浮窗 20 | 再按一次退出 21 | 拼命加载中。 22 | 复制成功 23 | 很抱歉,程序出现异常,即将关闭。 24 | 25 | 26 | 星期日 27 | 星期一 28 | 星期二 29 | 星期三 30 | 星期四 31 | 星期五 32 | 星期六 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /MyApplication/librarys/src/test/java/com/john/librarys/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.john.librarys; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MyApplication/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':librarys' 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android-Librarys 2 | 3 | allprojects { 4 | repositories { 5 | ... 6 | maven { url 'https://jitpack.io' } 7 | } 8 | } 9 | 10 | dependencies { 11 | //compile 'com.github.guqh:Android-Librarys:v1.0.0' 12 | //compile 'com.github.guqh:Android-Librarys:v1.1.0' 13 |       //compile 'com.github.guqh:Android-Librarys:v1.3.0' 14 |       implementation 'com.github.guqh:Android-Librarys:v1.9.6' 15 | } 16 | ![image](https://github.com/guqh/Android-Librarys/blob/master/MyApplication/app/src/main/res/mipmap-hdpi/info.jpg) 17 | --------------------------------------------------------------------------------