├── .gitattributes ├── .gitignore ├── BinarySlidingMenu ├── .classpath ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── Screenshot_2015-01-15-19-10-08.png ├── Screenshot_2015-01-15-19-10-12.png ├── bin │ ├── AndroidManifest.xml │ ├── BinarySlidingMenu.apk │ ├── classes.dex │ ├── classes │ │ ├── activity │ │ │ ├── MainActivity$1.class │ │ │ ├── MainActivity$2.class │ │ │ ├── MainActivity$3.class │ │ │ ├── MainActivity$4.class │ │ │ ├── MainActivity$FragmentAdapter.class │ │ │ └── MainActivity.class │ │ └── com │ │ │ ├── zhengj │ │ │ ├── utils │ │ │ │ ├── Blur.class │ │ │ │ └── ScreenUtils.class │ │ │ └── view │ │ │ │ ├── BinarySlidingMenu$OnMenuOpenListener.class │ │ │ │ ├── BinarySlidingMenu.class │ │ │ │ ├── FooterView.class │ │ │ │ ├── Fragment1$1.class │ │ │ │ ├── Fragment1.class │ │ │ │ ├── Fragment2$1.class │ │ │ │ ├── Fragment2$2.class │ │ │ │ ├── Fragment2.class │ │ │ │ ├── HeaderView.class │ │ │ │ ├── MyLinearLayout.class │ │ │ │ ├── MyViewPaper.class │ │ │ │ ├── PullScrollView$OnPullListener.class │ │ │ │ ├── PullScrollView.class │ │ │ │ ├── XFooterView.class │ │ │ │ ├── XHeaderView.class │ │ │ │ ├── XListView$1.class │ │ │ │ ├── XListView$2.class │ │ │ │ ├── XListView$IXListViewListener.class │ │ │ │ ├── XListView$OnXScrollListener.class │ │ │ │ ├── XListView.class │ │ │ │ ├── XScrollView$1.class │ │ │ │ ├── XScrollView$2.class │ │ │ │ ├── XScrollView$3.class │ │ │ │ ├── XScrollView$4.class │ │ │ │ ├── XScrollView$IXScrollViewListener.class │ │ │ │ ├── XScrollView$OnXScrollListener.class │ │ │ │ └── XScrollView.class │ │ │ └── zj │ │ │ ├── BuildConfig.class │ │ │ ├── R$attr.class │ │ │ ├── R$color.class │ │ │ ├── R$dimen.class │ │ │ ├── R$drawable.class │ │ │ ├── R$id.class │ │ │ ├── R$layout.class │ │ │ ├── R$menu.class │ │ │ ├── R$string.class │ │ │ ├── R$style.class │ │ │ ├── R$styleable.class │ │ │ └── R.class │ ├── dexedLibs │ │ ├── android-support-v4-dab5e60c6505a01cd5c2992069a88311.jar │ │ └── nineoldandroids-2.4.0-84712f8ae9086fa7486a4b4637140b4e.jar │ ├── jarlist.cache │ ├── res │ │ └── crunch │ │ │ ├── drawable-hdpi │ │ │ ├── arrow_down.png │ │ │ ├── arrow_up.png │ │ │ ├── btn_background.png │ │ │ ├── btn_press.png │ │ │ ├── ic_launcher.png │ │ │ ├── ic_pulltorefresh_arrow.png │ │ │ ├── ic_pulltorefresh_arrow_up.png │ │ │ ├── icon.png │ │ │ ├── sy_2.png │ │ │ ├── sy_2_1.png │ │ │ ├── tab_icon1.png │ │ │ ├── tab_icon2.png │ │ │ ├── tab_icon3.png │ │ │ ├── tab_icon4.png │ │ │ ├── tab_icon5.png │ │ │ ├── tab_item_d.png │ │ │ ├── tab_item_p.png │ │ │ ├── tab_widget_background.png │ │ │ └── tztd.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ ├── ic_action_github.png │ │ │ ├── ic_launcher.png │ │ │ ├── img_1.png │ │ │ ├── img_2.png │ │ │ ├── img_3.png │ │ │ ├── img_4.png │ │ │ ├── img_5.png │ │ │ └── indicator.png │ │ │ └── drawable-xxhdpi │ │ │ └── ic_launcher.png │ └── resources.ap_ ├── gen │ └── com │ │ └── zj │ │ ├── BuildConfig.java │ │ └── R.java ├── ic_launcher-web.png ├── libs │ ├── android-support-v4.jar │ └── nineoldandroids-2.4.0.jar ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ ├── arrow_down.png │ │ ├── arrow_up.png │ │ ├── bg.jpg │ │ ├── btn_background.png │ │ ├── btn_press.png │ │ ├── ccc.jpg │ │ ├── ddd.jpg │ │ ├── eee.jpg │ │ ├── ic_launcher.png │ │ ├── ic_pulltorefresh_arrow.png │ │ ├── ic_pulltorefresh_arrow_up.png │ │ ├── icon.png │ │ ├── main_background.jpg │ │ ├── sy_2.png │ │ ├── sy_2_1.png │ │ ├── tab_icon1.png │ │ ├── tab_icon2.png │ │ ├── tab_icon3.png │ │ ├── tab_icon4.png │ │ ├── tab_icon5.png │ │ ├── tab_item_d.png │ │ ├── tab_item_p.png │ │ ├── tab_widget_background.png │ │ └── tztd.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ ├── ic_action_github.png │ │ ├── ic_launcher.png │ │ ├── img_1.png │ │ ├── img_2.png │ │ ├── img_3.png │ │ ├── img_4.png │ │ ├── img_5.png │ │ ├── img_frame_background.jpg │ │ └── indicator.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── drawable │ │ ├── selector_btn.xml │ │ ├── selector_tab_background.xml │ │ ├── selector_tab_background2.xml │ │ └── tab_indicator.xml │ ├── layout │ │ ├── activity_main.xml │ │ ├── fragment1.xml │ │ ├── fragment2.xml │ │ ├── item.xml │ │ ├── layout_menu.xml │ │ ├── layout_menu2.xml │ │ ├── main.xml │ │ ├── main_fragment_tabs.xml │ │ ├── pull_footer.xml │ │ ├── pull_header.xml │ │ ├── vw_footer.xml │ │ ├── vw_header.xml │ │ ├── vw_list_item.xml │ │ ├── vw_scroll_view_content.xml │ │ └── vw_xscrollview_layout.xml │ ├── menu │ │ └── main.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── attr.xml │ │ ├── color.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ ├── activity │ └── MainActivity.java │ └── com │ └── zhengj │ ├── utils │ ├── Blur.java │ └── ScreenUtils.java │ └── view │ ├── BinarySlidingMenu.java │ ├── FooterView.java │ ├── Fragment1.java │ ├── Fragment2.java │ ├── HeaderView.java │ ├── MyLinearLayout.java │ ├── MyViewPaper.java │ ├── PullScrollView.java │ ├── XFooterView.java │ ├── XHeaderView.java │ ├── XListView.java │ └── XScrollView.java └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /BinarySlidingMenu/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BinarySlidingMenu/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | BinarySlidingMenu 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /BinarySlidingMenu/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /BinarySlidingMenu/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /BinarySlidingMenu/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BinarySlidingMenu/Screenshot_2015-01-15-19-10-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/Screenshot_2015-01-15-19-10-08.png -------------------------------------------------------------------------------- /BinarySlidingMenu/Screenshot_2015-01-15-19-10-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/Screenshot_2015-01-15-19-10-12.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/BinarySlidingMenu.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/BinarySlidingMenu.apk -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes.dex -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity$1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity$2.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity$3.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity$4.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity$FragmentAdapter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity$FragmentAdapter.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/activity/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/activity/MainActivity.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/utils/Blur.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/utils/Blur.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/utils/ScreenUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/utils/ScreenUtils.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/BinarySlidingMenu$OnMenuOpenListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/BinarySlidingMenu$OnMenuOpenListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/BinarySlidingMenu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/BinarySlidingMenu.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/FooterView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/FooterView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment1$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment1$1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2$1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2$2.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/Fragment2.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/HeaderView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/HeaderView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/MyLinearLayout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/MyLinearLayout.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/MyViewPaper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/MyViewPaper.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/PullScrollView$OnPullListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/PullScrollView$OnPullListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/PullScrollView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/PullScrollView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XFooterView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XFooterView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XHeaderView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XHeaderView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$2.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$IXListViewListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$IXListViewListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$OnXScrollListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XListView$OnXScrollListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XListView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XListView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$1.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$2.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$3.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$4.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$IXScrollViewListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$IXScrollViewListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$OnXScrollListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView$OnXScrollListener.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zhengj/view/XScrollView.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/BuildConfig.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$attr.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$color.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$color.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$dimen.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$drawable.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$id.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$layout.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$menu.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$string.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$style.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R$styleable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R$styleable.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/classes/com/zj/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/classes/com/zj/R.class -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/dexedLibs/android-support-v4-dab5e60c6505a01cd5c2992069a88311.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/dexedLibs/android-support-v4-dab5e60c6505a01cd5c2992069a88311.jar -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/dexedLibs/nineoldandroids-2.4.0-84712f8ae9086fa7486a4b4637140b4e.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/dexedLibs/nineoldandroids-2.4.0-84712f8ae9086fa7486a4b4637140b4e.jar -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/arrow_down.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/arrow_up.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/btn_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/btn_background.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/btn_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/btn_press.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_pulltorefresh_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_pulltorefresh_arrow.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_pulltorefresh_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/ic_pulltorefresh_arrow_up.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/sy_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/sy_2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/sy_2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/sy_2_1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon3.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon4.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_icon5.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_item_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_item_d.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_item_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_item_p.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_widget_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tab_widget_background.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tztd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-hdpi/tztd.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/ic_action_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/ic_action_github.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_3.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_4.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/img_5.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xhdpi/indicator.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/bin/resources.ap_ -------------------------------------------------------------------------------- /BinarySlidingMenu/gen/com/zj/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.zj; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /BinarySlidingMenu/gen/com/zj/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.zj; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 13 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 14 | in (inches), mm (millimeters). 15 |

This may also be a reference to a resource (in the form 16 | "@[package:]type:name") or 17 | theme attribute (in the form 18 | "?[package:][type:]name") 19 | containing a value of this type. 20 | */ 21 | public static final int rightPadding=0x7f010000; 22 | } 23 | public static final class color { 24 | public static final int background=0x7f040001; 25 | public static final int title_color=0x7f040002; 26 | public static final int transparent=0x7f040000; 27 | } 28 | public static final class dimen { 29 | /** Default screen margins, per the Android Design guidelines. 30 | 31 | Customize dimensions originally defined in res/values/dimens.xml (such as 32 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. 33 | 34 | */ 35 | public static final int activity_horizontal_margin=0x7f050000; 36 | public static final int activity_vertical_margin=0x7f050001; 37 | public static final int correctWidth=0x7f050007; 38 | public static final int drag_min_distince=0x7f050002; 39 | public static final int footer_height=0x7f050005; 40 | public static final int footer_padding=0x7f050006; 41 | public static final int header_height=0x7f050004; 42 | public static final int left_distince=0x7f050003; 43 | } 44 | public static final class drawable { 45 | public static final int arrow_down=0x7f020000; 46 | public static final int arrow_up=0x7f020001; 47 | public static final int bg=0x7f020002; 48 | public static final int btn_background=0x7f020003; 49 | public static final int btn_press=0x7f020004; 50 | public static final int ccc=0x7f020005; 51 | public static final int ddd=0x7f020006; 52 | public static final int eee=0x7f020007; 53 | public static final int ic_action_github=0x7f020008; 54 | public static final int ic_launcher=0x7f020009; 55 | public static final int ic_pulltorefresh_arrow=0x7f02000a; 56 | public static final int ic_pulltorefresh_arrow_up=0x7f02000b; 57 | public static final int icon=0x7f02000c; 58 | public static final int img_1=0x7f02000d; 59 | public static final int img_2=0x7f02000e; 60 | public static final int img_3=0x7f02000f; 61 | public static final int img_4=0x7f020010; 62 | public static final int img_5=0x7f020011; 63 | public static final int img_frame_background=0x7f020012; 64 | public static final int indicator=0x7f020013; 65 | public static final int main_background=0x7f020014; 66 | public static final int selector_btn=0x7f020015; 67 | public static final int selector_tab_background=0x7f020016; 68 | public static final int selector_tab_background2=0x7f020017; 69 | public static final int sy_2=0x7f020018; 70 | public static final int sy_2_1=0x7f020019; 71 | public static final int tab_icon1=0x7f02001a; 72 | public static final int tab_icon2=0x7f02001b; 73 | public static final int tab_icon3=0x7f02001c; 74 | public static final int tab_icon4=0x7f02001d; 75 | public static final int tab_icon5=0x7f02001e; 76 | public static final int tab_indicator=0x7f02001f; 77 | public static final int tab_item_d=0x7f020020; 78 | public static final int tab_item_p=0x7f020021; 79 | public static final int tab_widget_background=0x7f020022; 80 | public static final int tztd=0x7f020023; 81 | } 82 | public static final class id { 83 | public static final int RadioButton0=0x7f09000b; 84 | public static final int RadioButton1=0x7f09000c; 85 | public static final int RadioButton2=0x7f09000d; 86 | public static final int RadioButton3=0x7f09000e; 87 | public static final int RadioButton4=0x7f09000f; 88 | public static final int action_settings=0x7f090026; 89 | public static final int content_layout=0x7f090024; 90 | public static final int content_list=0x7f090022; 91 | public static final int footer_arrow=0x7f09001a; 92 | public static final int footer_hint_text=0x7f090019; 93 | public static final int footer_layout=0x7f090025; 94 | public static final int footer_progressbar=0x7f090018; 95 | public static final int four=0x7f090006; 96 | public static final int header_arrow=0x7f090020; 97 | public static final int header_content=0x7f09001b; 98 | public static final int header_hint_text=0x7f09001d; 99 | public static final int header_hint_time=0x7f09001e; 100 | public static final int header_layout=0x7f090023; 101 | public static final int header_progressbar=0x7f09001f; 102 | public static final int header_text_layout=0x7f09001c; 103 | public static final int left_btn=0x7f090007; 104 | public static final int list_item_text=0x7f090021; 105 | public static final int list_view=0x7f090002; 106 | public static final int mRoot=0x7f090000; 107 | public static final int main_radiogroup=0x7f09000a; 108 | public static final int mylist=0x7f090001; 109 | public static final int one=0x7f090003; 110 | public static final int pull_to_load_image=0x7f090012; 111 | public static final int pull_to_load_progress=0x7f090011; 112 | public static final int pull_to_load_text=0x7f090013; 113 | public static final int pull_to_refresh_header=0x7f090010; 114 | public static final int pull_to_refresh_image=0x7f090015; 115 | public static final int pull_to_refresh_progress=0x7f090014; 116 | public static final int pull_to_refresh_text=0x7f090016; 117 | public static final int pull_to_refresh_updated_at=0x7f090017; 118 | public static final int realtabcontent=0x7f090009; 119 | public static final int right_btn=0x7f090008; 120 | public static final int three=0x7f090005; 121 | public static final int two=0x7f090004; 122 | } 123 | public static final class layout { 124 | public static final int activity_main=0x7f030000; 125 | public static final int fragment1=0x7f030001; 126 | public static final int fragment2=0x7f030002; 127 | public static final int item=0x7f030003; 128 | public static final int layout_menu=0x7f030004; 129 | public static final int layout_menu2=0x7f030005; 130 | public static final int main=0x7f030006; 131 | public static final int main_fragment_tabs=0x7f030007; 132 | public static final int pull_footer=0x7f030008; 133 | public static final int pull_header=0x7f030009; 134 | public static final int vw_footer=0x7f03000a; 135 | public static final int vw_header=0x7f03000b; 136 | public static final int vw_list_item=0x7f03000c; 137 | public static final int vw_scroll_view_content=0x7f03000d; 138 | public static final int vw_xscrollview_layout=0x7f03000e; 139 | } 140 | public static final class menu { 141 | public static final int main=0x7f080000; 142 | } 143 | public static final class string { 144 | public static final int action_settings=0x7f060001; 145 | public static final int app_name=0x7f060000; 146 | public static final int btn_list_view=0x7f060004; 147 | public static final int btn_scroll_view=0x7f060003; 148 | public static final int footer_hint_load_normal=0x7f060009; 149 | public static final int footer_hint_load_ready=0x7f06000a; 150 | public static final int header_hint_refresh_loading=0x7f060007; 151 | public static final int header_hint_refresh_normal=0x7f060005; 152 | public static final int header_hint_refresh_ready=0x7f060006; 153 | public static final int header_hint_refresh_time=0x7f060008; 154 | public static final int hello_world=0x7f060002; 155 | } 156 | public static final class style { 157 | /** 158 | Base application theme, dependent on API level. This theme is replaced 159 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 160 | 161 | 162 | Theme customizations available in newer API levels can go in 163 | res/values-vXX/styles.xml, while customizations related to 164 | backward-compatibility can go here. 165 | 166 | 167 | Base application theme for API 11+. This theme completely replaces 168 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 169 | 170 | API 11 theme customizations can go here. 171 | 172 | Base application theme for API 14+. This theme completely replaces 173 | AppBaseTheme from BOTH res/values/styles.xml and 174 | res/values-v11/styles.xml on API 14+ devices. 175 | 176 | API 14 theme customizations can go here. 177 | */ 178 | public static final int AppBaseTheme=0x7f070000; 179 | /** Application theme. 180 | All customizations that are NOT specific to a particular API-level can go here. 181 | */ 182 | public static final int AppTheme=0x7f070001; 183 | public static final int btn_style=0x7f070004; 184 | public static final int tab_item_background=0x7f070003; 185 | public static final int tab_item_text_style=0x7f070002; 186 | } 187 | public static final class styleable { 188 | /** Attributes that can be used with a BinarySlidingMenu. 189 |

Includes the following attributes:

190 | 191 | 192 | 193 | 194 | 195 |
AttributeDescription
{@link #BinarySlidingMenu_rightPadding com.zj:rightPadding}
196 | @see #BinarySlidingMenu_rightPadding 197 | */ 198 | public static final int[] BinarySlidingMenu = { 199 | 0x7f010000 200 | }; 201 | /** 202 |

This symbol is the offset where the {@link com.zj.R.attr#rightPadding} 203 | attribute's value can be found in the {@link #BinarySlidingMenu} array. 204 | 205 | 206 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 207 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 208 | in (inches), mm (millimeters). 209 |

This may also be a reference to a resource (in the form 210 | "@[package:]type:name") or 211 | theme attribute (in the form 212 | "?[package:][type:]name") 213 | containing a value of this type. 214 | @attr name com.zj:rightPadding 215 | */ 216 | public static final int BinarySlidingMenu_rightPadding = 0; 217 | }; 218 | } 219 | -------------------------------------------------------------------------------- /BinarySlidingMenu/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/ic_launcher-web.png -------------------------------------------------------------------------------- /BinarySlidingMenu/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/libs/android-support-v4.jar -------------------------------------------------------------------------------- /BinarySlidingMenu/libs/nineoldandroids-2.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/libs/nineoldandroids-2.4.0.jar -------------------------------------------------------------------------------- /BinarySlidingMenu/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /BinarySlidingMenu/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/arrow_down.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/arrow_up.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/bg.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/btn_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/btn_background.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/btn_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/btn_press.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/ccc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/ccc.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/ddd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/ddd.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/eee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/eee.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/ic_pulltorefresh_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/ic_pulltorefresh_arrow.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/ic_pulltorefresh_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/ic_pulltorefresh_arrow_up.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/main_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/main_background.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/sy_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/sy_2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/sy_2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/sy_2_1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_icon1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_icon2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_icon3.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_icon4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_icon4.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_icon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_icon5.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_item_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_item_d.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_item_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_item_p.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tab_widget_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tab_widget_background.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-hdpi/tztd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-hdpi/tztd.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/ic_action_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/ic_action_github.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_1.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_2.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_3.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_4.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_5.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/img_frame_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/img_frame_background.jpg -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xhdpi/indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xhdpi/indicator.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhengjian11/menu/dc4207682b99fa53810c99d1413df7050db42ae9/BinarySlidingMenu/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable/selector_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable/selector_tab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable/selector_tab_background2.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/drawable/tab_indicator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/fragment1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/fragment2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/layout_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 18 | 19 | 22 | 27 | 28 | 29 | 36 | 37 | 38 | 39 | 44 | 45 | 50 | 51 | 55 | 56 | 60 | 61 | 67 | 68 | 73 | 74 | 75 | 84 | 85 | 90 | 91 | 96 | 97 | 102 | 103 | 108 | 109 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/main_fragment_tabs.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 24 | 25 | 30 | 31 | 35 | 36 | 40 | 41 | 47 | 48 | 53 | 54 | 55 | 64 | 65 | 70 | 71 | 76 | 77 | 82 | 83 | 88 | 89 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/pull_footer.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 26 | 27 | 37 | 38 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/pull_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 26 | 27 | 37 | 38 | 48 | 49 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/vw_footer.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 17 | 18 | 25 | 26 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/vw_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 20 | 21 | 26 | 27 | 31 | 32 | 37 | 38 | 43 | 44 | 45 | 46 | 54 | 55 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/vw_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/vw_scroll_view_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/layout/vw_xscrollview_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 14 | 15 | 21 | 22 | 28 | 29 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/menu/main.xml: -------------------------------------------------------------------------------- 1 |

