list) {
27 | this.context = context;
28 | mList = list;
29 | }
30 |
31 | @Override
32 | public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_test_list, parent, false);
34 | return new BaseViewHolder(view);
35 | }
36 |
37 | @Override
38 | public void onBindViewHolder(BaseViewHolder holder, int position) {
39 | final int adapterPosition = holder.getAdapterPosition();
40 | TestGroupBean item = getItem(adapterPosition);
41 | if (item == null) {
42 | return;
43 | }
44 | holder.tv.setText(item.getName());
45 | holder.itemView.setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | notifyItemRemoved(adapterPosition);
49 | mList.remove(adapterPosition);
50 | notifyItemRangeChanged(adapterPosition, mList.size());
51 | Toast.makeText(context, "delete index:" + adapterPosition, Toast.LENGTH_LONG).show();
52 | }
53 | });
54 | }
55 |
56 | private TestGroupBean getItem(int pos) {
57 | if (pos <= -1 || pos > getItemCount()) {
58 | return null;
59 | }
60 | return mList.get(pos);
61 | }
62 |
63 | @Override
64 | public int getItemCount() {
65 | if (mList == null) {
66 | return 0;
67 | }
68 | return mList.size();
69 | }
70 |
71 | public class BaseViewHolder extends RecyclerView.ViewHolder {
72 | protected TextView tv;
73 |
74 | public BaseViewHolder(View itemView) {
75 | super(itemView);
76 | tv = itemView.findViewById(R.id.tv_test_list);
77 | }
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/java/com/tc/bubblelayout/testrecylerview/NormalDecoration.java:
--------------------------------------------------------------------------------
1 | //
2 | // Source code recreated from a .class file by IntelliJ IDEA
3 | // (powered by Fernflower decompiler)
4 | //
5 |
6 | package com.tc.bubblelayout.testrecylerview;
7 |
8 | import android.app.Activity;
9 | import android.graphics.Canvas;
10 | import android.graphics.Color;
11 | import android.graphics.Paint;
12 | import android.graphics.Paint.Align;
13 | import android.graphics.Paint.FontMetrics;
14 | import android.graphics.Rect;
15 | import android.support.v7.widget.RecyclerView;
16 | import android.support.v7.widget.RecyclerView.ItemDecoration;
17 | import android.support.v7.widget.RecyclerView.State;
18 | import android.util.SparseArray;
19 | import android.view.GestureDetector;
20 | import android.view.GestureDetector.OnGestureListener;
21 | import android.view.MotionEvent;
22 | import android.view.View;
23 | import android.view.View.OnTouchListener;
24 |
25 | import com.tc.bubblelayout.DensityUtil;
26 | import com.tc.bubblelayout.LogUtil;
27 |
28 | public abstract class NormalDecoration extends ItemDecoration {
29 | private static final String TAG = "NormalDecoration";
30 | //是否关系排序
31 | private final boolean isSalutationSort;
32 | private Paint mHeaderTxtPaint = new Paint(1);
33 | private Paint mHeaderContentPaint;
34 | private int headerHeight;
35 | //不是字母排序是,Recycle距离顶部的距离
36 | private int noLetterHeaderHeight;
37 | private int textPaddingLeft;
38 | private int textSize = 34;
39 | private int textColor = Color.parseColor("#000000");
40 | private final float txtYAxis;
41 | private RecyclerView mRecyclerView;
42 | private SparseArray stickyHeaderPosArray = new SparseArray();
43 | private GestureDetector gestureDetector;
44 | private OnGestureListener gestureListener = new OnGestureListener() {
45 | @Override
46 | public boolean onDown(MotionEvent e) {
47 | return false;
48 | }
49 |
50 | @Override
51 | public void onShowPress(MotionEvent e) {
52 | }
53 |
54 | @Override
55 | public boolean onSingleTapUp(MotionEvent e) {
56 | return false;
57 | }
58 |
59 | @Override
60 | public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
61 | return false;
62 | }
63 |
64 | @Override
65 | public void onLongPress(MotionEvent e) {
66 | }
67 |
68 | @Override
69 | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
70 | return false;
71 | }
72 | };
73 |
74 | protected NormalDecoration(Activity activity, boolean isSalutationSort) {
75 | this.isSalutationSort = isSalutationSort;
76 | this.mHeaderTxtPaint.setColor(this.textColor);
77 | this.mHeaderTxtPaint.setTextSize((float) this.textSize);
78 | this.mHeaderTxtPaint.setTextAlign(Align.LEFT);
79 | this.mHeaderContentPaint = new Paint(1);
80 | int headerContentColor = Color.parseColor("#f5f5f5");
81 | this.mHeaderContentPaint.setColor(headerContentColor);
82 | FontMetrics fontMetrics = this.mHeaderTxtPaint.getFontMetrics();
83 | float total = -fontMetrics.ascent + fontMetrics.descent;
84 | this.txtYAxis = total / 2.0F - fontMetrics.descent;
85 |
86 | headerHeight = DensityUtil.dip2px(activity, 25);
87 | noLetterHeaderHeight = DensityUtil.dip2px(activity, 10);
88 | textPaddingLeft = DensityUtil.dip2px(activity, 25);
89 | }
90 |
91 | @Override
92 | public void getItemOffsets(Rect outRect, View itemView, RecyclerView parent, State state) {
93 | super.getItemOffsets(outRect, itemView, parent, state);
94 | if (this.mRecyclerView == null) {
95 | this.mRecyclerView = parent;
96 | }
97 |
98 | int currentCount;
99 | int pos = parent.getChildAdapterPosition(itemView);
100 | int itemCount = parent.getAdapter().getItemCount();
101 | LogUtil.d(TAG, "itemCount--" + itemCount + ",getItemPos: " + pos);
102 | int applyContactCount = 0;
103 | String curHeaderName = this.getHeaderName(pos);
104 | if (curHeaderName != null) {
105 | if (pos == 0 || !curHeaderName.equals(this.getHeaderName(pos - 1))) {
106 | outRect.top = this.headerHeight;
107 | }
108 | }
109 | //字母排序联系人都有headName,除了好友申请item;
110 | //关系排序都没有headName
111 | if (curHeaderName != null) {
112 | // if (pos == 0 || !curHeaderName.equals(this.getHeaderName(pos - 1))) {
113 | // if (!curHeaderName.equals(this.getHeaderName(pos + 1))) {
114 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_all_selector);
115 | // } else {
116 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_top_selector);
117 | // }
118 | // } else if (!curHeaderName.equals(this.getHeaderName(pos + 1))) {
119 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_bottom_selector);
120 | // } else {
121 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_none_selector);
122 | // }
123 | } else {
124 | if (pos == 0) {
125 | outRect.top = this.noLetterHeaderHeight;
126 | }
127 | if (isSalutationSort) {
128 | currentCount = itemCount;
129 | } else {
130 | currentCount = applyContactCount;
131 | }
132 | // if (currentCount == 1) {
133 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_all_selector);
134 | // } else if (pos == 0) {
135 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_top_selector);
136 | // } else if (pos == currentCount - 1) {
137 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_bottom_selector);
138 | // } else {
139 | // itemView.setBackgroundResource(R.drawable.bg_list_item_corner_none_selector);
140 | // }
141 | }
142 |
143 | }
144 |
145 | public abstract String getHeaderName(int var1);
146 |
147 | @Override
148 | public void onDrawOver(Canvas canvas, RecyclerView recyclerView, State state) {
149 | super.onDrawOver(canvas, recyclerView, state);
150 | if (this.mRecyclerView == null) {
151 | this.mRecyclerView = recyclerView;
152 | }
153 |
154 | if (this.gestureDetector == null) {
155 | this.gestureDetector = new GestureDetector(recyclerView.getContext(), this.gestureListener);
156 | recyclerView.setOnTouchListener(new OnTouchListener() {
157 | @Override
158 | public boolean onTouch(View v, MotionEvent event) {
159 | return NormalDecoration.this.gestureDetector.onTouchEvent(event);
160 | }
161 | });
162 | }
163 |
164 | this.stickyHeaderPosArray.clear();
165 | int childCount = recyclerView.getChildCount();
166 | int left = recyclerView.getLeft() + recyclerView.getPaddingLeft();
167 | int right = recyclerView.getRight() - recyclerView.getPaddingRight();
168 | String firstHeaderName = null;
169 | int translateTop = 0;
170 |
171 | for (int i = 0; i < childCount; ++i) {
172 | View childView = recyclerView.getChildAt(i);
173 | int pos = recyclerView.getChildAdapterPosition(childView);
174 | String curHeaderName = this.getHeaderName(pos);
175 | if (i == 0) {
176 | firstHeaderName = curHeaderName;
177 | }
178 |
179 | if (curHeaderName != null) {
180 | int viewTop = childView.getTop() + recyclerView.getPaddingTop();
181 | if (pos == 0 || !curHeaderName.equals(this.getHeaderName(pos - 1))) {
182 | canvas.drawRect((float) left, (float) (viewTop - this.headerHeight), (float) right,
183 | (float) viewTop, this.mHeaderContentPaint);
184 | canvas.drawText(curHeaderName, (float) (left + this.textPaddingLeft),
185 | (float) (viewTop - this.headerHeight / 2) + this.txtYAxis, this.mHeaderTxtPaint);
186 | if (this.headerHeight < viewTop && viewTop <= 2 * this.headerHeight) {
187 | translateTop = viewTop - 2 * this.headerHeight;
188 | }
189 |
190 | this.stickyHeaderPosArray.put(pos, viewTop);
191 | }
192 | }
193 | }
194 |
195 | if (firstHeaderName != null) {
196 | canvas.save();
197 | canvas.translate(0.0F, (float) translateTop);
198 | canvas.drawRect((float) left, 0.0F, (float) right, (float) this.headerHeight, this.mHeaderContentPaint);
199 | canvas.drawText(firstHeaderName, (float) (left + this.textPaddingLeft),
200 | (float) (this.headerHeight / 2) + this.txtYAxis, this.mHeaderTxtPaint);
201 | canvas.restore();
202 | }
203 | }
204 |
205 | public void setTextSize(int textSize) {
206 | this.textSize = textSize;
207 | this.mHeaderTxtPaint.setTextSize((float) textSize);
208 | }
209 |
210 | public void setTextColor(int textColor) {
211 | this.textColor = textColor;
212 | this.mHeaderTxtPaint.setColor(textColor);
213 | }
214 | }
215 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/java/com/tc/bubblelayout/testrecylerview/PressEffectGroupItemDecoration.java:
--------------------------------------------------------------------------------
1 | package com.tc.bubblelayout.testrecylerview;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.graphics.drawable.StateListDrawable;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.View;
9 |
10 | import com.tc.bubblelayout.DensityUtil;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * author: tc
16 | * date: 2019/9/14 & 16:29
17 | * version 1.0
18 | * description Item有触摸反馈颜色, 列表根据不同数据类型,拆分为多个群组进行布局显示的布局间隔绘制类
19 | *
20 | * @see IGroupSort
21 | *
22 | * modify by
23 | */
24 | public class PressEffectGroupItemDecoration extends AbstractGroupItemDecoration {
25 |
26 | private int mCornerRadius;
27 |
28 |
29 | public PressEffectGroupItemDecoration(Context context, List list, int cornerRadius) {
30 | super(context, list);
31 | this.mCornerRadius = cornerRadius;
32 | }
33 |
34 | private void drawGroupCorner(Canvas canvas, View child, IGroupSort item, float[] corners) {
35 | if (item == null) {
36 | return;
37 | }
38 | StateListDrawable drawable = new StateListDrawable();
39 | drawable.addState(new int[]{android.R.attr.state_pressed}, new GroupPressBackgroundDrawable(
40 | item.getGroupPressColorId(), corners, child, mContext));
41 | //默认状态
42 | drawable.addState(new int[]{}, new GroupPressBackgroundDrawable(
43 | item.getGroupBackgroundColorId(), corners, child, mContext));
44 | child.setBackgroundDrawable(drawable);
45 | }
46 |
47 | @Override
48 | public void onDrawWhenFirstGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State state,
49 | int adapterPosition, IGroupSort item) {
50 | float[] corners = {mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, 0, 0, 0, 0};
51 | drawGroupCorner(canvas, child, item, corners);
52 | }
53 |
54 |
55 | @Override
56 | public void onDrawWhenMiddleGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State state,
57 | int adapterPosition, IGroupSort item) {
58 | float[] corners = {0, 0, 0, 0, 0, 0, 0, 0};
59 | drawGroupCorner(canvas, child, item, corners);
60 | }
61 |
62 | @Override
63 | public void onDrawWhenLastGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State state, int
64 | adapterPosition, IGroupSort item) {
65 | float[] corners = {0, 0, 0, 0, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius};
66 | drawGroupCorner(canvas, child, item, corners);
67 | }
68 |
69 | @Override
70 | public void onDrawWhenSingleGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State state,
71 | int adapterPosition, IGroupSort item) {
72 | float[] corners = {mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius,
73 | mCornerRadius, mCornerRadius};
74 | drawGroupCorner(canvas, child, item, corners);
75 | }
76 |
77 | @Override
78 | public void onDrawOverWhenFirstGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State
79 | state, int adapterPosition, IGroupSort item) {
80 |
81 | }
82 |
83 | @Override
84 | public void onDrawOverWhenMiddleGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State
85 | state, int adapterPosition, IGroupSort item) {
86 |
87 | }
88 |
89 | @Override
90 | public void onDrawOverWhenLastGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State state,
91 | int adapterPosition, IGroupSort item) {
92 |
93 | }
94 |
95 | @Override
96 | public void onDrawOverWhenSingleGroupItem(Canvas canvas, View child, RecyclerView parent, RecyclerView.State
97 | state, int adapterPosition, IGroupSort item) {
98 |
99 | }
100 |
101 | @Override
102 | public void getItemOffsetsWhenFirstGroupItem(Rect outRect, View child, RecyclerView parent, RecyclerView.State
103 | state, int adapterPosition, IGroupSort item) {
104 |
105 | if (adapterPosition != 0) {
106 | //第一个群组不加顶部间距
107 | outRect.set(0, DensityUtil.dip2px(mContext, item.getGroupDividerSize()), 0, 0);
108 | }
109 | }
110 |
111 | @Override
112 | public void getItemOffsetsWhenMiddleGroupItem(Rect outRect, View child, RecyclerView parent, RecyclerView.State
113 | state, int adapterPosition, IGroupSort item) {
114 | outRect.set(0, 0, 0, 0);
115 | }
116 |
117 | @Override
118 | public void getItemOffsetsWhenLastGroupItem(Rect outRect, View child, RecyclerView parent, RecyclerView.State
119 | state, int adapterPosition, IGroupSort item) {
120 | outRect.set(0, 0, 0, 0);
121 | }
122 |
123 | @Override
124 | public void getItemOffsetsWhenSingleGroupItem(Rect outRect, View child, RecyclerView parent, RecyclerView.State
125 | state, int adapterPosition, IGroupSort item) {
126 | outRect.set(0, DensityUtil.dip2px(mContext, item.getGroupDividerSize()), 0, 0);
127 |
128 | }
129 |
130 | }
131 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/java/com/tc/bubblelayout/testrecylerview/TestGroupBean.java:
--------------------------------------------------------------------------------
1 | package com.tc.bubblelayout.testrecylerview;
2 |
3 | import android.support.annotation.ColorRes;
4 |
5 | /**
6 | * author: tc
7 | * date: 2019/9/14 & 16:58
8 | * version 1.0
9 | * description 测试类
10 | * modify by
11 | */
12 | public class TestGroupBean extends GroupSortItem {
13 | private String name;
14 |
15 | public String getName() {
16 | return name == null ? "" : name;
17 | }
18 |
19 | public void setName(String name) {
20 | this.name = name;
21 | }
22 |
23 | public TestGroupBean() {
24 | }
25 |
26 | public TestGroupBean(String groupType, @ColorRes int groupBackgroundColorId, int groupDividerSize, @ColorRes int
27 | groupPressColorId, String name) {
28 | super(groupType, groupBackgroundColorId, groupDividerSize, groupPressColorId);
29 | this.name = name;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "TestGroupBean{" +
35 | "name='" + name + '\'' +
36 | '}';
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/java/com/tc/bubblelayout/testrecylerview/TestListActivity.java:
--------------------------------------------------------------------------------
1 | package com.tc.bubblelayout.testrecylerview;
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.tc.bubblelayout.DensityUtil;
10 | import com.tc.bubblelayout.R;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * author: tc
17 | * date: 2019/9/11 & 10:57
18 | * version 1.0
19 | * description
20 | * modify by
21 | */
22 | public class TestListActivity extends AppCompatActivity {
23 | @Override
24 | protected void onCreate(@Nullable Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_test_list);
27 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_list);
28 | final List list = new ArrayList<>();
29 |
30 | for (int i = 0; i < 50; i++) {
31 | if (i < 4) {
32 | list.add(new TestGroupBean(String.valueOf(1), R.color.color_999999, 20, R.color.color_ebebeb, String
33 | .valueOf(i)));
34 | } else if (i == 4) {
35 | list.add(new TestGroupBean(String.valueOf(2), R.color.orange_ff6000, 15, R.color.color_ebebeb, String
36 | .valueOf(i)));
37 | } else if (i == 5) {
38 | list.add(new TestGroupBean(String.valueOf(3), R.color.colorAccent, 15, R.color.color_ebebeb, String
39 | .valueOf(i)));
40 | } else if (i < 20) {
41 | list.add(new TestGroupBean(String.valueOf(4), R.color.colorPrimaryDark, 10, R.color.color_ebebeb,
42 | String.valueOf(i)));
43 | } else {
44 | list.add(new TestGroupBean(String.valueOf(5), R.color.color_ffffff, 30, R.color.color_ebebeb, String
45 | .valueOf(i)));
46 | }
47 | }
48 | //测试群组间的间距为0的情况
49 | for (TestGroupBean testGroupBean : list) {
50 | testGroupBean.setGroupDividerSize(0);
51 | }
52 | // 数据要事先排好序
53 | // Collections.sort(list, new Comparator() {
54 | // @Override
55 | // public int compare(TestGroupBean o1, TestGroupBean o2) {
56 | // return 0;
57 | // }
58 | // });
59 | final ListAdapter listAdapter = new ListAdapter(this, list);
60 |
61 | final NormalDecoration decoration = new NormalDecoration(this, true) {
62 | @Override
63 | public String getHeaderName(int pos) {
64 | if (pos <= -1 || pos >= listAdapter.getItemCount()) {
65 | return "";
66 | }
67 | return list.get(pos).getGroupSortType();
68 | }
69 | };
70 | decoration.setTextSize(DensityUtil.dip2px(this, 17));
71 | recyclerView.addItemDecoration(decoration);
72 |
73 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
74 | recyclerView.addItemDecoration(new PressEffectGroupItemDecoration(this, list, 25));
75 | recyclerView.setAdapter(listAdapter);
76 | }
77 |
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/java/com/tc/bubblelayout/testrecylerview/readme:
--------------------------------------------------------------------------------
1 | 封装一个分组展示圆角形状的功能,可以学习下ItemDecoration的使用
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/drawable-xhdpi/pic1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/drawable-xhdpi/pic1.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/drawable-xhdpi/white_sound_wave_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/drawable-xhdpi/white_sound_wave_default.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
16 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
172 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
24 |
25 |
34 |
35 |
39 |
40 |
47 |
48 |
49 |
50 |
55 |
56 |
69 |
70 |
75 |
76 |
77 |
84 |
85 |
90 |
91 |
92 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/layout/activity_test_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/layout/include_pop_emoji_bubble.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/layout/item_test_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
23 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #ffffff
7 | #cccccc
8 | #999999
9 | #ff6000
10 | #ffffff
11 | #e6ffffff
12 | #e6cbcbcb
13 | #ebebeb
14 |
15 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BubbleLayout
3 |
4 |
--------------------------------------------------------------------------------
/BubbleLayout/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/BubbleLayout/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/BubbleLayout/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/BubbleLayout/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/389273716/BubbleLayout/9df9014745f980fa9b7ce17a350dc6e20d073580/BubbleLayout/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/BubbleLayout/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Sep 12 16:16:12 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/BubbleLayout/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/BubbleLayout/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/BubbleLayout/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BubbleLayout
2 | 自定义气泡布局,支持文本、图片、多种类型混合
3 |
4 | [博客说明](https://www.jianshu.com/p/19929fabedca "title")
5 |
--------------------------------------------------------------------------------