├── .gitignore
├── LICENSE
├── README
├── README.md
├── android
├── LICENSE
├── assets
│ └── empty
├── build.properties
├── build.xml
├── dist
│ ├── TiBubbleAndroid.jar
│ └── com.tdtsh.tibubbleandroid-android-3.0.0.zip
├── documentation
│ └── index.md
├── example
│ └── app
│ │ ├── assets
│ │ ├── left.png
│ │ └── right.png
│ │ ├── config.json
│ │ ├── controllers
│ │ └── index.js
│ │ ├── styles
│ │ └── index.tss
│ │ └── views
│ │ └── index.xml
├── java-sources.txt
├── lib
│ └── README
├── libs
│ ├── arm64-v8a
│ │ └── libcom.tdtsh.tibubbleandroid.so
│ ├── armeabi-v7a
│ │ └── libcom.tdtsh.tibubbleandroid.so
│ └── x86
│ │ └── libcom.tdtsh.tibubbleandroid.so
├── manifest
├── platform
│ └── README
├── src
│ └── com
│ │ └── tdtsh
│ │ └── tibubbleandroid
│ │ ├── NativeBubbleView.java
│ │ ├── TiBubbleAndroidModule.java
│ │ ├── TiBubbleAndroidView.java
│ │ └── ViewProxy.java
└── timodule.xml
├── assets
└── empty
├── documentation
└── index.md
├── example
├── app.js
├── left.png
└── right.png
└── screenshot.png
/.gitignore:
--------------------------------------------------------------------------------
1 | tmp
2 | bin
3 | build
4 |
5 | .DS_Store
6 | build.log
7 | build
8 | npm-debug.log
9 | tmp
10 |
11 | # svn & cvs
12 | .svn
13 | CVS
14 |
15 | lost+found
16 | *.swp
17 |
18 | Resources
19 | *.class
20 |
21 | .settings
22 | .project
23 | .classpath
24 | .fastdev.lock
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Tadatoshi Hanazaki
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Appcelerator Titanium Mobile Module Project
2 | ===========================================
3 |
4 | This is a skeleton Titanium Mobile Mobile module project.
5 |
6 |
7 | MODULE NAMING
8 | -------------
9 |
10 | Choose a unique module id for your module. This ID usually follows a namespace
11 | convention using DNS notation. For example, com.appcelerator.module.test. This
12 | ID can only be used once by all public modules in Titanium.
13 |
14 |
15 | GET STARTED
16 | ------------
17 |
18 | 1. Edit manifest with the appropriate details about your module.
19 | 2. Edit LICENSE to add your license details.
20 | 3. Place any assets (such as PNG files) that are required anywhere in the module folder.
21 | 4. Edit the timodule.json and configure desired settings.
22 | 5. Code and build.
23 |
24 |
25 | DOCUMENTATION FOR YOUR MODULE
26 | -----------------------------
27 |
28 | You should provide at least minimal documentation for your module in `documentation` folder using the Markdown syntax.
29 |
30 | For more information on the Markdown syntax, refer to this documentation at:
31 |
32 |
33 |
34 |
35 | TEST HARNESS EXAMPLE FOR YOUR MODULE
36 | ------------------------------------
37 |
38 | The `example` directory contains a skeleton application test harness that can be
39 | used for testing and providing an example of usage to the users of your module.
40 |
41 |
42 | BUILDING YOUR MODULE
43 | --------------------
44 |
45 | Simply run `titanium build --platform --build-type production --dir /path/to/module`.
46 | You can omit the --dir option if your working directory is in the module's project directory.
47 |
48 |
49 | INSTALL YOUR MODULE
50 | -------------------
51 |
52 | Mac OS X
53 | --------
54 | Copy the distribution zip file into the `~/Library/Application Support/Titanium` folder
55 |
56 | Linux
57 | -----
58 | Copy the distribution zip file into the `~/.titanium` folder
59 |
60 | Windows
61 | -------
62 | Copy the distribution zip file into the `C:\ProgramData\Titanium` folder
63 |
64 |
65 | REGISTER YOUR MODULE
66 | --------------------
67 |
68 | Register your module with your application by editing `tiapp.xml` and adding your module.
69 | Example:
70 |
71 |
72 | com.tdtsh.tibubbleandroid
73 |
74 |
75 | When you run your project, the compiler will combine your module along with its dependencies
76 | and assets into the application.
77 |
78 |
79 | USING YOUR MODULE IN CODE
80 | -------------------------
81 |
82 | To use your module in code, you will need to require it.
83 |
84 | For example,
85 |
86 | var my_module = require('com.tdtsh.tibubbleandroid');
87 | my_module.foo();
88 |
89 |
90 | TESTING YOUR MODULE
91 | -------------------
92 |
93 | To test with the script, execute:
94 |
95 | titanium run --dir=YOURMODULEDIR
96 |
97 | This will execute the app.js in the example folder as a Titanium application.
98 |
99 |
100 | DISTRIBUTING YOUR MODULE
101 | -------------------------
102 |
103 | You can choose to manually distribute your module distribution zip file or through the Titanium Marketplace!
104 |
105 |
106 | Cheers!
107 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TiBubbleView for Android
2 |
3 | This is a Titanium Mobile Mobile module (for Android) project
4 | that TiBubbleView ported to Android.
5 |
6 |
7 | 
8 |
9 |
10 | ## Install
11 |
12 | [Compiled module download](android/dist/com.tdtsh.tibubbleandroid-android-2.0.0.zip)
13 |
14 |
15 | Register your module with your application by editing `tiapp.xml` and adding your module.
16 | Example:
17 |
18 | ```
19 |
20 | com.tdtsh.tibubbleandroid
21 |
22 | ```
23 |
24 | When you run your project, the compiler will combine your module along with its dependencies
25 | and assets into the application.
26 |
27 |
28 | ## Usage
29 |
30 | You can see screenshot's example at [example/app.js](example/app.js).
31 |
32 | ```javascript
33 | var label = Ti.UI.createLabel({
34 | top: 10,
35 | right: 10, // or 14 (consider the bubble beak)
36 | bottom: 10,
37 | left: 14, // or 10 (consider the bubble beak)
38 | width: Ti.UI.SIZE,
39 | height: Ti.UI.SIZE,
40 | color: '#fff',
41 | textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
42 | verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,
43 | text: 'hello, world'
44 | });
45 |
46 | var TiBubble = require('com.tdtsh.tibubbleandroid');
47 | var bubble = TiBubble.createView({
48 | top: 0,
49 | left: 10,
50 | width: Ti.UI.SIZE, // just fit from contained label
51 | height: Ti.UI.SIZE, // just fit from contained label
52 | bubbleColor: '#dfdee5', // default: #fff
53 | bubbleRadius: 20, // default: 20
54 | bubbleBeak: TiBubble.bubbleBeakLeft // default BUBBLE_BEAK_LEFT
55 | bubbleBeakVertical: TiBubble.bubbleBeakUpper // default BUBBLE_BEAK_LOWER
56 | });
57 | bubble.add(label);
58 | ```
59 |
60 | ### Properties
61 |
62 | >> Caution! There is a little difference from iOS version
63 |
64 | * bubbleColor
65 | * bubbleRadius
66 | * bubbleBeak / TiBubble.bubbleBeakLeft or TiBubble.bubbleBeakRight or TiBubble.bubbleBeakNone
67 | * bubbleBeakVertical / TiBubble.bubbleBeakLower or TiBubble.bubbleBeakUpper
68 |
69 | ## Credits
70 |
71 | Original TiBubbleView by Kosuke Isobe
72 |
73 |
74 | ## License
75 |
76 | The MIT License (MIT) Copyright (c) 2016 Tadatoshi Hanazaki
77 |
78 |
--------------------------------------------------------------------------------
/android/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Tadatoshi Hanazaki
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/android/assets/empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/assets/empty
--------------------------------------------------------------------------------
/android/build.properties:
--------------------------------------------------------------------------------
1 | titanium.platform=/Users/tadatoshi_hanazaki/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.v20161017194738/android
2 | android.platform=/Users/tadatoshi_hanazaki/Library/android-sdk-macosx/platforms/android-24
3 | google.apis=/Users/tadatoshi_hanazaki/Library/android-sdk-macosx/add-ons/addon-google_apis-google-24
4 | android.ndk=/Users/tadatoshi_hanazaki/android-ndk-r10e
5 |
--------------------------------------------------------------------------------
/android/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ant build script for Titanium Android module TiBubbleAndroid
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 |
--------------------------------------------------------------------------------
/android/dist/TiBubbleAndroid.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/dist/TiBubbleAndroid.jar
--------------------------------------------------------------------------------
/android/dist/com.tdtsh.tibubbleandroid-android-3.0.0.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/dist/com.tdtsh.tibubbleandroid-android-3.0.0.zip
--------------------------------------------------------------------------------
/android/documentation/index.md:
--------------------------------------------------------------------------------
1 | # TiBubbleAndroid Module
2 |
3 | ## Description
4 |
5 | TODO: Enter your module description here
6 |
7 | ## Accessing the TiBubbleAndroid Module
8 |
9 | To access this module from JavaScript, you would do the following:
10 |
11 | var tibubbleandroid = require("com.tdtsh.tibubbleandroid");
12 |
13 | The tibubbleandroid variable is a reference to the Module object.
14 |
15 | ## Reference
16 |
17 | TODO: If your module has an API, you should document
18 | the reference here.
19 |
20 | ### tibubbleandroid.function
21 |
22 | TODO: This is an example of a module function.
23 |
24 | ### tibubbleandroid.property
25 |
26 | TODO: This is an example of a module property.
27 |
28 | ## Usage
29 |
30 | TODO: Enter your usage example here
31 |
32 | ## Author
33 |
34 | TODO: Enter your author name, email and other contact
35 | details you want to share here.
36 |
37 | ## License
38 |
39 | TODO: Enter your license/legal information here.
40 |
--------------------------------------------------------------------------------
/android/example/app/assets/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/example/app/assets/left.png
--------------------------------------------------------------------------------
/android/example/app/assets/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/example/app/assets/right.png
--------------------------------------------------------------------------------
/android/example/app/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "global": {},
3 | "env:development": {},
4 | "env:test": {},
5 | "env:production": {},
6 | "os:android": {},
7 | "os:blackberry": {},
8 | "os:ios": {},
9 | "os:mobileweb": {},
10 | "os:windows": {},
11 | "dependencies": {}
12 | }
--------------------------------------------------------------------------------
/android/example/app/controllers/index.js:
--------------------------------------------------------------------------------
1 | var TiBubble = require('com.tdtsh.tibubbleandroid');
2 |
3 | var scroll = Ti.UI.createScrollView({
4 | top: 0,
5 | right: 0,
6 | bottom: 0,
7 | left: 0,
8 | width: Ti.UI.FILL,
9 | height: Ti.UI.FILL,
10 | layout: 'vertical'
11 | });
12 | $.index.add(scroll);
13 |
14 | var messages = [
15 | 'hello!',
16 | 'hello...',
17 | 'say hello to TiBubbleViewAndroid',
18 | '春は、あけぼの。やうやう白くなりゆく山ぎは 少し明りて紫だちたる雲の細くたなびきたる。',
19 | '夏は、夜。月の頃はさらなり。闇もなほ。螢の多く飛び違ひたる。また、ただ一つ二つなど、ほのかにうち光りて行くもをかし。雨など降るもをかし。',
20 | '秋は、夕暮。夕日のさして、山の端(は)いと近うなりたるに、烏の寝どころへ行くとて、三つ四つ、二つ三つなど、飛び急ぐさへあはれなり。まいて雁などの連ねたるがいと小さく見ゆるは、いとをかし。日入り果てて、風の音、虫の音など、はたいふべきにあらず。',
21 | '冬は、つとめて。雪の降りたるはいふべきにもあらず。霜のいと白きも、またさらでも、いと寒きに、火など急ぎ熾して、炭もて渡るも、いとつきづきし。昼になりて、ぬるくゆるびもていけば、火桶の火も、白き灰がちになりて、わろし。'
22 | ];
23 |
24 | var view, image, label, bubble,
25 | views = [];
26 |
27 | for (var i = 0; i < messages.length; i++) {
28 | view = Ti.UI.createView({
29 | top: 20,
30 | right: 10,
31 | left: 10,
32 | width: Ti.UI.FILL,
33 | height: Ti.UI.SIZE
34 | });
35 | views.push(view);
36 |
37 | if (i % 2) {
38 | image = Ti.UI.createImageView({
39 | right: 0,
40 | bottom: 0,
41 | width: 64,
42 | height: 64,
43 | image: '/right.png'
44 | });
45 | } else {
46 | image = Ti.UI.createImageView({
47 | top: 0,
48 | left: 0,
49 | width: 64,
50 | height: 64,
51 | image: '/left.png'
52 | });
53 | }
54 | view.add(image);
55 |
56 | label = Ti.UI.createLabel({
57 | top: 10,
58 | right: i % 2 ? 14 : 10,
59 | bottom: 10,
60 | left: i % 2 ? 10 : 14,
61 | width: Ti.UI.SIZE,
62 | height: Ti.UI.SIZE,
63 | color: i % 2 ? '#fff' : '#000',
64 | textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
65 | verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,
66 | font: {
67 | fontSize: "16sp"
68 | },
69 | text: messages[i]
70 | });
71 |
72 | if (i % 2) {
73 | bubble = TiBubble.createView({
74 | top: 0,
75 | right: 74,
76 | width: Ti.UI.SIZE,
77 | height: Ti.UI.SIZE,
78 | bubbleColor: '#1cce39',
79 | bubbleRadius: 20,
80 | bubbleBeak: TiBubble.bubbleBeakRight, // Caution! diffarent value from iOS version
81 | bubbleBeakVertical: TiBubble.bubbleBeakLower // Caution! diffarent value from iOS version
82 | });
83 | } else if (i % 3) {
84 | bubble = TiBubble.createView({
85 | top: 0,
86 | left: 74,
87 | width: Ti.UI.SIZE,
88 | height: Ti.UI.SIZE,
89 | bubbleColor: '#dfdee5',
90 | bubbleRadius: 20,
91 | bubbleBeak: TiBubble.bubbleBeakLeft, // Caution! diffarent value from iOS version
92 | bubbleBeakVertical: TiBubble.bubbleBeakUpper // Caution! diffarent value from iOS version
93 | });
94 | } else {
95 | bubble = TiBubble.createView({
96 | top: 0,
97 | left: 74,
98 | width: Ti.UI.SIZE,
99 | height: Ti.UI.SIZE,
100 | bubbleColor: '#fde500',
101 | bubbleRadius: 20,
102 | bubbleBeak: TiBubble.bubbleBeakNone
103 | });
104 | }
105 | bubble.add(label);
106 | view.add(bubble);
107 |
108 | scroll.add(view);
109 | }
110 |
111 | $.index.open();
112 |
--------------------------------------------------------------------------------
/android/example/app/styles/index.tss:
--------------------------------------------------------------------------------
1 | ".container": {
2 | backgroundColor:"white"
3 | }
4 |
5 | "Label": {
6 | width: Ti.UI.SIZE,
7 | height: Ti.UI.SIZE,
8 | color: "#000"
9 | }
10 |
11 | "#label": {
12 | font: {
13 | fontSize: 12
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/android/example/app/views/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android/java-sources.txt:
--------------------------------------------------------------------------------
1 | "/home/miga/tools/TiBubbleViewForAndroid/android/src/com/tdtsh/tibubbleandroid/NativeBubbleView.java"
2 | "/home/miga/tools/TiBubbleViewForAndroid/android/src/com/tdtsh/tibubbleandroid/TiBubbleAndroidModule.java"
3 | "/home/miga/tools/TiBubbleViewForAndroid/android/src/com/tdtsh/tibubbleandroid/TiBubbleAndroidView.java"
4 | "/home/miga/tools/TiBubbleViewForAndroid/android/src/com/tdtsh/tibubbleandroid/ViewProxy.java"
5 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/java/com/tdtsh/tibubbleandroid/TiBubbleAndroidBootstrap.java"
6 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/compat/R.java"
7 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/coreui/R.java"
8 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/coreutils/R.java"
9 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/design/R.java"
10 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/exifinterface/R.java"
11 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/fragment/R.java"
12 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/graphics/drawable/R.java"
13 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/graphics/drawable/animated/R.java"
14 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/mediacompat/R.java"
15 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/transition/R.java"
16 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/v4/R.java"
17 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/v7/appcompat/R.java"
18 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/v7/cardview/R.java"
19 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/android/support/v7/recyclerview/R.java"
20 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/com/tdtsh/tibubbleandroid/R.java"
21 | "/home/miga/tools/TiBubbleViewForAndroid/android/build/generated/r/ti/modules/titanium/ui/R.java"
--------------------------------------------------------------------------------
/android/lib/README:
--------------------------------------------------------------------------------
1 | You can place any .jar dependencies in this directory and they will be included
2 | when your module is being compiled.
--------------------------------------------------------------------------------
/android/libs/arm64-v8a/libcom.tdtsh.tibubbleandroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/libs/arm64-v8a/libcom.tdtsh.tibubbleandroid.so
--------------------------------------------------------------------------------
/android/libs/armeabi-v7a/libcom.tdtsh.tibubbleandroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/libs/armeabi-v7a/libcom.tdtsh.tibubbleandroid.so
--------------------------------------------------------------------------------
/android/libs/x86/libcom.tdtsh.tibubbleandroid.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/android/libs/x86/libcom.tdtsh.tibubbleandroid.so
--------------------------------------------------------------------------------
/android/manifest:
--------------------------------------------------------------------------------
1 | #
2 | # this is your module manifest and used by Titanium
3 | # during compilation, packaging, distribution, etc.
4 | #
5 | version: 3.0.0
6 | apiversion: 4
7 | architectures: arm64-v8a armeabi-v7a x86
8 | description: TiBubbleAndroid
9 | author: Tadatoshi Hanazaki
10 | license: The MIT License (MIT)
11 | copyright: Copyright (c) 2014 Tadatoshi Hanazaki
12 |
13 | # these should not be edited
14 | name: TiBubbleAndroid
15 | moduleid: com.tdtsh.tibubbleandroid
16 | guid: 7e164a78-bb67-43f5-97ea-9cf51c4a7f88
17 | platform: android
18 | minsdk: 7.0.0
19 |
--------------------------------------------------------------------------------
/android/platform/README:
--------------------------------------------------------------------------------
1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module.
2 |
3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder.
4 |
--------------------------------------------------------------------------------
/android/src/com/tdtsh/tibubbleandroid/NativeBubbleView.java:
--------------------------------------------------------------------------------
1 | package com.tdtsh.tibubbleandroid;
2 |
3 | import org.appcelerator.kroll.common.Log;
4 | import android.content.Context;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.Path;
9 | import android.graphics.Rect;
10 | import android.graphics.RectF;
11 | import android.graphics.Path.Direction;
12 | import android.widget.FrameLayout;
13 |
14 | import android.util.DisplayMetrics;
15 |
16 | /**
17 | * NativeBubbleView.
18 | *
19 | * @author Tadatoshi Hanazaki Copyright (c) 2014 by Tadatoshi Hanazaki. All
20 | * Rights Reserved.
21 | */
22 | public class NativeBubbleView extends FrameLayout {
23 | private static final String LCAT = "NativeBubbleView ";
24 |
25 | private int color = Color.GREEN;
26 | private float radius;
27 | private int bubbleBeak; // LEFT: 0, RIGHT: 1, NONE: 2
28 | private int bubbleBeakVertical; // LOWER: 0, UPPER: 1
29 |
30 | private Path path;
31 | private Paint paint;
32 |
33 | int padding = 10;
34 |
35 | public NativeBubbleView(Context context) {
36 | super(context);
37 |
38 | this.radius = 20.0F;
39 | this.bubbleBeak = 1;
40 | this.bubbleBeakVertical = 0;
41 |
42 | setWillNotDraw(false);
43 |
44 | DisplayMetrics metrics = context.getResources().getDisplayMetrics();
45 | padding = metrics.widthPixels / 100;
46 | Log.d(LCAT, "padding = " + padding);
47 | }
48 |
49 | public void setBubbleColor(int color) {
50 | this.color = color;
51 | }
52 |
53 | public void setBubbleRadius(float radius) {
54 | this.radius = radius;
55 | }
56 |
57 | public void setBubbleBeak(int beak) {
58 | bubbleBeak = beak;
59 | }
60 |
61 | public void setBubbleBeakVertical(int beak) {
62 | bubbleBeakVertical = beak;
63 | }
64 |
65 | @Override
66 | protected void onDraw(Canvas canvas) {
67 | drawBubblePath(canvas);
68 |
69 | paint = new Paint(Paint.ANTI_ALIAS_FLAG);
70 | paint.setColor(color);
71 | paint.setStyle(Paint.Style.FILL_AND_STROKE);
72 |
73 | canvas.drawPath(path, paint);
74 | }
75 |
76 | private void drawBubblePath(Canvas canvas) {
77 | Rect bounds = new Rect();
78 | getDrawingRect(bounds);
79 |
80 | float top = bounds.top;
81 | float bottom = bounds.bottom;
82 | float right = (this.bubbleBeak == 1) ? bounds.right - padding : bounds.right;
83 | float left = (this.bubbleBeak == 0) ? bounds.left + padding : bounds.left;
84 |
85 | path = new Path();
86 | path.setFillType(Path.FillType.EVEN_ODD);
87 | path.moveTo(left, top + radius);
88 |
89 | if (bubbleBeak == 1) {
90 | // right
91 | if (bubbleBeakVertical == 1) {
92 | // upper right beak
93 | path.arcTo(new RectF(left, top, left + (radius * 2), top + (radius * 2)), 180, 90);
94 |
95 | path.arcTo(new RectF(right - (radius * 2), top, right, top + (radius * 2)), 270, 35);
96 | path.cubicTo(right - 10, top + 3, right - 10, top + 2, right + (padding), top);
97 | path.cubicTo(right - 2, top + (radius / 4), right, top + (radius / 4), right, top + radius);
98 | path.arcTo(new RectF(right - (radius * 2), top, right, top + (radius * 2)), 355, 5);
99 |
100 | path.arcTo(new RectF(right - (radius * 2), bottom - (radius * 2), right, bottom), 0, 90);
101 | path.arcTo(new RectF(left, bottom - (radius * 2), left + (radius * 2), bottom), 90, 90);
102 | } else {
103 | // lower right beak
104 | path.arcTo(new RectF(left, top, left + (radius * 2), top + (radius * 2)), 180, 90);
105 | path.arcTo(new RectF(right - (radius * 2), top, right, top + (radius * 2)), 270, 90);
106 |
107 | path.arcTo(new RectF(right - (radius * 2), bottom - (radius * 2), right, bottom), 0, 5);
108 | path.cubicTo(right - 2, bottom - (radius / 4), right, bottom - (radius / 4), right + (padding), bottom);
109 | path.cubicTo(right - 10, bottom - 3, right - 10, bottom - 2, right - (radius / 2),
110 | bottom - (radius / 5));
111 | path.arcTo(new RectF(right - (radius * 2), bottom - (radius * 2), right, bottom), 55, 35);
112 |
113 | path.arcTo(new RectF(left, bottom - (radius * 2), left + (radius * 2), bottom), 90, 90);
114 | }
115 | } else if (bubbleBeak == 0) {
116 | // left
117 | if (bubbleBeakVertical == 1) {
118 | // upper left beak
119 | path.arcTo(new RectF(left, top, left + (radius * 2), top + (radius * 2)), 175, 5);
120 | path.cubicTo(left + 2, top + (radius / 4), left, top + (radius / 4), left - (padding), top);
121 | path.cubicTo(left + 10, top + 3, left + 10, top + 2, left + (radius / 2), top + (radius / 5));
122 | path.arcTo(new RectF(left, top, left + (radius * 2), top + (radius * 2)), 235, 35);
123 |
124 | path.arcTo(new RectF(right - (radius * 2), top, right, top + (radius * 2)), 270, 90);
125 | path.arcTo(new RectF(right - (radius * 2), bottom - (radius * 2), right, bottom), 0, 90);
126 | path.arcTo(new RectF(left, bottom - (radius * 2), left + (radius * 2), bottom), 90, 90);
127 | } else {
128 | // lower left beak
129 | path.arcTo(new RectF(left, top, left + (radius * 2), top + (radius * 2)), 180, 90);
130 | path.arcTo(new RectF(right - (radius * 2), top, right, top + (radius * 2)), 270, 90);
131 | path.arcTo(new RectF(right - (radius * 2), bottom - (radius * 2), right, bottom), 0, 90);
132 |
133 | path.arcTo(new RectF(left, bottom - (radius * 2), left + (radius * 2), bottom), 90, 35);
134 | path.cubicTo(left + 10, bottom - 3, left + 10, bottom - 2, left - (padding), bottom);
135 | path.cubicTo(left + 2, bottom - (radius / 4), left, bottom - (radius / 4), left, bottom - radius);
136 | path.arcTo(new RectF(left, bottom - (radius * 2), left + (radius * 2), bottom), 175, 5);
137 | }
138 | } else if (bubbleBeak == 2) {
139 | // none
140 | path.addRoundRect(new RectF(left, top, right, bottom), radius, radius, Direction.CCW);
141 | }
142 |
143 | path.close();
144 |
145 | }
146 |
147 | }
148 |
--------------------------------------------------------------------------------
/android/src/com/tdtsh/tibubbleandroid/TiBubbleAndroidModule.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file was auto-generated by the Titanium Module SDK helper for Android
3 | * Appcelerator Titanium Mobile
4 | * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
5 | * Licensed under the terms of the Apache Public License
6 | * Please see the LICENSE included with this distribution for details.
7 | *
8 | */
9 | package com.tdtsh.tibubbleandroid;
10 |
11 | import org.appcelerator.kroll.KrollModule;
12 | import org.appcelerator.kroll.annotations.Kroll;
13 |
14 | import org.appcelerator.titanium.TiApplication;
15 |
16 | @Kroll.module(name = "TiBubbleAndroid", id = "com.tdtsh.tibubbleandroid")
17 | public class TiBubbleAndroidModule extends KrollModule {
18 | public static final int BUBBLE_BEAK_LEFT = 0;
19 | public static final int BUBBLE_BEAK_RIGHT = 1;
20 | public static final int BUBBLE_BEAK_NONE = 2;
21 | public static final int BUBBLE_BEAK_LOWER = 0;
22 | public static final int BUBBLE_BEAK_UPPER = 1;
23 |
24 | public TiBubbleAndroidModule() {
25 | super();
26 | }
27 |
28 | @Kroll.onAppCreate
29 | public static void onAppCreate(TiApplication app) {
30 | // put module init code that needs to run when the application is
31 | // created
32 | }
33 |
34 | @Kroll.getProperty
35 | public int getBubbleBeakLeft() {
36 | return BUBBLE_BEAK_LEFT;
37 | }
38 |
39 | @Kroll.getProperty
40 | public int getBubbleBeakRight() {
41 | return BUBBLE_BEAK_RIGHT;
42 | }
43 |
44 | @Kroll.getProperty
45 | public int getBubbleBeakNone() {
46 | return BUBBLE_BEAK_NONE;
47 | }
48 |
49 | @Kroll.getProperty
50 | public int getBubbleBeakLower() {
51 | return BUBBLE_BEAK_LOWER;
52 | }
53 |
54 | @Kroll.getProperty
55 | public int getBubbleBeakUpper() {
56 | return BUBBLE_BEAK_UPPER;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/android/src/com/tdtsh/tibubbleandroid/TiBubbleAndroidView.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file was auto-generated by the Titanium Module SDK helper for Android
3 | * Appcelerator Titanium Mobile
4 | * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
5 | * Licensed under the terms of the Apache Public License
6 | * Please see the LICENSE included with this distribution for details.
7 | *
8 | */
9 | package com.tdtsh.tibubbleandroid;
10 |
11 | import org.appcelerator.kroll.KrollDict;
12 |
13 | import org.appcelerator.kroll.common.Log;
14 | import org.appcelerator.titanium.TiC;
15 | import org.appcelerator.titanium.TiApplication;
16 | import org.appcelerator.titanium.TiDimension;
17 | import org.appcelerator.titanium.proxy.TiViewProxy;
18 | import org.appcelerator.titanium.util.TiConvert;
19 | import org.appcelerator.titanium.view.TiUIView;
20 | import org.appcelerator.titanium.view.TiCompositeLayout;
21 | import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement;
22 | import org.appcelerator.titanium.view.TiCompositeLayout.LayoutParams;
23 |
24 | import android.content.Context;
25 | import android.widget.FrameLayout;
26 | import android.view.View;
27 | import android.view.ViewGroup;
28 | import android.view.ViewParent;
29 | import android.app.Activity;
30 | import android.os.Build;
31 |
32 | public class TiBubbleAndroidView extends TiUIView {
33 | private KrollDict prop;
34 | private NativeBubbleView nativeBubbleView = null;
35 |
36 | public TiBubbleAndroidView(TiViewProxy proxy) {
37 | super(proxy);
38 |
39 | prop = proxy.getProperties();
40 |
41 | LayoutArrangement arrangement = LayoutArrangement.DEFAULT;
42 |
43 | if (proxy.hasProperty(TiC.PROPERTY_LAYOUT)) {
44 | String layoutProperty = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_LAYOUT));
45 | if (layoutProperty.equals(TiC.LAYOUT_HORIZONTAL)) {
46 | arrangement = LayoutArrangement.HORIZONTAL;
47 | } else if (layoutProperty.equals(TiC.LAYOUT_VERTICAL)) {
48 | arrangement = LayoutArrangement.VERTICAL;
49 | }
50 | }
51 |
52 | TiCompositeLayout nativeView = new TiCompositeLayout(proxy.getActivity(), arrangement);
53 | setNativeView(nativeView);
54 |
55 | if (nativeBubbleView == null) {
56 | Activity currentActivity = proxy.getActivity();
57 | if (currentActivity == null) {
58 | currentActivity = TiApplication.getAppCurrentActivity();
59 | }
60 | nativeBubbleView = new NativeBubbleView(currentActivity);
61 |
62 | LayoutParams params = new LayoutParams();
63 | params.height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
64 | params.width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
65 |
66 | ViewGroup savedParent = null;
67 | int childIndex = -1;
68 |
69 | TiUIView parentView = proxy.getParent().getOrCreateView();
70 | View parentNativeView = (View) parentView.getNativeView();
71 |
72 | if (parentNativeView != null) {
73 | ViewParent nativeParent = (ViewParent) parentNativeView;
74 |
75 | if (nativeParent instanceof ViewGroup) {
76 | savedParent = (ViewGroup) nativeParent;
77 | childIndex = savedParent.indexOfChild(nativeView);
78 | savedParent.removeView(nativeView);
79 | }
80 | }
81 |
82 | nativeBubbleView.addView(nativeView, params);
83 |
84 | if (savedParent != null) {
85 | savedParent.addView(nativeBubbleView, childIndex, getLayoutParams());
86 | }
87 |
88 | if (prop.containsKey("bubbleRadius")) {
89 | float radius = 0;
90 | TiDimension radiusDim = TiConvert.toTiDimension(prop.get("bubbleRadius"), TiDimension.TYPE_WIDTH);
91 | if (radiusDim != null) {
92 | radius = (float) radiusDim.getPixels(getNativeView());
93 | }
94 | nativeBubbleView.setBubbleRadius(radius);
95 | }
96 |
97 | if (prop.containsKey("bubbleColor")) {
98 | nativeBubbleView.setBubbleColor(TiConvert.toColor(prop, "bubbleColor"));
99 | } else {
100 | Integer bgColor = TiConvert.toColor(prop, TiC.PROPERTY_BACKGROUND_COLOR);
101 | if (bgColor != null) {
102 | nativeBubbleView.setBubbleColor(bgColor);
103 | }
104 | }
105 |
106 | if (prop.containsKey("bubbleBeak")) {
107 | nativeBubbleView.setBubbleBeak(TiConvert.toInt(prop, "bubbleBeak"));
108 | }
109 |
110 | if (prop.containsKey("bubbleBeakVertical")) {
111 | nativeBubbleView.setBubbleBeakVertical(TiConvert.toInt(prop, "bubbleBeakVertical"));
112 | }
113 |
114 | parentView.remove(this);
115 | parentView.add(this);
116 | }
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/android/src/com/tdtsh/tibubbleandroid/ViewProxy.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This file was auto-generated by the Titanium Module SDK helper for Android
3 | * Appcelerator Titanium Mobile
4 | * Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
5 | * Licensed under the terms of the Apache Public License
6 | * Please see the LICENSE included with this distribution for details.
7 | *
8 | */
9 | package com.tdtsh.tibubbleandroid;
10 |
11 | import org.appcelerator.kroll.KrollDict;
12 | import org.appcelerator.kroll.KrollProxy;
13 | import org.appcelerator.kroll.annotations.Kroll;
14 | import org.appcelerator.kroll.common.Log;
15 | import org.appcelerator.kroll.common.TiConfig;
16 | import org.appcelerator.titanium.proxy.TiViewProxy;
17 | import org.appcelerator.titanium.view.TiUIView;
18 |
19 | import android.app.Activity;
20 |
21 | // This proxy can be created by calling TiBubbleAndroid.createExample({message: "hello world"})
22 | @Kroll.proxy(creatableInModule = TiBubbleAndroidModule.class)
23 | public class ViewProxy extends TiViewProxy {
24 | public ViewProxy() {
25 | super();
26 | }
27 |
28 | @Override
29 | public TiUIView createView(Activity activity) {
30 | return new TiBubbleAndroidView(this);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/android/timodule.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/assets/empty:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/assets/empty
--------------------------------------------------------------------------------
/documentation/index.md:
--------------------------------------------------------------------------------
1 | # TiBubbleAndroid Module
2 |
3 | ## Description
4 |
5 | TODO: Enter your module description here
6 |
7 | ## Accessing the TiBubbleAndroid Module
8 |
9 | To access this module from JavaScript, you would do the following:
10 |
11 | var tibubbleandroid = require("com.tdtsh.tibubbleandroid");
12 |
13 | The tibubbleandroid variable is a reference to the Module object.
14 |
15 | ## Reference
16 |
17 | TODO: If your module has an API, you should document
18 | the reference here.
19 |
20 | ### tibubbleandroid.function
21 |
22 | TODO: This is an example of a module function.
23 |
24 | ### tibubbleandroid.property
25 |
26 | TODO: This is an example of a module property.
27 |
28 | ## Usage
29 |
30 | TODO: Enter your usage example here
31 |
32 | ## Author
33 |
34 | TODO: Enter your author name, email and other contact
35 | details you want to share here.
36 |
37 | ## License
38 |
39 | TODO: Enter your license/legal information here.
40 |
--------------------------------------------------------------------------------
/example/app.js:
--------------------------------------------------------------------------------
1 | var TiBubble = require('com.tdtsh.tibubbleandroid');
2 |
3 | var win = Ti.UI.createWindow({
4 | backgroundColor: '#fff'
5 | });
6 | win.open();
7 |
8 | var scroll = Ti.UI.createScrollView({
9 | top: 0,
10 | right: 0,
11 | bottom: 0,
12 | left: 0,
13 | width: Ti.UI.FILL,
14 | height: Ti.UI.FILL,
15 | layout: 'vertical'
16 | });
17 | win.add(scroll);
18 |
19 | var messages = [
20 | 'hello!',
21 | 'hello...',
22 | 'say hello to TiBubbleViewAndroid',
23 | '春は、あけぼの。やうやう白くなりゆく山ぎは 少し明りて紫だちたる雲の細くたなびきたる。',
24 | '夏は、夜。月の頃はさらなり。闇もなほ。螢の多く飛び違ひたる。また、ただ一つ二つなど、ほのかにうち光りて行くもをかし。雨など降るもをかし。',
25 | '秋は、夕暮。夕日のさして、山の端(は)いと近うなりたるに、烏の寝どころへ行くとて、三つ四つ、二つ三つなど、飛び急ぐさへあはれなり。まいて雁などの連ねたるがいと小さく見ゆるは、いとをかし。日入り果てて、風の音、虫の音など、はたいふべきにあらず。',
26 | '冬は、つとめて。雪の降りたるはいふべきにもあらず。霜のいと白きも、またさらでも、いと寒きに、火など急ぎ熾して、炭もて渡るも、いとつきづきし。昼になりて、ぬるくゆるびもていけば、火桶の火も、白き灰がちになりて、わろし。'
27 | ];
28 |
29 | var view, image, label, bubble,
30 | views = [];
31 |
32 | for (var i = 0; i < messages.length; i++) {
33 | view = Ti.UI.createView({
34 | top: 20,
35 | right: 10,
36 | left: 10,
37 | width: Ti.UI.FILL,
38 | height: Ti.UI.SIZE
39 | });
40 | views.push(view);
41 |
42 | if (i % 2) {
43 | image = Ti.UI.createImageView({
44 | right: 0,
45 | bottom: 0,
46 | width: 64,
47 | height: 64,
48 | image: 'right.png'
49 | });
50 | } else {
51 | image = Ti.UI.createImageView({
52 | top: 0,
53 | left: 0,
54 | width: 64,
55 | height: 64,
56 | image: 'left.png'
57 | });
58 | }
59 | view.add(image);
60 |
61 | label = Ti.UI.createLabel({
62 | top: 10,
63 | right: i % 2 ? 14 : 10,
64 | bottom: 10,
65 | left: i % 2 ? 10 : 14,
66 | width: Ti.UI.SIZE,
67 | height: Ti.UI.SIZE,
68 | color: i % 2 ? '#fff' : '#000',
69 | textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
70 | verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,
71 | font: {
72 | fontSize: "16sp"
73 | },
74 | text: messages[i]
75 | });
76 |
77 | if (i % 2) {
78 | bubble = TiBubble.createView({
79 | top: 0,
80 | right: 74,
81 | width: Ti.UI.SIZE,
82 | height: Ti.UI.SIZE,
83 | bubbleColor: '#1cce39',
84 | bubbleRadius: 20,
85 | bubbleBeak: TiBubble.bubbleBeakRight, // Caution! diffarent value from iOS version
86 | bubbleBeakVertical: TiBubble.bubbleBeakLower // Caution! diffarent value from iOS version
87 | });
88 | } else {
89 | bubble = TiBubble.createView({
90 | top: 0,
91 | left: 74,
92 | width: Ti.UI.SIZE,
93 | height: Ti.UI.SIZE,
94 | bubbleColor: '#dfdee5',
95 | bubbleRadius: 20,
96 | bubbleBeak: TiBubble.bubbleBeakLeft, // Caution! diffarent value from iOS version
97 | bubbleBeakVertical: TiBubble.bubbleBeakUpper // Caution! diffarent value from iOS version
98 | });
99 | }
100 | bubble.add(label);
101 | view.add(bubble);
102 |
103 | scroll.add(view);
104 | }
105 |
--------------------------------------------------------------------------------
/example/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/example/left.png
--------------------------------------------------------------------------------
/example/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/example/right.png
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tdtsh/TiBubbleViewForAndroid/f33ff4ef8e30f61f28ad2330d45d24e55252f102/screenshot.png
--------------------------------------------------------------------------------