Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
init code
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangbin1937 committed Mar 30, 2017
1 parent 6e28f1f commit 6e0be1b
Show file tree
Hide file tree
Showing 71 changed files with 4,830 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .gitignore
@@ -0,0 +1,62 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
/.idea

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties
.classpath
.project
.settings/

# Proguard folder generated by Eclipse
proguard/

#Log Files
*.log

# OS X
.DS_Store

*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.ear
*.iml

# IDEA Files
.idea/
.settings/
out/

# MAVEN COMPILE Files
target/

project.properties
122 changes: 122 additions & 0 deletions ATTRIBUTES-ch.md
@@ -0,0 +1,122 @@
[Englis API](ATTRIBUTES.md)
### initIndicator

初始化indicator,支持链式调用set属性,focusColor, normalColor是必设属性,否则indicator不会显示。
#### 接口
```
IUltraIndicatorBuilder initIndicator();
```
---
### setFocusColor setNormalColor
设置indicator 图标颜色。
`focusColor` 被选中的indicator颜色
`normalColor` 未被选中的indicator颜色
#### 接口
```
IUltraIndicatorBuilder setFocusColor(int focusColor);
IUltraIndicatorBuilder setNormalColor(int normalColor);
```
```
ultraViewPager.getIndicator()
.setFocusColor(Color.GREEN)
.setNormalColor(Color.WHITE)
.setRadius((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
```

![color](pics/20151203-0.png)
---
### setFocusResId setNormalResId
设置indicator 图片资源。
`focusResId` 被选中的indicator icon Id
`normalResId` 未被选中的indicator icon Id
#### 接口
```
IUltraIndicatorBuilder setFocusResId(int focusResId);
IUltraIndicatorBuilder setNormalResId(int normalResId);
```
```
ultraViewPager.getIndicator()
.setFocusResId(R.mipmap.tm_biz_lifemaster_indicator_selected)
.setNormalResId(R.mipmap.tm_biz_lifemaster_indicator_normal);
```
![icon](pics/20151203-1.png)
---
### setIndicatorPadding

`indicatorPadding` indicator的item之间的间距,默认是item的宽度

#### 接口
```
IUltraIndicatorBuilder setIndicatorPadding(int indicatorPadding);
```
---
### build
设置完indicator属性后, 需调用`build`完成创建。

#### 接口
```
void build();
```
---
### setMultiScreen
开启一屏多显模式,child view的宽度不占满全屏。
#### 接口
```
void setMultiScreen(float ratio)
```

```
ultraViewPager.setMultiScreen(0.5f);
ultraViewPager.setItemRatio(1.0f);
ultraViewPager.setAutoMeasureHeight(true);
```

<img src="pics/api2.png" width="200px" />

---
### setAutoMeasureHeight
使能该功能,UltraViewPager的高度会自动调整到child view的高度。`setRadio``setAutoMeasureHeight` 不应该同时使用。
#### 接口
```
void setAutoMeasureHeight(boolean enable)
```

```
ultraViewPager.setMultiScreen(1.0f);//single screen
ultraViewPager.setItemRatio(1.0f);//the aspect ratio of child view equals to 1.0f
ultraViewPager.setAutoMeasureHeight(false);
```
<img src="pics/api0.png" width="200px" />

```
ultraViewPager.setMultiScreen(1.0f);
ultraViewPager.setItemRatio(1.0f);
ultraViewPager.setAutoMeasureHeight(true);
```
<img src="pics/api1.png" width="200px" />

---
### setItemRatio
设置后会以此宽高比调整child view的高度。
#### 接口

```
void setItemRatio(double ratio)
```

---

### setRatio
以设定的宽高比来绘制UltraViewPager。`setRatio`优先级高于`setItemRatio`.
#### 接口
```
void setRatio(float ratio)
```
```
ultraViewPager.setMultiScreen(1.0f);//single screen
ultraViewPager.setRatio(2.0f);//the aspect ratio of viewpager equals to 2.0f
ultraViewPager.setAutoMeasureHeight(true);
```

<img src="pics/api3.png" width="200px" />

129 changes: 129 additions & 0 deletions ATTRIBUTES.md
@@ -0,0 +1,129 @@
[中文API](ATTRIBUTES-ch.md)
### initIndicator
Constructs a indicator with no options. This indicator supports calling set-method in chained mode. The arrtibutes of `focusColor` and `normalColor` are necessary, or the indicator won't be shown.

#### API
```
IUltraIndicatorBuilder initIndicator();
```
---
### setFocusColor setNormalColor
Fill indicator with color.

`focusColor` Set focused color for indicator.
`normalColor` Set normal color for indicator.

#### API
```
IUltraIndicatorBuilder setFocusColor(int focusColor);
IUltraIndicatorBuilder setNormalColor(int normalColor);
```

```
ultraViewPager.getIndicator()
.setFocusColor(Color.GREEN)
.setNormalColor(Color.WHITE)
.setRadius((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
```

![color](pics/20151203-0.png)

---
### setFocusResId setNormalResId
Fill indicator with bitmap or icon.
`focusResId` Set focused resource ID for indicator.
`normalResId` Set normal resource ID for indicator.

#### API
```
IUltraIndicatorBuilder setFocusResId(int focusResId);
IUltraIndicatorBuilder setNormalResId(int normalResId);
```
```
ultraViewPager.getIndicator()
.setFocusResId(R.mipmap.tm_biz_lifemaster_indicator_selected)
.setNormalResId(R.mipmap.tm_biz_lifemaster_indicator_normal);
```
![icon](pics/20151203-1.png)
---
### setIndicatorPadding

`indicatorPadding` sets spacing between indicator items,the default value is item's height.


#### API
```
IUltraIndicatorBuilder setIndicatorPadding(int indicatorPadding);
```


---
### build
After setting the indicator feature, call `build()` to complete.

#### API
```
void build();
```
---
### setMultiScreen
set multi-screen feature, the width of the child view won't occupy full screen.
#### API
```
void setMultiScreen(float ratio)
```

```
ultraViewPager.setMultiScreen(0.5f);
ultraViewPager.setItemRatio(1.0f);
ultraViewPager.setAutoMeasureHeight(true);
```
<img src="pics/api2.png" width="200px" />

---
### setAutoMeasureHeight
When enabled, the height of the UltraViewPager will be automatically adjusted to the height of child view.
Do not use `setRadio` and `setAutoMeasureHeight` at the same time.
#### API
```
void setAutoMeasureHeight(boolean enable)
```

```
ultraViewPager.setMultiScreen(1.0f);//single screen
ultraViewPager.setItemRatio(1.0f);//the aspect ratio of child view equals to 1.0f
ultraViewPager.setAutoMeasureHeight(false);
```
<img src="pics/api0.png" width="200px" />

```
ultraViewPager.setMultiScreen(1.0f);
ultraViewPager.setItemRatio(1.0f);
ultraViewPager.setAutoMeasureHeight(true);
```
<img src="pics/api1.png" width="200px" />

---
### setItemRatio
Adjust the height of child view with aspect `ratio`.
#### API

```
void setItemRatio(double ratio)
```

---
### setRatio
Draw UltraViewPager with the aspect `ratio`. The priority of `setRatio` is higher than `setItemRatio`
#### API
```
void setRatio(float ratio)
```
```
ultraViewPager.setMultiScreen(1.0f);//single screen
ultraViewPager.setRatio(2.0f);//the aspect ratio of viewpager equals to 2.0f
ultraViewPager.setAutoMeasureHeight(true);
```

<img src="pics/api3.png" width="200px" />

0 comments on commit 6e0be1b

Please sign in to comment.