Skip to content

Commit

Permalink
chore: prepare for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Dec 29, 2022
1 parent 7acc495 commit f57c53b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 99 deletions.
8 changes: 7 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
TODO: place your license here and we'll include it in the module distribution
Copyright © 2022 Hans Knöchel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127 changes: 38 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,107 +1,56 @@
# Appcelerator Titanium Mobile Module Project
# Tooltips in Titanium

This is a skeleton Titanium Mobile Mobile module project.
Use the native `AMPopTip` (iOS) and `ViewTooltip` (Android) library to display tooltips above any view and window in Titanium!

## Module Naming
## Requirements

Choose a unique module id for your module. This ID usually follows a namespace
convention using DNS notation. For example, com.appcelerator.module.test. This
ID can only be used once by all public modules in Titanium.
- [x] Titanium SDK 9.2.0+

## Getting Started
## APIs

1. Edit the `manifest` with the appropriate details about your module.
2. Edit the `LICENSE` to add your license details.
3. Place any assets (such as PNG files) that are required anywhere in the module folder.
4. Edit the `timodule.xml` and configure desired settings.
5. Code and build.
### Methods

## Documentation
-----------------------------
- `show(params)` - Shows a new tooltip. See the example below for all options!
- `hideActiveTooltip` - Hide an active tooltip in the current window.

You should provide at least minimal documentation for your module in `documentation` folder using the Markdown syntax.
### Constants

For more information on the Markdown syntax, refer to this documentation at:
The following constants are used for the `direction` property:

<http://daringfireball.net/projects/markdown/>
- `TOOLTIP_DIRECTION_UP`
- `TOOLTIP_DIRECTION_DOWN`
- `TOOLTIP_DIRECTION_LEFT`
- `TOOLTIP_DIRECTION_RIGHT`

## Example

The `example` directory contains a skeleton application test harness that can be
used for testing and providing an example of usage to the users of your module.

## Building

Simply run `appc run -p [ios|android] --build-only` which will compile and package your module.

## Linting

You can use `clang` to lint your code. A default Axway linting style is included inside the module main folder.
Run `clang-format -style=file -i SRC_FILE` in the module root to lint the `SRC_FILE`. You can also patterns,
like `clang-format -style=file -i Classes/*`

## Install

To use your module locally inside an app you can copy the zip file into the app root folder and compile your app.
The file will automatically be extracted and copied into the correct `modules/` folder.

If you want to use your module globally in all your apps you have to do the following:

### macOS

Copy the distribution zip file into the `~/Library/Application Support/Titanium` folder

### Linux

Copy the distribution zip file into the `~/.titanium` folder

### Windows
Copy the distribution zip file into the `C:\ProgramData\Titanium` folder

## Project Usage

Register your module with your application by editing `tiapp.xml` and adding your module.
Example:

<modules>
<module version="1.0.0">ti.tooltip</module>
</modules>

When you run your project, the compiler will combine your module along with its dependencies
and assets into the application.

## Example Usage

To use your module in code, you will need to require it.

### ES6+ (recommended)

```js
import MyModule from 'ti.tooltip';
MyModule.foo();
```

### ES5

```js
var MyModule = require('ti.tooltip');
MyModule.foo();
```

## Testing

To test your module with the example, use:

```js
appc run -p [ios|android]
import Tooltips from 'ti.tooltip';

const params = {
sourceView: $.view,
direction: Tooltips.TOOLTIP_DIRECTION_UP,
title: 'Hello world',
backgroundColor: '#ffffff',
textColor: '#000000',
borderRadius: 15,
borderColor: '#ff0000'
borderWidth: 2,
padding: 10,
arrowMargin: 0,
onClick: () => {
alert('Tooltip tapped!');
}
};

Tooltips.show(params);
```

This will execute the app.js in the example/ folder as a Titanium application.
## Authors

## Distribution
- Prashant Saini (Android)
- Hans Knöchel (iOS)

You have a variety of choises for distributing your module
- [Gitt.io](http://gitt.io/)
- [Axway Marketplace](https://marketplace.axway.com/home)
## License

Code strong!
MIT
27 changes: 18 additions & 9 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
var win = Ti.UI.createWindow({
import Tooltips from 'ti.tooltip';

const window = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var Tooltip = require('ti.tooltip');
var btn = Ti.UI.createButton({ right: 10, top: 200, width: 50, height: 50, backgroundColor: '#333', title: 'Test', color: '#fff' });

const btn = Ti.UI.createButton({
top: 200,
width: 50,
height: 50,
backgroundColor: '#333',
title: 'Show tooltip!',
color: '#fff'
});

btn.addEventListener('click', () => {
Tooltip.show({
Tooltips.show({
title: 'This is a dummy text line 1.This is a dummy text line 2.',
backgroundColor: '#61c494',
borderRadius: 40,
arrowWidth: 20,
arrowHeight: 24,
arrowMargin: 10,
textColor: '#fff',
container: $.win,
sourceView: $.btn,
direction: Tooltip.TOOLTIP_DIRECTION_UP
container: win,
sourceView: btn,
direction: Tooltips.TOOLTIP_DIRECTION_UP
})
});
win.add(btn);

win.open();
window.add(btn);
window.open();

0 comments on commit f57c53b

Please sign in to comment.