2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00000000 4 | #F7F4F0 5 | #333333 6 | 7 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 10dip 8 | 220dip 9 | 10 | 11 | 60dp 12 | 90dp 13 | 10dp 14 | 30dip 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zhy_slidingmenu 5 | Settings 6 | Hello world! 7 | 8 | 9 | 10 | ScrollView demo 11 | ListView demo 12 | 13 | Pull to refresh 14 | Release to refresh 15 | Refreshing… 16 | Time: 17 | Load more 18 | Release to load more 19 | 20 | 21 | -------------------------------------------------------------------------------- /BinarySlidingMenu/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 24 | 25 | 31 | 32 | 42 | 43 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package activity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.os.Bundle; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.app.FragmentActivity; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.app.FragmentPagerAdapter; 11 | import android.support.v4.app.FragmentTabHost; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.View.OnClickListener; 15 | import android.view.Window; 16 | import android.widget.Button; 17 | import android.widget.RadioButton; 18 | import android.widget.RadioGroup; 19 | import android.widget.RadioGroup.OnCheckedChangeListener; 20 | 21 | import com.zhengj.view.BinarySlidingMenu; 22 | import com.zhengj.view.BinarySlidingMenu.OnMenuOpenListener; 23 | import com.zhengj.view.Fragment1; 24 | import com.zhengj.view.Fragment2; 25 | import com.zhengj.view.MyViewPaper; 26 | import com.zj.R; 27 | 28 | public class MainActivity extends FragmentActivity { 29 | private BinarySlidingMenu mMenu; 30 | private List mDatas = new ArrayList(); 31 | private List fragments = new ArrayList(); 32 | private MyViewPaper pager; 33 | private Button button1; 34 | private Button button2; 35 | private FragmentTabHost mTabHost; 36 | private RadioGroup m_radioGroup; 37 | String tabs[] = { "Tab1", "Tab2" }; 38 | Class cls[] = { Fragment1.class, Fragment2.class }; 39 | private LayoutInflater inflater; 40 | private View view1; 41 | private View left_menu; 42 | private View main; 43 | private View right_menu; 44 | private Button right_btn; 45 | private Button left_btn; 46 | 47 | @Override 48 | protected void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | requestWindowFeature(Window.FEATURE_NO_TITLE); 51 | setContentView(R.layout.activity_main); 52 | 53 | inflater = LayoutInflater.from(this); 54 | left_menu = inflater.inflate(R.layout.layout_menu, null); 55 | main = inflater.inflate(R.layout.main, null); 56 | right_menu = inflater.inflate(R.layout.layout_menu2, null); 57 | 58 | mMenu = (BinarySlidingMenu) findViewById(R.id.mRoot); 59 | right_btn = (Button) main.findViewById(R.id.right_btn); 60 | left_btn = (Button) main.findViewById(R.id.left_btn); 61 | mMenu.addView(left_menu); 62 | mMenu.addView(main); 63 | mMenu.addView(right_menu); 64 | right_btn.setOnClickListener(new OnClickListener() { 65 | 66 | @Override 67 | public void onClick(View arg0) { 68 | 69 | mMenu.scrollRightMenu(); 70 | } 71 | }); 72 | 73 | left_btn.setOnClickListener(new OnClickListener() { 74 | 75 | @Override 76 | public void onClick(View arg0) { 77 | 78 | mMenu.scrollLeftMenu(); 79 | } 80 | }); 81 | 82 | mMenu.setOnMenuOpenListener(new OnMenuOpenListener() { 83 | @Override 84 | public void onMenuOpen(boolean isOpen, int flag) { 85 | if (isOpen) { 86 | // Toast.makeText(getApplicationContext(), 87 | // flag == 0 ? "LeftMenu Open" : "RightMenu Open", 88 | // Toast.LENGTH_SHORT).show(); 89 | } else { 90 | // Toast.makeText(getApplicationContext(), 91 | // flag == 0 ? "LeftMenu Close" : "RightMenu Close", 92 | // Toast.LENGTH_SHORT).show(); 93 | } 94 | 95 | } 96 | }); 97 | // pager = (MyViewPaper) findViewById(R.id.pager); 98 | // pager.setMenu(mMenu); 99 | // pager.setOnPageChangeListener(new OnPageChangeListener() { 100 | // 101 | // @Override 102 | // public void onPageSelected(int arg0) { 103 | // mMenu.setIsScroll(false); 104 | // } 105 | // 106 | // @Override 107 | // public void onPageScrolled(int arg0, float arg1, int arg2) { 108 | // 109 | // } 110 | // 111 | // @Override 112 | // public void onPageScrollStateChanged(int arg0) { 113 | // 114 | // } 115 | // }); 116 | // pager.requestDisallowInterceptTouchEvent(false); 117 | // 消息 118 | // Fragment1 placardFragment = new Fragment1(); 119 | // fragments.add(placardFragment); 120 | // 121 | // // 查询界面 122 | // Fragment2 findFragement = new Fragment2(); 123 | // fragments.add(findFragement); 124 | init(); 125 | // pager.setAdapter(new FragmentAdapter(getSupportFragmentManager())); 126 | 127 | // // 初始化数据 128 | // for (int i = 'A'; i <= 'Z'; i++) 129 | // { 130 | // mDatas.add((char) i + ""); 131 | // } 132 | // // 设置适配器 133 | // setListAdapter(new ArrayAdapter(this, R.layout.item, 134 | // mDatas)); 135 | // button1 = (Button)findViewById(R.id.button1); 136 | // button1.setOnClickListener(new OnClickListener() { 137 | // 138 | // @Override 139 | // public void onClick(View arg0) { 140 | // pager.setCurrentItem(0,false); 141 | // 142 | // } 143 | // }); 144 | // 145 | // button2 = (Button)findViewById(R.id.button2); 146 | // button2.setOnClickListener(new OnClickListener() { 147 | // 148 | // @Override 149 | // public void onClick(View arg0) { 150 | // pager.setCurrentItem(1,false); 151 | // } 152 | // }); 153 | } 154 | 155 | private void init() { 156 | mTabHost = (FragmentTabHost) this.findViewById(android.R.id.tabhost); 157 | mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); 158 | mTabHost.getTabWidget().setVisibility(View.GONE); 159 | for (int i = 0; i < tabs.length; i++) { 160 | // View tabView = 161 | // this.getLayoutInflater().inflate(R.layout.tab_indicator, null); 162 | mTabHost.addTab(mTabHost.newTabSpec(tabs[i]).setIndicator(tabs[i]), 163 | cls[i], null); 164 | } 165 | m_radioGroup = (RadioGroup) findViewById(R.id.main_radiogroup); 166 | m_radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { 167 | 168 | @Override 169 | public void onCheckedChanged(RadioGroup group, int checkedId) { 170 | switch (checkedId) { 171 | case R.id.RadioButton0: 172 | 173 | mTabHost.setCurrentTabByTag(tabs[0]); 174 | break; 175 | case R.id.RadioButton1: 176 | mTabHost.setCurrentTabByTag(tabs[1]); 177 | break; 178 | } 179 | } 180 | }); 181 | 182 | ((RadioButton) m_radioGroup.getChildAt(0)).toggle(); 183 | } 184 | 185 | /** 186 | * 页面适配器 187 | */ 188 | public class FragmentAdapter extends FragmentPagerAdapter { 189 | 190 | public FragmentAdapter(FragmentManager fm) { 191 | super(fm); 192 | } 193 | 194 | @Override 195 | public Fragment getItem(int arg0) { 196 | return fragments.get(arg0); 197 | } 198 | 199 | @Override 200 | public int getCount() { 201 | return fragments.size(); 202 | } 203 | 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/utils/Blur.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.utils; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.graphics.Bitmap; 6 | import android.graphics.BlurMaskFilter; 7 | import android.graphics.Canvas; 8 | import android.graphics.Paint; 9 | import android.os.Build.VERSION; 10 | import android.renderscript.Allocation; 11 | import android.renderscript.Element; 12 | import android.renderscript.RenderScript; 13 | import android.renderscript.ScriptIntrinsicBlur; 14 | import android.util.Log; 15 | 16 | public class Blur 17 | { 18 | 19 | @SuppressLint("NewApi") 20 | public static Bitmap fastblur(Context context, Bitmap sentBitmap, int radius) 21 | { 22 | 23 | if (VERSION.SDK_INT > 16) 24 | { 25 | Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); 26 | 27 | final RenderScript rs = RenderScript.create(context); 28 | final Allocation input = Allocation.createFromBitmap(rs, 29 | sentBitmap, Allocation.MipmapControl.MIPMAP_NONE, 30 | Allocation.USAGE_SCRIPT); 31 | final Allocation output = Allocation.createTyped(rs, 32 | input.getType()); 33 | final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, 34 | Element.U8_4(rs)); 35 | script.setRadius(radius /* e.g. 3.f */); 36 | script.setInput(input); 37 | script.forEach(output); 38 | output.copyTo(bitmap); 39 | return bitmap; 40 | } 41 | 42 | // Stack Blur v1.0 from 43 | // http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html 44 | // 45 | // Java Author: Mario Klingemann 46 | // http://incubator.quasimondo.com 47 | // created Feburary 29, 2004 48 | // Android port : Yahel Bouaziz 49 | // http://www.kayenko.com 50 | // ported april 5th, 2012 51 | 52 | // This is a compromise between Gaussian Blur and Box blur 53 | // It creates much better looking blurs than Box Blur, but is 54 | // 7x faster than my Gaussian Blur implementation. 55 | // 56 | // I called it Stack Blur because this describes best how this 57 | // filter works internally: it creates a kind of moving stack 58 | // of colors whilst scanning through the image. Thereby it 59 | // just has to add one new block of color to the right side 60 | // of the stack and remove the leftmost color. The remaining 61 | // colors on the topmost layer of the stack are either added on 62 | // or reduced by one, depending on if they are on the right or 63 | // on the left side of the stack. 64 | // 65 | // If you are using this algorithm in your code please add 66 | // the following line: 67 | // 68 | // Stack Blur Algorithm by Mario Klingemann 69 | 70 | Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); 71 | 72 | if (radius < 1) 73 | { 74 | return (null); 75 | } 76 | 77 | int w = bitmap.getWidth(); 78 | int h = bitmap.getHeight(); 79 | 80 | int[] pix = new int[w * h]; 81 | Log.e("pix", w + " " + h + " " + pix.length); 82 | bitmap.getPixels(pix, 0, w, 0, 0, w, h); 83 | 84 | int wm = w - 1; 85 | int hm = h - 1; 86 | int wh = w * h; 87 | int div = radius + radius + 1; 88 | 89 | int r[] = new int[wh]; 90 | int g[] = new int[wh]; 91 | int b[] = new int[wh]; 92 | int rsum, gsum, bsum, x, y, i, p, yp, yi, yw; 93 | int vmin[] = new int[Math.max(w, h)]; 94 | 95 | int divsum = (div + 1) >> 1; 96 | divsum *= divsum; 97 | int dv[] = new int[256 * divsum]; 98 | for (i = 0; i < 256 * divsum; i++) 99 | { 100 | dv[i] = (i / divsum); 101 | } 102 | 103 | yw = yi = 0; 104 | 105 | int[][] stack = new int[div][3]; 106 | int stackpointer; 107 | int stackstart; 108 | int[] sir; 109 | int rbs; 110 | int r1 = radius + 1; 111 | int routsum, goutsum, boutsum; 112 | int rinsum, ginsum, binsum; 113 | 114 | for (y = 0; y < h; y++) 115 | { 116 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; 117 | for (i = -radius; i <= radius; i++) 118 | { 119 | p = pix[yi + Math.min(wm, Math.max(i, 0))]; 120 | sir = stack[i + radius]; 121 | sir[0] = (p & 0xff0000) >> 16; 122 | sir[1] = (p & 0x00ff00) >> 8; 123 | sir[2] = (p & 0x0000ff); 124 | rbs = r1 - Math.abs(i); 125 | rsum += sir[0] * rbs; 126 | gsum += sir[1] * rbs; 127 | bsum += sir[2] * rbs; 128 | if (i > 0) 129 | { 130 | rinsum += sir[0]; 131 | ginsum += sir[1]; 132 | binsum += sir[2]; 133 | } else 134 | { 135 | routsum += sir[0]; 136 | goutsum += sir[1]; 137 | boutsum += sir[2]; 138 | } 139 | } 140 | stackpointer = radius; 141 | 142 | for (x = 0; x < w; x++) 143 | { 144 | 145 | r[yi] = dv[rsum]; 146 | g[yi] = dv[gsum]; 147 | b[yi] = dv[bsum]; 148 | 149 | rsum -= routsum; 150 | gsum -= goutsum; 151 | bsum -= boutsum; 152 | 153 | stackstart = stackpointer - radius + div; 154 | sir = stack[stackstart % div]; 155 | 156 | routsum -= sir[0]; 157 | goutsum -= sir[1]; 158 | boutsum -= sir[2]; 159 | 160 | if (y == 0) 161 | { 162 | vmin[x] = Math.min(x + radius + 1, wm); 163 | } 164 | p = pix[yw + vmin[x]]; 165 | 166 | sir[0] = (p & 0xff0000) >> 16; 167 | sir[1] = (p & 0x00ff00) >> 8; 168 | sir[2] = (p & 0x0000ff); 169 | 170 | rinsum += sir[0]; 171 | ginsum += sir[1]; 172 | binsum += sir[2]; 173 | 174 | rsum += rinsum; 175 | gsum += ginsum; 176 | bsum += binsum; 177 | 178 | stackpointer = (stackpointer + 1) % div; 179 | sir = stack[(stackpointer) % div]; 180 | 181 | routsum += sir[0]; 182 | goutsum += sir[1]; 183 | boutsum += sir[2]; 184 | 185 | rinsum -= sir[0]; 186 | ginsum -= sir[1]; 187 | binsum -= sir[2]; 188 | 189 | yi++; 190 | } 191 | yw += w; 192 | } 193 | for (x = 0; x < w; x++) 194 | { 195 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0; 196 | yp = -radius * w; 197 | for (i = -radius; i <= radius; i++) 198 | { 199 | yi = Math.max(0, yp) + x; 200 | 201 | sir = stack[i + radius]; 202 | 203 | sir[0] = r[yi]; 204 | sir[1] = g[yi]; 205 | sir[2] = b[yi]; 206 | 207 | rbs = r1 - Math.abs(i); 208 | 209 | rsum += r[yi] * rbs; 210 | gsum += g[yi] * rbs; 211 | bsum += b[yi] * rbs; 212 | 213 | if (i > 0) 214 | { 215 | rinsum += sir[0]; 216 | ginsum += sir[1]; 217 | binsum += sir[2]; 218 | } else 219 | { 220 | routsum += sir[0]; 221 | goutsum += sir[1]; 222 | boutsum += sir[2]; 223 | } 224 | 225 | if (i < hm) 226 | { 227 | yp += w; 228 | } 229 | } 230 | yi = x; 231 | stackpointer = radius; 232 | for (y = 0; y < h; y++) 233 | { 234 | // Preserve alpha channel: ( 0xff000000 & pix[yi] ) 235 | pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) 236 | | (dv[gsum] << 8) | dv[bsum]; 237 | 238 | rsum -= routsum; 239 | gsum -= goutsum; 240 | bsum -= boutsum; 241 | 242 | stackstart = stackpointer - radius + div; 243 | sir = stack[stackstart % div]; 244 | 245 | routsum -= sir[0]; 246 | goutsum -= sir[1]; 247 | boutsum -= sir[2]; 248 | 249 | if (x == 0) 250 | { 251 | vmin[y] = Math.min(y + r1, hm) * w; 252 | } 253 | p = x + vmin[y]; 254 | 255 | sir[0] = r[p]; 256 | sir[1] = g[p]; 257 | sir[2] = b[p]; 258 | 259 | rinsum += sir[0]; 260 | ginsum += sir[1]; 261 | binsum += sir[2]; 262 | 263 | rsum += rinsum; 264 | gsum += ginsum; 265 | bsum += binsum; 266 | 267 | stackpointer = (stackpointer + 1) % div; 268 | sir = stack[stackpointer]; 269 | 270 | routsum += sir[0]; 271 | goutsum += sir[1]; 272 | boutsum += sir[2]; 273 | 274 | rinsum -= sir[0]; 275 | ginsum -= sir[1]; 276 | binsum -= sir[2]; 277 | 278 | yi += w; 279 | } 280 | } 281 | 282 | Log.e("pix", w + " " + h + " " + pix.length); 283 | bitmap.setPixels(pix, 0, w, 0, 0, w, h); 284 | return (bitmap); 285 | } 286 | 287 | /** 288 | * 289 | * add shadow to bitmap 290 | * 291 | * @param originalBitmap 292 | * @return 293 | */ 294 | public static Bitmap drawImageDropShadow(Bitmap originalBitmap) 295 | { 296 | 297 | BlurMaskFilter blurFilter = new BlurMaskFilter(3, 298 | BlurMaskFilter.Blur.OUTER); 299 | Paint shadowPaint = new Paint(); 300 | shadowPaint.setMaskFilter(blurFilter); 301 | int[] offsetXY = new int[2]; 302 | Bitmap shadowBitmap = originalBitmap 303 | .extractAlpha(shadowPaint, offsetXY); 304 | 305 | Bitmap shadowImage32 = shadowBitmap.copy(Bitmap.Config.ARGB_8888, true); 306 | Canvas c = new Canvas(shadowImage32); 307 | c.drawBitmap(originalBitmap, 0, 0, null); 308 | return shadowImage32; 309 | } 310 | 311 | } 312 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/utils/ScreenUtils.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.utils; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.graphics.Bitmap; 6 | import android.graphics.Rect; 7 | import android.util.DisplayMetrics; 8 | import android.view.View; 9 | import android.view.WindowManager; 10 | 11 | /** 12 | * 获得屏幕相关的辅助类 13 | * 14 | * @author zhy 15 | * 16 | */ 17 | public class ScreenUtils 18 | { 19 | private ScreenUtils() 20 | { 21 | /* cannot be instantiated */ 22 | throw new UnsupportedOperationException("cannot be instantiated"); 23 | } 24 | 25 | /** 26 | * 获得屏幕高度 27 | * 28 | * @param context 29 | * @return 30 | */ 31 | public static int getScreenWidth(Context context) 32 | { 33 | WindowManager wm = (WindowManager) context 34 | .getSystemService(Context.WINDOW_SERVICE); 35 | DisplayMetrics outMetrics = new DisplayMetrics(); 36 | wm.getDefaultDisplay().getMetrics(outMetrics); 37 | return outMetrics.widthPixels; 38 | } 39 | 40 | /** 41 | * 获得屏幕宽度 42 | * 43 | * @param context 44 | * @return 45 | */ 46 | public static int getScreenHeight(Context context) 47 | { 48 | WindowManager wm = (WindowManager) context 49 | .getSystemService(Context.WINDOW_SERVICE); 50 | DisplayMetrics outMetrics = new DisplayMetrics(); 51 | wm.getDefaultDisplay().getMetrics(outMetrics); 52 | return outMetrics.heightPixels; 53 | } 54 | 55 | /** 56 | * 获得状态栏的高度 57 | * 58 | * @param context 59 | * @return 60 | */ 61 | public static int getStatusHeight(Context context) 62 | { 63 | 64 | int statusHeight = -1; 65 | try 66 | { 67 | Class clazz = Class.forName("com.android.internal.R$dimen"); 68 | Object object = clazz.newInstance(); 69 | int height = Integer.parseInt(clazz.getField("status_bar_height") 70 | .get(object).toString()); 71 | statusHeight = context.getResources().getDimensionPixelSize(height); 72 | } catch (Exception e) 73 | { 74 | e.printStackTrace(); 75 | } 76 | return statusHeight; 77 | } 78 | 79 | /** 80 | * 获取当前屏幕截图,包含状态栏 81 | * 82 | * @param activity 83 | * @return 84 | */ 85 | public static Bitmap snapShotWithStatusBar(Activity activity) 86 | { 87 | View view = activity.getWindow().getDecorView(); 88 | view.setDrawingCacheEnabled(true); 89 | view.buildDrawingCache(); 90 | Bitmap bmp = view.getDrawingCache(); 91 | int width = getScreenWidth(activity); 92 | int height = getScreenHeight(activity); 93 | Bitmap bp = null; 94 | bp = Bitmap.createBitmap(bmp, 0, 0, width, height); 95 | view.destroyDrawingCache(); 96 | return bp; 97 | 98 | } 99 | 100 | /** 101 | * 获取当前屏幕截图,不包含状态栏 102 | * 103 | * @param activity 104 | * @return 105 | */ 106 | public static Bitmap snapShotWithoutStatusBar(Activity activity) 107 | { 108 | View view = activity.getWindow().getDecorView(); 109 | view.setDrawingCacheEnabled(true); 110 | view.buildDrawingCache(); 111 | Bitmap bmp = view.getDrawingCache(); 112 | Rect frame = new Rect(); 113 | activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); 114 | int statusBarHeight = frame.top; 115 | 116 | int width = getScreenWidth(activity); 117 | int height = getScreenHeight(activity); 118 | Bitmap bp = null; 119 | bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height 120 | - statusBarHeight); 121 | view.destroyDrawingCache(); 122 | return bp; 123 | 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/BinarySlidingMenu.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.view.VelocityTracker; 8 | import android.view.View; 9 | import android.view.ViewConfiguration; 10 | import android.view.ViewGroup; 11 | import android.widget.Scroller; 12 | 13 | import com.nineoldandroids.view.ViewHelper; 14 | import com.zhengj.utils.ScreenUtils; 15 | import com.zj.R; 16 | 17 | /** 18 | * 19 | * @author zhengjian 20 | * 21 | */ 22 | public class BinarySlidingMenu extends ViewGroup { 23 | /** 24 | * 菜单的宽度 25 | */ 26 | private int mMenuWidth; 27 | private int mHalfMenuWidth = 0; 28 | 29 | private boolean isOperateRight = false; 30 | private boolean isOperateLeft = false; 31 | 32 | private View mContent; 33 | 34 | private boolean isLeftMenuOpen; 35 | private boolean isRightMenuOpen = false; 36 | 37 | private int minScrollWidth = 0; 38 | private int correctWidth = 0; 39 | private boolean ones = false; 40 | 41 | private int scrollDirection = 0; 42 | /** 43 | * 0:没有打开menu,1 打开左侧菜单,2,打开右侧菜单 44 | */ 45 | private int LastOpenDirection = 0; 46 | 47 | /** 48 | * 回调的接口 49 | * 50 | * @author zhengjian 51 | * 52 | */ 53 | public interface OnMenuOpenListener { 54 | /** 55 | * 56 | * @param isOpen 57 | * true打开菜单,false关闭菜单 58 | * @param flag 59 | * 0 左侧, 1右侧 60 | */ 61 | void onMenuOpen(boolean isOpen, int flag); 62 | } 63 | 64 | public OnMenuOpenListener mOnMenuOpenListener; 65 | private VelocityTracker mVelocityTracker; 66 | private int left_distince; 67 | private Scroller cmScroller; 68 | 69 | public void setOnMenuOpenListener(OnMenuOpenListener mOnMenuOpenListener) { 70 | this.mOnMenuOpenListener = mOnMenuOpenListener; 71 | } 72 | 73 | public BinarySlidingMenu(Context context, AttributeSet attrs) { 74 | this(context, attrs, 0); 75 | mScreenWidth = ScreenUtils.getScreenWidth(context); 76 | cmScroller = new Scroller(context); 77 | left_distince = context.getResources().getDimensionPixelSize( 78 | R.dimen.left_distince); 79 | ViewConfiguration configuration = ViewConfiguration.get(context); 80 | touchSlop = configuration.getScaledTouchSlop(); 81 | drag_min_distince = context.getResources().getDimensionPixelSize( 82 | R.dimen.drag_min_distince); 83 | minScrollWidth = left_distince / 3; 84 | correctWidth = context.getResources().getDimensionPixelSize( 85 | R.dimen.correctWidth); 86 | 87 | } 88 | 89 | /** 90 | * 屏幕宽度 91 | */ 92 | private int mScreenWidth; 93 | 94 | /** 95 | * dp 菜单距离屏幕的右边距 96 | */ 97 | // private int mMenuRightPadding; 98 | 99 | public BinarySlidingMenu(Context context, AttributeSet attrs, int defStyle) { 100 | super(context, attrs, defStyle); 101 | 102 | } 103 | 104 | public BinarySlidingMenu(Context context) { 105 | this(context, null, 0); 106 | } 107 | 108 | @Override 109 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 110 | mMenuWidth = left_distince; 111 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 112 | 113 | final int width = MeasureSpec.getSize(widthMeasureSpec); 114 | 115 | final int widthMode = MeasureSpec.getMode(widthMeasureSpec); 116 | Log.e("onMeasure", "onMeasure width = " + width); 117 | 118 | mContent = getChildAt(1); 119 | 120 | final int count = getChildCount(); 121 | for (int i = 0; i < count; i++) { 122 | getChildAt(i).measure(widthMeasureSpec, heightMeasureSpec); 123 | } 124 | } 125 | 126 | private float mLastMotionX; 127 | private float mLastMotionY; 128 | private int touchSlop; 129 | 130 | private int drag_min_distince = 10; 131 | private float mLastMotionX1; 132 | private int direction; 133 | 134 | @Override 135 | public boolean onInterceptTouchEvent(MotionEvent ev) { 136 | 137 | final int action = ev.getAction(); 138 | if (mVelocityTracker == null) { 139 | mVelocityTracker = VelocityTracker.obtain(); 140 | } 141 | mVelocityTracker.addMovement(ev); 142 | 143 | float x = ev.getX(); 144 | float y = ev.getY(); 145 | switch (action) { 146 | case MotionEvent.ACTION_MOVE: 147 | x = ev.getX(); 148 | y = ev.getY(); 149 | 150 | final int xDiff = (int) Math.abs(x - mLastMotionX); 151 | final int yDiff = (int) Math.abs(y - mLastMotionY); 152 | 153 | boolean xMoved = (Math.abs(xDiff) > (Math.abs(yDiff) + drag_min_distince)) 154 | && (xDiff > touchSlop); 155 | 156 | if (xMoved) { 157 | return true; 158 | } else { 159 | return false; 160 | } 161 | case MotionEvent.ACTION_DOWN: 162 | mLastMotionX = x; 163 | mLastMotionY = y; 164 | break; 165 | 166 | case MotionEvent.ACTION_CANCEL: 167 | return false; 168 | case MotionEvent.ACTION_UP: 169 | mLastMotionX = x; 170 | mLastMotionY = y; 171 | default: 172 | break; 173 | } 174 | 175 | return super.onInterceptTouchEvent(ev); 176 | } 177 | 178 | @Override 179 | public boolean onTouchEvent(MotionEvent ev) { 180 | int action = ev.getAction(); 181 | 182 | switch (action) { 183 | case MotionEvent.ACTION_MOVE: 184 | float x1 = ev.getX(); 185 | if (mLastMotionX1 != 0) { 186 | 187 | int dx = (int) (x1 - mLastMotionX1); 188 | int scrollX = getScrollX(); 189 | int resultScrollX = scrollX - dx; 190 | Log.e("dx=================", dx + "==="); 191 | if (dx < 0) { 192 | 193 | if (direction == 2 || direction == 0 || isLeftMenuOpen) { 194 | if (resultScrollX >= 2 * left_distince) { 195 | dx = 0; 196 | } 197 | 198 | if (resultScrollX > left_distince && isLeftMenuOpen) { 199 | dx = 0; 200 | } 201 | 202 | scrollBy(-dx, 0); 203 | } 204 | 205 | } else { 206 | if (direction == 1 || direction == 0 || isRightMenuOpen) { 207 | if (resultScrollX <= 0) { 208 | 209 | dx = 0; 210 | } 211 | 212 | if (resultScrollX < left_distince && isRightMenuOpen) { 213 | dx = 0; 214 | } 215 | 216 | scrollBy(-dx, 0); 217 | } 218 | } 219 | 220 | } 221 | mLastMotionX1 = x1; 222 | break; 223 | case MotionEvent.ACTION_DOWN: 224 | mLastMotionX1 = 0; 225 | break; 226 | 227 | case MotionEvent.ACTION_UP: 228 | mLastMotionX1 = 0; 229 | 230 | int scrollX = getScrollX(); 231 | int dx = 2 * left_distince - getScrollX(); 232 | 233 | if (direction == 1 || direction == 0) { 234 | if (getScrollX() <= mMenuWidth) { 235 | 236 | if (isLeftMenuOpen) { 237 | if (scrollX > minScrollWidth) { 238 | 239 | dx = mMenuWidth - scrollX; 240 | int startX = scrollX; 241 | cmScroller.startScroll(startX, 0, dx, 0, 242 | Math.abs(dx) * 2); 243 | 244 | if (isLeftMenuOpen && mOnMenuOpenListener != null) { 245 | mOnMenuOpenListener.onMenuOpen(false, 0); 246 | } 247 | isLeftMenuOpen = false; 248 | 249 | } else { 250 | 251 | dx = -scrollX; 252 | int startX = scrollX; 253 | cmScroller.startScroll(startX, 0, dx, 0, 254 | Math.abs(dx) * 2); 255 | if (!isLeftMenuOpen && mOnMenuOpenListener != null) { 256 | mOnMenuOpenListener.onMenuOpen(true, 0); 257 | } 258 | isLeftMenuOpen = true; 259 | 260 | } 261 | } else { 262 | 263 | if (scrollX < mMenuWidth - minScrollWidth) { 264 | dx = -scrollX; 265 | int startX = scrollX; 266 | cmScroller.startScroll(startX, 0, dx, 0, 267 | Math.abs(dx) * 2); 268 | if (isLeftMenuOpen && mOnMenuOpenListener != null) { 269 | mOnMenuOpenListener.onMenuOpen(true, 0); 270 | } 271 | isLeftMenuOpen = true; 272 | 273 | } else { 274 | dx = mMenuWidth - scrollX; 275 | int startX = scrollX; 276 | cmScroller.startScroll(startX, 0, dx, 0, 277 | Math.abs(dx) * 2); 278 | if (!isLeftMenuOpen && mOnMenuOpenListener != null) { 279 | mOnMenuOpenListener.onMenuOpen(false, 0); 280 | } 281 | isLeftMenuOpen = false; 282 | 283 | } 284 | 285 | } 286 | } 287 | 288 | } 289 | 290 | if (direction == 2 || direction == 0) { 291 | if (getScrollX() >= mMenuWidth) { 292 | if (isRightMenuOpen == false) { 293 | if (scrollX > (mMenuWidth + minScrollWidth)) { 294 | int startX = scrollX; 295 | cmScroller.startScroll(startX, 0, dx, 0, 296 | Math.abs(dx) * 2); 297 | if (!isRightMenuOpen && mOnMenuOpenListener != null) { 298 | mOnMenuOpenListener.onMenuOpen(true, 1); 299 | } 300 | isRightMenuOpen = true; 301 | } else { 302 | dx = mMenuWidth - getScrollX(); 303 | int startX = scrollX; 304 | cmScroller.startScroll(startX, 0, dx, 0, 305 | Math.abs(dx) * 2); 306 | if (isRightMenuOpen && mOnMenuOpenListener != null) { 307 | mOnMenuOpenListener.onMenuOpen(false, 1); 308 | } 309 | isRightMenuOpen = false; 310 | } 311 | } else { 312 | if (scrollX < (2 * mMenuWidth - minScrollWidth)) { 313 | dx = mMenuWidth - getScrollX(); 314 | int startX = scrollX; 315 | cmScroller.startScroll(startX, 0, dx, 0, 316 | Math.abs(dx) * 2); 317 | if (isRightMenuOpen && mOnMenuOpenListener != null) { 318 | mOnMenuOpenListener.onMenuOpen(false, 1); 319 | } 320 | isRightMenuOpen = false; 321 | } else { 322 | int startX = scrollX; 323 | cmScroller.startScroll(startX, 0, dx, 0, 324 | Math.abs(dx) * 2); 325 | if (!isRightMenuOpen && mOnMenuOpenListener != null) { 326 | mOnMenuOpenListener.onMenuOpen(true, 1); 327 | } 328 | isRightMenuOpen = true; 329 | } 330 | } 331 | } 332 | } 333 | postInvalidate(); 334 | 335 | break; 336 | default: 337 | break; 338 | } 339 | return true; 340 | } 341 | 342 | @Override 343 | public void computeScroll() { 344 | if (cmScroller.computeScrollOffset()) { 345 | scrollTo(cmScroller.getCurrX(), cmScroller.getCurrY()); 346 | } 347 | scrollChanged(); 348 | postInvalidate(); 349 | } 350 | 351 | protected void scrollChanged() { 352 | int l = getScrollX(); 353 | if (getScrollX() >= mMenuWidth) { 354 | float scale = l * 1.0f / mMenuWidth; 355 | isOperateRight = true; 356 | isOperateLeft = false; 357 | float scale1 = 1 - ((mMenuWidth * (scale - 1)) / mMenuWidth) * 0.2f; 358 | float scale2 = 1 - ((mMenuWidth * (scale - 1)) / mMenuWidth) * 0.3f; 359 | ViewHelper.setAlpha(getChildAt(2), Math.abs(scale - 1)); 360 | ViewHelper.setScaleX(mContent, (scale1)); 361 | ViewHelper.setScaleY(mContent, (scale2)); 362 | 363 | } else { 364 | float scale = l * 1.0f / mMenuWidth; 365 | isOperateRight = false; 366 | isOperateLeft = true; 367 | float scale1 = ((mMenuWidth * (scale - 1)) / mMenuWidth) * 0.2f + 1; 368 | float scale2 = ((mMenuWidth * (scale - 1)) / mMenuWidth) * 0.3f + 1; 369 | ViewHelper.setAlpha(getChildAt(0), Math.abs(scale - 1)); 370 | ViewHelper.setScaleX(mContent, (scale1)); 371 | ViewHelper.setScaleY(mContent, (scale2)); 372 | } 373 | 374 | } 375 | 376 | public void scrollRightMenu() { 377 | 378 | if (direction == 2 || direction == 0) { 379 | int scrollX = getScrollX(); 380 | int dx = 2 * left_distince - getScrollX(); 381 | Log.d("scrollX", "scrollX===" + scrollX); 382 | 383 | if (isRightMenuOpen) { 384 | dx = mMenuWidth - getScrollX(); 385 | int startX = scrollX; 386 | cmScroller.startScroll(startX, 0, dx, 0, Math.abs(dx) * 2); 387 | if (isRightMenuOpen && mOnMenuOpenListener != null) { 388 | mOnMenuOpenListener.onMenuOpen(false, 1); 389 | } 390 | isRightMenuOpen = false; 391 | } else { 392 | int startX = scrollX; 393 | if (!isRightMenuOpen && mOnMenuOpenListener != null) { 394 | mOnMenuOpenListener.onMenuOpen(true, 1); 395 | } 396 | cmScroller.startScroll(startX, 0, dx, 0, Math.abs(dx) * 2); 397 | isRightMenuOpen = true; 398 | } 399 | 400 | } 401 | postInvalidate(); 402 | } 403 | 404 | public void scrollLeftMenu() { 405 | if (direction == 1 || direction == 0) { 406 | int scrollX = getScrollX(); 407 | int dx = 2 * left_distince - getScrollX(); 408 | 409 | if (isLeftMenuOpen) { 410 | dx = mMenuWidth - scrollX; 411 | int startX = scrollX; 412 | cmScroller.startScroll(startX, 0, dx, 0, Math.abs(dx) * 2); 413 | 414 | if (isLeftMenuOpen && mOnMenuOpenListener != null) { 415 | mOnMenuOpenListener.onMenuOpen(false, 0); 416 | } 417 | isLeftMenuOpen = false; 418 | } else { 419 | dx = -scrollX; 420 | int startX = scrollX; 421 | cmScroller.startScroll(startX, 0, dx, 0, Math.abs(dx) * 2); 422 | if (!isLeftMenuOpen && mOnMenuOpenListener != null) { 423 | mOnMenuOpenListener.onMenuOpen(true, 0); 424 | } 425 | isLeftMenuOpen = true; 426 | } 427 | 428 | } 429 | postInvalidate(); 430 | } 431 | 432 | public boolean isRightMenuOpen() { 433 | return isRightMenuOpen; 434 | } 435 | 436 | @Override 437 | protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { 438 | final int childCount = getChildCount(); 439 | 440 | for (int i = 0; i < childCount; i++) { 441 | 442 | final View childView = getChildAt(i); 443 | 444 | if (childView.getVisibility() != View.GONE) { 445 | 446 | if (i == 0) { 447 | childView.layout(0, 0, left_distince + correctWidth, 448 | childView.getMeasuredHeight()); 449 | 450 | } else if (i == 1) { 451 | childView 452 | .layout(left_distince, 0, 453 | 454 | left_distince + mScreenWidth, 455 | childView.getMeasuredHeight()); 456 | 457 | } else { 458 | childView.layout(left_distince + mScreenWidth 459 | - correctWidth, 0, 460 | 461 | 2 * left_distince + mScreenWidth, 462 | childView.getMeasuredHeight()); 463 | } 464 | } 465 | } 466 | 467 | if (!ones) { 468 | ones = true; 469 | scrollTo(left_distince, 0); 470 | } 471 | 472 | } 473 | 474 | /** 475 | * direction 0:左右都支持 1向右侧 2向左侧 476 | * 477 | * @param direction 478 | */ 479 | public void setMenuEnable(int direction) { 480 | this.direction = direction; 481 | } 482 | } 483 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/FooterView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.animation.LinearInterpolator; 8 | import android.view.animation.RotateAnimation; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.ProgressBar; 12 | import android.widget.TextView; 13 | 14 | import com.zj.R; 15 | 16 | /** 17 | * 18 | * @since July 4, 2013 19 | * @author kzhang 20 | */ 21 | public class FooterView extends LinearLayout { 22 | 23 | private ProgressBar progressBar; 24 | private ImageView arrows; 25 | private TextView tvRefresh; 26 | private boolean isArrowsUp = true; 27 | 28 | public FooterView(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | } 31 | 32 | public FooterView(Context context) { 33 | super(context); 34 | LayoutInflater.from(context).inflate(R.layout.pull_footer, this); 35 | 36 | init(context); 37 | } 38 | 39 | private void init(Context context) { 40 | progressBar = (ProgressBar) findViewById(R.id.pull_to_load_progress); 41 | arrows = (ImageView) findViewById(R.id.pull_to_load_image); 42 | tvRefresh = (TextView) findViewById(R.id.pull_to_load_text); 43 | } 44 | 45 | /** 46 | * 上拉加载更多 47 | */ 48 | public int setStartLoad() { 49 | progressBar.setVisibility(View.GONE); 50 | arrows.setVisibility(View.VISIBLE); 51 | tvRefresh.setText("上拉加载更多"); 52 | 53 | if (!isArrowsUp) { 54 | RotateAnimation mReverseFlipAnimation = new RotateAnimation(180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, 55 | RotateAnimation.RELATIVE_TO_SELF, 0.5f); 56 | mReverseFlipAnimation.setInterpolator(new LinearInterpolator()); 57 | mReverseFlipAnimation.setDuration(250); 58 | mReverseFlipAnimation.setFillAfter(true); 59 | 60 | arrows.clearAnimation(); 61 | arrows.startAnimation(mReverseFlipAnimation); 62 | } 63 | 64 | isArrowsUp = true; 65 | return PullScrollView.PULL_UP_STATE; 66 | } 67 | 68 | /** 69 | * 松开手加载更多 70 | */ 71 | public int releaseLoad() { 72 | progressBar.setVisibility(View.GONE); 73 | arrows.setVisibility(View.VISIBLE); 74 | tvRefresh.setText("松开手加载更多"); 75 | 76 | if (isArrowsUp) { 77 | RotateAnimation animationUp = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, 78 | RotateAnimation.RELATIVE_TO_SELF, 0.5f); 79 | animationUp.setInterpolator(new LinearInterpolator()); 80 | animationUp.setDuration(250); 81 | animationUp.setFillAfter(true); 82 | 83 | arrows.clearAnimation(); 84 | arrows.setAnimation(animationUp); 85 | } 86 | 87 | isArrowsUp = false; 88 | return PullScrollView.RELEASE_TO_LOADING; 89 | } 90 | 91 | /** 92 | * 正在加载更多 93 | */ 94 | public int setLoading() { 95 | arrows.clearAnimation(); 96 | progressBar.setVisibility(View.VISIBLE); 97 | arrows.setVisibility(View.GONE); 98 | tvRefresh.setText("正在加载更多"); 99 | return PullScrollView.LOADING; 100 | } 101 | 102 | /** 103 | * 设置 View 高度 104 | * 105 | * @param presetHeight 106 | * 原始高度 107 | * @param currentHeight 108 | * 当前高度 109 | */ 110 | public int setPadding(int presetHeight, int paddingHeight) { 111 | this.setPadding(0, 0, 0, paddingHeight); 112 | 113 | // 初始化箭头状态向上 114 | if (paddingHeight <= presetHeight) { 115 | return setStartLoad(); 116 | } else { // 改变按钮状态向下 117 | return releaseLoad(); 118 | } 119 | } 120 | 121 | /** 122 | * 初始化 FootView PaddingButtom 123 | */ 124 | public void setPaddingButtom() { 125 | this.setPadding(0, 0, 0, 0); 126 | arrows.clearAnimation(); 127 | } 128 | 129 | /** 130 | * 显示加载更多按钮 131 | */ 132 | public void show() { 133 | this.setVisibility(View.VISIBLE); 134 | } 135 | 136 | /** 137 | * 隐藏加载更多按钮 138 | */ 139 | public void hide() { 140 | this.setVisibility(View.GONE); 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/Fragment1.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.os.Bundle; 7 | import android.support.v4.app.Fragment; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.AdapterView; 12 | import android.widget.AdapterView.OnItemClickListener; 13 | import android.widget.ArrayAdapter; 14 | import android.widget.ImageView; 15 | import android.widget.ListView; 16 | import android.widget.ProgressBar; 17 | import android.widget.Toast; 18 | 19 | import com.zj.R; 20 | 21 | public class Fragment1 extends Fragment { 22 | private String mImageUrl; 23 | 24 | private ImageView mImageView; 25 | 26 | 27 | private ProgressBar progressBar; 28 | 29 | 30 | 31 | private List mDatas = new ArrayList(); 32 | 33 | private ListView mylist; 34 | 35 | 36 | public static Fragment1 newInstance(String imageUrl) { 37 | final Fragment1 f = new Fragment1(); 38 | 39 | final Bundle args = new Bundle(); 40 | args.putString("url", imageUrl); 41 | f.setArguments(args); 42 | 43 | return f; 44 | } 45 | 46 | 47 | 48 | @Override 49 | public void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | 52 | } 53 | 54 | 55 | 56 | @Override 57 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 58 | final View v = inflater.inflate(R.layout.fragment1, container, false); 59 | // 初始化数据 60 | for (int i = 'A'; i <= 'Z'; i++) 61 | { 62 | mDatas.add((char) i + ""); 63 | } 64 | mylist = (ListView) v.findViewById(R.id.mylist); 65 | mylist.setAdapter(new ArrayAdapter(getActivity(), R.layout.item, mDatas)); 66 | 67 | mylist.setOnItemClickListener(new OnItemClickListener() { 68 | 69 | @Override 70 | public void onItemClick(AdapterView arg0, View arg1, int arg2, 71 | long arg3) { 72 | Toast.makeText(getActivity(), "=======131243243243333333333333========", 2000).show(); 73 | 74 | } 75 | }); 76 | return v; 77 | } 78 | 79 | 80 | @Override 81 | public void onActivityCreated(Bundle savedInstanceState) { 82 | super.onActivityCreated(savedInstanceState); 83 | 84 | 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/Fragment2.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Date; 6 | import java.util.List; 7 | import java.util.Locale; 8 | 9 | import android.os.Bundle; 10 | import android.os.Handler; 11 | import android.support.v4.app.Fragment; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.widget.ArrayAdapter; 16 | import android.widget.ImageView; 17 | import android.widget.ListView; 18 | import android.widget.ProgressBar; 19 | 20 | import com.zj.R; 21 | 22 | public class Fragment2 extends Fragment implements XListView.IXListViewListener{ 23 | private XListView mListView; 24 | private String mImageUrl; 25 | 26 | private ImageView mImageView; 27 | 28 | 29 | private ProgressBar progressBar; 30 | 31 | 32 | private ArrayAdapter mAdapter; 33 | private ArrayList items = new ArrayList(); 34 | private Handler mHandler; 35 | private int mIndex = 0; 36 | private int mRefreshIndex = 0; 37 | 38 | private List mDatas = new ArrayList(); 39 | 40 | private ListView mylist; 41 | 42 | 43 | public static Fragment2 newInstance(String imageUrl) { 44 | final Fragment2 f = new Fragment2(); 45 | 46 | return f; 47 | } 48 | 49 | 50 | 51 | @Override 52 | public void onCreate(Bundle savedInstanceState) { 53 | super.onCreate(savedInstanceState); 54 | 55 | } 56 | 57 | 58 | private void initView(View view) { 59 | mHandler = new Handler(); 60 | 61 | mListView = (XListView) view.findViewById(R.id.list_view); 62 | mListView.setPullRefreshEnable(true); 63 | mListView.setPullLoadEnable(true); 64 | mListView.setAutoLoadEnable(true); 65 | mListView.setXListViewListener(this); 66 | mListView.setRefreshTime(getTime()); 67 | 68 | mAdapter = new ArrayAdapter(getActivity(), R.layout.vw_list_item, items); 69 | mListView.setAdapter(mAdapter); 70 | } 71 | 72 | // @Override 73 | // public void onWindowFocusChanged(boolean hasFocus) { 74 | // super.onWindowFocusChanged(hasFocus); 75 | // 76 | // if (hasFocus) { 77 | // mListView.autoRefresh(); 78 | // } 79 | // } 80 | 81 | @Override 82 | public void onRefresh() { 83 | mHandler.postDelayed(new Runnable() { 84 | @Override 85 | public void run() { 86 | mIndex = ++mRefreshIndex; 87 | items.clear(); 88 | geneItems(); 89 | mAdapter = new ArrayAdapter(getActivity(), R.layout.vw_list_item, 90 | items); 91 | mListView.setAdapter(mAdapter); 92 | onLoad(); 93 | } 94 | }, 2500); 95 | } 96 | 97 | @Override 98 | public void onLoadMore() { 99 | mHandler.postDelayed(new Runnable() { 100 | @Override 101 | public void run() { 102 | geneItems(); 103 | mAdapter.notifyDataSetChanged(); 104 | onLoad(); 105 | } 106 | }, 2500); 107 | } 108 | 109 | private void geneItems() { 110 | for (int i = 0; i != 20; ++i) { 111 | items.add("Test XListView item " + (++mIndex)); 112 | } 113 | } 114 | 115 | private void onLoad() { 116 | mListView.stopRefresh(); 117 | mListView.stopLoadMore(); 118 | mListView.setRefreshTime(getTime()); 119 | } 120 | 121 | private String getTime() { 122 | return new SimpleDateFormat("MM-dd HH:mm", Locale.CHINA).format(new Date()); 123 | } 124 | 125 | 126 | @Override 127 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 128 | final View v = inflater.inflate(R.layout.fragment2, container, false); 129 | //XListView 130 | // 初始化数据 131 | // for (int i = 1; i <= 25; i++) 132 | // { 133 | // mDatas.add(i + ""); 134 | // } 135 | // mylist = (ListView) v.findViewById(R.id.mylist); 136 | // mylist.setAdapter(new ArrayAdapter(getActivity(), R.layout.item, mDatas)); 137 | 138 | geneItems(); 139 | initView(v); 140 | 141 | return v; 142 | } 143 | 144 | 145 | @Override 146 | public void onActivityCreated(Bundle savedInstanceState) { 147 | super.onActivityCreated(savedInstanceState); 148 | 149 | 150 | 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/HeaderView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.animation.LinearInterpolator; 8 | import android.view.animation.RotateAnimation; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.ProgressBar; 12 | import android.widget.TextView; 13 | 14 | import com.zj.R; 15 | 16 | /** 17 | * 18 | * @since July 4, 2013 19 | * @author kzhang 20 | */ 21 | public class HeaderView extends LinearLayout { 22 | 23 | private ProgressBar progressBar; 24 | private ImageView arrows; 25 | private TextView tvRefresh; 26 | private TextView tvDate; 27 | private boolean isArrowsUp = true; 28 | 29 | public HeaderView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | } 32 | 33 | public HeaderView(Context context) { 34 | super(context); 35 | LayoutInflater.from(context).inflate(R.layout.pull_header, this); 36 | 37 | init(context); 38 | } 39 | 40 | private void init(Context context) { 41 | progressBar = (ProgressBar) findViewById(R.id.pull_to_refresh_progress); 42 | arrows = (ImageView) findViewById(R.id.pull_to_refresh_image); 43 | tvRefresh = (TextView) findViewById(R.id.pull_to_refresh_text); 44 | tvDate = (TextView) findViewById(R.id.pull_to_refresh_updated_at); 45 | } 46 | 47 | /** 48 | * 下拉刷新 49 | */ 50 | public int setStartRefresh() { 51 | arrows.setVisibility(View.VISIBLE); 52 | tvRefresh.setVisibility(View.VISIBLE); 53 | tvDate.setVisibility(View.VISIBLE); 54 | progressBar.setVisibility(View.GONE); 55 | tvRefresh.setText("下拉刷新"); 56 | 57 | if (!isArrowsUp) { 58 | RotateAnimation mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 59 | 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); 60 | mReverseFlipAnimation.setInterpolator(new LinearInterpolator()); 61 | mReverseFlipAnimation.setDuration(250); 62 | mReverseFlipAnimation.setFillAfter(true); 63 | 64 | arrows.clearAnimation(); 65 | arrows.setAnimation(mReverseFlipAnimation); 66 | } 67 | 68 | isArrowsUp = true; 69 | return PullScrollView.PULL_DOWN_STATE; 70 | } 71 | 72 | /** 73 | * 松开手刷新 74 | */ 75 | public int releaseFreshing() { 76 | arrows.setVisibility(View.VISIBLE); 77 | tvRefresh.setVisibility(View.VISIBLE); 78 | tvDate.setVisibility(View.VISIBLE); 79 | progressBar.setVisibility(View.GONE); 80 | tvRefresh.setText("松开手刷新"); 81 | 82 | if (isArrowsUp) { 83 | RotateAnimation animationUp = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, 84 | RotateAnimation.RELATIVE_TO_SELF, 0.5f); 85 | animationUp.setInterpolator(new LinearInterpolator()); 86 | animationUp.setDuration(250); 87 | animationUp.setFillAfter(true); 88 | 89 | arrows.clearAnimation(); 90 | arrows.setAnimation(animationUp); 91 | } 92 | 93 | isArrowsUp = false; 94 | return PullScrollView.RELEASE_TO_REFRESH; 95 | } 96 | 97 | /** 98 | * 正在刷新 99 | */ 100 | public int setRefreshing() { 101 | arrows.clearAnimation(); 102 | arrows.setVisibility(View.GONE); 103 | tvRefresh.setVisibility(View.VISIBLE); 104 | tvDate.setVisibility(View.VISIBLE); 105 | progressBar.setVisibility(View.VISIBLE); 106 | tvRefresh.setText("正在刷新..."); 107 | return PullScrollView.REFRESHING; 108 | } 109 | 110 | /** 111 | * 设置 View 高度 112 | * 113 | * @param presetHeight 114 | * 原始高度 115 | * @param currentHeight 116 | * 当前高度 117 | */ 118 | public int setPadding(int presetHeight, int currentHeight) { 119 | this.setPadding(0, currentHeight, 0, 0); 120 | 121 | // 初始化箭头状态向下 122 | if (currentHeight <= presetHeight) { 123 | return setStartRefresh(); 124 | } else { // 改变按钮状态向上 125 | return releaseFreshing(); 126 | } 127 | } 128 | 129 | /** 130 | * 初始化 HeadView PaddingTop 131 | */ 132 | public void setPaddingTop(int paddingTop) { 133 | this.setPadding(0, paddingTop, 0, 0); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/MyLinearLayout.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.widget.LinearLayout; 8 | 9 | public class MyLinearLayout extends LinearLayout { 10 | 11 | public MyLinearLayout(Context context, AttributeSet attrs) { 12 | super(context, attrs); 13 | Log.e("TAG", "MyLinearLayout"); 14 | // setChildrenDrawingOrderEnabled(true); 15 | } 16 | 17 | @Override 18 | protected int getChildDrawingOrder(int childCount, int i) { 19 | 20 | if (i == 0) 21 | return 0; 22 | if (i == 2) 23 | return 1; 24 | if (i == 1) 25 | return 2; 26 | return super.getChildDrawingOrder(childCount, i); 27 | 28 | } 29 | 30 | @Override 31 | public boolean onInterceptTouchEvent(MotionEvent ev) { 32 | Log.e("lineratefdsafsdfsadfa", ""); 33 | return false; 34 | } 35 | 36 | @Override 37 | public boolean onTouchEvent(MotionEvent event) { 38 | Log.e("lineratefdonTouchEventsafsdfsadfa", ""); 39 | // TODO Auto-generated method stub 40 | return true; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/MyViewPaper.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.AttributeSet; 6 | import android.util.Log; 7 | import android.view.MotionEvent; 8 | 9 | public class MyViewPaper extends ViewPager{ 10 | private BinarySlidingMenu menu; 11 | public MyViewPaper(Context context) { 12 | super(context); 13 | } 14 | public MyViewPaper(Context context, AttributeSet attrs) { 15 | super(context, attrs); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | 20 | @Override 21 | public void setCurrentItem(int item, boolean smoothScroll) { 22 | // TODO Auto-generated method stub 23 | super.setCurrentItem(item, smoothScroll); 24 | } 25 | 26 | 27 | @Override 28 | public boolean onInterceptTouchEvent(MotionEvent arg0) { 29 | // TODO Auto-generated method stub 30 | Log.e("mypaper=========onInterceptTouchEvent", ""); 31 | return super.onInterceptTouchEvent(arg0); 32 | } 33 | 34 | @Override 35 | public boolean onTouchEvent(MotionEvent ev) { 36 | Log.e("myPaperfffffffffffffffff", ""); 37 | switch (ev.getAction()) { 38 | 39 | case MotionEvent.ACTION_DOWN: 40 | 41 | return true; 42 | default: 43 | break; 44 | } 45 | 46 | return super.onTouchEvent(ev); 47 | } 48 | 49 | public void setMenu(BinarySlidingMenu menu){ 50 | this.menu = menu; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/PullScrollView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.LinearLayout; 10 | import android.widget.ScrollView; 11 | 12 | /** 13 | * 14 | * @since July 4, 2013 15 | * @author kzhang 16 | */ 17 | public class PullScrollView extends ScrollView { 18 | 19 | private static final String TAG = "RefreshAndMoreView"; 20 | 21 | // pull state 上拉开始加载更多 22 | public static final int PULL_UP_STATE = 0; 23 | 24 | // pull state 下拉开始刷新 25 | public static final int PULL_DOWN_STATE = 1; 26 | 27 | // release states 释放 去刷新 28 | public static final int RELEASE_TO_REFRESH = 3; 29 | 30 | // release states 释放 去加载更多 31 | public static final int RELEASE_TO_LOADING = 4; 32 | 33 | // 正在刷新 34 | public static final int REFRESHING = 5; 35 | 36 | // 正在加载更多 37 | public static final int LOADING = 6; 38 | 39 | // 没做任何操作 40 | private static final int DONE = 7; 41 | 42 | // 实际的padding的距离与界面上偏移距离的比例 43 | private final static int RATIO = 3; 44 | 45 | private LinearLayout innerLayout; 46 | private LinearLayout bodyLayout; 47 | 48 | private HeaderView headerView; 49 | private FooterView footerView; 50 | 51 | private int headContentHeight; 52 | private int footContentHeight; 53 | // Down 初始化 Y 54 | private int startY; 55 | private int scrollY = -1; 56 | 57 | private Context mContext; 58 | 59 | // 上下拉状态 60 | private int pullState; 61 | 62 | // 刷新、加载更多 接口 63 | private OnPullListener onPullListener; 64 | 65 | public PullScrollView(Context context, AttributeSet attrs, int defStyle) { 66 | super(context, attrs, defStyle); 67 | } 68 | 69 | public PullScrollView(Context context, AttributeSet attrs) { 70 | super(context, attrs); 71 | init(context); 72 | } 73 | 74 | public PullScrollView(Context context) { 75 | super(context); 76 | init(context); 77 | } 78 | 79 | private void init(Context context) { 80 | 81 | this.mContext = context; 82 | 83 | // ScrollView 可以滑动必须有且只有一个子View - ScrollView 内装的View都将放在 innerLayout 里面 84 | // ScrollView 设置为上下滚动 LinearLayout.VERTICAL 85 | innerLayout = new LinearLayout(context); 86 | innerLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 87 | LinearLayout.LayoutParams.WRAP_CONTENT)); 88 | innerLayout.setOrientation(LinearLayout.VERTICAL); 89 | 90 | addheaderView(); 91 | 92 | // 设置 bodyLayout 区域 93 | bodyLayout = new LinearLayout(context); 94 | bodyLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 95 | LinearLayout.LayoutParams.WRAP_CONTENT)); 96 | bodyLayout.setOrientation(LinearLayout.VERTICAL); 97 | innerLayout.addView(bodyLayout); 98 | 99 | // 初始化刷新、加载状态 100 | pullState = DONE; 101 | } 102 | 103 | /** 104 | * 添加 headerView 105 | */ 106 | private void addheaderView() { 107 | headerView = new HeaderView(mContext); 108 | measureView(headerView); 109 | 110 | headContentHeight = headerView.getMeasuredHeight(); 111 | 112 | // 初始化 headerView 位置(不可见) 113 | headerView.setPaddingTop(-1 * headContentHeight); 114 | headerView.invalidate(); 115 | 116 | innerLayout.addView(headerView); 117 | addView(innerLayout); 118 | } 119 | 120 | /** 121 | * 添加 footerView 122 | */ 123 | private void addfooterView() { 124 | footerView = new FooterView(mContext); 125 | measureView(footerView); 126 | footContentHeight = footerView.getMeasuredHeight(); 127 | footerView.setPaddingButtom(); 128 | footerView.invalidate(); 129 | innerLayout.addView(footerView); 130 | } 131 | 132 | /** 133 | * 添加 BodyView : 滑动内容区域 134 | */ 135 | public void addBodyView(View view) { 136 | bodyLayout.addView(view); 137 | } 138 | 139 | /** 140 | * footer view 在此添加保证添加到 innerLayout 中的最后 141 | */ 142 | @Override 143 | protected void onFinishInflate() { 144 | super.onFinishInflate(); 145 | addfooterView(); 146 | } 147 | 148 | /** 149 | * 滑动时,首先会触发 onInterceptTouchEvent事件,然后触发 onTouchEvent 事件时 150 | * 151 | * onInterceptTouchEvent 总是将 onTouchEvent 事件中的 ACTION_DOWN 事件拦截 152 | * 153 | * 所以在此做监听,以防万一 154 | */ 155 | @Override 156 | public boolean onInterceptTouchEvent(MotionEvent event) { 157 | switch (event.getAction()) { 158 | case MotionEvent.ACTION_DOWN: 159 | // 首先拦截down事件,记录y坐标 160 | scrollY = getScrollY(); 161 | Log.i(TAG, "在down时候记录当前位置scrollY[onInterceptTouchEvent]" + scrollY); 162 | startY = (int) event.getY(); 163 | Log.i(TAG, "在down时候记录当前位置startY[onInterceptTouchEvent]" + startY); 164 | break; 165 | case MotionEvent.ACTION_MOVE: 166 | case MotionEvent.ACTION_UP: 167 | case MotionEvent.ACTION_CANCEL: 168 | } 169 | return super.onInterceptTouchEvent(event); 170 | } 171 | 172 | /** 173 | * 监听上下拉首饰操作 174 | */ 175 | @Override 176 | public boolean onTouchEvent(MotionEvent event) { 177 | 178 | if (isLoadable()) { 179 | switch (event.getAction()) { 180 | 181 | case MotionEvent.ACTION_DOWN: 182 | scrollY = getScrollY(); 183 | startY = (int) event.getY(); 184 | break; 185 | 186 | case MotionEvent.ACTION_MOVE: 187 | if (pullState != REFRESHING && pullState != LOADING) { 188 | int tempY = (int) event.getY() - startY; 189 | 190 | // 如果 ScrollViwe 滑到最顶端,且有下拉刷新手势,则激活下拉刷新动作 191 | if (tempY > 0 && scrollY == 0) { 192 | changeheaderViewHeight(tempY); 193 | } 194 | 195 | // 如果 ScrollViwe 滑倒最底端,且有上拉刷加载更多手势,则激活上拉加载更多动作 196 | else if (tempY < 0) { // 上拉加载更多 197 | changefooterViewHeight(tempY); 198 | } 199 | break; 200 | } 201 | 202 | case MotionEvent.ACTION_UP: 203 | 204 | // 重置 headerView、footerView ,激化监听 205 | resetPullStateForActionUp(); 206 | break; 207 | } 208 | } 209 | return super.onTouchEvent(event); 210 | } 211 | 212 | /* 213 | * 改变 headerView 高度 214 | */ 215 | private void changeheaderViewHeight(int tempY) { 216 | 217 | if (pullState == DONE) { 218 | pullState = headerView.setStartRefresh(); 219 | } 220 | 221 | if (pullState == PULL_DOWN_STATE || pullState == RELEASE_TO_REFRESH) { 222 | pullState = headerView.setPadding(headContentHeight, -1 * headContentHeight + tempY / RATIO); 223 | } 224 | } 225 | 226 | /* 227 | * 改变 footerView 高度 228 | */ 229 | private void changefooterViewHeight(int tempY) { 230 | if (footerView.getVisibility() == View.GONE) { 231 | return; 232 | } 233 | 234 | if (getChildAt(0).getMeasuredHeight() <= getScrollY() + getHeight()) { 235 | if (pullState == DONE) { 236 | pullState = footerView.setStartLoad(); 237 | } 238 | } 239 | 240 | if (pullState == PULL_UP_STATE || pullState == RELEASE_TO_LOADING) { 241 | pullState = footerView.setPadding(footContentHeight, (Math.abs(-tempY) / RATIO)); 242 | } 243 | } 244 | 245 | /* 246 | * 当手离开屏幕后重置 pullState 状态及 headerView、footerView,激活监听事件 247 | */ 248 | private void resetPullStateForActionUp() { 249 | if (pullState != REFRESHING && pullState != LOADING) { 250 | 251 | // 松开手刷新 252 | if (pullState == RELEASE_TO_REFRESH) { 253 | pullState = headerView.setRefreshing(); 254 | headerView.setPaddingTop(0); 255 | onPullListener.refresh(); 256 | } 257 | // 松开手加载更多 258 | else if (pullState == RELEASE_TO_LOADING) { 259 | pullState = footerView.setLoading(); 260 | footerView.setPaddingButtom(); 261 | onPullListener.loadMore(); 262 | } 263 | // 重置到最初状态 264 | else { 265 | headerView.setPaddingTop(-1 * headContentHeight); 266 | footerView.setPaddingButtom(); 267 | pullState = DONE; 268 | } 269 | } 270 | } 271 | 272 | /** 273 | * 判断是否可以上下拉刷新加载手势 274 | * 275 | * @return true:可以 276 | */ 277 | private boolean isLoadable() { 278 | if (pullState == REFRESHING || pullState == LOADING) 279 | return false; 280 | return true; 281 | } 282 | 283 | /** 284 | * 重置下拉刷新按钮状态并隐藏 285 | */ 286 | public void setheaderViewReset() { 287 | headerView.setStartRefresh(); 288 | headerView.setPaddingTop(-1 * headContentHeight); 289 | pullState = DONE; 290 | } 291 | 292 | /** 293 | * 加载更多按钮不可见 294 | */ 295 | public void setfooterViewGone() { 296 | footerView.setStartLoad(); 297 | footerView.hide(); 298 | pullState = DONE; 299 | } 300 | 301 | /** 302 | * 加载更多按钮重置为加载更多状态 303 | */ 304 | public void setfooterViewReset() { 305 | footerView.setStartLoad(); 306 | pullState = DONE; 307 | } 308 | 309 | /** 310 | * 如果:高度>0,则有父类完全决定子窗口高度大小;否则,由子窗口自己觉得自己的高度大小 311 | * 312 | * 设置 headerView、HootViwe 的 LayoutParams 属性 313 | * 314 | * @param childView 315 | */ 316 | private void measureView(View childView) { 317 | ViewGroup.LayoutParams p = childView.getLayoutParams(); 318 | if (p == null) { 319 | p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 320 | } 321 | int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width); 322 | int lpHeight = p.height; 323 | int childHeightSpec; 324 | if (lpHeight > 0) { 325 | childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY); 326 | } else { 327 | childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); 328 | } 329 | childView.measure(childWidthSpec, childHeightSpec); 330 | } 331 | 332 | public interface OnPullListener { 333 | void refresh(); 334 | 335 | void loadMore(); 336 | } 337 | 338 | public void setOnPullListener(OnPullListener onPullListener) { 339 | this.onPullListener = onPullListener; 340 | } 341 | 342 | } 343 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/XFooterView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.animation.Animation; 8 | import android.view.animation.RotateAnimation; 9 | import android.widget.LinearLayout; 10 | import android.widget.TextView; 11 | 12 | import com.zj.R; 13 | 14 | /** 15 | * The footer view for {@link com.markmao.pulltorefresh.widget.XListView} and 16 | * {@link com.markmao.pulltorefresh.widget.XScrollView} 17 | * 18 | * @author markmjw 19 | * @date 2013-10-08 20 | */ 21 | public class XFooterView extends LinearLayout { 22 | public final static int STATE_NORMAL = 0; 23 | public final static int STATE_READY = 1; 24 | public final static int STATE_LOADING = 2; 25 | 26 | private final int ROTATE_ANIM_DURATION = 180; 27 | 28 | private View mLayout; 29 | 30 | private View mProgressBar; 31 | 32 | private TextView mHintView; 33 | 34 | // private ImageView mHintImage; 35 | 36 | private Animation mRotateUpAnim; 37 | private Animation mRotateDownAnim; 38 | 39 | private int mState = STATE_NORMAL; 40 | 41 | public XFooterView(Context context) { 42 | super(context); 43 | initView(context); 44 | } 45 | 46 | public XFooterView(Context context, AttributeSet attrs) { 47 | super(context, attrs); 48 | initView(context); 49 | } 50 | 51 | private void initView(Context context) { 52 | mLayout = LayoutInflater.from(context).inflate(R.layout.vw_footer, null); 53 | mLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 54 | LayoutParams.WRAP_CONTENT)); 55 | addView(mLayout); 56 | 57 | mProgressBar = mLayout.findViewById(R.id.footer_progressbar); 58 | mHintView = (TextView) mLayout.findViewById(R.id.footer_hint_text); 59 | // mHintImage = (ImageView) mLayout.findViewById(R.id.footer_arrow); 60 | 61 | mRotateUpAnim = new RotateAnimation(0.0f, 180.0f, Animation.RELATIVE_TO_SELF, 0.5f, 62 | Animation.RELATIVE_TO_SELF, 0.5f); 63 | mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION); 64 | mRotateUpAnim.setFillAfter(true); 65 | 66 | mRotateDownAnim = new RotateAnimation(180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, 67 | Animation.RELATIVE_TO_SELF, 0.5f); 68 | mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION); 69 | mRotateDownAnim.setFillAfter(true); 70 | } 71 | 72 | /** 73 | * Set footer view state 74 | * 75 | * @see #STATE_LOADING 76 | * @see #STATE_NORMAL 77 | * @see #STATE_READY 78 | * 79 | * @param state 80 | */ 81 | public void setState(int state) { 82 | if (state == mState) return; 83 | 84 | if (state == STATE_LOADING) { 85 | // mHintImage.clearAnimation(); 86 | // mHintImage.setVisibility(View.INVISIBLE); 87 | mProgressBar.setVisibility(View.VISIBLE); 88 | mHintView.setVisibility(View.INVISIBLE); 89 | } else { 90 | mHintView.setVisibility(View.VISIBLE); 91 | // mHintImage.setVisibility(View.VISIBLE); 92 | mProgressBar.setVisibility(View.INVISIBLE); 93 | } 94 | 95 | switch (state) { 96 | case STATE_NORMAL: 97 | // if (mState == STATE_READY) { 98 | // mHintImage.startAnimation(mRotateDownAnim); 99 | // } 100 | // if (mState == STATE_LOADING) { 101 | // mHintImage.clearAnimation(); 102 | // } 103 | mHintView.setText(R.string.footer_hint_load_normal); 104 | break; 105 | 106 | case STATE_READY: 107 | if (mState != STATE_READY) { 108 | // mHintImage.clearAnimation(); 109 | // mHintImage.startAnimation(mRotateUpAnim); 110 | mHintView.setText(R.string.footer_hint_load_ready); 111 | } 112 | break; 113 | 114 | case STATE_LOADING: 115 | break; 116 | } 117 | 118 | mState = state; 119 | } 120 | 121 | /** 122 | * Set footer view bottom margin. 123 | * 124 | * @param margin 125 | */ 126 | public void setBottomMargin(int margin) { 127 | if (margin < 0) return; 128 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mLayout.getLayoutParams(); 129 | lp.bottomMargin = margin; 130 | mLayout.setLayoutParams(lp); 131 | } 132 | 133 | /** 134 | * Get footer view bottom margin. 135 | * 136 | * @return 137 | */ 138 | public int getBottomMargin() { 139 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mLayout.getLayoutParams(); 140 | return lp.bottomMargin; 141 | } 142 | 143 | /** 144 | * normal status 145 | */ 146 | public void normal() { 147 | mHintView.setVisibility(View.VISIBLE); 148 | mProgressBar.setVisibility(View.GONE); 149 | } 150 | 151 | /** 152 | * loading status 153 | */ 154 | public void loading() { 155 | mHintView.setVisibility(View.GONE); 156 | mProgressBar.setVisibility(View.VISIBLE); 157 | } 158 | 159 | /** 160 | * hide footer when disable pull load more 161 | */ 162 | public void hide() { 163 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mLayout.getLayoutParams(); 164 | lp.height = 0; 165 | mLayout.setLayoutParams(lp); 166 | } 167 | 168 | /** 169 | * show footer 170 | */ 171 | public void show() { 172 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mLayout.getLayoutParams(); 173 | lp.height = LayoutParams.WRAP_CONTENT; 174 | mLayout.setLayoutParams(lp); 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/XHeaderView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.Gravity; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.animation.Animation; 9 | import android.view.animation.RotateAnimation; 10 | import android.widget.ImageView; 11 | import android.widget.LinearLayout; 12 | import android.widget.ProgressBar; 13 | import android.widget.TextView; 14 | 15 | import com.zj.R; 16 | 17 | /** 18 | * The header view for {@link com.markmao.pulltorefresh.widget.XListView} and 19 | * {@link com.markmao.pulltorefresh.widget.XScrollView} 20 | * 21 | * @author markmjw 22 | * @date 2013-10-08 23 | */ 24 | public class XHeaderView extends LinearLayout { 25 | public final static int STATE_NORMAL = 0; 26 | public final static int STATE_READY = 1; 27 | public final static int STATE_REFRESHING = 2; 28 | 29 | private final int ROTATE_ANIM_DURATION = 180; 30 | 31 | private LinearLayout mContainer; 32 | 33 | private ImageView mArrowImageView; 34 | 35 | private ProgressBar mProgressBar; 36 | 37 | private TextView mHintTextView; 38 | 39 | private int mState = STATE_NORMAL; 40 | 41 | private Animation mRotateUpAnim; 42 | private Animation mRotateDownAnim; 43 | 44 | private boolean mIsFirst; 45 | 46 | public XHeaderView(Context context) { 47 | super(context); 48 | initView(context); 49 | } 50 | 51 | public XHeaderView(Context context, AttributeSet attrs) { 52 | super(context, attrs); 53 | initView(context); 54 | } 55 | 56 | private void initView(Context context) { 57 | // Initial set header view height 0 58 | LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0); 59 | mContainer = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.vw_header, null); 60 | addView(mContainer, lp); 61 | setGravity(Gravity.BOTTOM); 62 | 63 | mArrowImageView = (ImageView) findViewById(R.id.header_arrow); 64 | mHintTextView = (TextView) findViewById(R.id.header_hint_text); 65 | mProgressBar = (ProgressBar) findViewById(R.id.header_progressbar); 66 | 67 | mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, 68 | Animation.RELATIVE_TO_SELF, 0.5f); 69 | mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION); 70 | mRotateUpAnim.setFillAfter(true); 71 | 72 | mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, 73 | Animation.RELATIVE_TO_SELF, 0.5f); 74 | mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION); 75 | mRotateDownAnim.setFillAfter(true); 76 | } 77 | 78 | public void setState(int state) { 79 | if (state == mState && mIsFirst) { 80 | mIsFirst = true; 81 | return; 82 | } 83 | 84 | if (state == STATE_REFRESHING) { 85 | // show progress 86 | mArrowImageView.clearAnimation(); 87 | mArrowImageView.setVisibility(View.INVISIBLE); 88 | mProgressBar.setVisibility(View.VISIBLE); 89 | } else { 90 | // show arrow image 91 | mArrowImageView.setVisibility(View.VISIBLE); 92 | mProgressBar.setVisibility(View.INVISIBLE); 93 | } 94 | 95 | switch (state) { 96 | case STATE_NORMAL: 97 | if (mState == STATE_READY) { 98 | mArrowImageView.startAnimation(mRotateDownAnim); 99 | } 100 | 101 | if (mState == STATE_REFRESHING) { 102 | mArrowImageView.clearAnimation(); 103 | } 104 | 105 | mHintTextView.setText(R.string.header_hint_refresh_normal); 106 | break; 107 | 108 | case STATE_READY: 109 | if (mState != STATE_READY) { 110 | mArrowImageView.clearAnimation(); 111 | mArrowImageView.startAnimation(mRotateUpAnim); 112 | mHintTextView.setText(R.string.header_hint_refresh_ready); 113 | } 114 | break; 115 | 116 | case STATE_REFRESHING: 117 | mHintTextView.setText(R.string.header_hint_refresh_loading); 118 | break; 119 | 120 | default: 121 | break; 122 | } 123 | 124 | mState = state; 125 | } 126 | 127 | /** 128 | * Set the header view visible height. 129 | * 130 | * @param height 131 | */ 132 | public void setVisibleHeight(int height) { 133 | if (height < 0) height = 0; 134 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContainer.getLayoutParams(); 135 | lp.height = height; 136 | mContainer.setLayoutParams(lp); 137 | } 138 | 139 | /** 140 | * Get the header view visible height. 141 | * 142 | * @return 143 | */ 144 | public int getVisibleHeight() { 145 | return mContainer.getHeight(); 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/XListView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.view.Gravity; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewTreeObserver; 11 | import android.view.ViewTreeObserver.OnGlobalLayoutListener; 12 | import android.view.animation.DecelerateInterpolator; 13 | import android.widget.AbsListView; 14 | import android.widget.AbsListView.OnScrollListener; 15 | import android.widget.LinearLayout; 16 | import android.widget.ListAdapter; 17 | import android.widget.ListView; 18 | import android.widget.RelativeLayout; 19 | import android.widget.Scroller; 20 | import android.widget.TextView; 21 | 22 | import com.zj.R; 23 | 24 | /** 25 | * XListView, it's based on XListView(Maxwin) 26 | * 27 | * @author markmjw 28 | * @date 2013-10-08 29 | */ 30 | public class XListView extends ListView implements OnScrollListener { 31 | // private static final String TAG = "XListView"; 32 | 33 | private final static int SCROLL_BACK_HEADER = 0; 34 | private final static int SCROLL_BACK_FOOTER = 1; 35 | 36 | private final static int SCROLL_DURATION = 400; 37 | 38 | // when pull up >= 50px 39 | private final static int PULL_LOAD_MORE_DELTA = 50; 40 | 41 | // support iOS like pull 42 | private final static float OFFSET_RADIO = 1.8f; 43 | 44 | private float mLastY = -1; 45 | 46 | // used for scroll back 47 | private Scroller mScroller; 48 | // user's scroll listener 49 | private OnScrollListener mScrollListener; 50 | // for mScroller, scroll back from header or footer. 51 | private int mScrollBack; 52 | 53 | // the interface to trigger refresh and load more. 54 | private IXListViewListener mListener; 55 | 56 | private XHeaderView mHeader; 57 | // header view content, use it to calculate the Header's height. And hide it when disable pull refresh. 58 | private RelativeLayout mHeaderContent; 59 | private TextView mHeaderTime; 60 | private int mHeaderHeight; 61 | 62 | private LinearLayout mFooterLayout; 63 | private XFooterView mFooterView; 64 | private boolean mIsFooterReady = false; 65 | 66 | private boolean mEnablePullRefresh = true; 67 | private boolean mPullRefreshing = false; 68 | 69 | private boolean mEnablePullLoad = true; 70 | private boolean mEnableAutoLoad = false; 71 | private boolean mPullLoading = false; 72 | 73 | // total list items, used to detect is at the bottom of ListView 74 | private int mTotalItemCount; 75 | 76 | public XListView(Context context) { 77 | super(context); 78 | initWithContext(context); 79 | } 80 | 81 | public XListView(Context context, AttributeSet attrs) { 82 | super(context, attrs); 83 | initWithContext(context); 84 | } 85 | 86 | public XListView(Context context, AttributeSet attrs, int defStyle) { 87 | super(context, attrs, defStyle); 88 | initWithContext(context); 89 | } 90 | 91 | private void initWithContext(Context context) { 92 | mScroller = new Scroller(context, new DecelerateInterpolator()); 93 | super.setOnScrollListener(this); 94 | 95 | // init header view 96 | mHeader = new XHeaderView(context); 97 | mHeaderContent = (RelativeLayout) mHeader.findViewById(R.id.header_content); 98 | mHeaderTime = (TextView) mHeader.findViewById(R.id.header_hint_time); 99 | addHeaderView(mHeader); 100 | 101 | // init footer view 102 | mFooterView = new XFooterView(context); 103 | mFooterLayout = new LinearLayout(context); 104 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout 105 | .LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); 106 | params.gravity = Gravity.CENTER; 107 | mFooterLayout.addView(mFooterView, params); 108 | 109 | // init header height 110 | ViewTreeObserver observer = mHeader.getViewTreeObserver(); 111 | if (null != observer) { 112 | observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { 113 | @SuppressWarnings("deprecation") 114 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 115 | @Override 116 | public void onGlobalLayout() { 117 | mHeaderHeight = mHeaderContent.getHeight(); 118 | ViewTreeObserver observer = getViewTreeObserver(); 119 | 120 | if (null != observer) { 121 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 122 | observer.removeGlobalOnLayoutListener(this); 123 | } else { 124 | observer.removeOnGlobalLayoutListener(this); 125 | } 126 | } 127 | } 128 | }); 129 | } 130 | } 131 | 132 | @Override 133 | public void setAdapter(ListAdapter adapter) { 134 | // make sure XFooterView is the last footer view, and only add once. 135 | if (!mIsFooterReady) { 136 | mIsFooterReady = true; 137 | addFooterView(mFooterLayout); 138 | } 139 | 140 | super.setAdapter(adapter); 141 | } 142 | 143 | /** 144 | * Enable or disable pull down refresh feature. 145 | * 146 | * @param enable 147 | */ 148 | public void setPullRefreshEnable(boolean enable) { 149 | mEnablePullRefresh = enable; 150 | 151 | // disable, hide the content 152 | mHeaderContent.setVisibility(enable ? View.VISIBLE : View.INVISIBLE); 153 | } 154 | 155 | /** 156 | * Enable or disable pull up load more feature. 157 | * 158 | * @param enable 159 | */ 160 | public void setPullLoadEnable(boolean enable) { 161 | mEnablePullLoad = enable; 162 | 163 | if (!mEnablePullLoad) { 164 | mFooterView.setBottomMargin(0); 165 | mFooterView.hide(); 166 | mFooterView.setPadding(0, 0, 0, mFooterView.getHeight() * (-1)); 167 | mFooterView.setOnClickListener(null); 168 | 169 | } else { 170 | mPullLoading = false; 171 | mFooterView.setPadding(0, 0, 0, 0); 172 | mFooterView.show(); 173 | mFooterView.setState(XFooterView.STATE_NORMAL); 174 | // both "pull up" and "click" will invoke load more. 175 | mFooterView.setOnClickListener(new OnClickListener() { 176 | @Override 177 | public void onClick(View v) { 178 | startLoadMore(); 179 | } 180 | }); 181 | } 182 | } 183 | 184 | /** 185 | * Enable or disable auto load more feature when scroll to bottom. 186 | * 187 | * @param enable 188 | */ 189 | public void setAutoLoadEnable(boolean enable) { 190 | mEnableAutoLoad = enable; 191 | } 192 | 193 | /** 194 | * Stop refresh, reset header view. 195 | */ 196 | public void stopRefresh() { 197 | if (mPullRefreshing) { 198 | mPullRefreshing = false; 199 | resetHeaderHeight(); 200 | } 201 | } 202 | 203 | /** 204 | * Stop load more, reset footer view. 205 | */ 206 | public void stopLoadMore() { 207 | if (mPullLoading) { 208 | mPullLoading = false; 209 | mFooterView.setState(XFooterView.STATE_NORMAL); 210 | } 211 | } 212 | 213 | /** 214 | * Set last refresh time 215 | * 216 | * @param time 217 | */ 218 | public void setRefreshTime(String time) { 219 | mHeaderTime.setText(time); 220 | } 221 | 222 | /** 223 | * Set listener. 224 | * 225 | * @param listener 226 | */ 227 | public void setXListViewListener(IXListViewListener listener) { 228 | mListener = listener; 229 | } 230 | 231 | /** 232 | * Auto call back refresh. 233 | */ 234 | public void autoRefresh() { 235 | mHeader.setVisibleHeight(mHeaderHeight); 236 | 237 | if (mEnablePullRefresh && !mPullRefreshing) { 238 | // update the arrow image not refreshing 239 | if (mHeader.getVisibleHeight() > mHeaderHeight) { 240 | mHeader.setState(XHeaderView.STATE_READY); 241 | } else { 242 | mHeader.setState(XHeaderView.STATE_NORMAL); 243 | } 244 | } 245 | 246 | mPullRefreshing = true; 247 | mHeader.setState(XHeaderView.STATE_REFRESHING); 248 | refresh(); 249 | } 250 | 251 | private void invokeOnScrolling() { 252 | if (mScrollListener instanceof OnXScrollListener) { 253 | OnXScrollListener listener = (OnXScrollListener) mScrollListener; 254 | listener.onXScrolling(this); 255 | } 256 | } 257 | 258 | private void updateHeaderHeight(float delta) { 259 | mHeader.setVisibleHeight((int) delta + mHeader.getVisibleHeight()); 260 | 261 | if (mEnablePullRefresh && !mPullRefreshing) { 262 | // update the arrow image unrefreshing 263 | if (mHeader.getVisibleHeight() > mHeaderHeight) { 264 | mHeader.setState(XHeaderView.STATE_READY); 265 | } else { 266 | mHeader.setState(XHeaderView.STATE_NORMAL); 267 | } 268 | } 269 | 270 | // scroll to top each time 271 | setSelection(0); 272 | } 273 | 274 | private void resetHeaderHeight() { 275 | int height = mHeader.getVisibleHeight(); 276 | if (height == 0) return; 277 | 278 | // refreshing and header isn't shown fully. do nothing. 279 | if (mPullRefreshing && height <= mHeaderHeight) return; 280 | 281 | // default: scroll back to dismiss header. 282 | int finalHeight = 0; 283 | // is refreshing, just scroll back to show all the header. 284 | if (mPullRefreshing && height > mHeaderHeight) { 285 | finalHeight = mHeaderHeight; 286 | } 287 | 288 | mScrollBack = SCROLL_BACK_HEADER; 289 | mScroller.startScroll(0, height, 0, finalHeight - height, SCROLL_DURATION); 290 | 291 | // trigger computeScroll 292 | invalidate(); 293 | } 294 | 295 | private void updateFooterHeight(float delta) { 296 | int height = mFooterView.getBottomMargin() + (int) delta; 297 | 298 | if (mEnablePullLoad && !mPullLoading) { 299 | if (height > PULL_LOAD_MORE_DELTA) { 300 | // height enough to invoke load more. 301 | mFooterView.setState(XFooterView.STATE_READY); 302 | } else { 303 | mFooterView.setState(XFooterView.STATE_NORMAL); 304 | } 305 | } 306 | 307 | mFooterView.setBottomMargin(height); 308 | 309 | // scroll to bottom 310 | // setSelection(mTotalItemCount - 1); 311 | } 312 | 313 | private void resetFooterHeight() { 314 | int bottomMargin = mFooterView.getBottomMargin(); 315 | 316 | if (bottomMargin > 0) { 317 | mScrollBack = SCROLL_BACK_FOOTER; 318 | mScroller.startScroll(0, bottomMargin, 0, -bottomMargin, SCROLL_DURATION); 319 | invalidate(); 320 | } 321 | } 322 | 323 | private void startLoadMore() { 324 | mPullLoading = true; 325 | mFooterView.setState(XFooterView.STATE_LOADING); 326 | loadMore(); 327 | } 328 | 329 | @Override 330 | public boolean onTouchEvent(MotionEvent ev) { 331 | if (mLastY == -1) { 332 | mLastY = ev.getRawY(); 333 | } 334 | 335 | switch (ev.getAction()) { 336 | case MotionEvent.ACTION_DOWN: 337 | mLastY = ev.getRawY(); 338 | break; 339 | 340 | case MotionEvent.ACTION_MOVE: 341 | final float deltaY = ev.getRawY() - mLastY; 342 | mLastY = ev.getRawY(); 343 | 344 | if (getFirstVisiblePosition() == 0 && (mHeader.getVisibleHeight() > 0 || 345 | deltaY > 0)) { 346 | // the first item is showing, header has shown or pull down. 347 | updateHeaderHeight(deltaY / OFFSET_RADIO); 348 | invokeOnScrolling(); 349 | 350 | } else if (getLastVisiblePosition() == mTotalItemCount - 1 && (mFooterView 351 | .getBottomMargin() > 0 || deltaY < 0)) { 352 | // last item, already pulled up or want to pull up. 353 | updateFooterHeight(-deltaY / OFFSET_RADIO); 354 | } 355 | break; 356 | 357 | default: 358 | // reset 359 | mLastY = -1; 360 | if (getFirstVisiblePosition() == 0) { 361 | // invoke refresh 362 | if (mEnablePullRefresh && mHeader.getVisibleHeight() > mHeaderHeight) { 363 | mPullRefreshing = true; 364 | mHeader.setState(XHeaderView.STATE_REFRESHING); 365 | refresh(); 366 | } 367 | 368 | resetHeaderHeight(); 369 | 370 | } else if (getLastVisiblePosition() == mTotalItemCount - 1) { 371 | // invoke load more. 372 | if (mEnablePullLoad && mFooterView.getBottomMargin() > PULL_LOAD_MORE_DELTA) { 373 | startLoadMore(); 374 | } 375 | resetFooterHeight(); 376 | } 377 | break; 378 | } 379 | return super.onTouchEvent(ev); 380 | } 381 | 382 | @Override 383 | public void computeScroll() { 384 | if (mScroller.computeScrollOffset()) { 385 | if (mScrollBack == SCROLL_BACK_HEADER) { 386 | mHeader.setVisibleHeight(mScroller.getCurrY()); 387 | } else { 388 | mFooterView.setBottomMargin(mScroller.getCurrY()); 389 | } 390 | 391 | postInvalidate(); 392 | invokeOnScrolling(); 393 | } 394 | 395 | super.computeScroll(); 396 | } 397 | 398 | @Override 399 | public void setOnScrollListener(OnScrollListener l) { 400 | mScrollListener = l; 401 | } 402 | 403 | @Override 404 | public void onScrollStateChanged(AbsListView view, int scrollState) { 405 | if (mScrollListener != null) { 406 | mScrollListener.onScrollStateChanged(view, scrollState); 407 | } 408 | 409 | if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) { 410 | if (mEnableAutoLoad && getLastVisiblePosition() == getCount() - 1) { 411 | startLoadMore(); 412 | } 413 | } 414 | } 415 | 416 | @Override 417 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, 418 | int totalItemCount) { 419 | // send to user's listener 420 | mTotalItemCount = totalItemCount; 421 | if (mScrollListener != null) { 422 | mScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); 423 | } 424 | } 425 | 426 | private void refresh() { 427 | if (mEnablePullRefresh && null != mListener) { 428 | mListener.onRefresh(); 429 | } 430 | } 431 | 432 | private void loadMore() { 433 | if (mEnablePullLoad && null != mListener) { 434 | mListener.onLoadMore(); 435 | } 436 | } 437 | 438 | /** 439 | * You can listen ListView.OnScrollListener or this one. it will invoke 440 | * onXScrolling when header/footer scroll back. 441 | */ 442 | public interface OnXScrollListener extends OnScrollListener { 443 | public void onXScrolling(View view); 444 | } 445 | 446 | /** 447 | * Implements this interface to get refresh/load more event. 448 | * 449 | * @author markmjw 450 | */ 451 | public interface IXListViewListener { 452 | public void onRefresh(); 453 | 454 | public void onLoadMore(); 455 | } 456 | } 457 | -------------------------------------------------------------------------------- /BinarySlidingMenu/src/com/zhengj/view/XScrollView.java: -------------------------------------------------------------------------------- 1 | package com.zhengj.view; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.view.Gravity; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.view.ViewTreeObserver; 12 | import android.view.ViewTreeObserver.OnGlobalLayoutListener; 13 | import android.view.animation.DecelerateInterpolator; 14 | import android.widget.AbsListView; 15 | import android.widget.AbsListView.OnScrollListener; 16 | import android.widget.LinearLayout; 17 | import android.widget.RelativeLayout; 18 | import android.widget.ScrollView; 19 | import android.widget.Scroller; 20 | import android.widget.TextView; 21 | 22 | import com.zj.R; 23 | 24 | /** 25 | * XScrollView, modified from {@link com.markmao.pulltorefresh.widget.XListView} 26 | * 27 | * @author markmjw 28 | * @date 2013-10-08 29 | * @see com.markmao.pulltorefresh.widget.XListView 30 | */ 31 | public class XScrollView extends ScrollView implements OnScrollListener { 32 | // private static final String TAG = "XScrollView"; 33 | 34 | private final static int SCROLL_BACK_HEADER = 0; 35 | private final static int SCROLL_BACK_FOOTER = 1; 36 | 37 | private final static int SCROLL_DURATION = 400; 38 | 39 | // when pull up >= 50px 40 | private final static int PULL_LOAD_MORE_DELTA = 50; 41 | 42 | // support iOS like pull 43 | private final static float OFFSET_RADIO = 1.8f; 44 | 45 | private float mLastY = -1; 46 | 47 | // used for scroll back 48 | private Scroller mScroller; 49 | // user's scroll listener 50 | private OnScrollListener mScrollListener; 51 | // for mScroller, scroll back from header or footer. 52 | private int mScrollBack; 53 | 54 | // the interface to trigger refresh and load more. 55 | private IXScrollViewListener mListener; 56 | 57 | private LinearLayout mLayout; 58 | private LinearLayout mContentLayout; 59 | 60 | private XHeaderView mHeader; 61 | // header view content, use it to calculate the Header's height. And hide it when disable pull refresh. 62 | private RelativeLayout mHeaderContent; 63 | private TextView mHeaderTime; 64 | private int mHeaderHeight; 65 | 66 | private XFooterView mFooterView; 67 | 68 | private boolean mEnablePullRefresh = true; 69 | private boolean mPullRefreshing = false; 70 | 71 | private boolean mEnablePullLoad = true; 72 | private boolean mEnableAutoLoad = false; 73 | private boolean mPullLoading = false; 74 | 75 | public XScrollView(Context context) { 76 | super(context); 77 | initWithContext(context); 78 | } 79 | 80 | public XScrollView(Context context, AttributeSet attrs) { 81 | super(context, attrs); 82 | initWithContext(context); 83 | } 84 | 85 | public XScrollView(Context context, AttributeSet attrs, int defStyle) { 86 | super(context, attrs, defStyle); 87 | initWithContext(context); 88 | } 89 | 90 | private void initWithContext(Context context) { 91 | mLayout = (LinearLayout) View.inflate(context, R.layout.vw_xscrollview_layout, null); 92 | mContentLayout = (LinearLayout) mLayout.findViewById(R.id.content_layout); 93 | 94 | mScroller = new Scroller(context, new DecelerateInterpolator()); 95 | // XScrollView need the scroll event, and it will dispatch the event to user's listener (as a proxy). 96 | this.setOnScrollListener(this); 97 | 98 | // init header view 99 | mHeader = new XHeaderView(context); 100 | mHeaderContent = (RelativeLayout) mHeader.findViewById(R.id.header_content); 101 | mHeaderTime = (TextView) mHeader.findViewById(R.id.header_hint_time); 102 | LinearLayout headerLayout = (LinearLayout) mLayout.findViewById(R.id.header_layout); 103 | headerLayout.addView(mHeader); 104 | 105 | // init footer view 106 | mFooterView = new XFooterView(context); 107 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( 108 | LinearLayout.LayoutParams.MATCH_PARENT, 109 | LinearLayout.LayoutParams.MATCH_PARENT); 110 | params.gravity = Gravity.CENTER; 111 | LinearLayout footLayout = (LinearLayout) mLayout.findViewById(R.id.footer_layout); 112 | footLayout.addView(mFooterView, params); 113 | 114 | // init header height 115 | ViewTreeObserver observer = mHeader.getViewTreeObserver(); 116 | if (null != observer) { 117 | observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { 118 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 119 | @SuppressWarnings("deprecation") 120 | @Override 121 | public void onGlobalLayout() { 122 | mHeaderHeight = mHeaderContent.getHeight(); 123 | ViewTreeObserver observer = getViewTreeObserver(); 124 | if (null != observer) { 125 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 126 | observer.removeGlobalOnLayoutListener(this); 127 | } else { 128 | observer.removeOnGlobalLayoutListener(this); 129 | } 130 | } 131 | } 132 | }); 133 | } 134 | 135 | this.addView(mLayout); 136 | } 137 | 138 | /** 139 | * Set the content ViewGroup for XScrollView. 140 | * 141 | * @param content 142 | */ 143 | public void setContentView(ViewGroup content) { 144 | if (mLayout == null) { 145 | return; 146 | } 147 | 148 | if (mContentLayout == null) { 149 | mContentLayout = (LinearLayout) mLayout.findViewById(R.id.content_layout); 150 | } 151 | 152 | if (mContentLayout.getChildCount() > 0) { 153 | mContentLayout.removeAllViews(); 154 | } 155 | mContentLayout.addView(content); 156 | } 157 | 158 | /** 159 | * Set the content View for XScrollView. 160 | * 161 | * @param content 162 | */ 163 | public void setView(View content) { 164 | if (mLayout == null) { 165 | return; 166 | } 167 | 168 | if (mContentLayout == null) { 169 | mContentLayout = (LinearLayout) mLayout.findViewById(R.id.content_layout); 170 | } 171 | mContentLayout.addView(content); 172 | } 173 | 174 | /** 175 | * Enable or disable pull down refresh feature. 176 | * 177 | * @param enable 178 | */ 179 | public void setPullRefreshEnable(boolean enable) { 180 | mEnablePullRefresh = enable; 181 | 182 | // disable, hide the content 183 | mHeaderContent.setVisibility(enable ? View.VISIBLE : View.INVISIBLE); 184 | } 185 | 186 | /** 187 | * Enable or disable pull up load more feature. 188 | * 189 | * @param enable 190 | */ 191 | public void setPullLoadEnable(boolean enable) { 192 | mEnablePullLoad = enable; 193 | 194 | if (!mEnablePullLoad) { 195 | mFooterView.setBottomMargin(0); 196 | mFooterView.hide(); 197 | mFooterView.setPadding(0, 0, 0, mFooterView.getHeight() * (-1)); 198 | mFooterView.setOnClickListener(null); 199 | 200 | } else { 201 | mPullLoading = false; 202 | mFooterView.setPadding(0, 0, 0, 0); 203 | mFooterView.show(); 204 | mFooterView.setState(XFooterView.STATE_NORMAL); 205 | // both "pull up" and "click" will invoke load more. 206 | mFooterView.setOnClickListener(new OnClickListener() { 207 | @Override 208 | public void onClick(View v) { 209 | startLoadMore(); 210 | } 211 | }); 212 | } 213 | } 214 | 215 | /** 216 | * Enable or disable auto load more feature when scroll to bottom. 217 | * 218 | * @param enable 219 | */ 220 | public void setAutoLoadEnable(boolean enable) { 221 | mEnableAutoLoad = enable; 222 | } 223 | 224 | /** 225 | * Stop refresh, reset header view. 226 | */ 227 | public void stopRefresh() { 228 | if (mPullRefreshing) { 229 | mPullRefreshing = false; 230 | resetHeaderHeight(); 231 | } 232 | } 233 | 234 | /** 235 | * Stop load more, reset footer view. 236 | */ 237 | public void stopLoadMore() { 238 | if (mPullLoading) { 239 | mPullLoading = false; 240 | mFooterView.setState(XFooterView.STATE_NORMAL); 241 | } 242 | } 243 | 244 | /** 245 | * Set last refresh time 246 | * 247 | * @param time 248 | */ 249 | public void setRefreshTime(String time) { 250 | mHeaderTime.setText(time); 251 | } 252 | 253 | /** 254 | * Set listener. 255 | * 256 | * @param listener 257 | */ 258 | public void setIXScrollViewListener(IXScrollViewListener listener) { 259 | mListener = listener; 260 | } 261 | 262 | /** 263 | * Auto call back refresh. 264 | */ 265 | public void autoRefresh() { 266 | mHeader.setVisibleHeight(mHeaderHeight); 267 | 268 | if (mEnablePullRefresh && !mPullRefreshing) { 269 | // update the arrow image not refreshing 270 | if (mHeader.getVisibleHeight() > mHeaderHeight) { 271 | mHeader.setState(XHeaderView.STATE_READY); 272 | } else { 273 | mHeader.setState(XHeaderView.STATE_NORMAL); 274 | } 275 | } 276 | 277 | mPullRefreshing = true; 278 | mHeader.setState(XHeaderView.STATE_REFRESHING); 279 | refresh(); 280 | } 281 | 282 | private void invokeOnScrolling() { 283 | if (mScrollListener instanceof OnXScrollListener) { 284 | OnXScrollListener l = (OnXScrollListener) mScrollListener; 285 | l.onXScrolling(this); 286 | } 287 | } 288 | 289 | private void updateHeaderHeight(float delta) { 290 | mHeader.setVisibleHeight((int) delta + mHeader.getVisibleHeight()); 291 | 292 | if (mEnablePullRefresh && !mPullRefreshing) { 293 | // update the arrow image unrefreshing 294 | if (mHeader.getVisibleHeight() > mHeaderHeight) { 295 | mHeader.setState(XHeaderView.STATE_READY); 296 | } else { 297 | mHeader.setState(XHeaderView.STATE_NORMAL); 298 | } 299 | } 300 | 301 | // scroll to top each time 302 | post(new Runnable() { 303 | @Override 304 | public void run() { 305 | XScrollView.this.fullScroll(ScrollView.FOCUS_UP); 306 | } 307 | }); 308 | } 309 | 310 | private void resetHeaderHeight() { 311 | int height = mHeader.getVisibleHeight(); 312 | if (height == 0) return; 313 | 314 | // refreshing and header isn't shown fully. do nothing. 315 | if (mPullRefreshing && height <= mHeaderHeight) return; 316 | 317 | // default: scroll back to dismiss header. 318 | int finalHeight = 0; 319 | // is refreshing, just scroll back to show all the header. 320 | if (mPullRefreshing && height > mHeaderHeight) { 321 | finalHeight = mHeaderHeight; 322 | } 323 | 324 | mScrollBack = SCROLL_BACK_HEADER; 325 | mScroller.startScroll(0, height, 0, finalHeight - height, SCROLL_DURATION); 326 | 327 | // trigger computeScroll 328 | invalidate(); 329 | } 330 | 331 | private void updateFooterHeight(float delta) { 332 | int height = mFooterView.getBottomMargin() + (int) delta; 333 | 334 | if (mEnablePullLoad && !mPullLoading) { 335 | if (height > PULL_LOAD_MORE_DELTA) { 336 | // height enough to invoke load more. 337 | mFooterView.setState(XFooterView.STATE_READY); 338 | } else { 339 | mFooterView.setState(XFooterView.STATE_NORMAL); 340 | } 341 | } 342 | 343 | mFooterView.setBottomMargin(height); 344 | 345 | // scroll to bottom 346 | post(new Runnable() { 347 | @Override 348 | public void run() { 349 | XScrollView.this.fullScroll(ScrollView.FOCUS_DOWN); 350 | } 351 | }); 352 | } 353 | 354 | private void resetFooterHeight() { 355 | int bottomMargin = mFooterView.getBottomMargin(); 356 | 357 | if (bottomMargin > 0) { 358 | mScrollBack = SCROLL_BACK_FOOTER; 359 | mScroller.startScroll(0, bottomMargin, 0, -bottomMargin, SCROLL_DURATION); 360 | invalidate(); 361 | } 362 | } 363 | 364 | private void startLoadMore() { 365 | if (!mPullLoading) { 366 | mPullLoading = true; 367 | mFooterView.setState(XFooterView.STATE_LOADING); 368 | loadMore(); 369 | } 370 | } 371 | 372 | @Override 373 | public boolean onTouchEvent(MotionEvent ev) { 374 | if (mLastY == -1) { 375 | mLastY = ev.getRawY(); 376 | } 377 | 378 | switch (ev.getAction()) { 379 | case MotionEvent.ACTION_DOWN: 380 | mLastY = ev.getRawY(); 381 | break; 382 | 383 | case MotionEvent.ACTION_MOVE: 384 | final float deltaY = ev.getRawY() - mLastY; 385 | mLastY = ev.getRawY(); 386 | 387 | if (isTop() && (mHeader.getVisibleHeight() > 0 || deltaY > 0)) { 388 | // the first item is showing, header has shown or pull down. 389 | updateHeaderHeight(deltaY / OFFSET_RADIO); 390 | invokeOnScrolling(); 391 | 392 | } else if (isBottom() && (mFooterView.getBottomMargin() > 0 || deltaY < 0)) { 393 | // last item, already pulled up or want to pull up. 394 | updateFooterHeight(-deltaY / OFFSET_RADIO); 395 | 396 | } 397 | break; 398 | 399 | default: 400 | // reset 401 | mLastY = -1; 402 | 403 | resetHeaderOrBottom(); 404 | break; 405 | } 406 | 407 | return super.onTouchEvent(ev); 408 | } 409 | 410 | private void resetHeaderOrBottom() { 411 | if (isTop()) { 412 | // invoke refresh 413 | if (mEnablePullRefresh && mHeader.getVisibleHeight() > mHeaderHeight) { 414 | mPullRefreshing = true; 415 | mHeader.setState(XHeaderView.STATE_REFRESHING); 416 | refresh(); 417 | } 418 | resetHeaderHeight(); 419 | 420 | } else if (isBottom()) { 421 | // invoke load more. 422 | if (mEnablePullLoad && mFooterView.getBottomMargin() > PULL_LOAD_MORE_DELTA) { 423 | startLoadMore(); 424 | } 425 | resetFooterHeight(); 426 | } 427 | } 428 | 429 | private boolean isTop() { 430 | return getScrollY() <= 0 || mHeader.getVisibleHeight() > mHeaderHeight; 431 | } 432 | 433 | private boolean isBottom() { 434 | return Math.abs(getScrollY() + getHeight() - computeVerticalScrollRange()) <= 5 || 435 | (getScrollY() > 0 && null != mFooterView && mFooterView.getBottomMargin() > 0); 436 | } 437 | 438 | @Override 439 | public void computeScroll() { 440 | if (mScroller.computeScrollOffset()) { 441 | if (mScrollBack == SCROLL_BACK_HEADER) { 442 | mHeader.setVisibleHeight(mScroller.getCurrY()); 443 | } else { 444 | mFooterView.setBottomMargin(mScroller.getCurrY()); 445 | } 446 | 447 | postInvalidate(); 448 | invokeOnScrolling(); 449 | } 450 | super.computeScroll(); 451 | } 452 | 453 | public void setOnScrollListener(OnScrollListener l) { 454 | mScrollListener = l; 455 | } 456 | 457 | @Override 458 | public void onScrollStateChanged(AbsListView view, int scrollState) { 459 | if (mScrollListener != null) { 460 | mScrollListener.onScrollStateChanged(view, scrollState); 461 | } 462 | } 463 | 464 | @Override 465 | protected void onScrollChanged(int l, int t, int oldl, int oldt) { 466 | // Grab the last child placed in the ScrollView, we need it to determinate the bottom position. 467 | View view = getChildAt(getChildCount() - 1); 468 | 469 | if (null != view) { 470 | // Calculate the scroll diff 471 | int diff = (view.getBottom() - (view.getHeight() + view.getScrollY())); 472 | 473 | // if diff is zero, then the bottom has been reached 474 | if (diff == 0 && mEnableAutoLoad) { 475 | // notify that we have reached the bottom 476 | startLoadMore(); 477 | } 478 | } 479 | 480 | super.onScrollChanged(l, t, oldl, oldt); 481 | } 482 | 483 | @Override 484 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, 485 | int totalItemCount) { 486 | // send to user's listener 487 | if (mScrollListener != null) { 488 | mScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); 489 | } 490 | } 491 | 492 | private void refresh() { 493 | if (mEnablePullRefresh && null != mListener) { 494 | mListener.onRefresh(); 495 | } 496 | } 497 | 498 | private void loadMore() { 499 | if (mEnablePullLoad && null != mListener) { 500 | mListener.onLoadMore(); 501 | } 502 | } 503 | 504 | /** 505 | * You can listen ListView.OnScrollListener or this one. it will invoke 506 | * onXScrolling when header/footer scroll back. 507 | */ 508 | public interface OnXScrollListener extends OnScrollListener { 509 | public void onXScrolling(View view); 510 | } 511 | 512 | /** 513 | * Implements this interface to get refresh/load more event. 514 | */ 515 | public interface IXScrollViewListener { 516 | public void onRefresh(); 517 | 518 | public void onLoadMore(); 519 | } 520 | } 521 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # menu 2 | 双向侧滑menu 3 | ![github](https://github.com/zhengjian11/menu/blob/master/BinarySlidingMenu/Screenshot_2015-01-15-19-10-08.png) 4 | ![github](https://github.com/zhengjian11/menu/blob/master/BinarySlidingMenu/Screenshot_2015-01-15-19-10-12.png) 5 | --------------------------------------------------------------------------------