Skip to content

Commit

Permalink
fix(position): fixed position issues and updated to v1.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiaji committed Apr 7, 2019
1 parent 93768a8 commit 73a006a
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 87 deletions.
10 changes: 7 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 9 additions & 17 deletions README-cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HappyBubble
[![GitHub release](https://img.shields.io/badge/Download-demo--apk-brightgreen.svg)](https://github.com/xujiaji/HappyBubble/releases) [![maven](https://img.shields.io/badge/bintray-1.1.6-brightgreen.svg)](https://bintray.com/xujiaji/maven/happy-bubble/1.1.6)
[![GitHub release](https://img.shields.io/badge/Download-demo--apk-brightgreen.svg)](https://github.com/xujiaji/HappyBubble/releases) [![maven](https://img.shields.io/badge/bintray-1.1.7-brightgreen.svg)](https://bintray.com/xujiaji/maven/happy-bubble/1.1.7)

![bubble](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/img5.png)

Expand All @@ -12,6 +12,7 @@
[旧文档(Old README)](README-old.md)

## 更新
- 1.1.7: 修复位置问题,修复`autoPosition`无效问题,修复横屏模式问题。[issues13](https://github.com/xujiaji/HappyBubble/issues/13) [issues11](https://github.com/xujiaji/HappyBubble/issues/11) [issues10](https://github.com/xujiaji/HappyBubble/issues/10)
- 1.1.6:
<br>[新增方向优先级:issues/9](https://github.com/xujiaji/HappyBubble/issues/9)
- 1.1.5:
Expand Down Expand Up @@ -46,7 +47,7 @@
## 如何开始?
在你模块中的build.gradle添加上HappyBubble依赖
```
implementation 'com.github.xujiaji:happy-bubble:1.1.6'
implementation 'com.github.xujiaji:happy-bubble:1.1.7'
```

## 如何使用 HappyBubble-BubbleDialog?
Expand All @@ -57,7 +58,6 @@ implementation 'com.github.xujiaji:happy-bubble:1.1.6'
|addContentView|View|添加填充在气泡中的视图|
|setClickedView|View|被点击的View(触发Dialog出现的View)|
|setPosition|enum ... `BubbleDialog.Position:LEFT, TOP, RIGHT, BOTTOM`|BubbleDialog相对于被点击的view的位置。如果传入多个位置,那么最前面的位置优先级越高|
|calBar|boolean|是否计算状态栏的高度(如果布局没有全屏,则需要计算)|
|setOffsetX|int|如果您对dialog所展示的x轴位置不满,需要调整x轴方向偏移|
|setOffsetY|int|如果您对dialog所展示的y轴位置不满,需要调整y轴方向偏移|
|setBubbleLayout|BubbleLayout|自定义dialog的气泡布局|
Expand All @@ -74,14 +74,10 @@ implementation 'com.github.xujiaji:happy-bubble:1.1.6'
|-|-|
|![exampel1](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/img_example1.png)|![exampel2](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/img_example2.png)|

> 需要提供:Context、填充的View、被点击的View。</br>
> 如果最外层布局没有全屏时,您需要计算状态栏的高度,否则会多向下偏移一个状态栏的高度。
``` java
new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view3, null))
.setClickedView(mButton)
.calBar(true)
.show();
```
### 向下偏移8dp
Expand All @@ -92,7 +88,6 @@ new BubbleDialog(this)
.setClickedView(mButton4)
.setPosition(mPosition)
.setOffsetY(8)
.calBar(true)
.show();
```
### 当想要输入框随软键盘上移时
Expand All @@ -102,24 +97,23 @@ new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view, null))
.setClickedView(mButton12)
.setPosition(mPosition)
.calBar(true)
.softShowUp()
.show();
```
### 自定义 BubbleLayout.
![exampel5](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/img_example5.png)
![exampel5](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/20190407164328.png)

``` java
BubbleLayout bl = new BubbleLayout(this);
bl.setBubbleColor(Color.BLUE);
bl.setBubbleColor(Color.YELLOW);
bl.setShadowColor(Color.RED);
bl.setLookLength(Util.dpToPx(this, 54));
bl.setLookWidth(Util.dpToPx(this, 48));
bl.setLookLength(Util.dpToPx(this, 18));
bl.setLookWidth(Util.dpToPx(this, 24));
bl.setBubbleRadius(Util.dpToPx(this, 3));
new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view5, null))
.setClickedView(mButton8)
.setPosition(mPosition)
.calBar(true)
.setBubbleLayout(bl)
.show();
```
Expand Down Expand Up @@ -171,7 +165,6 @@ public class CustomOperateDialog extends BubbleDialog implements View.OnClickLis
public CustomOperateDialog(Context context)
{
super(context);
calBar(true);
setTransParentBackground();
setPosition(Position.TOP);
View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_view4, null);
Expand Down Expand Up @@ -244,8 +237,7 @@ if(mBubbleDialog == null)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view3, null))
.setClickedView(mButton4)
.setPosition(mPosition)
.setOffsetY(8)
.calBar(true);
.setOffsetY(8);
}
mBubbleDialog.show();
```
Expand Down
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HappyBubble
[![GitHub release](https://img.shields.io/badge/Download-demo--apk-brightgreen.svg)](https://github.com/xujiaji/HappyBubble/releases) [![maven](https://img.shields.io/badge/bintray-1.1.6-brightgreen.svg)](https://bintray.com/xujiaji/maven/happy-bubble/1.1.6)
[![GitHub release](https://img.shields.io/badge/Download-demo--apk-brightgreen.svg)](https://github.com/xujiaji/HappyBubble/releases) [![maven](https://img.shields.io/badge/bintray-1.1.7-brightgreen.svg)](https://bintray.com/xujiaji/maven/happy-bubble/1.1.7)

![bubble](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/en/img5.png)

Expand All @@ -11,6 +11,7 @@ Dialog according to click View position display;

[Old README(旧文档)](README-old.md)
## update
- 1.1.7: fix position error, fix `autoPosition` invalid ... [#13](https://github.com/xujiaji/HappyBubble/issues/13) [#11](https://github.com/xujiaji/HappyBubble/issues/11) [#10](https://github.com/xujiaji/HappyBubble/issues/10)
- 1.1.6:
<br>[feat position priority: #9](https://github.com/xujiaji/HappyBubble/issues/9)
- 1.1.5:
Expand Down Expand Up @@ -43,7 +44,7 @@ Dialog according to click View position display;
## How to get started?
Add HappyBubble dependency into your build.gradle
```
implementation 'com.github.xujiaji:happy-bubble:1.1.6'
implementation 'com.github.xujiaji:happy-bubble:1.1.7'
```

## How to use HappyBubble-BubbleDialog?
Expand All @@ -54,7 +55,6 @@ implementation 'com.github.xujiaji:happy-bubble:1.1.6'
|addContentView|View|Fill content view|
|setClickedView|View|Clicked view|
|setPosition|enum ... BubbleDialog.Position:LEFT, TOP, RIGHT, BOTTOM|BubbleDialog relative to the location of the view being clicked. If you pass in multiple locations, the higher the priority of the front position|
|calBar|boolean|Whether to calculate the status bar|
|setOffsetX|int|If you are not satisfied with the x position, you need to adjust.|
|setOffsetY|int|If you are not satisfied with the y position, you need to adjust.|
|setBubbleLayout|BubbleLayout|Custom BubbleLayout|
Expand All @@ -71,14 +71,10 @@ implementation 'com.github.xujiaji:happy-bubble:1.1.6'
|-|-|
|![exampel1](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/en/img_example1.png)|![exampel2](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/en/img_example2.png)|

> Need to provide Context, fill View, clicked View.</br>
> If the layout is not full screen then you need to calculate the status bar.
``` java
new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view3, null))
.setClickedView(mButton)
.calBar(true)
.show();
```
### Off 8dp down.
Expand All @@ -89,7 +85,6 @@ new BubbleDialog(this)
.setClickedView(mButton4)
.setPosition(mPosition)
.setOffsetY(8)
.calBar(true)
.show();
```
### When the input box is covered by the keyboard.
Expand All @@ -99,24 +94,23 @@ new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view, null))
.setClickedView(mButton12)
.setPosition(mPosition)
.calBar(true)
.softShowUp()
.show();
```
### Custom BubbleLayout.
![exampel5](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/en/img_example5.png)
![exampel5](https://raw.githubusercontent.com/xujiaji/xujiaji.github.io/pictures/github/HappyBubble/20190407164631.png)

``` java
BubbleLayout bl = new BubbleLayout(this);
bl.setBubbleColor(Color.BLUE);
bl.setBubbleColor(Color.YELLOW);
bl.setShadowColor(Color.RED);
bl.setLookLength(Util.dpToPx(this, 54));
bl.setLookWidth(Util.dpToPx(this, 48));
bl.setLookLength(Util.dpToPx(this, 18));
bl.setLookWidth(Util.dpToPx(this, 24));
bl.setBubbleRadius(Util.dpToPx(this, 3));
new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view5, null))
.setClickedView(mButton8)
.setPosition(mPosition)
.calBar(true)
.setBubbleLayout(bl)
.show();
```
Expand Down Expand Up @@ -168,7 +162,6 @@ public class CustomOperateDialog extends BubbleDialog implements View.OnClickLis
public CustomOperateDialog(Context context)
{
super(context);
calBar(true);
setTransParentBackground();
setPosition(Position.TOP);
View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_view4, null);
Expand Down Expand Up @@ -241,8 +234,7 @@ if(mBubbleDialog == null)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view3, null))
.setClickedView(mButton4)
.setPosition(mPosition)
.setOffsetY(8)
.calBar(true);
.setOffsetY(8);
}
mBubbleDialog.show();
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class CustomOperateDialog extends BubbleDialog implements View.OnClickLis
public CustomOperateDialog(Context context)
{
super(context);
calBar(true);
// setTransParentBackground();
setPosition(Position.TOP);
View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_view4, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ public void onClick(View v)
.setClickedView(mButton)
.setPosition(mPosition)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true)
.calBar(true);
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
mCurrentDialog.show();

break;
Expand All @@ -220,8 +219,7 @@ public void onClick(View v)
// .setClickedView(mButton2)
// .setPosition(mPosition)
// .autoPosition(isAuto)
// .setThroughEvent(mCheckBoxThrough.isChecked(), true)
// .calBar(true);
// .setThroughEvent(mCheckBoxThrough.isChecked(), true);
// mCurrentDialog.show();

break;
Expand All @@ -232,8 +230,7 @@ public void onClick(View v)
// .setClickedView(mButton3)
// .setPosition(mPosition)
// .autoPosition(isAuto)
// .setThroughEvent(mCheckBoxThrough.isChecked(), true)
// .calBar(true);
// .setThroughEvent(mCheckBoxThrough.isChecked(), true);
// mCurrentDialog.show();

break;
Expand All @@ -243,9 +240,7 @@ public void onClick(View v)
.setClickedView(mButton4)
.setPosition(mPosition)
.setOffsetY(8)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true)
.calBar(true);
.autoPosition(mAuto);
mCurrentDialog.show();

break;
Expand All @@ -255,8 +250,7 @@ public void onClick(View v)
.setClickedView(mButton5)
.setPosition(mPosition)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true)
.calBar(true);
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
mCurrentDialog.show();
break;
case R.id.button6:
Expand All @@ -273,23 +267,22 @@ public void onClick(View v)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view3, null))
.setClickedView(mButton7)
.setPosition(mPosition)
.calBar(true)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
mCurrentDialog.show();

break;
case R.id.button8:
BubbleLayout bl = new BubbleLayout(this);
bl.setBubbleColor(Color.BLUE);
bl.setBubbleColor(Color.YELLOW);
bl.setShadowColor(Color.RED);
bl.setLookLength(Util.dpToPx(this, 54));
bl.setLookWidth(Util.dpToPx(this, 48));
bl.setLookLength(Util.dpToPx(this, 18));
bl.setLookWidth(Util.dpToPx(this, 24));
bl.setBubbleRadius(Util.dpToPx(this, 3));
mCurrentDialog = new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view5, null))
.setClickedView(mButton8)
.setPosition(mPosition)
.calBar(true)
.setBubbleLayout(bl)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
Expand Down Expand Up @@ -330,16 +323,14 @@ public void onClick(String str)
// .setClickedView(mButton11)
// .setPosition(mPosition)
// .autoPosition(isAuto)
// .setThroughEvent(mCheckBoxThrough.isChecked(), true)
// .calBar(true);
// .setThroughEvent(mCheckBoxThrough.isChecked(), true);
//
// mCurrentDialog.show();

mCurrentDialog = new BubbleDialog(this)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view, null))
.setClickedView(mButton11)
.setPosition(mPosition)
.calBar(true)
.softShowUp()
.autoPosition(mAuto)
.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
Expand All @@ -354,7 +345,6 @@ public void onClick(String str)
.addContentView(LayoutInflater.from(this).inflate(R.layout.dialog_view, null))
.setClickedView(mButton12)
.setPosition(mPosition)
.calBar(true)
.softShowUp()
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
Expand Down Expand Up @@ -398,8 +388,7 @@ public void onClick(View v)
.setClickedView(mButton3)
.setPosition(mPosition)
.autoPosition(mAuto)
.setThroughEvent(mCheckBoxThrough.isChecked(), true)
.calBar(true);
.setThroughEvent(mCheckBoxThrough.isChecked(), true);
mCurrentDialog.show();
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_test_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:textAllCaps="false"
android:text="@string/have_status_but_no_cal_status_height"
android:text="Button"
app:layout_constraintBottom_toBottomOf="@+id/button7"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button5" />
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ext {
siteUrl = 'https://github.com/xujiaji/HappyBubble'
gitUrl = 'https://github.com/xujiaji/HappyBubble.git'

libraryVersion = '1.1.6'
libraryVersion = '1.1.7'

developerId = 'xujiaji'
developerName = 'xujiaji'
Expand Down
4 changes: 2 additions & 2 deletions happy-bubble/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 3
versionName "1.1.6"
versionCode 4
versionName "1.1.7"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down

0 comments on commit 73a006a

Please sign in to comment.