/
BubbleDrawableActivity.java
75 lines (59 loc) · 2.35 KB
/
BubbleDrawableActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package de.viktorreiser.androidtoolbox.showcase.drawable;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import de.viktorreiser.androidtoolbox.showcase.AndroidToolboxShowcaseActivity;
import de.viktorreiser.toolbox.graphics.drawable.BubbleDrawable;
import de.viktorreiser.toolbox.graphics.drawable.BubbleDrawable.IndicatorDirection;
import de.viktorreiser.toolbox.util.AndroidUtils;
/**
* <b>NOT READY!</b>
*
* @author Viktor Reiser <<a href="mailto:viktorreiser@gmx.de">viktorreiser@gmx.de</a>>
*/
@SuppressWarnings("unused")
public class BubbleDrawableActivity extends Activity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setTitle(AndroidToolboxShowcaseActivity.getShowcaseTitle(getClass()));
LinearLayout mainLayout = getLinearRowLayout();
mainLayout.setOrientation(LinearLayout.VERTICAL);
mainLayout.setBackgroundColor(0xff000088);
LinearLayout row;
row = getLinearRowLayout();
// row.addView(getBubbleView());
// row.addView(getBubbleView());
mainLayout.addView(row);
row = getLinearRowLayout();
// row.addView(getBubbleView());
// row.addView(getBubbleView());
mainLayout.addView(row);
setContentView(mainLayout);
}
private View getBubbleView(int strokeWidth, int corenerWidth, int width, int height, IndicatorDirection direction, float position) {
BubbleDrawable drawable = new BubbleDrawable();
View view = new View(this);
view.setBackgroundDrawable(drawable);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
params.weight = 1f;
params.bottomMargin = params.topMargin = params.leftMargin =
params.rightMargin = AndroidUtils.dipToPixel(this, 10);
view.setLayoutParams(params);
return view;
}
private LinearLayout getLinearRowLayout() {
LinearLayout row = new LinearLayout(this);
row.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
params.weight = 1f;
params.bottomMargin = params.topMargin = params.leftMargin =
params.rightMargin = AndroidUtils.dipToPixel(this, 10);
row.setLayoutParams(params);
return row;
}
}