Skip to content

Commit

Permalink
release 2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
hupei committed May 8, 2017
1 parent c341774 commit 6b96e63
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# 引入
```xml
compile 'com.mylhyl:circleDialog:2.1.5'
compile 'com.mylhyl:circleDialog:2.1.6'
```

eclipse 可以[点击这里下载aar文件](http://jcenter.bintray.com/com/mylhyl/circleDialog/), 然后用zip解压取出jar包
Expand Down Expand Up @@ -83,6 +83,8 @@ QQ交流群:553426264 [点击链接加入群Android-CircleDialog](https://jq.q

# 版本

> 2.1.6 增加`text``title`参数`gravity`
> 2.1.5 修复已知Bug
> 2.1.4 minSdkVersion 15
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/com/mylhyl/circledialog/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
import com.mylhyl.circledialog.callback.ConfigButton;
import com.mylhyl.circledialog.callback.ConfigDialog;
import com.mylhyl.circledialog.callback.ConfigInput;
import com.mylhyl.circledialog.callback.ConfigText;
import com.mylhyl.circledialog.params.ButtonParams;
import com.mylhyl.circledialog.params.DialogParams;
import com.mylhyl.circledialog.params.InputParams;
import com.mylhyl.circledialog.params.ProgressParams;
import com.mylhyl.circledialog.params.TextParams;
import com.mylhyl.circledialog.view.listener.OnInputClickListener;

import java.util.Timer;
Expand All @@ -46,6 +48,13 @@ public void onItemClick(final AdapterView<?> parent, View view, int position, lo
new CircleDialog.Builder(this)
.setTitle("标题")
.setText("提示框")
.configText(new ConfigText() {
@Override
public void onConfig(TextParams params) {
params.gravity = Gravity.LEFT;
params.padding = new int[]{50, 50, 50, 50};
}
})
.setPositive("确定", null)
.show();
break;
Expand Down Expand Up @@ -82,7 +91,8 @@ public void onConfig(DialogParams params) {
.setTitleColor(Color.BLUE)
.setItems(items, new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
public void onItemClick(AdapterView<?> parent, View view, int
position, long id) {

}
})
Expand Down Expand Up @@ -173,7 +183,8 @@ public void run() {
@Override
public void onConfig(DialogParams params) {
params.gravity = Gravity.TOP;
// TranslateAnimation refreshAnimation = new TranslateAnimation(15, -15, 0, 0);
// TranslateAnimation refreshAnimation = new TranslateAnimation(15, -15,
// 0, 0);
// refreshAnimation.setInterpolator(new OvershootInterpolator());
// refreshAnimation.setDuration(100);
// refreshAnimation.setRepeatCount(3);
Expand Down
4 changes: 2 additions & 2 deletions circledialog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "2017.5.5"
versionName "2017.5.8"
}
buildTypes {
release {
Expand All @@ -33,7 +33,7 @@ publish {
userOrg = 'mylhyl'
groupId = 'com.mylhyl'
artifactId = 'circleDialog'
version = '2.1.5'
version = '2.1.6'
description = 'circleDialog ios style'
website = "https://github.com/mylhyl/Android-CircleDialog"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Parcel;
import android.os.Parcelable;
import android.view.Gravity;

import com.mylhyl.circledialog.res.values.CircleColor;
import com.mylhyl.circledialog.res.values.CircleDimen;
Expand Down Expand Up @@ -36,6 +37,8 @@ public class TextParams implements Parcelable {
*/
public int textSize = CircleDimen.CONTENT_TEXT_SIZE;

public int gravity = Gravity.CENTER;

@Override
public int describeContents() {
return 0;
Expand All @@ -49,6 +52,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.backgroundColor);
dest.writeInt(this.textColor);
dest.writeInt(this.textSize);
dest.writeInt(this.gravity);
}

public TextParams() {
Expand All @@ -61,6 +65,7 @@ protected TextParams(Parcel in) {
this.backgroundColor = in.readInt();
this.textColor = in.readInt();
this.textSize = in.readInt();
this.gravity = in.readInt();
}

public static final Parcelable.Creator<TextParams> CREATOR = new Parcelable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import android.os.Parcel;
import android.os.Parcelable;
import android.view.Gravity;

import com.mylhyl.circledialog.res.values.CircleColor;
import com.mylhyl.circledialog.res.values.CircleDimen;

import java.io.Serializable;

/**
* 标题参数
* Created by hupei on 2017/3/30.
Expand All @@ -34,6 +33,7 @@ public class TitleParams implements Parcelable {
*/
public int backgroundColor;

public int gravity = Gravity.CENTER;

@Override
public int describeContents() {
Expand All @@ -47,6 +47,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.textSize);
dest.writeInt(this.textColor);
dest.writeInt(this.backgroundColor);
dest.writeInt(this.gravity);
}

public TitleParams() {
Expand All @@ -58,6 +59,7 @@ protected TitleParams(Parcel in) {
this.textSize = in.readInt();
this.textColor = in.readInt();
this.backgroundColor = in.readInt();
this.gravity = in.readInt();
}

public static final Parcelable.Creator<TitleParams> CREATOR = new Parcelable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import android.content.Context;
import android.os.Build;

import com.mylhyl.circledialog.params.ButtonParams;
import com.mylhyl.circledialog.params.CircleParams;
import com.mylhyl.circledialog.params.DialogParams;
import com.mylhyl.circledialog.params.TextParams;
import com.mylhyl.circledialog.params.ButtonParams;
import com.mylhyl.circledialog.params.TitleParams;
import com.mylhyl.circledialog.res.drawable.CircleDrawable;
import com.mylhyl.circledialog.res.values.CircleColor;
Expand All @@ -31,6 +31,8 @@ private void init(CircleParams params) {
ButtonParams negativeParams = params.negativeParams;
ButtonParams positiveParams = params.positiveParams;

setGravity(textParams.gravity);

//如果标题没有背景色,则使用默认色
int backgroundColor = textParams.backgroundColor != 0 ? textParams.backgroundColor :
CircleColor.bgDialog;
Expand Down Expand Up @@ -66,7 +68,8 @@ else if (titleParams == null && negativeParams == null && positiveParams == null
//有标题有按钮则不用考虑圆角
else setBackgroundColor(backgroundColor);

setHeight(textParams.height);
// setHeight(textParams.height);
setMinHeight(textParams.height);
setTextColor(textParams.textColor);
setTextSize(textParams.textSize);
setText(textParams.text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ private void init(CircleParams params) {
DialogParams dialogParams = params.dialogParams;
TitleParams titleParams = params.titleParams;

setGravity(titleParams.gravity);

//如果标题没有背景色,则使用默认色
int backgroundColor = titleParams.backgroundColor != 0 ? titleParams.backgroundColor :
CircleColor.bgDialog;
Expand Down

0 comments on commit 6b96e63

Please sign in to comment.