├── sample
├── assets
│ ├── ToggleButton.txt
│ ├── CollageView.txt
│ ├── Titanic.txt
│ ├── CircleProgress.txt
│ ├── CircularProgressButton.txt
│ ├── SweetAlertDialog.txt
│ ├── SwipeMenuListView.txt
│ ├── TickPlusDrawable.txt
│ ├── TextJustify.txt
│ ├── about.txt
│ ├── FlabbyListView.txt
│ ├── TouchImageView.txt
│ ├── GossipView.txt
│ ├── XListView.txt
│ ├── ResideMenu.txt
│ ├── DragSortListView.txt
│ ├── ButterKnife.txt
│ ├── NumberProgressBar.txt
│ ├── SatelliteMenu.txt
│ └── DiscrollView.txt
├── res
│ ├── drawable-hdpi
│ │ ├── hd.jpg
│ │ ├── ic_1.png
│ │ ├── ic_2.png
│ │ ├── ic_3.png
│ │ ├── ic_4.png
│ │ ├── ic_5.png
│ │ ├── ic_6.png
│ │ ├── main.png
│ │ ├── wave.png
│ │ ├── cheese1.png
│ │ ├── cheese2.png
│ │ ├── cheese3.png
│ │ ├── menu_bg.jpg
│ │ ├── about_img.png
│ │ ├── home_img.png
│ │ ├── ic_delete.png
│ │ ├── image_img.png
│ │ ├── list_img.png
│ │ ├── logo_big.png
│ │ ├── main_icon.png
│ │ ├── menu_img.png
│ │ ├── other_img.png
│ │ ├── sat_item.png
│ │ ├── sat_main.png
│ │ ├── shadow.9.png
│ │ ├── button_img.png
│ │ ├── dialog_img.png
│ │ ├── ic_launcher.png
│ │ ├── icon_profile.png
│ │ ├── progress_img.png
│ │ ├── badge_ifaux.9.png
│ │ ├── framework_img.png
│ │ ├── ic_action_good.png
│ │ ├── icon_settings.png
│ │ ├── ilovecheese_i.png
│ │ ├── title_bar_menu.png
│ │ ├── ic_action_about.png
│ │ ├── ic_action_accept.png
│ │ ├── ic_action_cancel.png
│ │ ├── ic_action_discard.png
│ │ ├── ic_action_share.png
│ │ ├── ilovecheese_heart.png
│ │ ├── title_bar_menu_on.png
│ │ ├── xlistview_arrow.png
│ │ ├── ic_action_favorite.png
│ │ ├── ic_action_important.png
│ │ └── ilovecheese_cheese.png
│ ├── drawable
│ │ ├── home_view_bg.png
│ │ ├── home_view_inner_bg.png
│ │ ├── home_score_normal_bg.png
│ │ ├── home_score_pressed_bg.png
│ │ ├── home_view_inner_press_bg.png
│ │ ├── dialog_background.xml
│ │ ├── home_score_bg_selector.xml
│ │ ├── error_circle.xml
│ │ ├── success_bow.xml
│ │ ├── warning_circle.xml
│ │ ├── success_circle.xml
│ │ ├── cpb_background.xml
│ │ ├── titlebar_menu_selector.xml
│ │ ├── error_state_selector.xml
│ │ ├── complete_state_selector.xml
│ │ ├── idle_state_selector.xml
│ │ ├── blue_button_background.xml
│ │ ├── gray_button_background.xml
│ │ ├── red_button_background.xml
│ │ ├── warning_sigh.xml
│ │ └── error_center_x.xml
│ ├── values
│ │ ├── sat_strings.xml
│ │ ├── ids.xml
│ │ ├── sat_attrs.xml
│ │ ├── toggle_button_attrs.xml
│ │ ├── dimens.xml
│ │ ├── library_circularprogressbutton_strings.xml
│ │ ├── dslv_attrs.xml
│ │ ├── colors.xml
│ │ └── strings.xml
│ ├── anim
│ │ ├── sat_item_click_interpolator.xml
│ │ ├── sat_item_anticipate_interpolator.xml
│ │ ├── sat_item_in_rotate_interpolator.xml
│ │ ├── sat_item_out_rotate_interpolator.xml
│ │ ├── sat_item_overshoot_interpolator.xml
│ │ ├── sat_main_rotate_left.xml
│ │ ├── sat_main_rotate_right.xml
│ │ ├── success_bow_roate.xml
│ │ ├── modal_out.xml
│ │ ├── success_mask_layout.xml
│ │ ├── error_frame_in.xml
│ │ ├── sat_item_anim_click.xml
│ │ ├── error_x_in.xml
│ │ └── modal_in.xml
│ ├── layout
│ │ ├── flabby_lv_main.xml
│ │ ├── sat_item_cr.xml
│ │ ├── sat_main.xml
│ │ ├── touch_imageview_main.xml
│ │ ├── tickplusdrawable_main.xml
│ │ ├── swipemenulistview_main.xml
│ │ ├── collageviews_main.xml
│ │ ├── about.xml
│ │ ├── home.xml
│ │ ├── flabby_lv_item.xml
│ │ ├── gossipview_main.xml
│ │ ├── titanic_main.xml
│ │ ├── residemenu_item.xml
│ │ ├── satellite_menu_main.xml
│ │ ├── swipemenulistview_item.xml
│ │ ├── dragsort_listview_item.xml
│ │ ├── xlistview_footer.xml
│ │ ├── textjustify_test.xml
│ │ ├── main_item.xml
│ │ ├── dragsort_listview.xml
│ │ ├── togglebutton_main.xml
│ │ ├── intro.xml
│ │ ├── residemenu.xml
│ │ ├── textjustify_layout.xml
│ │ ├── main.xml
│ │ ├── xlistview_header.xml
│ │ └── numberprogressbar_main.xml
│ └── color
│ │ ├── cpb_error_state_selector.xml
│ │ ├── cpb_idle_state_selector.xml
│ │ └── cpb_complete_state_selector.xml
├── libs
│ ├── butterknife-6.0.0.jar
│ ├── android-support-v4.jar
│ ├── android-support-v7-appcompat.jar
│ ├── nineoldandroids-library-2.4.0.jar
│ └── universal-image-loader-1.9.3.jar
├── ui.src
│ └── com
│ │ └── qy
│ │ └── customview
│ │ ├── circular_progress_button
│ │ ├── OnAnimationEndListener.java
│ │ ├── StateManager.java
│ │ ├── StrokeGradientDrawable.java
│ │ └── CircularProgressDrawable.java
│ │ ├── residemenu
│ │ ├── ResideMenu_helper.txt
│ │ ├── TouchDisableView.java
│ │ └── ResideMenuItem.java
│ │ ├── swipemenu_listview
│ │ ├── SwipeMenuCreator.java
│ │ ├── SwipeMenu.java
│ │ ├── SwipeMenuItem.java
│ │ └── SwipeMenuView.java
│ │ ├── satellite_menu
│ │ ├── IDegreeProvider.java
│ │ ├── ArrayDegreeProvider.java
│ │ ├── LinearDegreeProvider.java
│ │ ├── DefaultDegreeProvider.java
│ │ └── SatelliteMenuItem.java
│ │ ├── gossipview
│ │ ├── GossipItem.java
│ │ └── MyUtils.java
│ │ ├── circleprogress
│ │ ├── Utils.java
│ │ └── DummyContent.java
│ │ ├── discrollview
│ │ ├── Discrollvable.java
│ │ └── simple
│ │ │ ├── DiscrollvableRedLayout.java
│ │ │ ├── DiscrollvableGreenLayout.java
│ │ │ ├── DiscrollvablePurpleLayout.java
│ │ │ ├── DiscrollvableLastLayout.java
│ │ │ └── DiscrollvablePathLayout.java
│ │ ├── xlistview
│ │ ├── XListView.txt
│ │ └── XListViewFooter.java
│ │ ├── collage_views
│ │ ├── Vector2D.java
│ │ └── CollageView.java
│ │ ├── toggle_button
│ │ └── facebook
│ │ │ └── rebound
│ │ │ ├── SpringSystem.java
│ │ │ ├── SimpleSpringListener.java
│ │ │ ├── OrigamiValueConverter.java
│ │ │ ├── SteppingLooper.java
│ │ │ ├── SynchronousLooper.java
│ │ │ ├── SpringListener.java
│ │ │ ├── SpringSystemListener.java
│ │ │ ├── SpringLooper.java
│ │ │ ├── SpringConfig.java
│ │ │ ├── ui
│ │ │ └── Util.java
│ │ │ ├── SpringUtil.java
│ │ │ └── SpringConfigRegistry.java
│ │ ├── touch_imageview
│ │ └── ExtendedViewPager.java
│ │ ├── text_justify
│ │ ├── simple
│ │ │ ├── MyLeadingMarginSpan2.java
│ │ │ ├── FontsOverride.java
│ │ │ ├── Utils.java
│ │ │ ├── ArticleBuilder.java
│ │ │ └── MyQuoteSpan.java
│ │ ├── style
│ │ │ ├── Direction.java
│ │ │ ├── TextAlignment.java
│ │ │ ├── LeftSpan.java
│ │ │ ├── CenterSpan.java
│ │ │ ├── RightSpan.java
│ │ │ ├── JustifiedSpan.java
│ │ │ ├── TextAlignmentSpan.java
│ │ │ └── DirectionSpan.java
│ │ └── Console.java
│ │ ├── dragsort_listview
│ │ ├── DragSortItemViewCheckable.java
│ │ ├── SimpleFloatViewManager.java
│ │ ├── DragSortItemView.java
│ │ └── help.txt
│ │ ├── flabby_listview
│ │ └── FlabbyAdapter.java
│ │ └── sweet_alert_dialog
│ │ └── OptAnimationLoader.java
├── 使用前必读.txt
└── src
│ └── com
│ └── qy
│ └── main
│ ├── activity
│ ├── DiscrollViewActivity.java
│ ├── TouchImageViewActivity.java
│ ├── CollageViewActivity.java
│ ├── TitanicActivity.java
│ ├── TickPlusDrawableActivity.java
│ ├── GossipViewActivity.java
│ ├── FlabbyListViewActivity.java
│ ├── NumberProgressBarActivity.java
│ ├── IntroActivity.java
│ ├── CircleProgressActivity.java
│ ├── SatelliteMenuActivity.java
│ └── ToggleButtonActivity.java
│ ├── fragment
│ └── AboutFragment.java
│ ├── utils
│ └── AssetsUtil.java
│ └── bean
│ └── Obj.java
├── apk
└── QY-OpenSource.apk
└── README.md
/sample/assets/ToggleButton.txt:
--------------------------------------------------------------------------------
1 | 一个效果非常好的滑动开关控件。
--------------------------------------------------------------------------------
/sample/assets/CollageView.txt:
--------------------------------------------------------------------------------
1 | 可以在界面上随意拖动缩放旋转的ImageView.
--------------------------------------------------------------------------------
/sample/assets/Titanic.txt:
--------------------------------------------------------------------------------
1 | Titanic实现动态波浪形动画逐渐填充自定义TextView.
--------------------------------------------------------------------------------
/sample/assets/CircleProgress.txt:
--------------------------------------------------------------------------------
1 | 各种形式的圆形进度条,有圆圈+数字风格的,有类似水位上升的。
--------------------------------------------------------------------------------
/sample/assets/CircularProgressButton.txt:
--------------------------------------------------------------------------------
1 | 显示进度的按钮,可用于数据的提交,系统登录等,动画效果很棒,提高用户体验。
--------------------------------------------------------------------------------
/sample/assets/SweetAlertDialog.txt:
--------------------------------------------------------------------------------
1 | Android版的SweetAlert,清新文艺,快意灵动的甜心弹框.
2 | 灵感来源于JS版SweetAlert.
--------------------------------------------------------------------------------
/apk/QY-OpenSource.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/apk/QY-OpenSource.apk
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/hd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/hd.jpg
--------------------------------------------------------------------------------
/sample/libs/butterknife-6.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/libs/butterknife-6.0.0.jar
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_1.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_2.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_3.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_4.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_5.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_6.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/main.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/wave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/wave.png
--------------------------------------------------------------------------------
/sample/assets/SwipeMenuListView.txt:
--------------------------------------------------------------------------------
1 | SwipeMenuListView 实现了类似于iPhone 的列表滑动功能,开发者可以在此基础上制作一些类似滑动删除的效果, 纯代码添加菜单,不需要在item布局文件中添加菜单的布局。
--------------------------------------------------------------------------------
/sample/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/cheese1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/cheese1.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/cheese2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/cheese2.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/cheese3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/cheese3.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/menu_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/menu_bg.jpg
--------------------------------------------------------------------------------
/sample/res/drawable/home_view_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable/home_view_bg.png
--------------------------------------------------------------------------------
/sample/assets/TickPlusDrawable.txt:
--------------------------------------------------------------------------------
1 | 作者很有个性的标语:I'm not a Gif maker, I'm a developer ,解释了这个项目的目的。tickplusdrawable用纯代码而不是gif图片实现了一个动画按钮。
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/about_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/about_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/home_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/home_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_delete.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/image_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/image_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/list_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/list_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/logo_big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/logo_big.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/main_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/main_icon.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/menu_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/menu_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/other_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/other_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/sat_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/sat_item.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/sat_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/sat_main.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/shadow.9.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/button_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/button_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/dialog_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/dialog_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/icon_profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/icon_profile.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/progress_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/progress_img.png
--------------------------------------------------------------------------------
/sample/assets/TextJustify.txt:
--------------------------------------------------------------------------------
1 | TextJustify是对安卓TextView控件的格式优化,TextView在显示文字的时候往往在一行的中间部分就跳到了下一行,看起来很杂乱,尤其是在显示英文的时候,TextJustify解决了这个问题。
2 |
3 |
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/badge_ifaux.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/badge_ifaux.9.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/framework_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/framework_img.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_good.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_good.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/icon_settings.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ilovecheese_i.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ilovecheese_i.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/title_bar_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/title_bar_menu.png
--------------------------------------------------------------------------------
/sample/res/drawable/home_view_inner_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable/home_view_inner_bg.png
--------------------------------------------------------------------------------
/sample/res/values/sat_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/sample/libs/android-support-v7-appcompat.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/libs/android-support-v7-appcompat.jar
--------------------------------------------------------------------------------
/sample/libs/nineoldandroids-library-2.4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/libs/nineoldandroids-library-2.4.0.jar
--------------------------------------------------------------------------------
/sample/libs/universal-image-loader-1.9.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/libs/universal-image-loader-1.9.3.jar
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_about.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_accept.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_accept.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_cancel.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_discard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_discard.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_share.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ilovecheese_heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ilovecheese_heart.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/title_bar_menu_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/title_bar_menu_on.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/xlistview_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/xlistview_arrow.png
--------------------------------------------------------------------------------
/sample/res/drawable/home_score_normal_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable/home_score_normal_bg.png
--------------------------------------------------------------------------------
/sample/res/drawable/home_score_pressed_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable/home_score_pressed_bg.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_favorite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_favorite.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ic_action_important.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ic_action_important.png
--------------------------------------------------------------------------------
/sample/res/drawable-hdpi/ilovecheese_cheese.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable-hdpi/ilovecheese_cheese.png
--------------------------------------------------------------------------------
/sample/res/drawable/home_view_inner_press_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qyxxjd/QY-OpenSource/HEAD/sample/res/drawable/home_view_inner_press_bg.png
--------------------------------------------------------------------------------
/sample/assets/about.txt:
--------------------------------------------------------------------------------
1 | Q Q : 630404403
2 |
3 | 微信 : 630404403
4 |
5 | 邮箱 : 630404403@qq.com
6 |
7 | 博客 : http://blog.csdn.net/qy1387
8 |
9 | 项目地址:https://github.com/qyxxjd/QY-OpenSource
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_click_interpolator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_anticipate_interpolator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_in_rotate_interpolator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_out_rotate_interpolator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_overshoot_interpolator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/assets/FlabbyListView.txt:
--------------------------------------------------------------------------------
1 | 这个ListView看上去比标准的“柔和”多了,而且滚动的时候还跟橡皮筋一样的粘着,比较有趣。
2 |
3 | Android library to display a ListView which cells are not rigid but flabby and react to ListView scroll and touch events.
--------------------------------------------------------------------------------
/sample/assets/TouchImageView.txt:
--------------------------------------------------------------------------------
1 | 最好用的可缩放ImagView,继承自ImageView具有ImageView的所有功能;除此之外,还有缩放、拖拽、双击放大等功能,并伴有动画效果。
2 |
3 | 我在github上找到了三个,分别是 PhotoView、ImageViewZoom、TouchImageView。经过比较TouchImageView在性能上最好、集成简单。
4 |
5 |
--------------------------------------------------------------------------------
/sample/assets/GossipView.txt:
--------------------------------------------------------------------------------
1 | 当我们想展示一个数组形式的数据的时候,要么是使用列表的形式,要么是使用网格的形式,今天我们介绍一种奇葩的形式,圆圈形式.
2 |
3 | 注意,周边的扇形是可以点击的。如果使用现有控件,要实现起来是有难度的,所以我们就采用了自定义View的方式。
4 |
5 | 原理以及使用方法,请移步: http://jcodecraeer.com/a/opensource/2014/1115/1988.html
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circular_progress_button/OnAnimationEndListener.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circular_progress_button;
2 |
3 | interface OnAnimationEndListener {
4 |
5 | public void onAnimationEnd();
6 | }
7 |
--------------------------------------------------------------------------------
/sample/res/drawable/dialog_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/residemenu/ResideMenu_helper.txt:
--------------------------------------------------------------------------------
1 |
2 | 复制src/com/special/ResideMenu下的所有代码到您的项目相应位置
3 | 复制libs/nineoldandroids-library-2.4.0.jar到您项目libs/下
4 | 复制res/drawable-hdpi/shadow.9.png到您的项目相应位置
5 | 复制res/layout/residemenu.xml 和 residemenu_item.xml到您的项目相应位置
--------------------------------------------------------------------------------
/sample/assets/XListView.txt:
--------------------------------------------------------------------------------
1 | XlistView,可以实现流行的下拉刷新功能以及上拉加载更多的分页功能.
2 | listview是在项目中用到最多的控件之一吧,下拉刷新和自动翻页也似乎成了标配。
3 | 优点是集成很方便,而且下拉刷新后释放,反弹的过度效果也做得很顺滑.
4 |
5 | 已知bug:(我在写这个项目的时候发现了这个问题,网友也有反馈)
6 | 当最开始数据不能撑满屏幕的时候,也就是比如有1条,那么将ListView向上拉不会完美刷新,必须将底部的view拉出屏幕才可以刷新。
7 | 解决方法:详见XListView的onTouchEvent方法。
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/swipemenu_listview/SwipeMenuCreator.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.swipemenu_listview;
2 |
3 |
4 | /**
5 | *
6 | * @author baoyz
7 | * @date 2014-8-24
8 | *
9 | */
10 | public interface SwipeMenuCreator {
11 |
12 | void create(SwipeMenu menu);
13 | }
14 |
--------------------------------------------------------------------------------
/sample/assets/ResideMenu.txt:
--------------------------------------------------------------------------------
1 | ReisdeMenu 创意灵感来自于Dribbble(Dribbble是一个面向创作家、艺术工作者、设计师等创意类作品的人群,提供作品在线服务,供网友在线查看已经完成的作品,或者正在创作的作品.).
2 | 而这个是Android版的ResideMenu,在视觉效果上部分参考了iOS版的RESideMenu,并在此感谢以上作者的贡献。
3 | 支持手势操作菜单,同时支持自定义手势操作失效区域。更详细的说明文档请看https://github.com/SpecialCyCi/AndroidResideMenu/blob/master/README_CN.md
--------------------------------------------------------------------------------
/sample/res/drawable/home_score_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
--------------------------------------------------------------------------------
/sample/res/drawable/error_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/res/drawable/success_bow.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/res/drawable/warning_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/satellite_menu/IDegreeProvider.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.satellite_menu;
2 |
3 | /**
4 | * Interface for providing degrees between satellites.
5 | *
6 | * @author Siyamed SINIR
7 | *
8 | */
9 | public interface IDegreeProvider {
10 | public float[] getDegrees(int count, float totalDegrees);
11 | }
12 |
--------------------------------------------------------------------------------
/sample/assets/DragSortListView.txt:
--------------------------------------------------------------------------------
1 | DragSortListView(DSLV)是Android ListView的一个扩展,支持拖拽排序和左右滑动删除功能。重写了TouchInterceptor(TI)类来提供更加优美的拖拽动画效果。
2 |
3 | DSLV主要特性:
4 | 完美的拖拽支持;
5 | 在拖动时提供更平滑的滚动列表滚动;
6 | 支持每个ListItem高度的多样性
7 | 公开startDrag()和stopDrag()方法;
8 | 有公开的接口可以自定义拖动的View。
9 |
10 | DragSortListView适用于带有任何优先级的列表:收藏夹、播放列表及清单等,算得上是目前Android开源实现拖动排序操作最完美的方案。
--------------------------------------------------------------------------------
/sample/使用前必读.txt:
--------------------------------------------------------------------------------
1 | 导入项目后会报错的,需要在eclipse里面配置一下butterknife环境,
2 | 1.右键你的工程,选择“Properties”,
3 | 2.选择"Java Compiler" ,
4 | 3.选择 "Java Compiler"—"Annotation Processing" 并选择"Enable annotation processing",
5 | 4.选择 "Java Compiler“—”Annotation Processing“—”Factory Path",选择butterknife-6.0.0.jar的路径。
6 | 官网配置教程:
7 | http://jakewharton.github.io/butterknife/ide-eclipse.html
--------------------------------------------------------------------------------
/sample/res/drawable/success_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/res/drawable/cpb_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/res/layout/flabby_lv_main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/sample/res/drawable/titlebar_menu_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_main_rotate_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_main_rotate_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/res/values/sat_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/res/anim/success_bow_roate.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/sample/res/layout/sat_item_cr.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/sample/res/layout/sat_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/sample/res/layout/touch_imageview_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/DiscrollViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import com.qy.main.R;
4 |
5 | import android.app.Activity;
6 | import android.os.Bundle;
7 |
8 | public class DiscrollViewActivity
9 | extends
10 | Activity
11 | {
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.discrollview_main);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/sample/res/layout/tickplusdrawable_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/TouchImageViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import com.qy.main.R;
7 |
8 | public class TouchImageViewActivity
9 | extends
10 | Activity
11 | {
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.touch_imageview_main);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/sample/res/layout/swipemenulistview_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/sample/res/drawable/error_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/res/drawable/complete_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/res/drawable/idle_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/assets/ButterKnife.txt:
--------------------------------------------------------------------------------
1 | 自于jakewharton大神的力作,安卓里面的视图注入库
2 | 可以对任意的View对象使用注入,当然了,需要提供view root的对象
3 | 简化list adapter中的View Holder模式
4 | View "injection" library for Android which uses annotation processing to generate boilerplate code for you.
5 | Eliminate findViewById calls by using @InjectView on fields.
6 | Group multiple viewsin a list using @InjectViews. Operate on all of them at once with actions, setters, or properties.
7 | Eliminate anonymous inner-classes for listeners by annotating methods with @OnClick and others.
--------------------------------------------------------------------------------
/sample/res/color/cpb_error_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/res/color/cpb_idle_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/res/color/cpb_complete_state_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
9 |
11 |
--------------------------------------------------------------------------------
/sample/res/layout/collageviews_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/res/values/toggle_button_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/res/layout/about.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/gossipview/GossipItem.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.gossipview;
2 |
3 | public class GossipItem {
4 | private String title;
5 | private int index;
6 | public GossipItem (String title,int index){
7 | this.title =title;
8 | this.index = index;
9 | }
10 |
11 | public String getTitle() {
12 | return title;
13 | }
14 |
15 | public void setTitle(String title) {
16 | this.title = title;
17 | }
18 |
19 | public int getIndex() {
20 | return index;
21 | }
22 |
23 | public void setIndex(int index) {
24 | this.index = index;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circleprogress/Utils.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circleprogress;
2 |
3 | import android.content.res.Resources;
4 |
5 | /**
6 | * Created by bruce on 14-11-6.
7 | */
8 | public class Utils {
9 | public static float dp2px(Resources resources, float dp) {
10 | final float scale = resources.getDisplayMetrics().density;
11 | return dp * scale + 0.5f;
12 | }
13 |
14 | public static float sp2px(Resources resources, float sp){
15 | final float scale = resources.getDisplayMetrics().scaledDensity;
16 | return sp * scale;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/sample/res/drawable/blue_button_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/res/drawable/gray_button_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/res/drawable/red_button_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/res/layout/home.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/CollageViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import com.qy.customview.collage_views.MultiTouchListener;
7 | import com.qy.main.R;
8 |
9 | public class CollageViewActivity
10 | extends
11 | Activity
12 | {
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.collageviews_main);
17 | findViewById(R.id.collageviews_img).setOnTouchListener(new MultiTouchListener());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/sample/assets/NumberProgressBar.txt:
--------------------------------------------------------------------------------
1 | NumberProgressBar实现了带数字进度的Android进度控件。
2 |
3 | The NumberProgressBar is a bar, slim and sexy (every man wants! ).
4 |
5 | I decided to do this because I was really tired of android original progress bar. So, I made some change, added more color style for this.
6 |
7 | And also you can contribute more color style, or new idea to me.
8 |
9 | BTW. My friends also made some other platform's NumberProgressBar:
10 | Web-Front by kalasoo - https://github.com/kalasoo/NumberProgressBar
11 | iOS by Ming-Zhe - https://github.com/Ming-Zhe/NumberProgressBar
12 | Windows Phone by s2003zy - https://github.com/s2003zy
--------------------------------------------------------------------------------
/sample/res/anim/modal_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
14 |
18 |
--------------------------------------------------------------------------------
/sample/res/anim/success_mask_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 | 290dp
9 | 3dp
10 | 34dp
11 |
12 |
13 | 8dp
14 |
15 |
16 | 4dp
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/assets/SatelliteMenu.txt:
--------------------------------------------------------------------------------
1 | 点击主按钮,会弹出多个围绕着主按钮排列的子按钮,从而形成一个弹出式菜单。子按钮弹出和消失的动画效果都很棒。这种弹出式菜单按钮应用在Path app中。
2 |
3 | 'Path' has a very attractive menu sitting on the left bottom corner of the screen. Satellite Menu is the open version of this menu.
4 |
5 | For the ones who didnt see path, the menu consists of a main button on the left bottom of the screen. When the user clicks on this button, a number of buttons are popped out of this button. I have resembled this structure to a planet and satellites and thats why I gave the name of this project.
6 |
7 | The menu uses built-in animations of Android platform.
8 |
9 | Works in API Level 7 (2.1) and above.
10 |
11 | Licenced with LGPL.
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/Discrollvable.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview;
2 |
3 | /**
4 | * Represents a View able to be discrollved.
5 | */
6 | public interface Discrollvable {
7 |
8 | /**
9 | * Called to discrollve the View.
10 | * @param ratio discrollve ratio between 0.0 and 1.0.
11 | * 1.0 means the View is totally discrollved
12 | */
13 | public void onDiscrollve(float ratio);
14 |
15 | /**
16 | * Called to reset the discrollvation of the View.
17 | * In this method, you have to reset the View in order
18 | * to be discrollved again.
19 | */
20 | public void onResetDiscrollve();
21 | }
22 |
--------------------------------------------------------------------------------
/sample/res/anim/error_frame_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/TitanicActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import com.qy.customview.titanic.Titanic;
7 | import com.qy.customview.titanic.TitanicTextView;
8 | import com.qy.main.R;
9 |
10 | public class TitanicActivity
11 | extends
12 | Activity
13 | {
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.titanic_main);
18 | TitanicTextView tv = (TitanicTextView) findViewById(R.id.titanic_tv);
19 |
20 | // start animation
21 | new Titanic().start(tv);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/sample/assets/DiscrollView.txt:
--------------------------------------------------------------------------------
1 | 支持滚动时Item淡入淡出,平移,缩放效果的ScrollView.
2 | 在滚动页面时,网页上的部件会逐渐褪色、平移或者缩放。
3 | Regularly, I am pleasantly surprised by websites using a pattern I called the discrollver pattern. I'm sure you already know what I'm talking about but if not, http://vimeo.com/player is a good example. When you scroll, widgets appear from nowhere by fade, translation or scale.
4 |
5 | With DiscrollView, I wanted to import this pattern on Android. This is an 0.0.1 alpha version because you have to do all the transformation work (fade, translation, scale etc) yourself base on a ratio value. I'm going to add some transformation presets (translation from left to right + fade in for example) to make the library more ready to use for lazy developers.
--------------------------------------------------------------------------------
/sample/res/drawable/warning_sigh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sample/res/anim/sat_item_anim_click.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/sample/res/layout/flabby_lv_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/res/layout/gossipview_main.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/satellite_menu/ArrayDegreeProvider.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.satellite_menu;
2 |
3 | /**
4 | * Provide the degree between each satellite as an array of degrees. Can be provided to
5 | * {@link SatelliteMenu} as a parameter.
6 | *
7 | * @author Siyamed SINIR
8 | *
9 | */
10 | public class ArrayDegreeProvider implements IDegreeProvider {
11 | private float[] degrees;
12 |
13 | public ArrayDegreeProvider(float[] degrees) {
14 | this.degrees = degrees;
15 | }
16 |
17 | public float[] getDegrees(int count, float totalDegrees){
18 | if(degrees == null || degrees.length != count){
19 | throw new IllegalArgumentException("Provided delta degrees and the action count are not the same.");
20 | }
21 | return degrees;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/xlistview/XListView.txt:
--------------------------------------------------------------------------------
1 | XlistView
2 | 可以实现流行的下拉刷新功能以及上拉加载更多的分页功能
3 | 优点是集成很方便,而且下拉刷新后释放,反弹的过度效果也做得很顺滑.
4 |
5 |
6 |
7 | 文件清单
8 |
9 | java:
10 | XListView.java
11 | XListViewFooter.java
12 | XListViewHeader.java
13 |
14 | layout:
15 | xlistview_footer.xml
16 | xlistview_header.xml
17 |
18 | 图片:
19 | xlistview_arrow.png
20 |
21 | strings.xml 加入:
22 | 下拉刷新
23 | 松开刷新数据
24 | 正在加载...
25 | 上次更新时间:
26 | 查看更多
27 | 松开载入更多
28 |
29 |
30 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/collage_views/Vector2D.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.collage_views;
2 |
3 | import android.graphics.PointF;
4 |
5 | public class Vector2D extends PointF {
6 |
7 | public Vector2D() {
8 | super();
9 | }
10 |
11 | public Vector2D(float x, float y) {
12 | super(x, y);
13 | }
14 |
15 | public static float getAngle(Vector2D vector1, Vector2D vector2) {
16 | vector1.normalize();
17 | vector2.normalize();
18 | double degrees = (180.0 / Math.PI) * (Math.atan2(vector2.y, vector2.x) - Math.atan2(vector1.y, vector1.x));
19 | return (float) degrees;
20 | }
21 |
22 | public void normalize() {
23 | float length = (float) Math.sqrt(x * x + y * y);
24 | x /= length;
25 | y /= length;
26 | }
27 | }
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringSystem.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.toggle_button.facebook.rebound;
2 |
3 | /**
4 | * This is a wrapper for BaseSpringSystem that provides the convenience of automatically providing
5 | * the AndroidSpringLooper dependency in {@link SpringSystem#create}.
6 | */
7 | public class SpringSystem extends BaseSpringSystem {
8 |
9 | /**
10 | * Create a new SpringSystem providing the appropriate constructor parameters to work properly
11 | * in an Android environment.
12 | * @return the SpringSystem
13 | */
14 | public static SpringSystem create() {
15 | return new SpringSystem(AndroidSpringLooperFactory.createSpringLooper());
16 | }
17 |
18 | private SpringSystem(SpringLooper springLooper) {
19 | super(springLooper);
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/sample/res/layout/titanic_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/res/layout/residemenu_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/sample/res/layout/satellite_menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SimpleSpringListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | public class SimpleSpringListener implements SpringListener {
14 | @Override
15 | public void onSpringUpdate(Spring spring) {
16 | }
17 |
18 | @Override
19 | public void onSpringAtRest(Spring spring) {
20 | }
21 |
22 | @Override
23 | public void onSpringActivate(Spring spring) {
24 | }
25 |
26 | @Override
27 | public void onSpringEndStateChange(Spring spring) {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/sample/res/layout/swipemenulistview_item.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
23 |
24 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/OrigamiValueConverter.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.toggle_button.facebook.rebound;
2 |
3 | /**
4 | * Helper math util to convert tension & friction values from the Origami design tool to values that
5 | * the spring system needs.
6 | */
7 | public class OrigamiValueConverter {
8 |
9 | public static double tensionFromOrigamiValue(double oValue) {
10 | return oValue == 0 ? 0 : (oValue - 30.0) * 3.62 + 194.0;
11 | }
12 |
13 | public static double origamiValueFromTension(double tension) {
14 | return tension == 0 ? 0 : (tension - 194.0) / 3.62 + 30.0;
15 | }
16 |
17 | public static double frictionFromOrigamiValue(double oValue) {
18 | return oValue == 0 ? 0 : (oValue - 8.0) * 3.0 + 25.0;
19 | }
20 |
21 | public static double origamiValueFromFriction(double friction) {
22 | return friction == 0 ? 0 : (friction - 25.0) / 3.0 + 8.0;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/satellite_menu/LinearDegreeProvider.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.satellite_menu;
2 |
3 | /**
4 | * Linearly distributes satellites in the given total degree.
5 | *
6 | * @author Siyamed SINIR
7 | *
8 | */
9 | public class LinearDegreeProvider implements IDegreeProvider {
10 | public float[] getDegrees(int count, float totalDegrees){
11 | if(count < 1){
12 | return new float[]{};
13 | }
14 |
15 | if(count == 1){
16 | return new float[]{45};
17 | }
18 |
19 | float[] result = null;
20 | int tmpCount = count-1;
21 |
22 | result = new float[count];
23 | float delta = totalDegrees / tmpCount;
24 |
25 | for(int index=0; index
2 |
6 |
13 |
22 |
23 |
--------------------------------------------------------------------------------
/sample/res/anim/error_x_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
12 |
13 |
22 |
23 |
32 |
--------------------------------------------------------------------------------
/sample/res/drawable/error_center_x.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/fragment/AboutFragment.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.fragment;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 | import butterknife.ButterKnife;
11 | import butterknife.InjectView;
12 |
13 | import com.qy.main.R;
14 | import com.qy.main.utils.AssetsUtil;
15 |
16 |
17 | public class AboutFragment
18 | extends
19 | Fragment
20 | {
21 |
22 | private Activity context;
23 | private View parentView;
24 | @InjectView (R.id.about_txt)
25 | TextView tv;
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
29 | parentView = inflater.inflate(R.layout.about, container, false);
30 |
31 | context = getActivity();
32 | ButterKnife.inject(this, parentView);
33 |
34 | tv.setText(AssetsUtil.getAssetString("about.txt", context));
35 | return parentView;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circular_progress_button/StateManager.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circular_progress_button;
2 |
3 | class StateManager {
4 |
5 | private boolean mIsEnabled;
6 | private int mProgress;
7 |
8 | public StateManager(CircularProgressButton progressButton) {
9 | mIsEnabled = progressButton.isEnabled();
10 | mProgress = progressButton.getProgress();
11 | }
12 |
13 | public void saveProgress(CircularProgressButton progressButton) {
14 | mProgress = progressButton.getProgress();
15 | }
16 |
17 | public boolean isEnabled() {
18 | return mIsEnabled;
19 | }
20 |
21 | public int getProgress() {
22 | return mProgress;
23 | }
24 |
25 | public void checkState(CircularProgressButton progressButton) {
26 | if (progressButton.getProgress() != getProgress()) {
27 | progressButton.setProgress(progressButton.getProgress());
28 | } else if(progressButton.isEnabled() != isEnabled()) {
29 | progressButton.setEnabled(progressButton.isEnabled());
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SteppingLooper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | package com.qy.customview.toggle_button.facebook.rebound;
11 |
12 | public class SteppingLooper extends SpringLooper {
13 |
14 | private boolean mStarted;
15 | private long mLastTime;
16 |
17 | @Override
18 | public void start() {
19 | mStarted = true;
20 | mLastTime = 0;
21 | }
22 |
23 | public boolean step(long interval) {
24 | if (mSpringSystem == null || !mStarted) {
25 | return false;
26 | }
27 | long currentTime = mLastTime + interval;
28 | mSpringSystem.loop(currentTime);
29 | mLastTime = currentTime;
30 | return mSpringSystem.getIsIdle();
31 | }
32 |
33 | @Override
34 | public void stop() {
35 | mStarted = false;
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/sample/res/layout/xlistview_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/touch_imageview/ExtendedViewPager.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.touch_imageview;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 |
9 | public class ExtendedViewPager extends ViewPager {
10 |
11 | public ExtendedViewPager(Context context) {
12 | super(context);
13 | }
14 |
15 | public ExtendedViewPager(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | @Override
20 | protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
21 | if (v instanceof TouchImageView) {
22 | //
23 | // canScrollHorizontally is not supported for Api < 14. To get around this issue,
24 | // ViewPager is extended and canScrollHorizontallyFroyo, a wrapper around
25 | // canScrollHorizontally supporting Api >= 8, is called.
26 | //
27 | return ((TouchImageView) v).canScrollHorizontallyFroyo(-dx);
28 |
29 | } else {
30 | return super.canScroll(v, checkV, dx, x, y);
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/sample/res/values/library_circularprogressbutton_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | circularprogressbutton
4 | Dmytro Danylyk
5 | http://dmytrodanylyk.com/
6 | Circular Progress Button
7 | Android Button which can morph to Circular Progress.
8 | 1.1.0
9 | http://dmytrodanylyk.com/pages/portfolio/circular-progress-button.html
10 | mit
11 | true
12 | https://github.com/dmytrodanylyk/circular-progress-button
13 |
14 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circular_progress_button/StrokeGradientDrawable.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circular_progress_button;
2 |
3 | import android.graphics.drawable.GradientDrawable;
4 |
5 | public class StrokeGradientDrawable {
6 |
7 | private int mStrokeWidth;
8 | private int mStrokeColor;
9 |
10 | private GradientDrawable mGradientDrawable;
11 |
12 | public StrokeGradientDrawable(GradientDrawable drawable) {
13 | mGradientDrawable = drawable;
14 | }
15 |
16 | public int getStrokeWidth() {
17 | return mStrokeWidth;
18 | }
19 |
20 | public void setStrokeWidth(int strokeWidth) {
21 | mStrokeWidth = strokeWidth;
22 | mGradientDrawable.setStroke(strokeWidth, getStrokeColor());
23 | }
24 |
25 | public int getStrokeColor() {
26 | return mStrokeColor;
27 | }
28 |
29 | public void setStrokeColor(int strokeColor) {
30 | mStrokeColor = strokeColor;
31 | mGradientDrawable.setStroke(getStrokeWidth(), strokeColor);
32 | }
33 |
34 | public GradientDrawable getGradientDrawable() {
35 | return mGradientDrawable;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/swipemenu_listview/SwipeMenu.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.swipemenu_listview;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.content.Context;
7 |
8 | /**
9 | *
10 | * @author baoyz
11 | * @date 2014-8-23
12 | *
13 | */
14 | public class SwipeMenu {
15 |
16 | private Context mContext;
17 | private List mItems;
18 | private int mViewType;
19 |
20 | public SwipeMenu(Context context) {
21 | mContext = context;
22 | mItems = new ArrayList();
23 | }
24 |
25 | public Context getContext() {
26 | return mContext;
27 | }
28 |
29 | public void addMenuItem(SwipeMenuItem item) {
30 | mItems.add(item);
31 | }
32 |
33 | public void removeMenuItem(SwipeMenuItem item) {
34 | mItems.remove(item);
35 | }
36 |
37 | public List getMenuItems() {
38 | return mItems;
39 | }
40 |
41 | public SwipeMenuItem getMenuItem(int index) {
42 | return mItems.get(index);
43 | }
44 |
45 | public int getViewType() {
46 | return mViewType;
47 | }
48 |
49 | public void setViewType(int viewType) {
50 | this.mViewType = viewType;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/gossipview/MyUtils.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.gossipview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import android.util.DisplayMetrics;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.WindowManager;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.TextView;
12 |
13 | /**
14 | * Created by Dacer on 10/8/13.
15 | */
16 | public class MyUtils {
17 |
18 | public static int dip2px(Context context, float dipValue){
19 | final float scale = context.getResources().getDisplayMetrics().density;
20 | return (int)(dipValue * scale + 0.5f);
21 | }
22 |
23 | public static int px2dip(Context context, float pxValue){
24 | final float scale = context.getResources().getDisplayMetrics().density;
25 | return (int)(pxValue / scale + 0.5f);
26 | }
27 |
28 | public static int sp2px(Context context, float spValue) {
29 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
30 | return (int) (spValue * fontScale + 0.5f);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/simple/MyLeadingMarginSpan2.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.simple;
2 |
3 | /*
4 | * Provided by @levifan
5 | * https://github.com/bluejamesbond/Sandbox/issues/2#issuecomment-60928630
6 | */
7 |
8 | import android.graphics.Canvas;
9 | import android.graphics.Paint;
10 | import android.text.Layout;
11 |
12 | public class MyLeadingMarginSpan2 implements
13 | android.text.style.LeadingMarginSpan.LeadingMarginSpan2 {
14 |
15 | private int margin;
16 | private int lines;
17 |
18 | public MyLeadingMarginSpan2(int lines, int margin) {
19 | this.lines = lines;
20 | this.margin = margin;
21 | }
22 |
23 | @Override
24 | public int getLeadingMargin(boolean first) {
25 | return margin;
26 | }
27 |
28 | @Override
29 | public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline,
30 | int bottom, CharSequence text, int start, int end, boolean first,
31 | Layout layout) {
32 | }
33 |
34 | @Override
35 | public int getLeadingMarginLineCount() {
36 | return lines;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/Direction.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * Direction.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 11/25/14 7:13 PM
30 | */
31 |
32 | public enum Direction {
33 | NORMAL, REVERSE
34 | }
--------------------------------------------------------------------------------
/sample/res/layout/textjustify_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
22 |
23 |
24 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/res/anim/modal_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
10 |
11 |
19 |
20 |
29 |
30 |
39 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/TextAlignment.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * TextAlignment.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | public enum TextAlignment {
33 | LEFT, RIGHT, JUSTIFIED, CENTER
34 | }
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SynchronousLooper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | package com.qy.customview.toggle_button.facebook.rebound;
11 |
12 | public class SynchronousLooper extends SpringLooper {
13 |
14 | public static double SIXTY_FPS = 16.6667;
15 | private double mTimeStep;
16 | private boolean mRunning;
17 |
18 | public SynchronousLooper() {
19 | mTimeStep = SIXTY_FPS;
20 | }
21 |
22 | public double getTimeStep() {
23 | return mTimeStep;
24 | }
25 |
26 | public void setTimeStep(double timeStep) {
27 | mTimeStep = timeStep;
28 | }
29 |
30 | @Override
31 | public void start() {
32 | mRunning = true;
33 | while (!mSpringSystem.getIsIdle()) {
34 | if (mRunning == false) {
35 | break;
36 | }
37 | mSpringSystem.loop(mTimeStep);
38 | }
39 | }
40 |
41 | @Override
42 | public void stop() {
43 | mRunning = false;
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/satellite_menu/DefaultDegreeProvider.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.satellite_menu;
2 |
3 | /**
4 | * Default provider for degrees between satellites. For number of satellites up to 3
5 | * tries to keep satellites centered in the given total degrees. For number equal and
6 | * bigger than four, distirbutes evenly using min and max degrees.
7 | *
8 | * @author Siyamed SINIR
9 | *
10 | */
11 | public class DefaultDegreeProvider implements IDegreeProvider {
12 | public float[] getDegrees(int count, float totalDegrees){
13 | if(count < 1)
14 | {
15 | return new float[]{};
16 | }
17 |
18 | float[] result = null;
19 | int tmpCount = 0;
20 | if(count < 4){
21 | tmpCount = count+1;
22 | }else{
23 | tmpCount = count-1;
24 | }
25 |
26 | result = new float[count];
27 | float delta = totalDegrees / tmpCount;
28 |
29 | for(int index=0; index
6 |
7 |
13 |
14 |
22 |
23 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sample/res/layout/dragsort_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
31 |
32 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/simple/FontsOverride.java:
--------------------------------------------------------------------------------
1 | /*
2 | * http://stackoverflow.com/questions/2973270/using-a-custom-typeface-in-android/16275257#16275257
3 | */
4 |
5 | package com.qy.customview.text_justify.simple;
6 |
7 | import android.content.Context;
8 | import android.graphics.Typeface;
9 |
10 | import java.lang.reflect.Field;
11 |
12 | public final class FontsOverride {
13 |
14 | public static void setDefaultFont(Context context,
15 | String staticTypefaceFieldName, String fontAssetName) {
16 | final Typeface regular = Typeface.createFromAsset(context.getAssets(),
17 | fontAssetName);
18 | replaceFont(staticTypefaceFieldName, regular);
19 | }
20 |
21 | protected static void replaceFont(String staticTypefaceFieldName,
22 | final Typeface newTypeface) {
23 | try {
24 | final Field staticField = Typeface.class
25 | .getDeclaredField(staticTypefaceFieldName);
26 | staticField.setAccessible(true);
27 | staticField.set(null, newTypeface);
28 | } catch (NoSuchFieldException e) {
29 | e.printStackTrace();
30 | } catch (IllegalAccessException e) {
31 | e.printStackTrace();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/LeftSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * LeftSpan.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | public class LeftSpan extends TextAlignmentSpan {
33 | @Override
34 | public TextAlignment getTextAlignment() {
35 | return TextAlignment.LEFT;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringSystemListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | /**
14 | * SpringSystemListener provides an interface for listening to events before and after each Physics
15 | * solving loop the BaseSpringSystem runs.
16 | */
17 | public interface SpringSystemListener {
18 |
19 | /**
20 | * Runs before each pass through the physics integration loop providing an opportunity to do any
21 | * setup or alterations to the Physics state before integrating.
22 | * @param springSystem the BaseSpringSystem listened to
23 | */
24 | void onBeforeIntegrate(BaseSpringSystem springSystem);
25 |
26 | /**
27 | * Runs after each pass through the physics integration loop providing an opportunity to do any
28 | * setup or alterations to the Physics state after integrating.
29 | * @param springSystem the BaseSpringSystem listened to
30 | */
31 | void onAfterIntegrate(BaseSpringSystem springSystem);
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/CenterSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * CenterSpan.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | public class CenterSpan extends TextAlignmentSpan {
33 | @Override
34 | public TextAlignment getTextAlignment() {
35 | return TextAlignment.CENTER;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/RightSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * RightSpan.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | public class RightSpan extends TextAlignmentSpan {
33 |
34 | @Override
35 | public TextAlignment getTextAlignment() {
36 | return TextAlignment.RIGHT;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/JustifiedSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * JustifiedSpan.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | public class JustifiedSpan extends TextAlignmentSpan {
33 | @Override
34 | public TextAlignment getTextAlignment() {
35 | return TextAlignment.JUSTIFIED;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/utils/AssetsUtil.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.utils;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStreamReader;
6 |
7 | import android.content.Context;
8 |
9 | public class AssetsUtil
10 | {
11 | /**
12 | * 读取assets下的文本文件
13 | * @param asset 文件名称
14 | * @param context
15 | * @return
16 | */
17 | public static String getAssetString(String asset, Context context) {
18 | BufferedReader bufferedReader = null;
19 | try {
20 | bufferedReader = new BufferedReader(new InputStreamReader(context.getAssets().open(asset)));
21 | String line = null;
22 | StringBuilder builder = new StringBuilder();
23 | while (null != (line = bufferedReader.readLine())) {
24 | builder.append(line).append("\n");
25 | }
26 | return builder.toString();
27 | } catch (IOException e) {
28 | e.printStackTrace();
29 | }finally{
30 | if (null != bufferedReader) {
31 | try {
32 | bufferedReader.close();
33 | } catch (IOException e) {
34 | e.printStackTrace();
35 | }
36 | }
37 | bufferedReader = null;
38 | }
39 | return "";
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/TickPlusDrawableActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import com.qy.customview.tickplus_drawable.TickPlusDrawable;
9 | import com.qy.main.R;
10 |
11 | public class TickPlusDrawableActivity
12 | extends
13 | Activity
14 | {
15 | @SuppressLint ("NewApi")
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.tickplusdrawable_main);
20 |
21 | View view = findViewById(R.id.view);
22 |
23 | final TickPlusDrawable tickPlusDrawable = new TickPlusDrawable(getResources().getDimensionPixelSize(R.dimen.stroke_width), getResources().getColor(android.R.color.holo_blue_dark), Color.WHITE);
24 |
25 | if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
26 | view.setBackgroundDrawable(tickPlusDrawable);
27 | } else {
28 | view.setBackground(tickPlusDrawable);
29 | }
30 |
31 | view.setOnClickListener(new View.OnClickListener() {
32 | @Override
33 | public void onClick(View v) {
34 | tickPlusDrawable.toggle();
35 | }
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/sample/res/values/dslv_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringLooper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | /**
14 | * The spring looper is an interface for implementing platform-dependent run loops.
15 | */
16 | public abstract class SpringLooper {
17 |
18 | protected BaseSpringSystem mSpringSystem;
19 |
20 | /**
21 | * Set the BaseSpringSystem that the SpringLooper will call back to.
22 | * @param springSystem the spring system to call loop on.
23 | */
24 | public void setSpringSystem(BaseSpringSystem springSystem) {
25 | mSpringSystem = springSystem;
26 | }
27 |
28 | /**
29 | * The BaseSpringSystem has requested that the looper begins running this {@link Runnable}
30 | * on every frame. The {@link Runnable} will continue running on every frame until
31 | * {@link #stop()} is called.
32 | * If an existing {@link Runnable} had been started on this looper, it will be cancelled.
33 | */
34 | public abstract void start();
35 |
36 | /**
37 | * The looper will no longer run the {@link Runnable}.
38 | */
39 | public abstract void stop();
40 | }
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/GossipViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.Activity;
7 | import android.os.Bundle;
8 | import android.view.View;
9 | import android.view.View.OnClickListener;
10 | import android.widget.Toast;
11 |
12 | import com.qy.customview.gossipview.GossipItem;
13 | import com.qy.customview.gossipview.GossipView;
14 | import com.qy.main.R;
15 |
16 | public class GossipViewActivity
17 | extends
18 | Activity
19 | {
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.gossipview_main);
24 | GossipView gossipView = (GossipView)findViewById(R.id.gossipview);
25 | String [] strs = {"安卓","微软","苹果","谷歌","百度","腾讯"} ;
26 |
27 | final List items =new ArrayList();
28 | for(int i = 0; i < strs.length; i++) {
29 | GossipItem item = new GossipItem(strs[i],3);
30 | items.add(item);
31 | }
32 | gossipView.setItems(items);
33 | gossipView.setNumber(6);
34 | gossipView.setOnPieceClickListener( new GossipView.OnPieceClickListener(){
35 | @Override
36 | public void onPieceClick(int index) {
37 | if(index != -1 && index != -2) {
38 | Toast.makeText(GossipViewActivity.this, "你选择了" + items.get(index).getTitle(), Toast.LENGTH_SHORT).show();
39 | }
40 | }
41 | });
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/collage_views/CollageView.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.collage_views;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.util.AttributeSet;
8 | import android.widget.ImageView;
9 |
10 | public class CollageView extends ImageView {
11 |
12 | private static final int PADDING = 8;
13 | private static final float STROKE_WIDTH = 8.0f;
14 |
15 | private Paint mBorderPaint;
16 |
17 | public CollageView(Context context) {
18 | this(context, null);
19 | }
20 |
21 | public CollageView(Context context, AttributeSet attrs) {
22 | this(context, attrs, 0);
23 | setPadding(PADDING, PADDING, PADDING, PADDING);
24 | }
25 |
26 | public CollageView(Context context, AttributeSet attrs, int defStyle) {
27 | super(context, attrs, defStyle);
28 | initBorderPaint();
29 | }
30 |
31 | private void initBorderPaint() {
32 | mBorderPaint = new Paint();
33 | mBorderPaint.setAntiAlias(true);
34 | mBorderPaint.setStyle(Paint.Style.STROKE);
35 | mBorderPaint.setColor(Color.TRANSPARENT);
36 | mBorderPaint.setStrokeWidth(STROKE_WIDTH);
37 | }
38 |
39 | @Override
40 | protected void onDraw(Canvas canvas) {
41 | super.onDraw(canvas);
42 | canvas.drawRect(PADDING, PADDING, getWidth() - PADDING, getHeight() - PADDING, mBorderPaint);
43 | }
44 | }
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/FlabbyListViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.ListActivity;
7 | import android.os.Bundle;
8 | import android.view.View;
9 | import android.widget.ListView;
10 | import android.widget.Toast;
11 |
12 | import com.qy.customview.flabby_listview.FlabbyAdapter;
13 | import com.qy.main.R;
14 |
15 | public class FlabbyListViewActivity
16 | extends
17 | ListActivity
18 | {
19 | private static final int NUM_LIST_ITEM = 100;
20 | private FlabbyAdapter mAdapter;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.flabby_lv_main);
26 | List items = getListItems();
27 | mAdapter = new FlabbyAdapter(this,items);
28 | setListAdapter(mAdapter);
29 | getListView().setSelection(items.size()/2);
30 | }
31 |
32 | private ArrayList getListItems() {
33 | ArrayList list = new ArrayList();
34 | for(int i=0;i
55 | 微信:630404403
56 | 博客:[http://blog.csdn.net/qy1387](http://blog.csdn.net/qy1387)
57 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circleprogress/DummyContent.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circleprogress;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | /**
9 | * Helper class for providing sample content for user interfaces created by
10 | * Android template wizards.
11 | *
12 | * TODO: Replace all uses of this class before publishing your app.
13 | */
14 | public class DummyContent {
15 |
16 | /**
17 | * An array of sample (dummy) items.
18 | */
19 | public static List ITEMS = new ArrayList();
20 |
21 | /**
22 | * A map of sample (dummy) items, by ID.
23 | */
24 | public static Map ITEM_MAP = new HashMap();
25 |
26 | static {
27 | // Add 3 sample items.
28 | addItem(new DummyItem("1", "Item 1"));
29 | addItem(new DummyItem("2", "Item 2"));
30 | addItem(new DummyItem("3", "Item 3"));
31 | }
32 |
33 | private static void addItem(DummyItem item) {
34 | ITEMS.add(item);
35 | ITEM_MAP.put(item.id, item);
36 | }
37 |
38 | /**
39 | * A dummy item representing a piece of content.
40 | */
41 | public static class DummyItem {
42 | public String id;
43 | public String content;
44 |
45 | public DummyItem(String id, String content) {
46 | this.id = id;
47 | this.content = content;
48 | }
49 |
50 | @Override
51 | public String toString() {
52 | return content;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/sample/res/layout/togglebutton_main.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
16 |
17 |
24 |
25 |
35 |
36 |
41 |
42 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/style/DirectionSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.style;
2 |
3 | import android.text.TextPaint;
4 | import android.text.style.CharacterStyle;
5 |
6 | /*
7 | * Copyright 2014 Mathew Kurian
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | *
21 | * -------------------------------------------------------------------------
22 | *
23 | * ReverseSpan.java
24 | * @author Mathew Kurian
25 | *
26 | * From TextJustify-Android Library v2.0
27 | * https://github.com/bluejamesbond/TextJustify-Android
28 | *
29 | * Please report any issues
30 | * https://github.com/bluejamesbond/TextJustify-Android/issues
31 | *
32 | * Date: 11/25/14 7:06 PM
33 | */
34 |
35 | public class DirectionSpan extends CharacterStyle {
36 | private final Direction direction;
37 |
38 | public DirectionSpan(Direction direction) {
39 | this.direction = direction;
40 | }
41 |
42 | public Direction getDirection() {
43 | return direction;
44 | }
45 |
46 | @Override
47 | public void updateDrawState(TextPaint tp) {
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/simple/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Mathew Kurian
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * -------------------------------------------------------------------------
17 | *
18 | * Utils.java
19 | * @author Mathew Kurian
20 | *
21 | * From TextJustify-Android Library v2.0
22 | * https://github.com/bluejamesbond/TextJustify-Android
23 | *
24 | * Please report any issues
25 | * https://github.com/bluejamesbond/TextJustify-Android/issues
26 | *
27 | * Date: 11/1/14 3:03 PM
28 | */
29 |
30 | package com.qy.customview.text_justify.simple;
31 |
32 | public class Utils {
33 |
34 | /*
35 | * Refer to http://stackoverflow.com/a/2560017/1100536
36 | */
37 | public static String splitCamelCase(String s) {
38 | return s.replaceAll(
39 | String.format("%s|%s|%s",
40 | "(?<=[A-Z])(?=[A-Z][a-z])",
41 | "(?<=[^A-Z])(?=[A-Z])",
42 | "(?<=[A-Za-z])(?=[^A-Za-z])"
43 | ),
44 | " "
45 | );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | /**
14 | * Data structure for storing spring configuration.
15 | */
16 | public class SpringConfig {
17 | public double friction;
18 | public double tension;
19 |
20 | public static SpringConfig defaultConfig = SpringConfig.fromOrigamiTensionAndFriction(40, 7);
21 |
22 | /**
23 | * constructor for the SpringConfig
24 | * @param tension tension value for the SpringConfig
25 | * @param friction friction value for the SpringConfig
26 | */
27 | public SpringConfig(double tension, double friction) {
28 | this.tension = tension;
29 | this.friction = friction;
30 | }
31 |
32 | /**
33 | * A helper to make creating a SpringConfig easier with values mapping to the Origami values.
34 | * @param qcTension tension as defined in the Quartz Composition
35 | * @param qcFriction friction as defined in the Quartz Composition
36 | * @return a SpringConfig that maps to these values
37 | */
38 | public static SpringConfig fromOrigamiTensionAndFriction(double qcTension, double qcFriction) {
39 | return new SpringConfig(
40 | OrigamiValueConverter.tensionFromOrigamiValue(qcTension),
41 | OrigamiValueConverter.frictionFromOrigamiValue(qcFriction)
42 | );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/ui/Util.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.toggle_button.facebook.rebound.ui;
2 |
3 | import android.content.res.Resources;
4 | import android.util.TypedValue;
5 | import android.view.ViewGroup;
6 | import android.widget.FrameLayout;
7 | import android.widget.RelativeLayout;
8 |
9 | /**
10 | * Utilities for generating view hierarchies without using resources.
11 | */
12 | public abstract class Util {
13 |
14 | public static final int dpToPx(float dp, Resources res) {
15 | return (int) TypedValue.applyDimension(
16 | TypedValue.COMPLEX_UNIT_DIP,
17 | dp,
18 | res.getDisplayMetrics());
19 | }
20 |
21 | public static final FrameLayout.LayoutParams createLayoutParams(int width, int height) {
22 | return new FrameLayout.LayoutParams(width, height);
23 | }
24 |
25 | public static final FrameLayout.LayoutParams createMatchParams() {
26 | return createLayoutParams(
27 | ViewGroup.LayoutParams.MATCH_PARENT,
28 | ViewGroup.LayoutParams.MATCH_PARENT);
29 | }
30 |
31 | public static final FrameLayout.LayoutParams createWrapParams() {
32 | return createLayoutParams(
33 | ViewGroup.LayoutParams.WRAP_CONTENT,
34 | ViewGroup.LayoutParams.WRAP_CONTENT);
35 | }
36 |
37 | public static final FrameLayout.LayoutParams createWrapMatchParams() {
38 | return createLayoutParams(
39 | ViewGroup.LayoutParams.WRAP_CONTENT,
40 | ViewGroup.LayoutParams.MATCH_PARENT);
41 | }
42 |
43 | public static final FrameLayout.LayoutParams createMatchWrapParams() {
44 | return createLayoutParams(
45 | ViewGroup.LayoutParams.MATCH_PARENT,
46 | ViewGroup.LayoutParams.WRAP_CONTENT);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/IntroActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.text.TextUtils;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.TextView;
10 | import butterknife.ButterKnife;
11 | import butterknife.InjectView;
12 | import butterknife.OnClick;
13 |
14 | import com.qy.main.R;
15 | import com.qy.main.bean.Obj;
16 | import com.qy.main.utils.AssetsUtil;
17 |
18 | public class IntroActivity extends Activity{
19 |
20 | @InjectView(R.id.intro_title)
21 | TextView title;
22 | @InjectView(R.id.intro_content)
23 | TextView intro;
24 | @InjectView(R.id.intro_url)
25 | TextView url;
26 | @InjectView(R.id.intro_btn)
27 | Button btn;
28 |
29 | Obj obj;
30 |
31 | @Override
32 | public void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.intro);
35 | ButterKnife.inject(this);
36 |
37 | if(getIntent().hasExtra("obj")){
38 | obj = (Obj) getIntent().getSerializableExtra("obj");
39 | }
40 | if(null==obj){
41 | finish();
42 | return;
43 | }
44 |
45 | title.setText(obj.title);
46 | intro.setText(AssetsUtil.getAssetString(obj.title+".txt", this));
47 | if(!TextUtils.isEmpty(obj.url)){
48 | url.setVisibility(View.VISIBLE);
49 | url.setText("项目主页:"+obj.url);
50 | }
51 | btn.setVisibility(obj.isEnable ? View.VISIBLE : View.GONE);
52 | }
53 |
54 | @OnClick(R.id.intro_btn)
55 | public void click(){
56 | startActivity(new Intent(this,obj._class));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/sample/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #00000000
5 | #FFFFFF
6 | #FFFFFF
7 | #D0D0D0
8 | #B6B6B6
9 | #AEDEF4
10 | #96BFD2
11 | #DD6B55
12 | #CD5B55
13 | #F27474
14 | #A5DC86
15 | #33A5DC86
16 | #F8BB86
17 | #575757
18 | #ff37474f
19 | #ff263238
20 | #ff21272b
21 | #ff80cbc4
22 | #ff009688
23 |
24 |
25 |
26 | #ffdedede
27 | #ff0099cc
28 | #ff00719b
29 | #ffff4444
30 | #ffcd3a3a
31 | #ff99cc00
32 | #ff6d9b00
33 | @android:color/white
34 | @android:color/white
35 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/simple/ArticleBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Mathew Kurian
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * -------------------------------------------------------------------------
17 | *
18 | * ArticleBuilder.java
19 | * @author Mathew Kurian
20 | *
21 | * From TextJustify-Android Library v2.0
22 | * https://github.com/bluejamesbond/TextJustify-Android
23 | *
24 | * Please report any issues
25 | * https://github.com/bluejamesbond/TextJustify-Android/issues
26 | *
27 | * Date: 11/1/14 3:03 PM
28 | */
29 |
30 | package com.qy.customview.text_justify.simple;
31 |
32 | import android.text.Html;
33 | import android.text.SpannableStringBuilder;
34 | import android.text.Spanned;
35 |
36 | /**
37 | * Created by Mathew Kurian on 10/31/2014.
38 | */
39 | public class ArticleBuilder extends SpannableStringBuilder {
40 | public ArticleBuilder append(CharSequence text, boolean newline, Object... spans) {
41 | int start = this.length();
42 | this.append(Html.fromHtml(text + "
" + (newline ? "
" : "")));
43 | for (Object span : spans) {
44 | this.setSpan(span, start, this.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
45 | }
46 | return this;
47 | }
48 | }
--------------------------------------------------------------------------------
/sample/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 开源学院
5 |
6 |
7 | 下拉刷新
8 | 松开刷新数据
9 | 正在加载...
10 | 上次更新时间:
11 | 查看更多
12 | 松开载入更多
13 |
14 |
15 | Here\'s a message!
16 | OK
17 | Cancel
18 | Loading...
19 | Default Progressbar:
20 |
21 |
22 | Upload
23 | Error
24 | Complete
25 | Indeterminate Progress Sample
26 | Integer Progress Sample
27 | State Change Sample
28 | Progress Padding Sample
29 | Custom Selector Sample
30 |
31 | - @string/IndeterminateProgressSample
32 | - @string/IntegerProgressSample
33 | - @string/StateChangeSample
34 | - @string/ProgressPaddingSample
35 | - @string/CustomSelectorSample
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/sample/res/layout/intro.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
19 |
20 |
27 |
28 |
36 |
37 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | public class SpringUtil {
14 |
15 | /**
16 | * Map a value within a given range to another range.
17 | * @param value the value to map
18 | * @param fromLow the low end of the range the value is within
19 | * @param fromHigh the high end of the range the value is within
20 | * @param toLow the low end of the range to map to
21 | * @param toHigh the high end of the range to map to
22 | * @return the mapped value
23 | */
24 | public static double mapValueFromRangeToRange(
25 | double value,
26 | double fromLow,
27 | double fromHigh,
28 | double toLow,
29 | double toHigh) {
30 | double fromRangeSize = fromHigh - fromLow;
31 | double toRangeSize = toHigh - toLow;
32 | double valueScale = (value - fromLow) / fromRangeSize;
33 | return toLow + (valueScale * toRangeSize);
34 | }
35 |
36 | /**
37 | * Clamp a value to be within the provided range.
38 | * @param value the value to clamp
39 | * @param low the low end of the range
40 | * @param high the high end of the range
41 | * @return the clamped value
42 | */
43 | public static double clamp(double value, double low, double high) {
44 | return Math.min(Math.max(value, low), high);
45 | }
46 | public static int clamp(int value, int low, int high) {
47 | return Math.min(Math.max(value, low), high);
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/dragsort_listview/DragSortItemViewCheckable.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.dragsort_listview;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.View.MeasureSpec;
7 | import android.view.ViewGroup;
8 | import android.widget.AbsListView;
9 | import android.widget.Checkable;
10 | import android.util.Log;
11 |
12 | /**
13 | * Lightweight ViewGroup that wraps list items obtained from user's
14 | * ListAdapter. ItemView expects a single child that has a definite
15 | * height (i.e. the child's layout height is not MATCH_PARENT).
16 | * The width of
17 | * ItemView will always match the width of its child (that is,
18 | * the width MeasureSpec given to ItemView is passed directly
19 | * to the child, and the ItemView measured width is set to the
20 | * child's measured width). The height of ItemView can be anything;
21 | * the
22 | *
23 | *
24 | * The purpose of this class is to optimize slide
25 | * shuffle animations.
26 | */
27 | public class DragSortItemViewCheckable extends DragSortItemView implements Checkable {
28 |
29 | public DragSortItemViewCheckable(Context context) {
30 | super(context);
31 | }
32 |
33 | @Override
34 | public boolean isChecked() {
35 | View child = getChildAt(0);
36 | if (child instanceof Checkable)
37 | return ((Checkable) child).isChecked();
38 | else
39 | return false;
40 | }
41 |
42 | @Override
43 | public void setChecked(boolean checked) {
44 | View child = getChildAt(0);
45 | if (child instanceof Checkable)
46 | ((Checkable) child).setChecked(checked);
47 | }
48 |
49 | @Override
50 | public void toggle() {
51 | View child = getChildAt(0);
52 | if (child instanceof Checkable)
53 | ((Checkable) child).toggle();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/sample/res/layout/residemenu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
19 |
20 |
26 |
27 |
33 |
34 |
35 |
36 |
43 |
44 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/simple/DiscrollvableRedLayout.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview.simple;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.FrameLayout;
7 |
8 | import com.qy.customview.discrollview.Discrollvable;
9 | import com.qy.main.R;
10 |
11 | /**
12 | *
13 | */
14 | public class DiscrollvableRedLayout extends FrameLayout implements Discrollvable {
15 |
16 | private static final String TAG = "DiscrollvableRedLayout";
17 |
18 | private View mRedView1;
19 | private View mRedView2;
20 |
21 | private float mRedView1TranslationY;
22 |
23 | public DiscrollvableRedLayout(Context context) {
24 | super(context);
25 | }
26 |
27 | public DiscrollvableRedLayout(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | public DiscrollvableRedLayout(Context context, AttributeSet attrs, int defStyle) {
32 | super(context, attrs, defStyle);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 |
39 | mRedView1 = findViewById(R.id.redView1);
40 | mRedView1TranslationY = mRedView1.getTranslationY();
41 | mRedView2 = findViewById(R.id.redView2);
42 | }
43 |
44 | @Override
45 | public void onResetDiscrollve() {
46 |
47 | }
48 |
49 | @Override
50 | public void onDiscrollve(float ratio) {
51 | if(ratio <= 0.65f) {
52 | mRedView1.setTranslationY(-1 * (mRedView1.getHeight()/1.5f) * (ratio / 0.65f));
53 | } else {
54 | float rratio = (ratio - 0.65f) / 0.35f;
55 | rratio = Math.min(rratio, 1.0f);
56 | mRedView1.setTranslationY(-1 * (mRedView1.getHeight()/1.5f));
57 | mRedView2.setAlpha(1 * rratio);
58 | mRedView2.setScaleX(1.0f * rratio);
59 | mRedView2.setScaleY(1.0f * rratio);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/sample/res/layout/textjustify_layout.xml:
--------------------------------------------------------------------------------
1 |
6 |
18 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/swipemenu_listview/SwipeMenuItem.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.swipemenu_listview;
2 |
3 |
4 | import android.content.Context;
5 | import android.graphics.drawable.Drawable;
6 |
7 | /**
8 | *
9 | * @author baoyz
10 | * @date 2014-8-23
11 | *
12 | */
13 | public class SwipeMenuItem {
14 |
15 | private int id;
16 | private Context mContext;
17 | private String title;
18 | private Drawable icon;
19 | private Drawable background;
20 | private int titleColor;
21 | private int titleSize;
22 | private int width;
23 |
24 | public SwipeMenuItem(Context context) {
25 | mContext = context;
26 | }
27 |
28 | public int getId() {
29 | return id;
30 | }
31 |
32 | public void setId(int id) {
33 | this.id = id;
34 | }
35 |
36 | public int getTitleColor() {
37 | return titleColor;
38 | }
39 |
40 | public int getTitleSize() {
41 | return titleSize;
42 | }
43 |
44 | public void setTitleSize(int titleSize) {
45 | this.titleSize = titleSize;
46 | }
47 |
48 | public void setTitleColor(int titleColor) {
49 | this.titleColor = titleColor;
50 | }
51 |
52 | public String getTitle() {
53 | return title;
54 | }
55 |
56 | public void setTitle(String title) {
57 | this.title = title;
58 | }
59 |
60 | public void setTitle(int resId) {
61 | setTitle(mContext.getString(resId));
62 | }
63 |
64 | public Drawable getIcon() {
65 | return icon;
66 | }
67 |
68 | public void setIcon(Drawable icon) {
69 | this.icon = icon;
70 | }
71 |
72 | public void setIcon(int resId) {
73 | this.icon = mContext.getResources().getDrawable(resId);
74 | }
75 |
76 | public Drawable getBackground() {
77 | return background;
78 | }
79 |
80 | public void setBackground(Drawable background) {
81 | this.background = background;
82 | }
83 |
84 | public void setBackground(int resId) {
85 | this.background = mContext.getResources().getDrawable(resId);
86 | }
87 |
88 | public int getWidth() {
89 | return width;
90 | }
91 |
92 | public void setWidth(int width) {
93 | this.width = width;
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/residemenu/TouchDisableView.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.residemenu;
2 |
3 |
4 |
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.view.MotionEvent;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | /**
12 | * Created by thonguyen on 15/4/14.
13 | */
14 | class TouchDisableView extends ViewGroup {
15 |
16 | private View mContent;
17 |
18 | // private int mMode;
19 | private boolean mTouchDisabled = false;
20 |
21 | public TouchDisableView(Context context) {
22 | this(context, null);
23 | }
24 |
25 | public TouchDisableView(Context context, AttributeSet attrs) {
26 | super(context, attrs);
27 | }
28 |
29 | public void setContent(View v) {
30 | if (mContent != null) {
31 | this.removeView(mContent);
32 | }
33 | mContent = v;
34 | addView(mContent);
35 | }
36 |
37 | public View getContent() {
38 | return mContent;
39 | }
40 |
41 | @Override
42 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
43 |
44 | int width = getDefaultSize(0, widthMeasureSpec);
45 | int height = getDefaultSize(0, heightMeasureSpec);
46 | setMeasuredDimension(width, height);
47 |
48 | final int contentWidth = getChildMeasureSpec(widthMeasureSpec, 0, width);
49 | final int contentHeight = getChildMeasureSpec(heightMeasureSpec, 0, height);
50 | mContent.measure(contentWidth, contentHeight);
51 | }
52 |
53 | @Override
54 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
55 | final int width = r - l;
56 | final int height = b - t;
57 | mContent.layout(0, 0, width, height);
58 | }
59 |
60 | @Override
61 | public boolean onInterceptTouchEvent(MotionEvent ev) {
62 | return mTouchDisabled;
63 | }
64 |
65 | void setTouchDisable(boolean disableTouch) {
66 | mTouchDisabled = disableTouch;
67 | }
68 |
69 | boolean isTouchDisabled() {
70 | return mTouchDisabled;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/residemenu/ResideMenuItem.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.residemenu;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.widget.ImageView;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.qy.main.R;
10 |
11 | /**
12 | * User: special
13 | * Date: 13-12-10
14 | * Time: 下午11:05
15 | * Mail: specialcyci@gmail.com
16 | */
17 | public class ResideMenuItem extends LinearLayout{
18 |
19 | /** menu item icon */
20 | private ImageView iv_icon;
21 | /** menu item title */
22 | private TextView tv_title;
23 |
24 | public ResideMenuItem(Context context) {
25 | super(context);
26 | initViews(context);
27 | }
28 |
29 | public ResideMenuItem(Context context, int icon, int title) {
30 | super(context);
31 | initViews(context);
32 | iv_icon.setImageResource(icon);
33 | tv_title.setText(title);
34 | }
35 |
36 | public ResideMenuItem(Context context, int icon, String title) {
37 | super(context);
38 | initViews(context);
39 | iv_icon.setImageResource(icon);
40 | tv_title.setText(title);
41 | }
42 |
43 | private void initViews(Context context){
44 | LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
45 | inflater.inflate(R.layout.residemenu_item, this);
46 | iv_icon = (ImageView) findViewById(R.id.iv_icon);
47 | tv_title = (TextView) findViewById(R.id.tv_title);
48 | }
49 |
50 | /**
51 | * set the icon color;
52 | *
53 | * @param icon
54 | */
55 | public void setIcon(int icon){
56 | iv_icon.setImageResource(icon);
57 | }
58 |
59 | /**
60 | * set the title with resource
61 | * ;
62 | * @param title
63 | */
64 | public void setTitle(int title){
65 | tv_title.setText(title);
66 | }
67 |
68 | /**
69 | * set the title with string;
70 | *
71 | * @param title
72 | */
73 | public void setTitle(String title){
74 | tv_title.setText(title);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/flabby_listview/FlabbyAdapter.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.flabby_listview;
2 |
3 | import java.util.List;
4 | import java.util.Random;
5 |
6 | import android.content.Context;
7 | import android.graphics.Color;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.TextView;
13 | import butterknife.ButterKnife;
14 | import butterknife.InjectView;
15 |
16 | import com.qy.main.R;
17 |
18 | /**
19 | * Created by jpardogo on 22/03/2014.
20 | */
21 | public class FlabbyAdapter extends ArrayAdapter{
22 | private Context mContext;
23 | private List mItems;
24 | private Random mRandomizer = new Random();
25 |
26 | public FlabbyAdapter(Context context, List items) {
27 | super(context,0,items);
28 | mContext = context;
29 | mItems = items;
30 | }
31 |
32 | @Override
33 | public int getCount() {
34 | return mItems.size();
35 | }
36 |
37 | @Override
38 | public String getItem(int position) {
39 | return mItems.get(position);
40 | }
41 |
42 | @Override
43 | public long getItemId(int position) {
44 | return position;
45 | }
46 |
47 | @Override
48 | public View getView(int position, View convertView, ViewGroup parent) {
49 | ViewHolder holder;
50 | if (convertView == null) {
51 | convertView = LayoutInflater.from(mContext).inflate(R.layout.flabby_lv_item, parent, false);
52 | holder = new ViewHolder(convertView);
53 | convertView.setTag(holder);
54 | } else {
55 | holder = (ViewHolder) convertView.getTag();
56 | }
57 |
58 | int color = Color.argb(255, mRandomizer.nextInt(256), mRandomizer.nextInt(256), mRandomizer.nextInt(256));
59 | ((FlabbyLayout)convertView).setFlabbyColor(color);
60 | holder.text.setText(getItem(position));
61 | return convertView;
62 | }
63 |
64 | static class ViewHolder {
65 | @InjectView(R.id.flabby_lv_text)
66 | TextView text;
67 |
68 | public ViewHolder(View view) {
69 | ButterKnife.inject(this, view);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/simple/DiscrollvableGreenLayout.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview.simple;
2 |
3 | import android.animation.ArgbEvaluator;
4 | import android.content.Context;
5 | import android.graphics.Color;
6 | import android.util.AttributeSet;
7 | import android.widget.LinearLayout;
8 | import android.widget.TextView;
9 |
10 | import com.qy.customview.discrollview.Discrollvable;
11 | import com.qy.main.R;
12 |
13 | /**
14 | *
15 | */
16 | public class DiscrollvableGreenLayout extends LinearLayout implements Discrollvable {
17 |
18 | private static final String TAG = "DiscrollvableGreenLayout";
19 |
20 | private TextView mGreenView1;
21 | private float mGreenView1TranslationY;
22 | private int mGreenColor;
23 | private int mBlackColor = Color.BLACK;
24 | private ArgbEvaluator mArgbEvaluator = new ArgbEvaluator();
25 |
26 | public DiscrollvableGreenLayout(Context context) {
27 | super(context);
28 | }
29 |
30 | public DiscrollvableGreenLayout(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | }
33 |
34 | public DiscrollvableGreenLayout(Context context, AttributeSet attrs, int defStyle) {
35 | super(context, attrs, defStyle);
36 | }
37 |
38 | @Override
39 | protected void onFinishInflate() {
40 | super.onFinishInflate();
41 |
42 | mGreenView1 = (TextView) findViewById(R.id.greenView1);
43 | mGreenView1TranslationY = mGreenView1.getTranslationY();
44 | mGreenColor = getResources().getColor(android.R.color.holo_green_light);
45 | }
46 |
47 | @Override
48 | public void onResetDiscrollve() {
49 | mGreenView1.setTranslationY(mGreenView1TranslationY);
50 | mGreenView1.setTextColor(mGreenColor);
51 | setBackgroundColor(mBlackColor);
52 | }
53 |
54 | @Override
55 | public void onDiscrollve(float ratio) {
56 | mGreenView1.setTranslationY(mGreenView1TranslationY * (1 - ratio));
57 | if(ratio >= 0.5f) {
58 | ratio = (ratio - 0.5f) / 0.5f;
59 | mGreenView1.setTextColor((Integer) mArgbEvaluator.evaluate(ratio, mBlackColor, mGreenColor));
60 | setBackgroundColor((Integer) mArgbEvaluator.evaluate(ratio, mGreenColor, mBlackColor));
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/circular_progress_button/CircularProgressDrawable.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.circular_progress_button;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.ColorFilter;
5 | import android.graphics.Paint;
6 | import android.graphics.Path;
7 | import android.graphics.Rect;
8 | import android.graphics.RectF;
9 | import android.graphics.drawable.Drawable;
10 |
11 | class CircularProgressDrawable extends Drawable {
12 |
13 | private float mSweepAngle;
14 | private float mStartAngle;
15 | private int mSize;
16 | private int mStrokeWidth;
17 | private int mStrokeColor;
18 |
19 | public CircularProgressDrawable(int size, int strokeWidth, int strokeColor) {
20 | mSize = size;
21 | mStrokeWidth = strokeWidth;
22 | mStrokeColor = strokeColor;
23 | mStartAngle = -90;
24 | mSweepAngle = 0;
25 | }
26 |
27 | public void setSweepAngle(float sweepAngle) {
28 | mSweepAngle = sweepAngle;
29 | }
30 |
31 | public int getSize() {
32 | return mSize;
33 | }
34 |
35 | @Override
36 | public void draw(Canvas canvas) {
37 | final Rect bounds = getBounds();
38 |
39 | if (mPath == null) {
40 | mPath = new Path();
41 | }
42 | mPath.reset();
43 | mPath.addArc(getRect(), mStartAngle, mSweepAngle);
44 | mPath.offset(bounds.left, bounds.top);
45 | canvas.drawPath(mPath, createPaint());
46 | }
47 |
48 | @Override
49 | public void setAlpha(int alpha) {
50 |
51 | }
52 |
53 | @Override
54 | public void setColorFilter(ColorFilter cf) {
55 | }
56 |
57 | @Override
58 | public int getOpacity() {
59 | return 1;
60 | }
61 |
62 | private RectF mRectF;
63 | private Paint mPaint;
64 | private Path mPath;
65 |
66 | private RectF getRect() {
67 | if (mRectF == null) {
68 | int index = mStrokeWidth / 2;
69 | mRectF = new RectF(index, index, getSize() - index, getSize() - index);
70 | }
71 | return mRectF;
72 | }
73 |
74 | private Paint createPaint() {
75 | if (mPaint == null) {
76 | mPaint = new Paint();
77 | mPaint.setAntiAlias(true);
78 | mPaint.setStyle(Paint.Style.STROKE);
79 | mPaint.setStrokeWidth(mStrokeWidth);
80 | mPaint.setColor(mStrokeColor);
81 | }
82 |
83 | return mPaint;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/simple/DiscrollvablePurpleLayout.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview.simple;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 |
8 | import com.qy.customview.discrollview.Discrollvable;
9 | import com.qy.main.R;
10 |
11 | /**
12 | *
13 | */
14 | public class DiscrollvablePurpleLayout extends LinearLayout implements Discrollvable {
15 |
16 | private static final String TAG = "DiscrollvablePurpleLayout";
17 |
18 | private View mPurpleView1;
19 | private View mPurpleView2;
20 |
21 | private float mPurpleView1TranslationX;
22 | private float mPurpleView2TranslationX;
23 |
24 | public DiscrollvablePurpleLayout(Context context) {
25 | super(context);
26 | }
27 |
28 | public DiscrollvablePurpleLayout(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public DiscrollvablePurpleLayout(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | }
35 |
36 | @Override
37 | protected void onFinishInflate() {
38 | super.onFinishInflate();
39 |
40 | mPurpleView1 = findViewById(R.id.purpleView1);
41 | mPurpleView1TranslationX = mPurpleView1.getTranslationX();
42 | mPurpleView2 = findViewById(R.id.purpleView2);
43 | mPurpleView2TranslationX = mPurpleView2.getTranslationX();
44 | }
45 |
46 | @Override
47 | public void onResetDiscrollve() {
48 | mPurpleView1.setAlpha(0);
49 | mPurpleView2.setAlpha(0);
50 | mPurpleView1.setTranslationX(mPurpleView1TranslationX);
51 | mPurpleView2.setTranslationX(mPurpleView2TranslationX);
52 | }
53 |
54 | @Override
55 | public void onDiscrollve(float ratio) {
56 | if(ratio <= 0.5f) {
57 | mPurpleView2.setTranslationX(0);
58 | mPurpleView2.setAlpha(0.0f);
59 | float rratio = ratio / 0.5f;
60 | mPurpleView1.setTranslationX(mPurpleView1TranslationX * (1 - rratio));
61 | mPurpleView1.setAlpha(rratio);
62 | } else {
63 | mPurpleView1.setTranslationX(0);
64 | mPurpleView1.setAlpha(1.0f);
65 | float rratio = (ratio - 0.5f) / 0.5f;
66 | mPurpleView2.setTranslationX(mPurpleView2TranslationX * (1 - rratio));
67 | mPurpleView2.setAlpha(rratio);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/Console.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify;
2 |
3 | /*
4 | * Copyright 2014 Mathew Kurian
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * -------------------------------------------------------------------------
19 | *
20 | * Console.java
21 | * @author Mathew Kurian
22 | *
23 | * From TextJustify-Android Library v2.0
24 | * https://github.com/bluejamesbond/TextJustify-Android
25 | *
26 | * Please report any issues
27 | * https://github.com/bluejamesbond/TextJustify-Android/issues
28 | *
29 | * Date: 10/27/14 1:36 PM
30 | */
31 |
32 | @SuppressWarnings("unused")
33 | public class Console {
34 |
35 | public static void log(String tag, String s) {
36 | android.util.Log.d(tag, s);
37 | }
38 |
39 | public static void log(String tag, int s) {
40 | android.util.Log.d(tag, s + "");
41 | }
42 |
43 | public static void log(String tag, long s) {
44 | android.util.Log.d(tag, s + "");
45 | }
46 |
47 | public static void log(String tag, double s) {
48 | android.util.Log.d(tag, s + "");
49 | }
50 |
51 | public static void log(String tag, float s) {
52 | android.util.Log.d(tag, s + "");
53 | }
54 |
55 | public static void log(String tag, boolean s) {
56 | android.util.Log.d(tag, s + "");
57 | }
58 |
59 |
60 | public static void log(String s) {
61 | android.util.Log.d("", s);
62 | }
63 |
64 | public static void log(int s) {
65 | android.util.Log.d("", s + "");
66 | }
67 |
68 | public static void log(long s) {
69 | android.util.Log.d("", s + "");
70 | }
71 |
72 | public static void log(double s) {
73 | android.util.Log.d("", s + "");
74 | }
75 |
76 | public static void log(float s) {
77 | android.util.Log.d("", s + "");
78 | }
79 |
80 | public static void log(boolean s) {
81 | android.util.Log.d("", s + "");
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/CircleProgressActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import java.util.Timer;
4 | import java.util.TimerTask;
5 |
6 | import android.app.Activity;
7 | import android.os.Bundle;
8 | import butterknife.ButterKnife;
9 | import butterknife.InjectView;
10 |
11 | import com.qy.customview.circleprogress.ArcProgress;
12 | import com.qy.customview.circleprogress.CircleProgress;
13 | import com.qy.customview.circleprogress.DonutProgress;
14 | import com.qy.main.R;
15 |
16 |
17 | public class CircleProgressActivity
18 | extends
19 | Activity
20 | {
21 | private Timer timer;
22 | @InjectView(R.id.donut_progress)
23 | DonutProgress donutProgress;
24 | @InjectView(R.id.donut_progress2)
25 | DonutProgress donutProgress2;
26 | @InjectView(R.id.donut_progress3)
27 | DonutProgress donutProgress3;
28 | @InjectView(R.id.donut_progress4)
29 | DonutProgress donutProgress4;
30 | @InjectView(R.id.circle_progress)
31 | CircleProgress circleProgress;
32 | @InjectView(R.id.circle_progress2)
33 | CircleProgress circleProgress2;
34 | @InjectView(R.id.arc_progress)
35 | ArcProgress arcProgress;
36 | @InjectView(R.id.arc_progress2)
37 | ArcProgress arcProgress2;
38 | @InjectView(R.id.arc_progress3)
39 | ArcProgress arcProgress3;
40 |
41 | @Override
42 | protected void onCreate(Bundle savedInstanceState) {
43 | super.onCreate(savedInstanceState);
44 | setContentView(R.layout.circleprogress_my);
45 | ButterKnife.inject(this);
46 |
47 | timer = new Timer();
48 | timer.schedule(new TimerTask()
49 | {
50 | @Override
51 | public void run() {
52 | runOnUiThread(new Runnable()
53 | {
54 | @Override
55 | public void run() {
56 | donutProgress.setProgress(donutProgress.getProgress() + 1);
57 | donutProgress2.setProgress(donutProgress2.getProgress() + 1);
58 | donutProgress3.setProgress(donutProgress3.getProgress() + 1);
59 | donutProgress4.setProgress(donutProgress4.getProgress() + 1);
60 | circleProgress.setProgress(circleProgress.getProgress() + 1);
61 | circleProgress2.setProgress(circleProgress2.getProgress() + 1);
62 | arcProgress.setProgress(arcProgress.getProgress() + 1);
63 | arcProgress2.setProgress(arcProgress2.getProgress() + 1);
64 | arcProgress3.setProgress(arcProgress3.getProgress() + 1);
65 | }
66 | });
67 | }
68 | }, 1000, 100);
69 | }
70 |
71 | @Override
72 | protected void onDestroy() {
73 | super.onDestroy();
74 | timer.cancel();
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/sample/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
22 |
23 |
30 |
31 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/sample/res/layout/xlistview_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
18 |
19 |
24 |
25 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
44 |
52 |
53 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/satellite_menu/SatelliteMenuItem.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.satellite_menu;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.view.animation.Animation;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * Menu Item.
9 | *
10 | * TODO: tell about usage
11 | *
12 | * @author Siyamed SINIR
13 | *
14 | */
15 | public class SatelliteMenuItem {
16 | private int id;
17 | private int imgResourceId;
18 | private Drawable imgDrawable;
19 | private ImageView view;
20 | private ImageView cloneView;
21 | private Animation outAnimation;
22 | private Animation inAnimation;
23 | private Animation clickAnimation;
24 | private int finalX;
25 | private int finalY;
26 |
27 | public SatelliteMenuItem(int id, int imgResourceId) {
28 | this.imgResourceId = imgResourceId;
29 | this.id = id;
30 | }
31 |
32 | public SatelliteMenuItem(int id, Drawable imgDrawable) {
33 | this.imgDrawable = imgDrawable;
34 | this.id = id;
35 | }
36 |
37 | public int getId() {
38 | return id;
39 | }
40 |
41 | public void setId(int id) {
42 | this.id = id;
43 | }
44 |
45 | public int getImgResourceId() {
46 | return imgResourceId;
47 | }
48 |
49 | public void setImgResourceId(int imgResourceId) {
50 | this.imgResourceId = imgResourceId;
51 | }
52 |
53 | public Drawable getImgDrawable() {
54 | return imgDrawable;
55 | }
56 |
57 | public void setImgDrawable(Drawable imgDrawable) {
58 | this.imgDrawable = imgDrawable;
59 | }
60 |
61 | void setView(ImageView view) {
62 | this.view = view;
63 | }
64 |
65 | ImageView getView() {
66 | return view;
67 | }
68 |
69 | void setInAnimation(Animation inAnimation) {
70 | this.inAnimation = inAnimation;
71 | }
72 |
73 | Animation getInAnimation() {
74 | return inAnimation;
75 | }
76 |
77 | void setOutAnimation(Animation outAnimation) {
78 | this.outAnimation = outAnimation;
79 | }
80 |
81 | Animation getOutAnimation() {
82 | return outAnimation;
83 | }
84 |
85 | void setFinalX(int finalX) {
86 | this.finalX = finalX;
87 | }
88 |
89 | void setFinalY(int finalY) {
90 | this.finalY = finalY;
91 | }
92 |
93 | int getFinalX() {
94 | return finalX;
95 | }
96 |
97 | int getFinalY() {
98 | return finalY;
99 | }
100 |
101 | void setCloneView(ImageView cloneView) {
102 | this.cloneView = cloneView;
103 | }
104 |
105 | ImageView getCloneView() {
106 | return cloneView;
107 | }
108 |
109 | void setClickAnimation(Animation clickAnim) {
110 | this.clickAnimation = clickAnim;
111 | }
112 |
113 | Animation getClickAnimation() {
114 | return clickAnimation;
115 | }
116 | }
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/text_justify/simple/MyQuoteSpan.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.text_justify.simple;
2 |
3 | /*
4 | * Copyright (C) 2006 The Android Open Source Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import android.graphics.Canvas;
20 | import android.graphics.Paint;
21 | import android.os.Parcel;
22 | import android.text.Layout;
23 | import android.text.ParcelableSpan;
24 | import android.text.style.LeadingMarginSpan;
25 |
26 | @SuppressWarnings("UnusedDeclaration")
27 | public class MyQuoteSpan implements LeadingMarginSpan, ParcelableSpan {
28 |
29 | private final static int QUOTE_SPAN = 9;
30 |
31 | private int mStripeWidth = 2;
32 | private int mGapWidth = 30;
33 | private int mColor;
34 |
35 | public MyQuoteSpan() {
36 | super();
37 | mColor = 0xff0000ff;
38 | }
39 |
40 | public MyQuoteSpan(int color) {
41 | super();
42 | mColor = color;
43 | }
44 |
45 | public MyQuoteSpan(int color, int stripeWidth) {
46 | super();
47 | mColor = color;
48 | mStripeWidth = stripeWidth;
49 | }
50 |
51 | public MyQuoteSpan(int color, int stripeWidth, int gapWidth) {
52 | super();
53 | mColor = color;
54 | mStripeWidth = stripeWidth;
55 | mGapWidth = gapWidth;
56 | }
57 |
58 | public MyQuoteSpan(Parcel src) {
59 | mColor = src.readInt();
60 | }
61 |
62 | public int getSpanTypeId() {
63 | return QUOTE_SPAN;
64 | }
65 |
66 | public int describeContents() {
67 | return 0;
68 | }
69 |
70 | public void writeToParcel(Parcel dest, int flags) {
71 | dest.writeInt(mColor);
72 | }
73 |
74 | public int getColor() {
75 | return mColor;
76 | }
77 |
78 | public int getLeadingMargin(boolean first) {
79 | return mStripeWidth + mGapWidth;
80 | }
81 |
82 | public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline,
83 | int bottom, CharSequence text, int start, int end, boolean first,
84 | Layout layout) {
85 |
86 | float strokeWidth = p.getStrokeWidth();
87 | int color = p.getColor();
88 |
89 | p.setStrokeWidth(mStripeWidth);
90 | p.setColor(mColor);
91 |
92 | c.drawLine(x, top, x, bottom, p);
93 |
94 | p.setStrokeWidth(strokeWidth);
95 | p.setColor(color);
96 | }
97 | }
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/dragsort_listview/SimpleFloatViewManager.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.dragsort_listview;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Point;
5 | import android.graphics.Color;
6 | import android.widget.ListView;
7 | import android.widget.ImageView;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.util.Log;
11 |
12 | /**
13 | * Simple implementation of the FloatViewManager class. Uses list
14 | * items as they appear in the ListView to create the floating View.
15 | */
16 | public class SimpleFloatViewManager implements DragSortListView.FloatViewManager {
17 |
18 | private Bitmap mFloatBitmap;
19 |
20 | private ImageView mImageView;
21 |
22 | private int mFloatBGColor = Color.BLACK;
23 |
24 | private ListView mListView;
25 |
26 | public SimpleFloatViewManager(ListView lv) {
27 | mListView = lv;
28 | }
29 |
30 | public void setBackgroundColor(int color) {
31 | mFloatBGColor = color;
32 | }
33 |
34 | /**
35 | * This simple implementation creates a Bitmap copy of the
36 | * list item currently shown at ListView position.
37 | */
38 | @Override
39 | public View onCreateFloatView(int position) {
40 | // Guaranteed that this will not be null? I think so. Nope, got
41 | // a NullPointerException once...
42 | View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
43 |
44 | if (v == null) {
45 | return null;
46 | }
47 |
48 | v.setPressed(false);
49 |
50 | // Create a copy of the drawing cache so that it does not get
51 | // recycled by the framework when the list tries to clean up memory
52 | //v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
53 | v.setDrawingCacheEnabled(true);
54 | mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
55 | v.setDrawingCacheEnabled(false);
56 |
57 | if (mImageView == null) {
58 | mImageView = new ImageView(mListView.getContext());
59 | }
60 | mImageView.setBackgroundColor(mFloatBGColor);
61 | mImageView.setPadding(0, 0, 0, 0);
62 | mImageView.setImageBitmap(mFloatBitmap);
63 | mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
64 |
65 | return mImageView;
66 | }
67 |
68 | /**
69 | * This does nothing
70 | */
71 | @Override
72 | public void onDragFloatView(View floatView, Point position, Point touch) {
73 | // do nothing
74 | }
75 |
76 | /**
77 | * Removes the Bitmap from the ImageView created in
78 | * onCreateFloatView() and tells the system to recycle it.
79 | */
80 | @Override
81 | public void onDestroyFloatView(View floatView) {
82 | ((ImageView) floatView).setImageDrawable(null);
83 |
84 | mFloatBitmap.recycle();
85 | mFloatBitmap = null;
86 | }
87 |
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/toggle_button/facebook/rebound/SpringConfigRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | *
9 | */
10 |
11 | package com.qy.customview.toggle_button.facebook.rebound;
12 |
13 | import java.util.Collections;
14 | import java.util.HashMap;
15 | import java.util.Map;
16 |
17 | /**
18 | * class for maintaining a registry of all spring configs
19 | */
20 | public class SpringConfigRegistry {
21 |
22 | private static final SpringConfigRegistry INSTANCE = new SpringConfigRegistry(true);
23 |
24 | public static SpringConfigRegistry getInstance() {
25 | return INSTANCE;
26 | }
27 |
28 | private final Map mSpringConfigMap;
29 |
30 | /**
31 | * constructor for the SpringConfigRegistry
32 | */
33 | SpringConfigRegistry(boolean includeDefaultEntry) {
34 | mSpringConfigMap = new HashMap();
35 | if (includeDefaultEntry) {
36 | addSpringConfig(SpringConfig.defaultConfig, "default config");
37 | }
38 | }
39 |
40 | /**
41 | * add a SpringConfig to the registry
42 | *
43 | * @param springConfig SpringConfig to add to the registry
44 | * @param configName name to give the SpringConfig in the registry
45 | * @return true if the SpringConfig was added, false if a config with that name is already
46 | * present.
47 | */
48 | public boolean addSpringConfig(SpringConfig springConfig, String configName) {
49 | if (springConfig == null) {
50 | throw new IllegalArgumentException("springConfig is required");
51 | }
52 | if (configName == null) {
53 | throw new IllegalArgumentException("configName is required");
54 | }
55 | if (mSpringConfigMap.containsKey(springConfig)) {
56 | return false;
57 | }
58 | mSpringConfigMap.put(springConfig, configName);
59 | return true;
60 | }
61 |
62 | /**
63 | * remove a specific SpringConfig from the registry
64 | * @param springConfig the of the SpringConfig to remove
65 | * @return true if the SpringConfig was removed, false if it was not present.
66 | */
67 | public boolean removeSpringConfig(SpringConfig springConfig) {
68 | if (springConfig == null) {
69 | throw new IllegalArgumentException("springConfig is required");
70 | }
71 | return mSpringConfigMap.remove(springConfig) != null;
72 | }
73 |
74 | /**
75 | * retrieve all SpringConfig in the registry
76 | * @return a list of all SpringConfig
77 | */
78 | public Map getAllSpringConfig() {
79 | return Collections.unmodifiableMap(mSpringConfigMap);
80 | }
81 |
82 | /**
83 | * clear all SpringConfig in the registry
84 | */
85 | public void removeAllSpringConfig() {
86 | mSpringConfigMap.clear();
87 | }
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/SatelliteMenuActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Mathew Kurian
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * -------------------------------------------------------------------------
17 | *
18 | * TextJustifyActivity.java
19 | * @author Mathew Kurian
20 | *
21 | * From TextJustify-Android Library v2.0
22 | * https://github.com/bluejamesbond/TextJustify-Android
23 | *
24 | * Please report any issues
25 | * https://github.com/bluejamesbond/TextJustify-Android/issues
26 | *
27 | * Date: 11/1/14 3:03 PM
28 | */
29 |
30 | package com.qy.main.activity;
31 |
32 | import java.util.ArrayList;
33 | import java.util.List;
34 |
35 | import android.app.Activity;
36 | import android.os.Bundle;
37 | import android.util.Log;
38 | import android.widget.Toast;
39 |
40 | import com.qy.customview.satellite_menu.SatelliteMenu;
41 | import com.qy.customview.satellite_menu.SatelliteMenu.SateliteClickedListener;
42 | import com.qy.customview.satellite_menu.SatelliteMenuItem;
43 | import com.qy.main.R;
44 |
45 | public class SatelliteMenuActivity extends Activity {
46 |
47 | @Override
48 | protected void onCreate(Bundle savedInstanceState) {
49 | super.onCreate(savedInstanceState);
50 | setContentView(R.layout.satellite_menu_main);
51 |
52 | SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.menu);
53 |
54 | // Set from XML, possible to programmatically set
55 | // float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 170, getResources().getDisplayMetrics());
56 | // menu.setSatelliteDistance((int) distance);
57 | // menu.setExpandDuration(500);
58 | // menu.setCloseItemsOnClick(false);
59 | // menu.setTotalSpacingDegree(60);
60 |
61 | List items = new ArrayList();
62 | items.add(new SatelliteMenuItem(4, R.drawable.ic_1));
63 | items.add(new SatelliteMenuItem(4, R.drawable.ic_3));
64 | items.add(new SatelliteMenuItem(4, R.drawable.ic_4));
65 | items.add(new SatelliteMenuItem(3, R.drawable.ic_5));
66 | items.add(new SatelliteMenuItem(2, R.drawable.ic_6));
67 | items.add(new SatelliteMenuItem(1, R.drawable.ic_2));
68 | // items.add(new SatelliteMenuItem(5, R.drawable.sat_item));
69 | menu.addItems(items);
70 |
71 | menu.setOnItemClickedListener(new SateliteClickedListener() {
72 | public void eventOccured(int id) {
73 | Log.i("sat", "Clicked on " + id);
74 | Toast.makeText(SatelliteMenuActivity.this, "Clicked on " + id, Toast.LENGTH_SHORT).show();
75 | }
76 | });
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/swipemenu_listview/SwipeMenuView.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.swipemenu_listview;
2 |
3 | import java.util.List;
4 |
5 | import android.text.TextUtils;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.view.View.OnClickListener;
9 | import android.widget.ImageView;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 |
13 | /**
14 | *
15 | * @author baoyz
16 | * @date 2014-8-23
17 | *
18 | */
19 | public class SwipeMenuView extends LinearLayout implements OnClickListener {
20 |
21 | private SwipeMenuListView mListView;
22 | private SwipeMenuLayout mLayout;
23 | private SwipeMenu mMenu;
24 | private OnSwipeItemClickListener onItemClickListener;
25 | private int position;
26 |
27 | public int getPosition() {
28 | return position;
29 | }
30 |
31 | public void setPosition(int position) {
32 | this.position = position;
33 | }
34 |
35 | public SwipeMenuView(SwipeMenu menu, SwipeMenuListView listView) {
36 | super(menu.getContext());
37 | mListView = listView;
38 | mMenu = menu;
39 | List items = menu.getMenuItems();
40 | int id = 0;
41 | for (SwipeMenuItem item : items) {
42 | addItem(item, id++);
43 | }
44 | }
45 |
46 | private void addItem(SwipeMenuItem item, int id) {
47 | LayoutParams params = new LayoutParams(item.getWidth(),
48 | LayoutParams.MATCH_PARENT);
49 | LinearLayout parent = new LinearLayout(getContext());
50 | parent.setId(id);
51 | parent.setGravity(Gravity.CENTER);
52 | parent.setOrientation(LinearLayout.VERTICAL);
53 | parent.setLayoutParams(params);
54 | parent.setBackgroundDrawable(item.getBackground());
55 | parent.setOnClickListener(this);
56 | addView(parent);
57 |
58 | if (item.getIcon() != null) {
59 | parent.addView(createIcon(item));
60 | }
61 | if (!TextUtils.isEmpty(item.getTitle())) {
62 | parent.addView(createTitle(item));
63 | }
64 |
65 | }
66 |
67 | private ImageView createIcon(SwipeMenuItem item) {
68 | ImageView iv = new ImageView(getContext());
69 | iv.setImageDrawable(item.getIcon());
70 | return iv;
71 | }
72 |
73 | private TextView createTitle(SwipeMenuItem item) {
74 | TextView tv = new TextView(getContext());
75 | tv.setText(item.getTitle());
76 | tv.setGravity(Gravity.CENTER);
77 | tv.setTextSize(item.getTitleSize());
78 | tv.setTextColor(item.getTitleColor());
79 | return tv;
80 | }
81 |
82 | @Override
83 | public void onClick(View v) {
84 | if (onItemClickListener != null && mLayout.isOpen()) {
85 | onItemClickListener.onItemClick(this, mMenu, v.getId());
86 | }
87 | }
88 |
89 | public OnSwipeItemClickListener getOnSwipeItemClickListener() {
90 | return onItemClickListener;
91 | }
92 |
93 | public void setOnSwipeItemClickListener(OnSwipeItemClickListener onItemClickListener) {
94 | this.onItemClickListener = onItemClickListener;
95 | }
96 |
97 | public void setLayout(SwipeMenuLayout mLayout) {
98 | this.mLayout = mLayout;
99 | }
100 |
101 | public static interface OnSwipeItemClickListener {
102 | void onItemClick(SwipeMenuView view, SwipeMenu menu, int index);
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/simple/DiscrollvableLastLayout.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview.simple;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.RelativeLayout;
7 |
8 | import com.qy.customview.discrollview.Discrollvable;
9 | import com.qy.main.R;
10 |
11 | /**
12 | *
13 | */
14 | public class DiscrollvableLastLayout extends RelativeLayout implements Discrollvable {
15 |
16 | private static final String TAG = "DiscrollvableLastLayout";
17 |
18 | private View mLastView1;
19 | private View mLastView2;
20 | private View mLastView3;
21 |
22 | private float mLastView1TranslationX;
23 | private float mLastView2TranslationX;
24 | private float mLastView3TranslationX;
25 |
26 | private float mLastView1TranslationY;
27 | private float mLastView2TranslationY;
28 | private float mLastView3TranslationY;
29 |
30 | public DiscrollvableLastLayout(Context context) {
31 | super(context);
32 | }
33 |
34 | public DiscrollvableLastLayout(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public DiscrollvableLastLayout(Context context, AttributeSet attrs, int defStyle) {
39 | super(context, attrs, defStyle);
40 | }
41 |
42 | @Override
43 | protected void onFinishInflate() {
44 | super.onFinishInflate();
45 |
46 | mLastView1 = findViewById(R.id.lastView1);
47 | mLastView2 = findViewById(R.id.lastView2);
48 | mLastView3 = findViewById(R.id.lastView3);
49 |
50 | mLastView1TranslationX = mLastView1.getTranslationX();
51 | mLastView2TranslationX = mLastView2.getTranslationX();
52 | mLastView3TranslationX = mLastView3.getTranslationX();
53 |
54 | mLastView1TranslationY = mLastView1.getTranslationY();
55 | mLastView2TranslationY = mLastView2.getTranslationY();
56 | mLastView3TranslationY = mLastView3.getTranslationY();
57 |
58 | }
59 |
60 | @Override
61 | public void onResetDiscrollve() {
62 | mLastView1.setAlpha(0);
63 | mLastView1.setTranslationX(mLastView1TranslationX);
64 | mLastView1.setTranslationY(mLastView1TranslationY);
65 | mLastView2.setAlpha(0);
66 | mLastView2.setTranslationX(mLastView2TranslationX);
67 | mLastView2.setTranslationY(mLastView2TranslationY);
68 | mLastView3.setAlpha(0);
69 | mLastView3.setTranslationX(mLastView3TranslationX);
70 | mLastView3.setTranslationY(mLastView3TranslationY);
71 | }
72 |
73 | @Override
74 | public void onDiscrollve(float ratio) {
75 | mLastView1.setTranslationX(mLastView1TranslationX * (1 - ratio));
76 | mLastView1.setTranslationY(mLastView1TranslationY * (1 - ratio));
77 | mLastView1.setAlpha(ratio);
78 |
79 | mLastView2.setTranslationX(mLastView2TranslationX * (1 - ratio));
80 | mLastView2.setTranslationY(mLastView2TranslationY * (1 - ratio));
81 | mLastView2.setAlpha(ratio);
82 |
83 | mLastView3.setTranslationX(mLastView3TranslationX * (1 - ratio));
84 | mLastView3.setTranslationY(mLastView3TranslationY * (1 - ratio));
85 | mLastView3.setAlpha(ratio);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/sample/res/layout/numberprogressbar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
22 |
23 |
31 |
32 |
38 |
39 |
46 |
47 |
48 |
55 |
56 |
57 |
64 |
65 |
72 |
73 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/dragsort_listview/DragSortItemView.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.dragsort_listview;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.View.MeasureSpec;
7 | import android.view.ViewGroup;
8 | import android.widget.AbsListView;
9 | import android.util.Log;
10 |
11 | /**
12 | * Lightweight ViewGroup that wraps list items obtained from user's
13 | * ListAdapter. ItemView expects a single child that has a definite
14 | * height (i.e. the child's layout height is not MATCH_PARENT).
15 | * The width of
16 | * ItemView will always match the width of its child (that is,
17 | * the width MeasureSpec given to ItemView is passed directly
18 | * to the child, and the ItemView measured width is set to the
19 | * child's measured width). The height of ItemView can be anything;
20 | * the
21 | *
22 | *
23 | * The purpose of this class is to optimize slide
24 | * shuffle animations.
25 | */
26 | public class DragSortItemView extends ViewGroup {
27 |
28 | private int mGravity = Gravity.TOP;
29 |
30 | public DragSortItemView(Context context) {
31 | super(context);
32 |
33 | // always init with standard ListView layout params
34 | setLayoutParams(new AbsListView.LayoutParams(
35 | ViewGroup.LayoutParams.FILL_PARENT,
36 | ViewGroup.LayoutParams.WRAP_CONTENT));
37 |
38 | //setClipChildren(true);
39 | }
40 |
41 | public void setGravity(int gravity) {
42 | mGravity = gravity;
43 | }
44 |
45 | public int getGravity() {
46 | return mGravity;
47 | }
48 |
49 | @Override
50 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
51 | final View child = getChildAt(0);
52 |
53 | if (child == null) {
54 | return;
55 | }
56 |
57 | if (mGravity == Gravity.TOP) {
58 | child.layout(0, 0, getMeasuredWidth(), child.getMeasuredHeight());
59 | } else {
60 | child.layout(0, getMeasuredHeight() - child.getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight());
61 | }
62 | }
63 |
64 | /**
65 | *
66 | */
67 | @Override
68 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
69 |
70 | int height = MeasureSpec.getSize(heightMeasureSpec);
71 | int width = MeasureSpec.getSize(widthMeasureSpec);
72 |
73 | int heightMode = MeasureSpec.getMode(heightMeasureSpec);
74 |
75 | final View child = getChildAt(0);
76 | if (child == null) {
77 | setMeasuredDimension(0, width);
78 | return;
79 | }
80 |
81 | if (child.isLayoutRequested()) {
82 | // Always let child be as tall as it wants.
83 | measureChild(child, widthMeasureSpec,
84 | MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
85 | }
86 |
87 | if (heightMode == MeasureSpec.UNSPECIFIED) {
88 | ViewGroup.LayoutParams lp = getLayoutParams();
89 |
90 | if (lp.height > 0) {
91 | height = lp.height;
92 | } else {
93 | height = child.getMeasuredHeight();
94 | }
95 | }
96 |
97 | setMeasuredDimension(width, height);
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/discrollview/simple/DiscrollvablePathLayout.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.discrollview.simple;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.DashPathEffect;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.graphics.PathEffect;
10 | import android.graphics.PathMeasure;
11 | import android.util.AttributeSet;
12 | import android.view.View;
13 | import android.widget.LinearLayout;
14 |
15 | import com.qy.customview.discrollview.Discrollvable;
16 | import com.qy.main.R;
17 |
18 | /**
19 | *
20 | */
21 | public class DiscrollvablePathLayout extends LinearLayout implements Discrollvable {
22 |
23 | private float mRatio;
24 | private Paint mPaint;
25 | private View mPathView;
26 |
27 | public DiscrollvablePathLayout(Context context) {
28 | super(context);
29 | initPaint();
30 | }
31 |
32 | public DiscrollvablePathLayout(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | initPaint();
35 | }
36 |
37 | public DiscrollvablePathLayout(Context context, AttributeSet attrs, int defStyle) {
38 | super(context, attrs, defStyle);
39 | initPaint();
40 | }
41 |
42 | @Override
43 | protected void onFinishInflate() {
44 | super.onFinishInflate();
45 | mPathView = findViewById(R.id.pathView);
46 | }
47 |
48 | private void initPaint() {
49 | mPaint = new Paint();
50 | mPaint.setStyle(Paint.Style.STROKE);
51 | mPaint.setStrokeWidth(5.0f);
52 | mPaint.setAntiAlias(true);
53 | mPaint.setColor(Color.argb(180, 255, 255, 255));
54 | }
55 |
56 | @Override
57 | public void onDiscrollve(float ratio) {
58 | mRatio = ratio;
59 | mPathView.setAlpha(ratio);
60 | mPathView.setTranslationY(-(mPathView.getHeight()/2) * ((ratio - 0.5f) / 0.5f));
61 | invalidate();
62 | }
63 |
64 | @Override
65 | public void onResetDiscrollve() {
66 | mRatio = 0.0f;
67 | mPathView.setAlpha(0);
68 | mPathView.setTranslationY(mPathView.getHeight()/2);
69 | invalidate();
70 | }
71 |
72 |
73 | @Override
74 | protected void onDraw(Canvas canvas) {
75 | super.onDraw(canvas);
76 | makeAndMeasurePath();
77 |
78 | if(!isInEditMode()) {
79 | // Apply the dash effect
80 | float length = mPathMeasure.getLength();
81 | PathEffect effect = new DashPathEffect(new float[] {length, length }, length * (1 - mRatio));
82 | mPaint.setPathEffect(effect);
83 | }
84 |
85 | canvas.drawPath(mPath, mPaint);
86 | }
87 |
88 | private PathMeasure mPathMeasure = new PathMeasure();
89 | private Path mPath = new Path();
90 |
91 | private void makeAndMeasurePath() {
92 | mPath.reset();
93 | float translationY = mPathView.getTranslationY();
94 | mPath.moveTo(mPathView.getLeft(), mPathView.getTop() + translationY);
95 | mPath.lineTo(mPathView.getLeft() + mPathView.getWidth(), mPathView.getTop() + translationY);
96 | mPath.lineTo(mPathView.getLeft() + mPathView.getWidth(), mPathView.getTop() + mPathView.getHeight() + translationY);
97 | mPath.lineTo(mPathView.getLeft(), mPathView.getTop() + mPathView.getHeight() + translationY);
98 | mPath.close();
99 | mPathMeasure.setPath(mPath, false);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/sweet_alert_dialog/OptAnimationLoader.java:
--------------------------------------------------------------------------------
1 | package com.qy.customview.sweet_alert_dialog;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.XmlResourceParser;
6 | import android.util.AttributeSet;
7 | import android.util.Xml;
8 | import android.view.animation.*;
9 | import org.xmlpull.v1.XmlPullParser;
10 | import org.xmlpull.v1.XmlPullParserException;
11 |
12 | import java.io.IOException;
13 |
14 | public class OptAnimationLoader {
15 |
16 | public static Animation loadAnimation(Context context, int id)
17 | throws Resources.NotFoundException {
18 |
19 | XmlResourceParser parser = null;
20 | try {
21 | parser = context.getResources().getAnimation(id);
22 | return createAnimationFromXml(context, parser);
23 | } catch (XmlPullParserException ex) {
24 | Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" +
25 | Integer.toHexString(id));
26 | rnf.initCause(ex);
27 | throw rnf;
28 | } catch (IOException ex) {
29 | Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" +
30 | Integer.toHexString(id));
31 | rnf.initCause(ex);
32 | throw rnf;
33 | } finally {
34 | if (parser != null) parser.close();
35 | }
36 | }
37 |
38 | private static Animation createAnimationFromXml(Context c, XmlPullParser parser)
39 | throws XmlPullParserException, IOException {
40 |
41 | return createAnimationFromXml(c, parser, null, Xml.asAttributeSet(parser));
42 | }
43 |
44 | private static Animation createAnimationFromXml(Context c, XmlPullParser parser,
45 | AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {
46 |
47 | Animation anim = null;
48 |
49 | // Make sure we are on a start tag.
50 | int type;
51 | int depth = parser.getDepth();
52 |
53 | while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
54 | && type != XmlPullParser.END_DOCUMENT) {
55 |
56 | if (type != XmlPullParser.START_TAG) {
57 | continue;
58 | }
59 |
60 | String name = parser.getName();
61 |
62 | if (name.equals("set")) {
63 | anim = new AnimationSet(c, attrs);
64 | createAnimationFromXml(c, parser, (AnimationSet)anim, attrs);
65 | } else if (name.equals("alpha")) {
66 | anim = new AlphaAnimation(c, attrs);
67 | } else if (name.equals("scale")) {
68 | anim = new ScaleAnimation(c, attrs);
69 | } else if (name.equals("rotate")) {
70 | anim = new RotateAnimation(c, attrs);
71 | } else/* if (name.equals("translate"))*/ {
72 | anim = new TranslateAnimation(c, attrs);
73 | }/* else {
74 | try {
75 | anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
76 | } catch (Exception te) {
77 | throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
78 | }
79 | }*/
80 |
81 | if (parent != null) {
82 | parent.addAnimation(anim);
83 | }
84 | }
85 |
86 | return anim;
87 |
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/xlistview/XListViewFooter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * @file XFooterView.java
3 | * @create Mar 31, 2012 9:33:43 PM
4 | * @author Maxwin
5 | * @description XListView's footer
6 | */
7 | package com.qy.customview.xlistview;
8 |
9 | import android.content.Context;
10 | import android.util.AttributeSet;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.widget.LinearLayout;
14 | import android.widget.TextView;
15 |
16 | import com.qy.main.R;
17 |
18 | public class XListViewFooter extends LinearLayout {
19 | public final static int STATE_NORMAL = 0;
20 | public final static int STATE_READY = 1;
21 | public final static int STATE_LOADING = 2;
22 |
23 | private Context mContext;
24 |
25 | private View mContentView;
26 | private View mProgressBar;
27 | private TextView mHintView;
28 |
29 | public XListViewFooter(Context context) {
30 | super(context);
31 | initView(context);
32 | }
33 |
34 | public XListViewFooter(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | initView(context);
37 | }
38 |
39 |
40 | public void setState(int state) {
41 | mHintView.setVisibility(View.INVISIBLE);
42 | mProgressBar.setVisibility(View.INVISIBLE);
43 | mHintView.setVisibility(View.INVISIBLE);
44 | if (state == STATE_READY) {
45 | mHintView.setVisibility(View.VISIBLE);
46 | mHintView.setText(R.string.xlistview_footer_hint_ready);
47 | } else if (state == STATE_LOADING) {
48 | mProgressBar.setVisibility(View.VISIBLE);
49 | } else {
50 | mHintView.setVisibility(View.VISIBLE);
51 | mHintView.setText(R.string.xlistview_footer_hint_normal);
52 | }
53 | }
54 |
55 | public void setBottomMargin(int height) {
56 | if (height < 0) return ;
57 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)mContentView.getLayoutParams();
58 | lp.bottomMargin = height;
59 | mContentView.setLayoutParams(lp);
60 | }
61 |
62 | public int getBottomMargin() {
63 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)mContentView.getLayoutParams();
64 | return lp.bottomMargin;
65 | }
66 |
67 |
68 | /**
69 | * normal status
70 | */
71 | public void normal() {
72 | mHintView.setVisibility(View.VISIBLE);
73 | mProgressBar.setVisibility(View.GONE);
74 | }
75 |
76 |
77 | /**
78 | * loading status
79 | */
80 | public void loading() {
81 | mHintView.setVisibility(View.GONE);
82 | mProgressBar.setVisibility(View.VISIBLE);
83 | }
84 |
85 | /**
86 | * hide footer when disable pull load more
87 | */
88 | public void hide() {
89 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)mContentView.getLayoutParams();
90 | lp.height = 0;
91 | mContentView.setLayoutParams(lp);
92 | }
93 |
94 | /**
95 | * show footer
96 | */
97 | public void show() {
98 | LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)mContentView.getLayoutParams();
99 | lp.height = LayoutParams.WRAP_CONTENT;
100 | mContentView.setLayoutParams(lp);
101 | }
102 |
103 | private void initView(Context context) {
104 | mContext = context;
105 | LinearLayout moreView = (LinearLayout)LayoutInflater.from(mContext).inflate(R.layout.xlistview_footer, null);
106 | addView(moreView);
107 | moreView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
108 |
109 | mContentView = moreView.findViewById(R.id.xlistview_footer_content);
110 | mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar);
111 | mHintView = (TextView)moreView.findViewById(R.id.xlistview_footer_hint_textview);
112 | }
113 |
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/sample/src/com/qy/main/activity/ToggleButtonActivity.java:
--------------------------------------------------------------------------------
1 | package com.qy.main.activity;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.os.Bundle;
6 | import android.view.animation.BounceInterpolator;
7 | import android.view.animation.TranslateAnimation;
8 | import butterknife.ButterKnife;
9 | import butterknife.InjectView;
10 |
11 | import com.qy.customview.toggle_button.ToggleButton;
12 | import com.qy.customview.toggle_button.ToggleButton.OnToggleChanged;
13 | import com.qy.customview.viewbadger.BadgeView;
14 | import com.qy.main.R;
15 |
16 | public class ToggleButtonActivity
17 | extends
18 | Activity
19 | {
20 | @InjectView(R.id.toggle_btn1)
21 | ToggleButton btn1;
22 | @InjectView(R.id.toggle_btn2)
23 | ToggleButton btn2;
24 | @InjectView(R.id.toggle_btn3)
25 | ToggleButton btn3;
26 | @InjectView(R.id.toggle_btn4)
27 | ToggleButton btn4;
28 | private static final int red = Color.parseColor("#ff3300");
29 | BadgeView badge1,badge2,badge3,badge4;
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.togglebutton_main);
34 | ButterKnife.inject(this);
35 |
36 | badge1 = new BadgeView(this, btn1);
37 | badge1.setBadgeBackgroundColor(red);
38 | badge1.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
39 | badge1.setTextColor(getResources().getColor(android.R.color.white));
40 | badge1.setText("11");
41 |
42 | badge2 = new BadgeView(this, btn2);
43 | badge2.setBackgroundResource(R.drawable.badge_ifaux);
44 | badge2.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
45 | badge2.setTextColor(getResources().getColor(android.R.color.white));
46 | badge2.setText("22");
47 |
48 | badge3 = new BadgeView(this, btn3);
49 | badge3.setBadgeBackgroundColor(red);
50 | badge3.setBadgePosition(BadgeView.POSITION_TOP_LEFT);
51 | badge3.setTextColor(getResources().getColor(android.R.color.white));
52 | badge3.setText("33");
53 |
54 | badge4 = new BadgeView(this, btn4);
55 | badge4.setBackgroundResource(R.drawable.badge_ifaux);
56 | badge4.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
57 | badge4.setTextColor(getResources().getColor(android.R.color.white));
58 | badge4.setText("44");
59 |
60 | //切换开关
61 | // btn1.toggle();
62 | // btn1.setToggleOn();
63 | // btn1.setToggleOff();
64 |
65 | //开关切换事件
66 | btn1.setOnToggleChanged(new OnToggleChanged(){
67 | @Override
68 | public void onToggle(boolean on) {
69 | if(on){
70 | badge1.show();
71 | }else{
72 | badge1.hide();
73 | }
74 | }
75 | });
76 | btn2.setOnToggleChanged(new OnToggleChanged(){
77 | @Override
78 | public void onToggle(boolean on) {
79 | badge2.toggle();
80 | }
81 | });
82 | btn3.setOnToggleChanged(new OnToggleChanged(){
83 | @Override
84 | public void onToggle(boolean on) {
85 | badge3.toggle(true);
86 | }
87 | });
88 | btn4.setOnToggleChanged(new OnToggleChanged(){
89 | @Override
90 | public void onToggle(boolean on) {
91 | TranslateAnimation anim = new TranslateAnimation(-100, 0, 0, 0);
92 | anim.setInterpolator(new BounceInterpolator());
93 | anim.setDuration(1000);
94 | badge4.toggle(anim, null);
95 | }
96 | });
97 |
98 |
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/sample/ui.src/com/qy/customview/dragsort_listview/help.txt:
--------------------------------------------------------------------------------
1 |
2 | DragSortListView
3 | 是一个支持拖拽排序和左右滑动删除功能的自定义ListView,重写了 TouchInterceptor (TI) 类来提供更加优美的拖拽动画效果。包含如下特性
4 |
5 | 完美的拖拽支持 (应该没有视觉问题)
6 | 在拖动的时候提供更平滑的滚动列表滚动
7 | 支持每个ListItem高度的多样性
8 | Public startDrag() and stopDrag() methods.
9 | 有公开的接口可以自定义拖动的View
10 |
11 | : (, <默认值>) <属性描述>.
12 | XML attributes
13 | collapsed_height: (dimension, 1px) 拖动其实位置占位符的高度。不能为0.Height of placeholder at original drag position. Cannot be zero.
14 | drag_scroll_start: (float, 0.3) 拖动时开始滚动ListView的区域(为DSLV 高度的分数值,在0到1之前)Start of drag-scroll regions (defined by a fraction of the total DSLV height; i.e. between 0 and 1).
15 | max_drag_scroll_speed: (float, 0.5) 默认线性加速的拖动时滚动的最大速度。单位:像素/毫秒。Maximum drag-scroll speed for default linear drag-scroll profile. Units of pixels/millisecond.
16 | float_alpha: (float, 1.0) 拖动View的透明度。取值0到1 , 1代表不透明。Transparency of floating View. Value from 0 to 1 where 1 is opaque.
17 | slide_shuffle_speed: (float, 0.7) 拖动View下方的View挤走的动画速度。Speed of shuffle animations underneath floating View. A value of 0 means a shuffle animation is always in progress, whereas a value of 1 means items snap from position to position without animation.
18 | drop_animation_duration: (int, 150) 拖动放下时候的动画时间。Drop animation smoothly centers the floating View over the drop slot before destroying it. Duration in milliseconds.
19 | remove_animation_duration: (int, 150) 删除一个ListView的空白区域消失的动画时间。Remove animation smoothly collapses the empty slot when an item is removed. Duration in milliseconds.
20 | track_drag_sort: (bool, false) 调试的选项。Debugging option; explained below.
21 | use_default_controller: (bool, true) DSLV是否创建一个默认的DragSortController 对象,并且设置如下属性的值。如果该属性为false,则如下的属性忽略。Have DSLV create a DragSortController instance and pass the following xml attributes to it. If you set this to false, ignore the following attributes.
22 | float_background_color: (color, BLACK) 拖动View的北背景色。默认情况下拖动View是当前拖动的Item的图像缓存。Set the background color of the floating View when using the default DragSortController. Floating View in this case is a snapshot of the list item to be dragged.
23 | drag_handle_id: (id, 0) ListItem中的一个View的资源id(或者ListItem的根view)。这个id用来识别“拖动的手柄”,只有当点击该view的时候才会触发拖动操作。使用默认DragSortController并且支持拖动操作的时候需要设置该属性。Android resource id that points to a child View of a list item (or the root View of the list item layout). This identifies the “drag handle,” or the View within a list item that must be touched to start a drag-sort of that item. Required if drags are to be enabled using the default DragSortController.
24 | sort_enabled: (bool, true) 是否启用拖动排序功能(如果您只需要左右滑动删除,则无需启用排序功能)Enable sorting of dragged item (disabling is useful when you only want item removal).
25 | drag_start_mode: (enum, “onDown”) 设置启动拖动的手势。Sets the gesture for starting a drag.
26 | “onDown”:当用户按下拖动手柄的时候启动拖动操作。 Drag starts when finger touches down on the drag handle.
27 | “onDrag”: 当用户按下拖动手柄开始拖动的时候启动拖动操作。Drag starts when finger touches down on drag handle and then drags (allows item clicks and long clicks).
28 | “onLongPress”:在拖动手柄上长按时候启动拖动操作。 Drag starts on drag handle long press (allows item clicks).
29 | remove_enabled: (bool, false) 是否启用拖动删除的功能。Enable dragged item removal by one of the remove_mode options below.
30 | remove_mode: (enum, “flingRight”) 设置启用删除的手势。Sets the gesture for removing the dragged item.
31 | “clickRemove”:点击click_remove_id对应的View来删除。 Click on item child View with id click_remove_id.
32 | “flingRight”: 快速向右滑动。Fling to the right; get outta here!
33 | “flingLeft”: 快速向左滑动。Fling to the left; sayonara sucker!
34 | “slideRight”:向左滑动的时候,Floating View会变得透明。透明后释放,删除Item。 Floating View fades as you slide your finger to the right; lifting while faded removes item.
35 | “slideLeft”: 同上,向右滑动。Floating View fades as you slide your finger to the right; lifting while faded removes item.
36 | click_remove_id: (id, 0) 当 remove_mode="clickRemove"并且remove_enabled="true"时候指定的删除一个Item的View。DragSortController使用了该属性。Android resource id that points to a child View of a list item. When remove_mode="clickRemove" andremove_enabled="true", a click on this child View removes the containing item. This attr is used by DragSortController.
37 |
38 |
39 | 更多信息参考API http://bauerca.github.com/drag-sort-listview.或者 查看项目源代码。
40 |
41 | demo地址:https://github.com/bauerca/drag-sort-listview
--------------------------------------------------------------------------------