├── .gitignore ├── .idea ├── gradle.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.en.md ├── README.md ├── README_old_version.md ├── README_old_version_en.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── jxl.jar │ ├── poi-3.17.jar │ └── poi-scratchpad-3.17.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── bin │ │ └── david │ │ └── smarttable │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── c.xls │ │ └── ic_class.xls │ ├── java │ │ ├── com │ │ │ └── bin │ │ │ │ └── david │ │ │ │ └── smarttable │ │ │ │ ├── AlignActivity.java │ │ │ │ ├── AnnotationModeActivity.java │ │ │ │ ├── ArrayColumnModeActivity.java │ │ │ │ ├── ArrayModeActivity.java │ │ │ │ ├── AvatorModeActivity.java │ │ │ │ ├── BaseApplication.java │ │ │ │ ├── ChoiceExcelActivity.java │ │ │ │ ├── DesktopDrawFormat.java │ │ │ │ ├── DesktopModeActivity.java │ │ │ │ ├── FormModeActivity.java │ │ │ │ ├── GridModeActivity.java │ │ │ │ ├── JXLExcelModeActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── ManyActivity.java │ │ │ │ ├── MapModeActivity.java │ │ │ │ ├── MergeModeActivity.java │ │ │ │ ├── MinModeActivity.java │ │ │ │ ├── MultParseModeActivity.java │ │ │ │ ├── NetHttpActivity.java │ │ │ │ ├── POIExcelModeActivity.java │ │ │ │ ├── PagerModeActivity.java │ │ │ │ ├── ParseModeActivity.java │ │ │ │ ├── RefreshActivity.java │ │ │ │ ├── SeatModeActivity.java │ │ │ │ ├── TableListActivity.java │ │ │ │ ├── TanTanActivity.java │ │ │ │ ├── WelcomeActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── ItemAdapter.java │ │ │ │ ├── SheetAdapter.java │ │ │ │ ├── TableListAdapter.java │ │ │ │ └── TanTanAdapter.java │ │ │ │ ├── bean │ │ │ │ ├── ChildData.java │ │ │ │ ├── CollegeStudent.java │ │ │ │ ├── Course.java │ │ │ │ ├── DayTime.java │ │ │ │ ├── Form.java │ │ │ │ ├── ImagePoint.java │ │ │ │ ├── Lesson.java │ │ │ │ ├── LessonPoint.java │ │ │ │ ├── MainItem.java │ │ │ │ ├── MergeInfo.java │ │ │ │ ├── PM25.java │ │ │ │ ├── Student.java │ │ │ │ ├── StudentInfo.java │ │ │ │ ├── TableStyle.java │ │ │ │ ├── TanBean.java │ │ │ │ ├── UserInfo.java │ │ │ │ └── Week.java │ │ │ │ ├── excel │ │ │ │ ├── BaseExcel2Table.java │ │ │ │ ├── ExcelCallback.java │ │ │ │ ├── IExcel2Table.java │ │ │ │ ├── JXLExcel2Table.java │ │ │ │ └── POIExcel2Table.java │ │ │ │ ├── layoutManager │ │ │ │ └── TanTanLayoutManager.java │ │ │ │ ├── utils │ │ │ │ ├── DrawHelper.java │ │ │ │ ├── ExcelHelper.java │ │ │ │ └── JsonHelper.java │ │ │ │ └── view │ │ │ │ ├── BaseCheckDialog.java │ │ │ │ ├── BaseDialog.java │ │ │ │ ├── GlideCircleTransform.java │ │ │ │ └── QuickChartDialog.java │ │ └── java │ │ │ └── awt │ │ │ └── Color.java │ └── res │ │ ├── anim │ │ ├── fade_in_center.xml │ │ ├── fade_out_center.xml │ │ ├── modal_in.xml │ │ ├── modal_out.xml │ │ ├── out_to_left.xml │ │ ├── slide_in_bottom.xml │ │ ├── slide_in_top.xml │ │ ├── slide_left_in.xml │ │ ├── slide_left_out.xml │ │ ├── slide_out_bottom.xml │ │ ├── slide_out_top.xml │ │ ├── slide_right_in.xml │ │ └── slide_right_out.xml │ │ ├── drawable │ │ ├── cal_sign_bg.9.png │ │ ├── cal_sign_bg2.9.png │ │ ├── checkbox_btn_drawable.xml │ │ ├── dialog_btn_bg.xml │ │ ├── dialog_white_bg.xml │ │ ├── dialog_window_bg.xml │ │ ├── ic_launcher_background.xml │ │ └── side_nav_bar.xml │ │ ├── layout │ │ ├── activity_annotation.xml │ │ ├── activity_choice_excel.xml │ │ ├── activity_edit_table.xml │ │ ├── activity_excel_table.xml │ │ ├── activity_full_table.xml │ │ ├── activity_main.xml │ │ ├── activity_pager.xml │ │ ├── activity_recycler.xml │ │ ├── activity_refresh_table.xml │ │ ├── activity_scroll_table.xml │ │ ├── activity_seat_table.xml │ │ ├── activity_table.xml │ │ ├── activity_weclome.xml │ │ ├── app_bar_choice_excel.xml │ │ ├── content_choice_excel.xml │ │ ├── dialog_chart.xml │ │ ├── item_main.xml │ │ ├── item_pop_calculator.xml │ │ ├── item_sheet.xml │ │ ├── item_table.xml │ │ ├── item_tantan.xml │ │ ├── nav_header_choice_excel.xml │ │ └── pop_base_check.xml │ │ ├── menu │ │ ├── activity_choice_excel_drawer.xml │ │ └── choice_excel.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── a9m.png │ │ ├── activity_fill.png │ │ ├── age.png │ │ ├── avator_1.png │ │ ├── avator_10.png │ │ ├── avator_11.png │ │ ├── avator_12.png │ │ ├── avator_13.png │ │ ├── avator_14.png │ │ ├── avator_15.png │ │ ├── avator_16.png │ │ ├── avator_17.png │ │ ├── avator_18.png │ │ ├── avator_19.png │ │ ├── avator_2.png │ │ ├── avator_20.png │ │ ├── avator_3.png │ │ ├── avator_4.png │ │ ├── avator_5.png │ │ ├── avator_6.png │ │ ├── avator_7.png │ │ ├── avator_8.png │ │ ├── avator_9.png │ │ ├── brush_fill.png │ │ ├── check.png │ │ ├── clock_fill.png │ │ ├── collection_fill.png │ │ ├── excel_triangle.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── level1.png │ │ ├── level2.png │ │ ├── morning.png │ │ ├── name.png │ │ ├── night.png │ │ ├── noon.png │ │ ├── seat.png │ │ ├── seat_selected.png │ │ ├── set_bg.9.png │ │ ├── set_tow.png │ │ ├── sort_down.png │ │ ├── sort_up.png │ │ ├── uncheck.png │ │ ├── unsort.png │ │ └── update.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_select_check.png │ │ ├── ic_unselect_check.png │ │ ├── icon.png │ │ ├── round_rect.9.png │ │ ├── triangle.png │ │ ├── zuo_03.png │ │ └── zuo_05.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── drawables.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── bin │ └── david │ └── smarttable │ └── ExampleUnitTest.java ├── build.gradle ├── form ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── bin │ │ └── david │ │ └── form │ │ ├── annotation │ │ ├── ColumnType.java │ │ ├── SmartColumn.java │ │ └── SmartTable.java │ │ ├── component │ │ ├── GridDrawer.java │ │ ├── IComponent.java │ │ ├── ITableTitle.java │ │ ├── SelectionOperation.java │ │ ├── TableProvider.java │ │ ├── TableTitle.java │ │ ├── XSequence.java │ │ └── YSequence.java │ │ ├── core │ │ ├── AnnotationParser.java │ │ ├── SmartTable.java │ │ ├── TableConfig.java │ │ ├── TableMeasurer.java │ │ └── TableParser.java │ │ ├── data │ │ ├── ArrayStructure.java │ │ ├── Cell.java │ │ ├── CellInfo.java │ │ ├── CellRange.java │ │ ├── TableInfo.java │ │ ├── column │ │ │ ├── ArrayColumn.java │ │ │ ├── Column.java │ │ │ ├── ColumnInfo.java │ │ │ ├── ColumnNode.java │ │ │ └── MapColumn.java │ │ ├── form │ │ │ └── IForm.java │ │ ├── format │ │ │ ├── IFormat.java │ │ │ ├── bg │ │ │ │ ├── BaseBackgroundFormat.java │ │ │ │ ├── BaseCellBackgroundFormat.java │ │ │ │ ├── IBackgroundFormat.java │ │ │ │ └── ICellBackgroundFormat.java │ │ │ ├── count │ │ │ │ ├── DecimalCountFormat.java │ │ │ │ ├── ICountFormat.java │ │ │ │ ├── NumberCountFormat.java │ │ │ │ └── StringCountFormat.java │ │ │ ├── draw │ │ │ │ ├── BitmapDrawFormat.java │ │ │ │ ├── FastTextDrawFormat.java │ │ │ │ ├── IDrawFormat.java │ │ │ │ ├── ImageResDrawFormat.java │ │ │ │ ├── LeftTopDrawFormat.java │ │ │ │ ├── MultiLineDrawFormat.java │ │ │ │ ├── TextDrawFormat.java │ │ │ │ └── TextImageDrawFormat.java │ │ │ ├── grid │ │ │ │ ├── BaseAbstractGridFormat.java │ │ │ │ ├── BaseGridFormat.java │ │ │ │ ├── IGridFormat.java │ │ │ │ └── SimpleGridFormat.java │ │ │ ├── selected │ │ │ │ ├── BaseSelectFormat.java │ │ │ │ ├── IDrawOver.java │ │ │ │ └── ISelectFormat.java │ │ │ ├── sequence │ │ │ │ ├── BaseSequenceFormat.java │ │ │ │ ├── ISequenceFormat.java │ │ │ │ ├── LetterSequenceFormat.java │ │ │ │ └── NumberSequenceFormat.java │ │ │ ├── tip │ │ │ │ ├── BaseBubbleTip.java │ │ │ │ ├── ITip.java │ │ │ │ ├── MultiLineBubbleTip.java │ │ │ │ └── SingleLineBubbleTip.java │ │ │ └── title │ │ │ │ ├── BitmapTitleDrawFormat.java │ │ │ │ ├── ITitleDrawFormat.java │ │ │ │ ├── ImageResTitleDrawFormat.java │ │ │ │ ├── TitleDrawFormat.java │ │ │ │ └── TitleImageDrawFormat.java │ │ ├── style │ │ │ ├── FontStyle.java │ │ │ ├── IStyle.java │ │ │ ├── LineStyle.java │ │ │ └── PointStyle.java │ │ └── table │ │ │ ├── ArrayTableData.java │ │ │ ├── FormTableData.java │ │ │ ├── MapTableData.java │ │ │ ├── PageTableData.java │ │ │ └── TableData.java │ │ ├── exception │ │ └── TableException.java │ │ ├── listener │ │ ├── Observable.java │ │ ├── OnColumnClickListener.java │ │ ├── OnColumnItemClickListener.java │ │ ├── OnTableChangeListener.java │ │ └── TableClickObserver.java │ │ ├── matrix │ │ ├── ITouch.java │ │ ├── MatrixHelper.java │ │ └── PointEvaluator.java │ │ └── utils │ │ ├── BitmapDrawer.java │ │ ├── DensityUtils.java │ │ ├── DrawUtils.java │ │ └── LetterUtils.java │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img ├── 1.png ├── SmartTableCode.png ├── arrayColumn.gif ├── avator.jpg ├── dashang.jpg ├── multline.jpg ├── new_excel.png ├── old_excel.png ├── progress.jpg ├── refresh.gif ├── seat.jpg ├── smartTable.apk ├── table.gif ├── table.png └── zoom.gif ├── settings.gradle └── use.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README_old_version.md: -------------------------------------------------------------------------------- 1 | # SmartTable历史版本 2 | 3 | ###### 一款android自动生成表格框架 4 | **- 1.8版本** 5 | 6 | > 增加List Array Column 7 | 8 | **- 1.7版本** 9 | 10 | > 修复了缩放问题以及Excel导入显示 11 | > 增加自动合并单元格功能 12 | 13 | **- 1.6版本** 14 | 15 | > 修复缩放偏移问题和闪烁问题 16 | > 增加导出JXL Excel(导出文字样式,背景,图片,批注) 17 | > 增加单元格合并 18 | > 增加左上角空隙格式化 19 | > 支持二维数组转换 20 | > 增加导出POI Excel(导入图表示例) 21 | > 支持自动单元合并 22 | > 支持设置表格最小宽度 23 | 24 | 25 | 26 | **- 1.5版本** 27 | 28 | > 修复缩放问题 29 | > 增加ArrayTableData 支持二维数组 30 | 31 | **- 1.4版本** 32 | 33 | > 删除设置固定第一列setFixedFirstColumn方法,column的setFixed(boolean fixed)来固定任意列。 34 | >支持首尾动态添加数据SmartTable.addData(List t,boolean isFoot)来实现添加数据.实现增量解析数据和计算表格大小,效率更高。 35 | > 修复缩放中心偏移问题; 36 | > 支持内容多行显示。 37 | ![内容多行显示](/img/multline.jpg) 38 | 39 | 40 | **- 1.3版本** 41 | 42 | - 设置单个格子背景 43 | 44 | > 在网上参考了```html```的```table```,发现样式好看多了,按到这个思路,SmartTable增加了支持对单个格子的不同背景支持,在```TableConfig```里面有5个```IBackgroundFormat```样式,可以根据```boolean isDraw(T t)```返回数据做出判断是否绘制背景```drawBackground```,默认绘制整个背景,当然你可以自己定义```IBackgroundFormat```使用其他形状。 45 | 46 | - 设置单个格子字体 47 | 48 | > 由于支持到单个格子背景的支持,字体颜色也需要根据背景还进行调整,所以又支持单个格子的字体设置,```IBackgroundFormat```中有 ```int getTextColor(T t)```,你只需重写它,根据需求设置不同颜色。 49 | 50 | - 分页 51 | 52 | > 在客户端太多数据体验不好,所以开发分页模式,在未使用注解情况下,只需要使用```PageTableData```分页表格数据类 代替之前```TableData```表格数据类即可,使用```PageTableData```的```setPageSize```方法设置每页数量。分页就完成了。 53 | 如果你使用注解,请在```@SmartTable```注解元素添加```pageSize```属性即可,setData会返回```PageTableData```对象,你可以使用它完成后面其他的设置。 54 | 55 | - 其他 56 | 57 | > SmartTable 增加notifyDataChanged方法用于重新解析计算布局; 58 | 59 | > 提供back方法fling到原点; 60 | 61 | > 增加网络请求图片显示例子。 62 | 63 | **- 1.2版本** 64 | 65 | > 自动统计,排序(也可自定义统计规则); 66 | > 表格批注; 67 | > 缩放模式和滚动模式. 68 | 69 | **- 1.1版本** 70 | 71 | > 表格列标题组合; 72 | > 表格固定左序列、顶部序列、第一行、列标题、统计行; 73 | > 自动统计,排序(也可自定义统计规则); 74 | 75 | > 表格内容、列标题点击事件; 76 | 77 | 78 | 79 | **- 1.0版本** 80 | 81 | > 快速配置自动生成表格; 82 | > 自动计算表格宽高; 83 | > 表格各组成背景、文字、网格、padding等配置; 84 | > 表格图文、序列号、列标题格式化; 85 | > 支持注解模式。 86 | -------------------------------------------------------------------------------- /README_old_version_en.md: -------------------------------------------------------------------------------- 1 | # SmartTable version of history 2 | 3 | ###### An Android automatically generated table framework 4 | 5 | 6 | **- version 1.6** 7 | 8 | > repair the zoom offset problem 9 | > increase import Excel 10 | Increase cell merge 11 | > increase the upper left corner voids formatting 12 | 13 | **- version 1.5** 14 | 15 | > fix the zoom problem 16 | > add ArrayTableData to support two dimensional arrays 17 | 18 | **- version 1.4** 19 | 20 | > delete set the fixed first column setFixedFirstColumn method, column's setFixed (Boolean fixed) to fix any column. 21 | > support SmartTable.addData List t (Boolean isFoot) to add data. Incremental data analysis and computation form size are more efficient. 22 | > repair the zoom center offset problem; 23 | > support content multiline display. 24 | ![content multiline display](/img/multline.jpg) 25 | 26 | 27 | **- version 1.3** 28 | 29 | - setting a single lattice background 30 | 31 | In the online reference ```html``` > ```table```, find the pattern pretty much, according to this idea, SmartTable added support for different backgrounds on single grid support, there are 5 ```IBackgroundFormat``` style in ```TableConfig```, according to ```boolean isDraw (T T) to determine whether ` ` ` return data to draw the background of ```drawBackground```, the default of drawing the whole background. Of course, you can define your own ```IBackgroundFormat``` using other shapes. 32 | 33 | - setting a single lattices font 34 | 35 | Due to a single grid support > background support, font color is also need to adjust according to the background, so it supports a single lattice font settings, ```int getTextColor ```IBackgroundFormat``` (T T) ', you only need to rewrite it, according to the needs of different color settings. 36 | 37 | - paging 38 | 39 | "Too much data on the client experience is not good, so the development of paging mode, without using the annotation case, only need to use the ```PageTableData``` page table data instead of tabular data before the ```TableData``` class, the ```setPageSize``` method uses the ```PageTableData``` settings page number. The paging is finished. 40 | If you use annotations, please annotate elements in ```@SmartTable```, add ```pageSize``` attribute, setData will return ```PageTableData``` object, you can use it to finish other settings. 41 | 42 | - other 43 | 44 | > SmartTable adds the notifyDataChanged method to re parse the calculation layout; 45 | 46 | > provides the back method fling to the origin; 47 | 48 | > increase the network request picture display example. 49 | 50 | **-version 1.2** 51 | 52 | Automatic statistics, sorting (also customizable statistics rules); 53 | > form annotation; 54 | > zoom mode and scroll mode. 55 | 56 | **- version 1.1** 57 | 58 | Table column header combinations; 59 | The table is fixed to the left sequence, the top sequence, the first line, the column headline and the statistical line. 60 | Automatic statistics, sorting (also customizable statistics rules); 61 | 62 | > table content, column headlines, click events; 63 | 64 | 65 | 66 | **- version 1.0** 67 | 68 | Faster configuration automatically generates forms; 69 | > automatic calculation form is wide; 70 | > the configuration of the form, text, grid, padding and so on; 71 | Table schema, sequence number, column headline formatting; 72 | > support the annotation mode. 73 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '26.0.2' 6 | defaultConfig { 7 | applicationId "com.bin.david.smarttable" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.8.5" 12 | multiDexEnabled true 13 | } 14 | 15 | packagingOptions { 16 | exclude('META-INF/LICENSE.txt') 17 | exclude('META-INF/LICENSE') 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_7 27 | targetCompatibility JavaVersion.VERSION_1_7 28 | } 29 | } 30 | 31 | dependencies { 32 | compile 'com.android.support:appcompat-v7:25.3.1' 33 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 34 | testCompile 'junit:junit:4.12' 35 | compile project(':form') 36 | compile 'com.zhy:okhttputils:2.6.2' 37 | compile 'com.google.code.gson:gson:2.8.0' 38 | compile 'com.android.support:recyclerview-v7:25.3.1' 39 | compile 'com.github.huangyanbin:SmartChart:1.3.2' 40 | compile 'com.android.support:cardview-v7:25.3.1' 41 | compile 'com.android.support:multidex:1.0.0' 42 | compile 'com.github.bumptech.glide:glide:4.3.1' 43 | compile 'jp.wasabeef:glide-transformations:3.0.1' 44 | compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' 45 | annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1' 46 | compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.31' 47 | compile files('libs/jxl.jar') 48 | compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-1' 49 | implementation files('libs/poi-3.17.jar') 50 | implementation files('libs/poi-scratchpad-3.17.jar') 51 | compile 'com.vincent.filepicker:MultiTypeFilePicker:1.0.5' 52 | } 53 | -------------------------------------------------------------------------------- /app/libs/jxl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/libs/jxl.jar -------------------------------------------------------------------------------- /app/libs/poi-3.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/libs/poi-3.17.jar -------------------------------------------------------------------------------- /app/libs/poi-scratchpad-3.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/libs/poi-scratchpad-3.17.jar -------------------------------------------------------------------------------- /app/src/androidTest/java/com/bin/david/smarttable/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.bin.david.smarttable", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/assets/c.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/src/main/assets/c.xls -------------------------------------------------------------------------------- /app/src/main/assets/ic_class.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/src/main/assets/ic_class.xls -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.scwang.smartrefresh.layout.SmartRefreshLayout; 7 | import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator; 8 | import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; 9 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 10 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 11 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 12 | import com.scwang.smartrefresh.layout.footer.ClassicsFooter; 13 | import com.scwang.smartrefresh.layout.header.ClassicsHeader; 14 | import com.zhy.http.okhttp.OkHttpUtils; 15 | 16 | import java.util.concurrent.TimeUnit; 17 | 18 | import okhttp3.OkHttpClient; 19 | 20 | /** 21 | * Created by huang on 2017/11/4. 22 | */ 23 | 24 | public class BaseApplication extends android.support.multidex.MultiDexApplication { 25 | //static 代码段可以防止内存泄露 26 | static { 27 | //设置全局的Header构建器 28 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 29 | @Override 30 | public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) { 31 | layout.setPrimaryColorsId(R.color.windows_bg, R.color.text_color);//全局设置主题颜色 32 | return new ClassicsHeader(context); 33 | } 34 | }); 35 | //设置全局的Footer构建器 36 | SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() { 37 | @Override 38 | public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) { 39 | //指定为经典Footer,默认是 BallPulseFooter 40 | return new ClassicsFooter(context).setDrawableSize(20); 41 | } 42 | }); 43 | 44 | } 45 | 46 | @Override 47 | public void onCreate() { 48 | super.onCreate(); 49 | OkHttpClient okHttpClient = new OkHttpClient.Builder() 50 | // .addInterceptor(new LoggerInterceptor("TAG")) 51 | .connectTimeout(10000L, TimeUnit.MILLISECONDS) 52 | .readTimeout(10000L, TimeUnit.MILLISECONDS) 53 | //其他配置 54 | .build(); 55 | OkHttpUtils.initClient(okHttpClient); 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/JXLExcelModeActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.View; 9 | 10 | import com.bin.david.form.core.SmartTable; 11 | 12 | import com.bin.david.form.data.style.FontStyle; 13 | import com.bin.david.form.utils.DensityUtils; 14 | import com.bin.david.smarttable.adapter.SheetAdapter; 15 | import com.bin.david.smarttable.excel.ExcelCallback; 16 | import com.bin.david.smarttable.excel.IExcel2Table; 17 | import com.bin.david.smarttable.excel.JXLExcel2Table; 18 | import com.chad.library.adapter.base.BaseQuickAdapter; 19 | 20 | 21 | import java.util.List; 22 | 23 | import jxl.Cell; 24 | 25 | 26 | public class JXLExcelModeActivity extends AppCompatActivity implements ExcelCallback { 27 | 28 | private SmartTable table; 29 | private RecyclerView recyclerView; 30 | private String fileName = "ic_class.xls"; 31 | private IExcel2Table iExcel2Table; 32 | 33 | 34 | @Override 35 | protected void onCreate(Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.activity_excel_table); 38 | FontStyle.setDefaultTextSize(DensityUtils.sp2px(this,15)); 39 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 40 | recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false)); 41 | table = (SmartTable) findViewById(R.id.table); 42 | iExcel2Table = new JXLExcel2Table(); 43 | iExcel2Table.initTableConfig(this,table); 44 | iExcel2Table.setCallback(this); 45 | iExcel2Table.loadSheetList(this,fileName); 46 | 47 | } 48 | 49 | 50 | 51 | @Override 52 | protected void onDestroy() { 53 | if(iExcel2Table !=null){ 54 | iExcel2Table.clear(); 55 | } 56 | iExcel2Table = null; 57 | super.onDestroy(); 58 | } 59 | 60 | @Override 61 | public void getSheetListSuc(List sheetNames) { 62 | recyclerView.setHasFixedSize(true); 63 | if(sheetNames!=null && sheetNames.size() >0) { 64 | final SheetAdapter sheetAdapter = new SheetAdapter(sheetNames); 65 | sheetAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { 66 | @Override 67 | public void onItemClick(BaseQuickAdapter adapter, View view, int position) { 68 | sheetAdapter.setSelectPosition(position); 69 | iExcel2Table.loadSheetContent(JXLExcelModeActivity.this,position); 70 | } 71 | }); 72 | recyclerView.setAdapter(sheetAdapter); 73 | iExcel2Table.loadSheetContent(JXLExcelModeActivity.this,0); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/MergeModeActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | 7 | import com.bin.david.form.core.SmartTable; 8 | import com.bin.david.form.data.style.FontStyle; 9 | import com.bin.david.form.utils.DensityUtils; 10 | import com.bin.david.smarttable.bean.ChildData; 11 | import com.bin.david.smarttable.bean.MergeInfo; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class MergeModeActivity extends AppCompatActivity { 17 | 18 | private SmartTable table; 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_full_table); 23 | FontStyle.setDefaultTextSize(DensityUtils.sp2px(this,15)); 24 | 25 | List list = new ArrayList<>(); 26 | for(int i = 0;i <50; i++) { 27 | list.add(new MergeInfo("huangyanbinhuangyanbinhuangyanbinhuangyanbin", 18, System.currentTimeMillis(),true,new ChildData("测试1"))); 28 | list.add(new MergeInfo("huangyanbinhuangyanbinhuangyanbinhuangyanbin", 18, System.currentTimeMillis(),true,new ChildData("测试1"))); 29 | list.add(new MergeInfo("huangyanbinhuangyanbinhuangyanbinhuangyanbin", 18, System.currentTimeMillis(),true,new ChildData("测试1"))); 30 | list.add(new MergeInfo("huangyanbinhuangyanbinhuangyanbinhuangyanbin", 18, System.currentTimeMillis(),true,new ChildData("测试1"))); 31 | list.add(new MergeInfo("lihuangyanbinhuangyanbinhuangyanbinhuangyanbin", 23, System.currentTimeMillis(),false,null)); 32 | list.add(new MergeInfo("lihuangyanbinhuangyanbinhuangyanbinhuangyanbin", 23, System.currentTimeMillis(),false,null)); 33 | list.add(new MergeInfo("lihuangyanbinhuangyanbinhuangyanbinhuangyanbin", 23, System.currentTimeMillis(),false,null)); 34 | list.add(new MergeInfo("lihuangyanbinhuangyanbinhuangyanbinhuangyanbin", 23, System.currentTimeMillis(),false,null)); 35 | } 36 | table = (SmartTable) findViewById(R.id.table); 37 | table.setData(list); 38 | table.getConfig().setShowTableTitle(false); 39 | table.setZoom(true,2,0.2f); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/POIExcelModeActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.LinearLayoutManager; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.View; 8 | 9 | import com.bin.david.form.core.SmartTable; 10 | 11 | import com.bin.david.form.data.style.FontStyle; 12 | import com.bin.david.form.utils.DensityUtils; 13 | import com.bin.david.smarttable.adapter.SheetAdapter; 14 | import com.bin.david.smarttable.excel.ExcelCallback; 15 | import com.bin.david.smarttable.excel.IExcel2Table; 16 | import com.bin.david.smarttable.excel.POIExcel2Table; 17 | import com.chad.library.adapter.base.BaseQuickAdapter; 18 | 19 | import org.apache.poi.ss.usermodel.Cell; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * 通过poi来填充表格 25 | * 暂时只能支持xls 26 | */ 27 | public class POIExcelModeActivity extends AppCompatActivity implements ExcelCallback { 28 | 29 | private SmartTable table; 30 | 31 | private RecyclerView recyclerView; 32 | private String fileName = "c.xls"; 33 | private IExcel2Table iExcel2Table; 34 | 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | setContentView(R.layout.activity_excel_table); 40 | FontStyle.setDefaultTextSize(DensityUtils.sp2px(this,15)); 41 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 42 | recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false)); 43 | table = (SmartTable) findViewById(R.id.table); 44 | iExcel2Table = new POIExcel2Table(); 45 | iExcel2Table.initTableConfig(this,table); 46 | iExcel2Table.setCallback(this); 47 | iExcel2Table.loadSheetList(this,fileName); 48 | 49 | 50 | 51 | 52 | } 53 | 54 | 55 | 56 | 57 | @Override 58 | protected void onDestroy() { 59 | if(iExcel2Table !=null){ 60 | iExcel2Table.clear(); 61 | } 62 | iExcel2Table = null; 63 | super.onDestroy(); 64 | } 65 | 66 | @Override 67 | public void getSheetListSuc(List sheetNames) { 68 | recyclerView.setHasFixedSize(true); 69 | if(sheetNames!=null && sheetNames.size() >0) { 70 | final SheetAdapter sheetAdapter = new SheetAdapter(sheetNames); 71 | sheetAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { 72 | @Override 73 | public void onItemClick(BaseQuickAdapter adapter, View view, int position) { 74 | sheetAdapter.setSelectPosition(position); 75 | iExcel2Table.loadSheetContent(POIExcelModeActivity.this,position); 76 | } 77 | }); 78 | recyclerView.setAdapter(sheetAdapter); 79 | iExcel2Table.loadSheetContent(POIExcelModeActivity.this,0); 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/TableListActivity.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | 9 | import com.bin.david.smarttable.adapter.TableListAdapter; 10 | 11 | import java.util.ArrayList; 12 | 13 | /** 14 | * Created by huang on 2017/10/18. 15 | */ 16 | 17 | public class TableListActivity extends AppCompatActivity { 18 | 19 | private RecyclerView recyclerView; 20 | private TableListAdapter itemAdapter; 21 | @Override 22 | protected void onCreate(@Nullable Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_recycler); 25 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 26 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 27 | ArrayList items = new ArrayList<>(); 28 | for(int i = 0;i <100;i++){ 29 | items.add(i+""); 30 | } 31 | itemAdapter = new TableListAdapter(items); 32 | recyclerView.setAdapter(itemAdapter); 33 | itemAdapter.openLoadAnimation(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/adapter/ItemAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import com.bin.david.smarttable.R; 6 | import com.bin.david.smarttable.bean.MainItem; 7 | import com.chad.library.adapter.base.BaseQuickAdapter; 8 | import com.chad.library.adapter.base.BaseViewHolder; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by huang on 2017/10/13. 14 | */ 15 | 16 | public class ItemAdapter extends BaseQuickAdapter { 17 | 18 | 19 | public ItemAdapter(@Nullable List data) { 20 | super(R.layout.item_main, data); 21 | } 22 | 23 | @Override 24 | protected void convert(BaseViewHolder helper, MainItem item) { 25 | helper.setText(R.id.tv_chart_name,item.chartName); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/adapter/SheetAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v4.content.ContextCompat; 5 | 6 | import com.bin.david.smarttable.R; 7 | import com.chad.library.adapter.base.BaseQuickAdapter; 8 | import com.chad.library.adapter.base.BaseViewHolder; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by huang on 2018/1/16. 14 | */ 15 | 16 | public class SheetAdapter extends BaseQuickAdapter{ 17 | 18 | private int selectPosition =0; 19 | public SheetAdapter(@Nullable List data) { 20 | super(R.layout.item_sheet, data); 21 | } 22 | 23 | @Override 24 | protected void convert(BaseViewHolder helper, String item) { 25 | helper.setText(R.id.tv_sheet_name,item).setTextColor(R.id.tv_sheet_name, 26 | ContextCompat.getColor(mContext, 27 | selectPosition == helper.getAdapterPosition()?R.color.arc23:R.color.arc_temp)); 28 | helper.getView(R.id.tv_sheet_name).setBackgroundColor( ContextCompat.getColor(mContext, 29 | selectPosition == helper.getAdapterPosition()?R.color.white:R.color.arc_bg)); 30 | } 31 | 32 | 33 | 34 | public void setSelectPosition(int selectPosition) { 35 | this.selectPosition = selectPosition; 36 | notifyDataSetChanged(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/adapter/TanTanAdapter.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.adapter; 2 | 3 | import android.net.Uri; 4 | import android.support.annotation.Nullable; 5 | import android.widget.ImageView; 6 | 7 | import com.bin.david.smarttable.R; 8 | import com.bin.david.smarttable.bean.MainItem; 9 | import com.bin.david.smarttable.bean.TanBean; 10 | import com.bumptech.glide.Glide; 11 | import com.chad.library.adapter.base.BaseQuickAdapter; 12 | import com.chad.library.adapter.base.BaseViewHolder; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Created by huang on 2017/10/13. 18 | */ 19 | 20 | public class TanTanAdapter extends BaseQuickAdapter { 21 | 22 | 23 | public TanTanAdapter(@Nullable List data) { 24 | super(R.layout.item_tantan, data); 25 | } 26 | 27 | @Override 28 | protected void convert(BaseViewHolder helper, TanBean item) { 29 | helper.setText(R.id.tvName,item.getName()); 30 | Glide 31 | .with(mContext) 32 | .load(item.getUrl()) 33 | .into((ImageView) helper.getView(R.id.iv)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/ChildData.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | 4 | import com.bin.david.form.annotation.SmartColumn; 5 | 6 | /** 7 | * Created by huang on 2017/11/1. 8 | */ 9 | 10 | public class ChildData { 11 | 12 | @SmartColumn(id =5,name = "子类",autoCount = true) 13 | private String child; 14 | 15 | public ChildData(String child) { 16 | this.child = child; 17 | } 18 | 19 | public String getChild() { 20 | return child; 21 | } 22 | 23 | public void setChild(String child) { 24 | this.child = child; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/CollegeStudent.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | import com.bin.david.form.annotation.SmartTable; 6 | import com.bin.david.smarttable.bean.Week; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by huang on 2018/2/6. 12 | */ 13 | @SmartTable(name = "课程表") 14 | public class CollegeStudent { 15 | @SmartColumn(id = 1,name ="姓名") 16 | private String name; 17 | 18 | @SmartColumn(type = ColumnType.ArrayChild) 19 | private List weeks; 20 | private int age; 21 | 22 | public CollegeStudent(String name, int age, List weeks) { 23 | this.name = name; 24 | this.age = age; 25 | this.weeks = weeks; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | public int getAge() { 37 | return age; 38 | } 39 | 40 | public void setAge(int age) { 41 | this.age = age; 42 | } 43 | 44 | public List getWeeks() { 45 | return weeks; 46 | } 47 | 48 | public void setWeeks(List weeks) { 49 | this.weeks = weeks; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/Course.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | /** 4 | * Created by huang on 2018/3/21. 5 | */ 6 | 7 | public class Course { 8 | 9 | private String name; 10 | private int period; 11 | 12 | public Course(String name, int period) { 13 | this.name = name; 14 | this.period = period; 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public int getPeriod() { 26 | return period; 27 | } 28 | 29 | public void setPeriod(int period) { 30 | this.period = period; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/DayTime.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by huang on 2018/2/6. 10 | */ 11 | 12 | public class DayTime { 13 | @SmartColumn(id=3,name ="时间") 14 | private String time; 15 | @SmartColumn(type = ColumnType.ArrayChild) 16 | private List lessons; 17 | 18 | public DayTime() { 19 | } 20 | 21 | public DayTime(String time, List lessons) { 22 | this.time = time; 23 | this.lessons = lessons; 24 | } 25 | 26 | public String getTime() { 27 | return time; 28 | } 29 | 30 | public void setTime(String time) { 31 | this.time = time; 32 | } 33 | 34 | public List getLessons() { 35 | return lessons; 36 | } 37 | 38 | public void setLessons(List lessons) { 39 | this.lessons = lessons; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/Form.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import android.graphics.Paint; 4 | 5 | import com.bin.david.form.data.form.IForm; 6 | 7 | /** 8 | * Created by huang on 2018/4/10. 9 | */ 10 | 11 | public class Form implements IForm { 12 | 13 | private int spanWidthSize =1; 14 | private int spanHeightSize = 1; 15 | private String name; 16 | public static Form Empty = new Form(""); 17 | private Paint.Align align; 18 | public Form(int spanWidthSize, int spanHeightSize, String name) { 19 | this.spanWidthSize = spanWidthSize; 20 | this.spanHeightSize = spanHeightSize; 21 | this.name = name; 22 | } 23 | 24 | public Form(int spanWidthSize, int spanHeightSize, String name, Paint.Align align) { 25 | this.spanWidthSize = spanWidthSize; 26 | this.spanHeightSize = spanHeightSize; 27 | this.name = name; 28 | this.align = align; 29 | } 30 | 31 | public Form(String name) { 32 | this.name = name; 33 | } 34 | 35 | public Form(String name, Paint.Align align) { 36 | this.name = name; 37 | this.align = align; 38 | } 39 | 40 | public void setAlign(Paint.Align align) { 41 | this.align = align; 42 | } 43 | 44 | public void setSpanWidthSize(int spanWidthSize) { 45 | this.spanWidthSize = spanWidthSize; 46 | } 47 | 48 | public void setSpanHeightSize(int spanHeightSize) { 49 | this.spanHeightSize = spanHeightSize; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public void setName(String name) { 57 | this.name = name; 58 | } 59 | 60 | @Override 61 | public int getSpanWidthSize() { 62 | return spanWidthSize; 63 | } 64 | 65 | @Override 66 | public int getSpanHeightSize() { 67 | return spanHeightSize; 68 | } 69 | 70 | @Override 71 | public Paint.Align getAlign() { 72 | if(align == null) { 73 | return Paint.Align.CENTER; 74 | }else { 75 | return align; 76 | } 77 | } 78 | 79 | 80 | 81 | 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/ImagePoint.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | /** 4 | * Created by huang on 2018/1/18. 5 | */ 6 | 7 | public class ImagePoint { 8 | 9 | public double col; 10 | public double row; 11 | public double width; 12 | public double height; 13 | 14 | 15 | public ImagePoint(double col, double row) { 16 | this.col = col; 17 | this.row = row; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/Lesson.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by huang on 2018/2/1. 10 | */ 11 | 12 | public class Lesson { 13 | @SmartColumn(id = 3,name = "课程名称") 14 | private String name; 15 | @SmartColumn(id = 5,name="是否喜欢") 16 | private boolean isFav; 17 | @SmartColumn(type = ColumnType.ArrayChild) 18 | private LessonPoint[] lessonPoints; 19 | //@SmartColumn(type = ColumnType.ArrayOwn) 20 | private List test; 21 | 22 | public Lesson(String name, boolean isFav) { 23 | this.name = name; 24 | this.isFav = isFav; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public boolean isFav() { 36 | return isFav; 37 | } 38 | 39 | public void setFav(boolean fav) { 40 | isFav = fav; 41 | } 42 | 43 | public List getTest() { 44 | return test; 45 | } 46 | 47 | public void setTest(List test) { 48 | this.test = test; 49 | } 50 | 51 | public LessonPoint[] getLessonPoints() { 52 | return lessonPoints; 53 | } 54 | 55 | public void setLessonPoints(LessonPoint[] lessonPoints) { 56 | this.lessonPoints = lessonPoints; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/LessonPoint.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | 6 | 7 | /** 8 | * Created by huang on 2018/2/2. 9 | */ 10 | 11 | public class LessonPoint { 12 | 13 | @SmartColumn(id=4,name="知识点") 14 | private String name; 15 | public LessonPoint(String name) { 16 | this.name = name; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/MainItem.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | /** 4 | * Created by huang on 2017/10/13. 5 | */ 6 | 7 | public class MainItem { 8 | 9 | public Class clazz; 10 | public String chartName; 11 | 12 | public MainItem(Class clazz, String chartName) { 13 | this.clazz = clazz; 14 | this.chartName = chartName; 15 | } 16 | 17 | public Class getClazz() { 18 | return clazz; 19 | } 20 | 21 | public void setClazz(Class clazz) { 22 | this.clazz = clazz; 23 | } 24 | 25 | public String getChartName() { 26 | return chartName; 27 | } 28 | 29 | public void setChartName(String chartName) { 30 | this.chartName = chartName; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/MergeInfo.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | import com.bin.david.form.annotation.SmartTable; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by huang on 2017/11/1. 11 | */ 12 | @SmartTable(name="合并信息列表",count = true) 13 | public class MergeInfo { 14 | @SmartColumn(id =1,name = "姓名",autoCount = true,autoMerge = true,width = 100) 15 | private String name; 16 | @SmartColumn(id=2,name="年龄",autoCount = true,autoMerge = true) 17 | private int age; 18 | @SmartColumn(id =3,name="更新时间") 19 | private long time; 20 | @SmartColumn(type= ColumnType.Child) 21 | private ChildData childData; 22 | @SmartColumn(id =4,name="选中") 23 | private boolean isCheck; 24 | private String url; 25 | 26 | public MergeInfo(String name, int age, long time, boolean isCheck, ChildData childData) { 27 | this.name = name; 28 | this.age = age; 29 | this.time = time; 30 | this.childData = childData; 31 | this.isCheck = isCheck; 32 | } 33 | 34 | public boolean isCheck() { 35 | return isCheck; 36 | } 37 | 38 | public void setCheck(boolean check) { 39 | isCheck = check; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public int getAge() { 51 | return age; 52 | } 53 | 54 | public void setAge(int age) { 55 | this.age = age; 56 | } 57 | 58 | public long getTime() { 59 | return time; 60 | } 61 | 62 | public void setTime(long time) { 63 | this.time = time; 64 | } 65 | 66 | public ChildData getChildData() { 67 | return childData; 68 | } 69 | 70 | public void setChildData(ChildData childData) { 71 | this.childData = childData; 72 | } 73 | 74 | public String getUrl() { 75 | return url; 76 | } 77 | 78 | public void setUrl(String url) { 79 | this.url = url; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/PM25.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import android.graphics.Paint; 4 | 5 | import com.bin.david.form.annotation.SmartColumn; 6 | import com.bin.david.form.annotation.SmartTable; 7 | 8 | /** 9 | * Created by huang on 2017/11/4. 10 | */ 11 | @SmartTable(name = "PM2.5") 12 | public class PM25 { 13 | 14 | 15 | /** 16 | * aqi : 27 17 | * area : 上海 18 | * pm10 : 27 19 | * pm10_24h : 58 20 | * position_name : 徐汇上师大 21 | * primary_pollutant : null 22 | * quality : 优 23 | * station_code : 1144A 24 | * time_point : 2017-11-04T13:00:00Z 25 | */ 26 | 27 | private int aqi; 28 | @SmartColumn(id =1,name="地区",align = Paint.Align.LEFT,fixed = true) 29 | private String area; 30 | @SmartColumn(parent = "PM",id =3,name="PM10",align = Paint.Align.RIGHT) 31 | private int pm10; 32 | @SmartColumn(parent = "PM",id =2,name="PM10 24小时") 33 | private int pm10_24h; 34 | @SmartColumn(id=4,name = "地址") 35 | private String position_name; 36 | @SmartColumn(id=6,name="首要污染物") 37 | private Object primary_pollutant; 38 | @SmartColumn(id=5,name = "空气质量") 39 | private String quality; 40 | @SmartColumn(id=3,name = "坐标代码") 41 | private String station_code; 42 | @SmartColumn(id=7,name = "更新时间") 43 | private String time_point; 44 | 45 | public int getAqi() { 46 | return aqi; 47 | } 48 | 49 | public void setAqi(int aqi) { 50 | this.aqi = aqi; 51 | } 52 | 53 | public String getArea() { 54 | return area; 55 | } 56 | 57 | public void setArea(String area) { 58 | this.area = area; 59 | } 60 | 61 | public int getPm10() { 62 | return pm10; 63 | } 64 | 65 | public void setPm10(int pm10) { 66 | this.pm10 = pm10; 67 | } 68 | 69 | public int getPm10_24h() { 70 | return pm10_24h; 71 | } 72 | 73 | public void setPm10_24h(int pm10_24h) { 74 | this.pm10_24h = pm10_24h; 75 | } 76 | 77 | public String getPosition_name() { 78 | return position_name; 79 | } 80 | 81 | public void setPosition_name(String position_name) { 82 | this.position_name = position_name; 83 | } 84 | 85 | public Object getPrimary_pollutant() { 86 | return primary_pollutant; 87 | } 88 | 89 | public void setPrimary_pollutant(Object primary_pollutant) { 90 | this.primary_pollutant = primary_pollutant; 91 | } 92 | 93 | public String getQuality() { 94 | return quality; 95 | } 96 | 97 | public void setQuality(String quality) { 98 | this.quality = quality; 99 | } 100 | 101 | public String getStation_code() { 102 | return station_code; 103 | } 104 | 105 | public void setStation_code(String station_code) { 106 | this.station_code = station_code; 107 | } 108 | 109 | public String getTime_point() { 110 | return time_point; 111 | } 112 | 113 | public void setTime_point(String time_point) { 114 | this.time_point = time_point; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/Student.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | import com.bin.david.form.annotation.SmartTable; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by huang on 2017/11/1. 11 | */ 12 | @SmartTable(name="学生信息列表",count = true) 13 | public class Student { 14 | @SmartColumn(id =1,name = "姓名",autoCount = true) 15 | private String name; 16 | @SmartColumn(id=8,name="年龄",autoCount = true) 17 | private int age; 18 | @SmartColumn(id =7,name="更新时间") 19 | private long time; 20 | @SmartColumn(type= ColumnType.Child) 21 | private ChildData childData; 22 | @SmartColumn(id =6,name="选中") 23 | private boolean isCheck; 24 | @SmartColumn(id=8,name="测试Double",autoCount = true) 25 | private double data =5; 26 | private String url; 27 | @SmartColumn(type = ColumnType.ArrayChild) 28 | private List lessons; 29 | 30 | public Student(String name, int age, long time, boolean isCheck, ChildData childData) { 31 | this.name = name; 32 | this.age = age; 33 | this.time = time; 34 | this.childData = childData; 35 | this.isCheck = isCheck; 36 | } 37 | 38 | public boolean isCheck() { 39 | return isCheck; 40 | } 41 | 42 | public void setCheck(boolean check) { 43 | isCheck = check; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public int getAge() { 55 | return age; 56 | } 57 | 58 | public void setAge(int age) { 59 | this.age = age; 60 | } 61 | 62 | public long getTime() { 63 | return time; 64 | } 65 | 66 | public void setTime(long time) { 67 | this.time = time; 68 | } 69 | 70 | public ChildData getChildData() { 71 | return childData; 72 | } 73 | 74 | public void setChildData(ChildData childData) { 75 | this.childData = childData; 76 | } 77 | 78 | public String getUrl() { 79 | return url; 80 | } 81 | 82 | public void setUrl(String url) { 83 | this.url = url; 84 | } 85 | 86 | public List getLessons() { 87 | return lessons; 88 | } 89 | 90 | public void setLessons(List lessons) { 91 | this.lessons = lessons; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/StudentInfo.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | /** 4 | * Created by huang on 2018/3/11. 5 | */ 6 | 7 | public class StudentInfo { 8 | 9 | private String name; 10 | private String url; 11 | 12 | public StudentInfo(String name) { 13 | this.name = name; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getUrl() { 25 | return url; 26 | } 27 | 28 | public void setUrl(String url) { 29 | this.url = url; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/TableStyle.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | /** 4 | * Created by huang on 2017/10/13. 5 | */ 6 | 7 | public enum TableStyle { 8 | 9 | FIXED_X_AXIS("固定顶部"), 10 | FIXED_Y_AXIS("固定左侧"), 11 | FIXED_TITLE("固定标题"), 12 | @Deprecated 13 | FIXED_FIRST_COLUMN("固定第一列"), 14 | FIXED_COUNT_ROW("固定统计行"), 15 | ZOOM("是否缩放"), 16 | ALIGN("文字位置"), 17 | ANIM("动画"), 18 | FLING("Fling"), 19 | SHOW_SEQ("隐藏序列"); 20 | 21 | 22 | 23 | 24 | 25 | public String value; 26 | 27 | TableStyle(String value){ 28 | this.value = value; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/TanBean.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by huang on 2017/11/9. 8 | */ 9 | 10 | public class TanBean { 11 | 12 | private int position; 13 | private String url; 14 | private String name; 15 | 16 | public TanBean(int position, String url, String name) { 17 | this.position = position; 18 | this.url = url; 19 | this.name = name; 20 | } 21 | 22 | public static List initDatas() { 23 | List datas = new ArrayList<>(); 24 | int i = 1; 25 | datas.add(new TanBean(i++, "http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); 26 | datas.add(new TanBean(i++, "http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); 27 | datas.add(new TanBean(i++, "http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); 28 | datas.add(new TanBean(i++, "http://www.kejik.com/image/1460343965520.jpg", "多种type")); 29 | datas.add(new TanBean(i++, "http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); 30 | datas.add(new TanBean(i++, "http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); 31 | datas.add(new TanBean(i++, "http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); 32 | datas.add(new TanBean(i++, "http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); 33 | return datas; 34 | } 35 | 36 | public int getPosition() { 37 | return position; 38 | } 39 | 40 | public void setPosition(int position) { 41 | this.position = position; 42 | } 43 | 44 | public String getUrl() { 45 | return url; 46 | } 47 | 48 | public void setUrl(String url) { 49 | this.url = url; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public void setName(String name) { 57 | this.name = name; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | import com.bin.david.form.annotation.SmartTable; 6 | import com.bin.david.smarttable.bean.ChildData; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by huang on 2017/11/1. 12 | */ 13 | public class UserInfo { 14 | private String name; 15 | private int age; 16 | private long time; 17 | private ChildData childData; 18 | private boolean isCheck; 19 | private String url; 20 | private Boolean isTest; 21 | 22 | 23 | public UserInfo(String name, int age, long time, boolean isCheck, ChildData childData) { 24 | this.name = name; 25 | this.age = age; 26 | this.time = time; 27 | this.childData = childData; 28 | this.isCheck = isCheck; 29 | } 30 | 31 | public boolean isCheck() { 32 | return isCheck; 33 | } 34 | 35 | public void setCheck(boolean check) { 36 | isCheck = check; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public int getAge() { 48 | return age; 49 | } 50 | 51 | public void setAge(int age) { 52 | this.age = age; 53 | } 54 | 55 | public long getTime() { 56 | return time; 57 | } 58 | 59 | public void setTime(long time) { 60 | this.time = time; 61 | } 62 | 63 | public ChildData getChildData() { 64 | return childData; 65 | } 66 | 67 | public void setChildData(ChildData childData) { 68 | this.childData = childData; 69 | } 70 | 71 | public String getUrl() { 72 | return url; 73 | } 74 | 75 | public void setUrl(String url) { 76 | this.url = url; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/bean/Week.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.bean; 2 | 3 | import com.bin.david.form.annotation.ColumnType; 4 | import com.bin.david.form.annotation.SmartColumn; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by huang on 2018/2/6. 10 | */ 11 | 12 | public class Week { 13 | @SmartColumn(id=2,name ="星期") 14 | private String name; 15 | @SmartColumn(type = ColumnType.ArrayChild) 16 | private List times; 17 | 18 | public Week(String name, List times) { 19 | this.name = name; 20 | this.times = times; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/excel/ExcelCallback.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.excel; 2 | import java.util.List; 3 | 4 | /** 5 | * Created by huang on 2018/1/23. 6 | */ 7 | 8 | public interface ExcelCallback { 9 | 10 | void getSheetListSuc(List sheetNames); 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/excel/IExcel2Table.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.excel; 2 | 3 | import android.content.Context; 4 | 5 | import com.bin.david.form.core.SmartTable; 6 | 7 | 8 | /** 9 | * Created by huang on 2018/1/23. 10 | * excel 转换的接口 11 | */ 12 | 13 | public interface IExcel2Table { 14 | /** 15 | * 初始化表格配置 16 | * @param context 17 | * @param table 18 | */ 19 | void initTableConfig(Context context,SmartTable table); 20 | 21 | /** 22 | * 回调 23 | * @param excelCallback 24 | */ 25 | void setCallback(ExcelCallback excelCallback); 26 | 27 | /** 28 | * 加载Sheet 29 | * @param context 30 | * @param fileName 31 | */ 32 | void loadSheetList(Context context,String fileName); 33 | 34 | /** 35 | * 加载表格Sheet内容 36 | * @param context 37 | * @param position 38 | */ 39 | void loadSheetContent(Context context, int position); 40 | 41 | /** 42 | * 清理数据 43 | */ 44 | void clear(); 45 | 46 | void setIsAssetsFile(boolean isAssetsFile); 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/layoutManager/TanTanLayoutManager.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.layoutManager; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.support.v7.widget.RecyclerView.LayoutManager; 5 | import android.util.SparseArray; 6 | import android.view.View; 7 | 8 | import java.util.HashMap; 9 | 10 | /** 11 | * Created by huang on 2017/11/9. 12 | */ 13 | 14 | public class TanTanLayoutManager extends LayoutManager { 15 | 16 | public static final int MAX_SHOW_COUNT = 4; 17 | public static final float SCALE = 0.05f; 18 | public static final int MAX_TRANSLATION_Y = 20; 19 | @Override 20 | public RecyclerView.LayoutParams generateDefaultLayoutParams() { 21 | 22 | return new RecyclerView.LayoutParams(RecyclerView.LayoutParams.WRAP_CONTENT, RecyclerView.LayoutParams.WRAP_CONTENT); 23 | } 24 | 25 | @Override 26 | public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { 27 | detachAndScrapAttachedViews(recycler); 28 | int itemCount = getItemCount(); 29 | if(itemCount < MAX_SHOW_COUNT){ 30 | return; 31 | } 32 | for(int position = MAX_SHOW_COUNT -1; position>=0; position--){ 33 | View child = recycler.getViewForPosition(position); 34 | addView(child); 35 | measureChildWithMargins(child,0,0); 36 | int width = getDecoratedMeasuredWidth(child); 37 | int height = getDecoratedMeasuredHeight(child); 38 | int left = (getWidth() - width/2)/2; 39 | int right = left + width/2; 40 | int top = (getHeight() - height/2)/2; 41 | int bottom = top+ height/2; 42 | layoutDecoratedWithMargins(child,left,top,right,bottom); 43 | int level = position; 44 | if(level ==0){ 45 | child.setScaleX(1); 46 | child.setTranslationY(0); 47 | }else if(level < MAX_SHOW_COUNT-1){ 48 | child.setScaleX(1-SCALE*level); 49 | child.setTranslationY(MAX_TRANSLATION_Y *level); 50 | }else{ 51 | child.setScaleX(1-SCALE*(level-1)); 52 | child.setTranslationY(MAX_TRANSLATION_Y *(level-1)); 53 | } 54 | 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/utils/DrawHelper.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.utils; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.Rect; 7 | 8 | import com.bin.david.form.core.TableConfig; 9 | 10 | /** 11 | * Created by huang on 2018/1/18. 12 | */ 13 | 14 | public class DrawHelper { 15 | 16 | /** 17 | * 绘制图片 18 | * @param c 画布 19 | * @param rect 绘制大小 20 | * @param bitmap 位图 21 | * @param config 配置 22 | */ 23 | public static void drawBitmap(Canvas c, Rect rect, Bitmap bitmap, TableConfig config) { 24 | if (bitmap != null) { 25 | config.getPaint().setStyle(Paint.Style.FILL); 26 | int width = bitmap.getWidth(); 27 | int height = bitmap.getHeight(); 28 | Rect imgRect= new Rect(0,0,width,height); 29 | float scaleX = (float) width / rect.width(); 30 | float scaleY = (float) height / rect.height(); 31 | if (scaleX > 1 || scaleY > 1) { 32 | if (scaleX > scaleY) { 33 | width = (int) (width / scaleX); 34 | height = rect.height(); 35 | } else { 36 | height = (int) (height / scaleY); 37 | width = rect.width(); 38 | } 39 | } 40 | width = (int) (width * config.getZoom()); 41 | height = (int) (height * config.getZoom()); 42 | int disX = (rect.right - rect.left - width) / 2; 43 | int disY = (rect.bottom - rect.top - height) / 2; 44 | Rect drawRect = new Rect(); 45 | drawRect.left = rect.left + disX; 46 | drawRect.top = rect.top + disY; 47 | drawRect.right = rect.right - disX; 48 | drawRect.bottom = rect.bottom - disY; 49 | c.drawBitmap(bitmap, imgRect, drawRect, config.getPaint()); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/utils/ExcelHelper.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.utils; 2 | 3 | import org.apache.poi.hssf.usermodel.HSSFCell; 4 | import org.apache.poi.hssf.usermodel.HSSFDateUtil; 5 | import org.apache.poi.ss.usermodel.Cell; 6 | 7 | import java.text.DecimalFormat; 8 | import java.text.SimpleDateFormat; 9 | import java.util.Date; 10 | 11 | /** 12 | * Created by huang on 2018/1/23. 13 | */ 14 | 15 | public class ExcelHelper { 16 | 17 | public static String getCellValue(Cell cell){ 18 | String value; 19 | switch (cell.getCellType()) { 20 | case Cell.CELL_TYPE_NUMERIC: // 数字 21 | value = cell.getNumericCellValue() + ""; 22 | if (HSSFDateUtil.isCellDateFormatted(cell)) { 23 | Date date = cell.getDateCellValue(); 24 | if (date != null) { 25 | value = new SimpleDateFormat("yyyy-MM-dd").format(date); 26 | } else { 27 | value = ""; 28 | } 29 | } else { 30 | value = new DecimalFormat("0").format(cell.getNumericCellValue()); 31 | } 32 | break; 33 | case HSSFCell.CELL_TYPE_STRING: // 字符串 34 | value = cell.getStringCellValue(); 35 | break; 36 | case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean 37 | value = cell.getBooleanCellValue() + ""; 38 | break; 39 | case HSSFCell.CELL_TYPE_FORMULA: // 公式 40 | value = cell.getCellFormula() + ""; 41 | break; 42 | case HSSFCell.CELL_TYPE_BLANK: // 空值 43 | value = ""; 44 | break; 45 | case HSSFCell.CELL_TYPE_ERROR: // 故障 46 | value = "非法字符"; 47 | break; 48 | default: 49 | value = "未知类型"; 50 | break; 51 | } 52 | return value; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/view/GlideCircleTransform.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.view; 2 | 3 | 4 | import android.content.Context; 5 | import android.graphics.Bitmap; 6 | import android.graphics.BitmapShader; 7 | import android.graphics.Canvas; 8 | import android.graphics.Paint; 9 | 10 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 11 | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; 12 | 13 | import java.security.MessageDigest; 14 | 15 | public class GlideCircleTransform extends BitmapTransformation { 16 | 17 | 18 | @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { 19 | return circleCrop(pool, toTransform); 20 | } 21 | 22 | private static Bitmap circleCrop(BitmapPool pool, Bitmap source) { 23 | if (source == null) return null; 24 | 25 | int size = Math.min(source.getWidth(), source.getHeight()); 26 | int x = (source.getWidth() - size) / 2; 27 | int y = (source.getHeight() - size) / 2; 28 | 29 | // TODO this could be acquired from the pool too 30 | Bitmap squared = Bitmap.createBitmap(source, x, y, size, size); 31 | 32 | Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888); 33 | if (result == null) { 34 | result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); 35 | } 36 | 37 | Canvas canvas = new Canvas(result); 38 | Paint paint = new Paint(); 39 | paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP)); 40 | paint.setAntiAlias(true); 41 | float r = size / 2f; 42 | canvas.drawCircle(r, r, r, paint); 43 | return result; 44 | } 45 | 46 | 47 | @Override 48 | public void updateDiskCacheKey(MessageDigest messageDigest) { 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /app/src/main/java/com/bin/david/smarttable/view/QuickChartDialog.java: -------------------------------------------------------------------------------- 1 | package com.bin.david.smarttable.view; 2 | 3 | import android.app.Activity; 4 | 5 | 6 | import com.bin.david.smarttable.bean.TableStyle; 7 | 8 | import java.util.Arrays; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * Created by huang on 2017/10/13. 14 | */ 15 | 16 | public class QuickChartDialog { 17 | private Map> map; 18 | 19 | public QuickChartDialog(){ 20 | map = new HashMap<>(); 21 | } 22 | 23 | public void showDialog(Activity activity, TableStyle chartStyle, String[] dataList, OnCheckChangeAdapter adapter){ 24 | BaseCheckDialog dialog; 25 | if(map.containsKey(chartStyle)){ 26 | dialog = map.get(chartStyle); 27 | }else { 28 | dialog = new BaseCheckDialog<>(chartStyle.value,adapter); 29 | } 30 | map.put(chartStyle,dialog); 31 | dialog.show(activity,false, Arrays.asList(dataList)); 32 | } 33 | 34 | public abstract static class OnCheckChangeAdapter implements BaseCheckDialog.OnCheckChangeListener { 35 | @Override 36 | public String getItemText(String s) { 37 | return s; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_in_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fade_out_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/anim/modal_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 10 | 11 | 19 | 20 | 29 | 30 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/anim/modal_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 14 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/anim/out_to_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_left_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_left_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_right_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_right_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cal_sign_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/src/main/res/drawable/cal_sign_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/cal_sign_bg2.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangyanbin/smartTable/fe975d333a79586261f4f265317b9d1e6f2a36fa/app/src/main/res/drawable/cal_sign_bg2.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/checkbox_btn_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_white_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_window_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_annotation.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 18 |