Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP mirasmithy

30th June 2014, 05:19 PM   |  #1  
OP Junior Member
Thanks Meter: 32
 
8 posts
Join Date:Joined: Nov 2013
More
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, 12 views)
Last edited by mirasmithy; 2nd October 2014 at 11:33 PM. Reason: Changed Formatting
The Following 12 Users Say Thank You to mirasmithy For This Useful Post: [ View ]
2nd July 2014, 04:43 PM   |  #2  
its_Khal's Avatar
Senior Member
Flag Lagos
Thanks Meter: 25
 
351 posts
Join Date:Joined: Aug 2012
Hmmm!!!
2nd July 2014, 09:45 PM   |  #3  
ATRIXXIRTA's Avatar
Senior Member
Flag The Shangri-La Motel
Thanks Meter: 759
 
2,399 posts
Join Date:Joined: Mar 2012
More
Is this a flashable zip?

Does it only work with EPOCH?

I tried flashing and got "Installation Aborted" ?
The Following User Says Thank You to ATRIXXIRTA For This Useful Post: [ View ]
2nd July 2014, 11:32 PM   |  #4  
lefterios's Avatar
Senior Member
Thanks Meter: 113
 
622 posts
Join Date:Joined: May 2013
Quote:
Originally Posted by ATRIXXIRTA

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
2nd July 2014, 11:50 PM   |  #5  
ATRIXXIRTA's Avatar
Senior Member
Flag The Shangri-La Motel
Thanks Meter: 759
 
2,399 posts
Join Date:Joined: Mar 2012
More
Quote:
Originally Posted by lefterios

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
3rd July 2014, 11:09 AM   |  #6  
4Freedom's Avatar
Senior Member
Thanks Meter: 270
 
771 posts
Join Date:Joined: Jul 2013
More
Quote:
Originally Posted by mirasmithy

[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?
3rd July 2014, 11:26 AM   |  #7  
OP Junior Member
Thanks Meter: 32
 
8 posts
Join Date:Joined: Nov 2013
More
Smile
Quote:
Originally Posted by AXD96

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: [ View ]
4th July 2014, 12:10 AM   |  #8  
lefterios's Avatar
Senior Member
Thanks Meter: 113
 
622 posts
Join Date:Joined: May 2013
Quote:
Originally Posted by mirasmithy

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.
4th July 2014, 01:48 AM   |  #9  
OP Junior Member
Thanks Meter: 32
 
8 posts
Join Date:Joined: Nov 2013
More
Quote:
Originally Posted by lefterios

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: [ View ]
8th July 2014, 09:08 PM   |  #10  
voriax's Avatar
Senior Member
Thanks Meter: 271
 
371 posts
Join Date:Joined: Sep 2009
More
Hello.

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

RelativeLayout mRelativeLayout = new RelativeLayout();

?

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes