Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,811,035 Members 41,979 Now Online
XDA Developers Android and Mobile Development Forum

[library][android 2.2+][the web] airy 1.0.1

Tip us?
 
mirasmithy
Old
(Last edited by mirasmithy; 16th September 2014 at 05:55 PM.) Reason: Added example
#1  
Junior Member - OP
Thanks Meter 30
Posts: 8
Join Date: Nov 2013
Prompt [library][android 2.2+][the web] airy 1.0.1

Airy, an open source gesture library for Android and the web that I wrote for Epoch Launcher.

Platforms
- Android 2.2+ (written in Java)
- The Web (written in JavaScript)

Gestures
- Tap
- Swipe up
- Swipe down
- Swipe left
- Swipe right
- Two finger tap
- Two finger swipe up
- Two finger swipe down
- Two finger swipe left
- Two finger swipe right
- Two finger pinch in
- Two finger pinch out

Usage

Android

Code:
View mView = findViewById(R.id.view);
View mAnotherView = findViewById(R.id.anotherView);

// this has to be an instance of Activity.
Airy mAiry = new Airy(this) {
    @Override
    public void onGesture(View pView, int pGestureId) {
        if (pView == mView) {
            switch (pGestureId) {
                case Airy.INVALID_GESTURE:
                    break;
                case Airy.TAP:
                    break;
                case Airy.SWIPE_UP:
                    break;
                case Airy.SWIPE_DOWN:
                    break;
                case Airy.SWIPE_LEFT:
                    break;
                case Airy.SWIPE_RIGHT:
                    break;
                case Airy.TWO_FINGER_TAP:
                    break;
                case Airy.TWO_FINGER_SWIPE_UP:
                    break;
                case Airy.TWO_FINGER_SWIPE_DOWN:
                    break;
                case Airy.TWO_FINGER_SWIPE_LEFT:
                    break;
                case Airy.TWO_FINGER_SWIPE_RIGHT:
                    break;
                case Airy.TWO_FINGER_PINCH_IN:
                    break;
                case Airy.TWO_FINGER_PINCH_OUT:
                    break;
            }
        } else if (pView == mAnotherView) {
            switch (pGestureId) {
                case Airy.INVALID_GESTURE:
                    break;
                case Airy.TAP:
                    break;
                case Airy.SWIPE_UP:
                    break;
                case Airy.SWIPE_DOWN:
                    break;
                case Airy.SWIPE_LEFT:
                    break;
                case Airy.SWIPE_RIGHT:
                    break;
                case Airy.TWO_FINGER_TAP:
                    break;
                case Airy.TWO_FINGER_SWIPE_UP:
                    break;
                case Airy.TWO_FINGER_SWIPE_DOWN:
                    break;
                case Airy.TWO_FINGER_SWIPE_LEFT:
                    break;
                case Airy.TWO_FINGER_SWIPE_RIGHT:
                    break;
                case Airy.TWO_FINGER_PINCH_IN:
                    break;
                case Airy.TWO_FINGER_PINCH_OUT:
                    break;
            }
        }
    }
};

mView.setOnTouchListener(mAiry);
mAnotherView.setOnTouchListener(mAnotherAiry);
Alternate Constructor (Android)

Code:
DisplayMetrics mDisplayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(mDisplayMetrics);
float mDisplayDensity = mDisplayMetrics.density;

Airy mAiry = new Airy(mDisplayDensity);
The Web

Code:
var mElement = document.getElementById("element");
var mAnotherElement = document.getElementById("anotherElement");

var mOnGesture = function(pElement, pGestureId) {
    if (pElement == mElement) {
        switch (pGestureId) {
            case Airy.prototype.INVALID_GESTURE:
                break;
            case Airy.prototype.TAP:
                break;
            case Airy.prototype.SWIPE_UP:
                break;
            case Airy.prototype.SWIPE_DOWN:
                break;
            case Airy.prototype.SWIPE_LEFT:
                break;
            case Airy.prototype.SWIPE_RIGHT:
                break;
            case Airy.prototype.TWO_FINGER_TAP:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_UP:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_DOWN:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_LEFT:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_RIGHT:
                break;
            case Airy.prototype.TWO_FINGER_PINCH_IN:
                break;
            case Airy.prototype.TWO_FINGER_PINCH_OUT:
                break;
        }
    } else if (pElement == mAnotherElement) {
        switch (pGestureId) {
            case Airy.prototype.INVALID_GESTURE:
                break;
            case Airy.prototype.TAP:
                break;
            case Airy.prototype.SWIPE_UP:
                break;
            case Airy.prototype.SWIPE_DOWN:
                break;
            case Airy.prototype.SWIPE_LEFT:
                break;
            case Airy.prototype.SWIPE_RIGHT:
                break;
            case Airy.prototype.TWO_FINGER_TAP:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_UP:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_DOWN:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_LEFT:
                break;
            case Airy.prototype.TWO_FINGER_SWIPE_RIGHT:
                break;
            case Airy.prototype.TWO_FINGER_PINCH_IN:
                break;
            case Airy.prototype.TWO_FINGER_PINCH_OUT:
                break;
        }
    }
};

var mAiry = new Airy(mOnGesture);
mAiry.attachTo(mElement);
mAiry.attachTo(mAnotherElement);
Copyright Information

