GithubHelp home page GithubHelp logo

j-mcnally / cordova-statustap Goto Github PK

View Code? Open in Web Editor NEW
53.0 6.0 17.0 210 KB

Capture tap events on the status bar.

Home Page: http://www.kohactive.com

License: MIT License

Objective-C 89.49% JavaScript 10.51%

cordova-statustap's Introduction

cordova-statusTap

Capture tap events on the status bar.

This plugin is aimed at libraries like Sencha for users who want to execute custom code like scrolling their list views on status tap.

By j-mcnally and triceam

Installation

To use this plugin, all you have to do is add this to your project use the PhoneGap CLI:

phonegap local plugin add https://github.com/j-mcnally/cordova-statusTap

The CLI tooling sets up all JS file references, and the plugin will initialize itself.

Then to add a listener for the tap implement after PhoneGap/Cordova's onDeviceReady has been fired:

window.addEventListener("statusTap", function() {
  alert("status tap");
});

If you want to scroll a div based on this event, you can do something like the following (note, this is jQuery syntax):

window.addEventListener("statusTap", function() {
	var target = $("#scroller");
	
	//disable touch scroll
	target.css({
		'-webkit-overflow-scrolling' : 'auto',
		'overflow-y' : 'hidden'
	});
	
	//animate
	target.animate({ scrollTop: 0}, 300, "swing", function(){
		
		//re-enable touch scrolling
		target.css({
			'-webkit-overflow-scrolling' : 'touch',
			'overflow-y' : 'scroll'
		});
	});
});

This disables touch scrolling to kill an inertial scrolling in progress, animates it, then re-enables touch scrolling once the animation is complete.

That's it... very simple.

Details

Updated to Cordova 3.0 by triceam

Triceam's Changes include:

  1. Updated for PhoneGap/Cordova CLI usage
  2. Added auto-initialization - no need to manually initialize anymore
  3. Updated ARC compatibility

cordova-statustap's People

Contributors

apla avatar gdadevapp avatar hessius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cordova-statustap's Issues

License?

Looks useful. Thanks for putting it together. What OSS license are you making this available under? I'd suggest MIT or BSD, if you're taking requests. :)

Listen to taps on notificationcenter instead?

Instead of creating a webview that needs to be positioned, wouldn't it be easier to listen to taps on NSNotificationCenter and fire an event based on that?
Also, Cordova has a fireDocumentEvent method that is probably easier to use :)

Problem with camera plugin

I've used welldone-software version to fix severeal problems on iOS 8. But there is a bug: when I choose a picture, the keyboard won't work anymore nor will be shown. This could be also a bug due to IonicKeyboard plugin, but it just happen when I use statusTap. As soon as I remove statusTap, the keyboard will work fine without any problems.

Not work in iOS8

The plugin does not work in iOS 8. The status bar disappears after closing the application or after returning from landscape
Could you fix it please ? Thx

Event doesn't fire when the statusbar is hidden and then shown

I use a status bar plugin that hides/shows the status bar to fix iOS7 issues and this plugin doesn't work if the status bar is initially hidden. The fix for it however, is really simple.

In the .js file I replaced line 6 with the following:
setTimeout(function () { exec(null, null, "TapToScroll", "initListener",[]); }, 250);

This gives the status bar plugin time to show itself before initializing the tap plugin.

Submission to PhoneGap Build

Thank you for creating and sharing statusTap. Have you considered submitting it to PhoneGap Build? It would be great for users of this service.

StatusTap appears to already meet their requirements (mainly that it conforms to Plugman). They only ask for a repository URL.

https://build.phonegap.com/plugins

App freezes in ios9

Hi
I've issues with this useful plugin in ios9.
The build is successful but when I run the app I get this error and the app is unresponsive:

2015-09-22 11:15:28.009 XXXXXXXX[2419:1196806] *** Assertion failure in -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UIApplication.m:1697
2015-09-22 11:15:28.010 XXXXXXXX[2419:1196806] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'accessing _cachedSystemAnimationFence requires the main thread'
*** First throw call stack:
(0x182b48f5c 0x19764bf80 0x182b48e2c 0x183a37f3c 0x18833b0e8 0x18838cdf4 0x18815e47c 0x1880a6790 0x1880a3448 0x1000907b8 0x100199d70 0x100199d30 0x1001a8f38 0x1001a8600 0x198059478 0x198059028)
libc++abi.dylib: terminating with uncaught exception of type NSException

The error is in TapToScroll.m:
[overlay setHidden:NO];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.