Skip to content

Commit

Permalink
修改demo代码,应用更新后的 initViews() 方法
Browse files Browse the repository at this point in the history
  • Loading branch information
XuQK authored and zyyoona7 committed Jul 17, 2018
1 parent 73f11b3 commit ad6618b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void initAttributes() {
}

@Override
protected void initViews(View view) {
protected void initViews(View view, BasePopup basePopup) {

mCancelTv = findViewById(R.id.tv_cancel);
mOkTv = findViewById(R.id.tv_ok);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void initAttributes() {
}

@Override
protected void initViews(View view) {
protected void initViews(View view, BasePopup basePopup) {
mOkBtn = findViewById(R.id.btn_ok);
mCancelBtn = findViewById(R.id.btn_cancel);
mRecyclerView = findViewById(R.id.rv_complex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.zyyoona7.easypopup.base.BaseActivity;
import com.zyyoona7.easypopup.views.TitleBar;
import com.zyyoona7.easypopup.views.TriangleDrawable;
import com.zyyoona7.popup.BasePopup;
import com.zyyoona7.popup.EasyPopup;
import com.zyyoona7.popup.XGravity;
import com.zyyoona7.popup.YGravity;
Expand Down Expand Up @@ -147,7 +148,7 @@ private void initQQPop() {
.setAnimationStyle(R.style.RightTop2PopAnim)
.setOnViewListener(new EasyPopup.OnViewListener() {
@Override
public void initViews(View view) {
public void initViews(View view, BasePopup basePopup) {
View arrowView = view.findViewById(R.id.v_arrow);
arrowView.setBackground(new TriangleDrawable(TriangleDrawable.TOP, Color.parseColor("#88FF88")));
}
Expand All @@ -173,7 +174,7 @@ private void initWeiboPop() {
.setAnimationStyle(R.style.TopPopAnim)
.setOnViewListener(new EasyPopup.OnViewListener() {
@Override
public void initViews(View view) {
public void initViews(View view, BasePopup basePopup) {
View arrowView = view.findViewById(R.id.v_arrow_weibo);
arrowView.setBackground(new TriangleDrawable(TriangleDrawable.TOP, Color.WHITE));
}
Expand All @@ -192,24 +193,27 @@ private void initCirclePop() {
.setContentView(this, R.layout.layout_circle_comment)
.setAnimationStyle(R.style.RightPopAnim)
.setFocusAndOutsideEnable(true)
.setOnViewListener(new EasyPopup.OnViewListener() {
@Override
public void initViews(View view, final BasePopup popup) {
view.findViewById(R.id.tv_zan).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort("赞");
popup.dismiss();
}
});
view.findViewById(R.id.tv_comment).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort("评论");
popup.dismiss();
}
});
}
})
.apply();
TextView tvZan = mCirclePop.findViewById(R.id.tv_zan);
TextView tvComment = mCirclePop.findViewById(R.id.tv_comment);
tvZan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort("赞");
mCirclePop.dismiss();
}
});

tvComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort("评论");
mCirclePop.dismiss();
}
});
mCirclePop.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void initAttributes() {
}

@Override
protected void initViews(View view) {
protected void initViews(View view, BasePopup basePopup) {

// setOnRealWHAlreadyListener(new OnRealWHAlreadyListener() {
// @Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void initAttributes() {
}

@Override
protected void initViews(View view) {
protected void initViews(View view, BasePopup basePopup) {
mRecyclerView = findViewById(R.id.rv_gift);
mRecyclerView.setLayoutManager(new GridLayoutManager(mRecyclerView.getContext(), 4, GridLayoutManager.VERTICAL, false));
List<String> list = createList();
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/zyyoona7/easypopup/kt/CustomPopup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import com.zyyoona7.popup.BasePopup
* Created by zyyoona7 on 2017/9/19.
*/
class CustomPopup() : BasePopup<CustomPopup>() {

override fun initViews(view: View?) {
override fun initAttributes() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}

override fun initAttributes() {
override fun initViews(view: View?, popup: BasePopup<out BasePopup<*>>?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}

}

0 comments on commit ad6618b

Please sign in to comment.