Code:
Copyright 2014 Miras Absar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Example

GitHub
Attached Files
File Type: zip airy-1.0.1.zip - [Click for QR Code] (10.8 KB, 0 views)
The Following 12 Users Say Thank You to mirasmithy For This Useful Post: [ Click to Expand ]
 
its_Khal
Old
#2  
its_Khal's Avatar
Senior Member
Thanks Meter 23
Posts: 300
Join Date: Aug 2012
Location: Lagos
Hmmm!!!
 
ATRIXXIRTA
Old
#3  
ATRIXXIRTA's Avatar
Senior Member
Thanks Meter 729
Posts: 2,371
Join Date: Mar 2012
Location: The Shangri-La Motel
Is this a flashable zip?

Does it only work with EPOCH?

I tried flashing and got "Installation Aborted" ?
Phones: Motorola Atrix 4G ---> Samsung Galaxy Nexus (temporarily) ---> LG Optimus 3d ---> Samsung Galaxy SII LTE Skyrocket ---> LG Optimus G ---> Sony Xperia ZL ---> Motorola Moto G
My Roms/Ports: CarbonRom/CarbonClash (port): http://forum.xda-developers.com/show....php?t=2181390
Thanks: XDA and all its members. Without you I'd still be an uneducated bumpkin complaining about my shi**y phone.

The Following User Says Thank You to ATRIXXIRTA For This Useful Post: [ Click to Expand ]
 
lefterios
Old
#4  
lefterios's Avatar
Senior Member
Thanks Meter 107
Posts: 613
Join Date: May 2013
Quote:
Originally Posted by ATRIXXIRTA View Post
Is this a flashable zip?

Does it only work with EPOCH?

I tried flashing and got "Installation Aborted" ?
You have to look in title. It says LIBRARY meaning that it's a library for use if you are an application PROGRAMMER. If you aren't it's not necessary for you
 
ATRIXXIRTA
Old
#5  
ATRIXXIRTA's Avatar
Senior Member
Thanks Meter 729
Posts: 2,371
Join Date: Mar 2012
Location: The Shangri-La Motel
Quote:
Originally Posted by lefterios View Post
You have to look in title. It says LIBRARY meaning that it's a library for use if you are an application PROGRAMMER. If you aren't it's not necessary for you
Haha, thanks for the clarification. Guess this ones not for me :P

Sent from my C6503 using Tapatalk
Phones: Motorola Atrix 4G ---> Samsung Galaxy Nexus (temporarily) ---> LG Optimus 3d ---> Samsung Galaxy SII LTE Skyrocket ---> LG Optimus G ---> Sony Xperia ZL ---> Motorola Moto G
My Roms/Ports: CarbonRom/CarbonClash (port): http://forum.xda-developers.com/show....php?t=2181390
Thanks: XDA and all its members. Without you I'd still be an uneducated bumpkin complaining about my shi**y phone.

 
AXDFREEDOM
Old
#6  
AXDFREEDOM's Avatar
Senior Member
Thanks Meter 212
Posts: 679
Join Date: Jul 2013
Quote:
Originally Posted by mirasmithy View Post
[B]Airy

Copyright 2014 Miras Absar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
[/CODE]
how about license?
can i use it freely?
E610 4.4.4 CYANOGENMOD11 - Here to learn!
Ask/Reply me, I was born to help you! Please THANKS ME
 
mirasmithy
Old
#7  
Junior Member - OP
Thanks Meter 30
Posts: 8
Join Date: Nov 2013
Quote:
Originally Posted by AXD96 View Post
how about license?
can i use it freely?
You can use, modify, and redistribute Airy freely.
Just be sure to include the original copyright and license, state any changes you've made, and state that you're using Airy in your project.

TL;DR
Just put this somewhere in your project
Code:
Airy

Copyright 2014 Miras Absar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The Following User Says Thank You to mirasmithy For This Useful Post: [ Click to Expand ]
 
lefterios
Old
#8  
lefterios's Avatar
Senior Member
Thanks Meter 107
Posts: 613
Join Date: May 2013
Quote:
Originally Posted by mirasmithy View Post
You can use, modify, and redistribute Airy freely.
Just be sure to include the original copyright and license, state any changes you've made, and state that you're using Airy in your project.

TL;DR
Just put this somewhere in your project
Code:
Airy

Copyright 2014 Miras Absar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
I'm also curious if I can take only the class from your lib( may be a noobish question) and not the path. Of course keeping the copyright.
 
mirasmithy
Old
#9  
Junior Member - OP
Thanks Meter 30
Posts: 8
Join Date: Nov 2013
Quote:
Originally Posted by lefterios View Post
I'm also curious if I can take only the class from your lib( may be a noobish question) and not the path. Of course keeping the copyright.
As long as you keep the copyright intact, you're good to go!
The Following User Says Thank You to mirasmithy For This Useful Post: [ Click to Expand ]
 
voriax
Old
#10  
voriax's Avatar
Senior Member
Thanks Meter 268
Posts: 369
Join Date: Sep 2009
Hello.

May I kindly ask for what Android API level is this:

RelativeLayout mRelativeLayout = new RelativeLayout();

?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes