[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-visual--goodies-brightgreen.svg?style=flat-square)](http://android-arsenal.com/details/1/4100)
The purpose of this library is to provide an easy way to implement some of the the eye-candy lists/cards/and some other widgets Google demonstrates on the Material Design Guidelines.
Checkout some of the features below.
## Lists
The goal was to mimic the lists (and Grids) shown at [Google's Material Design guidelines](https://www.google.com/design/spec/components/lists.html#lists-specs) (or hybrids of them) with just a few lines of code:
```java
ListAdapter mAdapter = new ListAdapter(){
//Use GridAdapter if you need a grid (or an hybrid)
@Override
public String getSubHeaderText(int i) {/*If you have subheaders, text'd go here*/}
@Override
public int getNumItems(){/*Number of list items go here*/}
@Override
public void bindDataToListItem(int i, View view, ImageView imageView, ImageButton
imageButton, TextView... textViews) {
//Here you actually compose the list item
//i is the index
//view is the item's view
//imageView is an image (the one at the left)
//imageButton same (at the right)
//textViews are the textfields, from top to bottom, left to right
//These will depend on the method below
}
@Override
public ListItemType getListItemDataType(int i) {/*return the list item at index i's type*/}
```
#### Also you can:
* add an header view (```listAdapter.addHeaderView(view)```)
* add dividers between the list items (``` listAdapter.setDividerStyle(DividerStyle.JUST_SUB_HEADERS)```, other options are only above dividers, or none (default)). You'll need to set their color: (```listAdapter.setDividerColor(Divider.MATERIAL_LIGHT_DIVIDER_COLOR)```, or ```MATERIAL_DARK_DIVIDER_COLOR```)
* add click/long click listener (```listAdapter.setOnItemClickListener(new OnItemClickListener(){ ... })```)
* Turn the avatars/buttons into checkboxes (```listAdapter.setShowCheckboxes(true)```)
* Same as above but in an ActionMode (```startSupportActionMode(new ListAdapter.ListCheckingActionMode(listAdapter)```)
* Make the adapter to display a view when the list is empty (```listAdapter.setEmptyView(view)```)
#### Example:
| <img src="images/sample1.gif" width="150"/> | <img src="images/sample2.png" width="150"/> |
## RecyclerViewFragment
It's basically a fragment with a RecyclerView. Just extend this class, override onViewCreated, and then you can access these methods (even if you don't use this library's adapters):
* ```setAdapter(adapter)```
* ```setEmptyText(text)```, ```setEmptyView(view)```
* ```setOnItemClickListener(listener)```, ```setOnItemLongClickListener(listener)```
* suggestions are welcome!
## Dialogs
Instead of playing with ```AlertDialog.Builder``` class each time you need a dialog...
* Create a simple message dialog with a one-liner:```MessageDialog.show(getActivity(), "title here", "hey what\'s up?")```
* Ask confirmation: ```MessageDialog.askConfirmation(getActivity(), "title here", "msg here", new DialogInterface.OnClickListener(){...})```
* A number within a range ```new NumberPickerDialog(getActivity(), Integer.MIN_VALUE, Integer.MAX_VALUE).show(new NumberPickerDialog.NumberPickerListener() {...}```
* Text that fits some parameters:
```java
new TextInputDialog(getActivity()).setInputPolicy(new TextInputDialog.InputPolicy() {
@Override
public String isTextAcceptable(String s) {
if (s.equals("asdfghjkl"))
return "what?"; //what the user wrote is not okay
return null; //What the user wrote is fine
}
}).show(new TextInputDialog.TextListener() {
@Override
public void onTextAccepted(String s) {
//isTextAcceptable(s) returned null and the user accepted
}
});
```
## CardBuilder
The intent is to create a Card like the ones at [Google's MD guidelines](https://www.google.com/design/spec/components/cards.html) with just a few lines (and not having to create layout files)
[Check the demo project](/demo/src/main/java/com/alexive/graphicalutils/demo/CardsActivity.java) for a complete sample on how to use the CardBuilder. The result is this:
| <img src="images/sample3.png" width="150"/> | <img src="images/sample4.png" width="150"/> | <img src="images/sample5.png" width="150"/> | <img src="images/sample6.png" width="150"/> |
## Proportional Image View
Self-explanatory, can restrict an image to 16:9, 4:3, 1:1 or just be like a regular ImageView
## View Utils
Transforms plenty of methods (some that usually require checking the sdk version, not null, etc) to a single line method call.
* `setBackgroundDrawable(view, drawable)`
* ~~`getDrawable(drawable)`~~ ContextCompat already has a method for that!
* `animateSetViewVisibilityGone(view)` / `animateSetViewVisibilityVisible(view)` makes a view disappear/appear with style
* `createCircularReveal(view)` / `createCircularRevealInverse(view)`
* `convertDPtoPixels(context, dp)`
## Use it in your project
In your project's root build.gradle, add `maven { url "https://jitpack.io" }` at the end of repositories:
```
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
Then, in your module's build.gradle, add `compile 'com.github.alexive:visual-goodies:-SNAPSHOT'` to the dependencies:
```
dependencies {
compile 'com.github.alexive:visual-goodies:-SNAPSHOT'
}
```
I'll be updating this repo often (usually bug fixes) so, if you want, tell gradle to check for a new version at every build.
Add to your module's build.gradle:
```
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
```
## Suggest/Contribute
Any suggestions (and contributions) will be greatly appreciated.
The same thing goes for any bugs you find. Just file up an issue and I'll look it up ASAP.
##Demo project
If you want to try the demo project, just clone the repo, uncomment the project's root
settings.gradle and you can go from there.
In a one-liner:
`git clone https://github.com/alexive/visual-goodies.git && cd visual-goodies && echo "include ':library', ':demo'" > settings.gradle`
Then open the project on Android Studio and run the demo module
##Apps that use this library
None yet! If your use it in your app, feel free to open up an issue and i'll just mention it here
##Why I did this
After learning to code and doing a few Android apps just for me to learn, I found myself writing the same code over and over again. Then, in college, I realized I could reuse the code, so I decided to move the repeated parts onto a separate project tweak it a bit and voilà! This includes list adapters, dialogs, cards, etc
##Wishlist (or TODO):
* Swipeable list items
* Drag and drop to reorder
* Pull to refresh
* Even more cards
## License
```
Copyright 2016 J. Alexandre Oliveira
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
```
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码 APP源码 66_visual-goodies-master(仿版).zip
共95个文件
xml:44个
java:23个
png:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 23 浏览量
2023-03-11
09:36:14
上传
评论
收藏 1.92MB ZIP 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码 APP源码 66_visual-goodies-master(仿版).zip (95个子文件)
visual-goodies-master
gradle.properties 853B
gradle
wrapper
gradle-wrapper.jar 52KB
gradle-wrapper.properties 824B
library
src
androidTest
java
com
alexive
graphicalutils
ApplicationTest.java 954B
main
java
com
alexive
graphicalutils
dialog
MessageDialog.java 3KB
TextInputDialog.java 8KB
NumberPickerDialog.java 5KB
lists
OnItemLongClickListener.java 964B
ListItemType.java 3KB
GridAdapter.java 10KB
BaseAdapter.java 12KB
AwesomeViewTypes.java 1KB
Divider.java 2KB
AwesomeViewHolder.java 4KB
ListAdapter.java 15KB
OnItemClickListener.java 945B
view
CardBuilder.java 15KB
ViewUtils.java 8KB
ProportionalImageView.java 3KB
fragments
RecyclerViewFragment.java 11KB
res
layout-v11
card_image_bttn.xml 1KB
dialog_number_picker.xml 1KB
values
attr.xml 1KB
strings.xml 880B
layout
double_avatar_button_text.xml 4KB
subheader_72dp_padding_no_accent.xml 1KB
dialog_text_input.xml 1KB
double_avatar_text.xml 3KB
card_bttn.xml 1003B
card_big_image_left.xml 2KB
card_no_image.xml 1KB
griddetails_single_line.xml 2KB
subheader_simple_padding_no_accent.xml 1KB
recycler_fragment_layout.xml 2KB
card_image_as_background.xml 2KB
card_title_text_view.xml 1KB
subheader_72dp_padding.xml 1KB
single_avatar_text.xml 2KB
list_item_two_texts.xml 2KB
grid_float_headerfooter_tile.xml 1KB
card_custom_view_container.xml 969B
subheader_simple_padding.xml 1KB
card_image_full_width.xml 2KB
listem_item_one_text.xml 1KB
griddetails_two_lines.xml 3KB
card_content_text_view.xml 1KB
card_image_next_to_title.xml 3KB
grid_dummy_tile.xml 1KB
dialog_number_picker.xml 2KB
card_action_container.xml 1KB
single_avatar_button_text.xml 3KB
list_divider.xml 944B
card_subtitle_text_view.xml 1KB
AndroidManifest.xml 877B
build.gradle 2KB
.gitignore 7B
gradlew.bat 2KB
demo
src
main
java
com
alexive
graphicalutils
demo
DummyObject.java 1KB
ListFragment2.java 4KB
CardsActivity.java 5KB
ListFragment1.java 14KB
MainActivity.java 2KB
SimplerDummyObject.java 798B
res
mipmap-xxhdpi
ic_launcher.png 8KB
mipmap-hdpi
ic_launcher.png 3KB
menu
menu_listfragment1.xml 1KB
mipmap-mdpi
ic_launcher.png 2KB
mipmap-xxxhdpi
ic_launcher.png 10KB
mipmap-xhdpi
ic_launcher.png 5KB
values-w820dp
dimens.xml 980B
values
dimens.xml 833B
colors.xml 830B
strings.xml 704B
styles.xml 1005B
layout
activity_main.xml 982B
drawable
lisbon.jpg 8KB
ic_favorite_black_24dp.xml 1KB
rossio.jpg 24KB
sky.jpg 13KB
ic_info_outline_black_24dp.xml 1KB
AndroidManifest.xml 1KB
proguard-rules.pro 669B
build.gradle 1KB
.gitignore 36B
build.gradle 1KB
settings.gradle 636B
gradlew 5KB
.gitignore 567B
images
sample4.png 292KB
sample5.png 200KB
sample3.png 216KB
sample2.png 201KB
sample1.gif 696KB
sample6.png 164KB
README.md 7KB
共 95 条
- 1
资源评论
金枝玉叶9
- 粉丝: 195
- 资源: 7637
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功