google plus scrolling technique in android - scroll

I was wondering is there a way we can replicate how google plus scrolling works.
I am specifically talking about the way the new items come up on screen, it is delayed and I guess there is some animation added to it.
Any ideas how this is done ?

In the getView method of your Custom adapter, try adding the below animation to the convertView(list view item) and you should be able to do this..and its working for me
You need to set a TranslateAnimation to the view and that would do the trick for you.
TranslateAnimation translateAnim = new TranslateAnimation(0, 0, 200, 0 );
listView.clearAnimation();
translateAnim.setDuration(500);
translateAnim.setFillBefore(true);
listView.startAnimation(translateAnim);
Hope this helps :)

Related

NSTextView doesn’t work when placed near the top of an NSWindow

Context
I have a window with a fullSizeContentView and a transparent titlebar and hidden titlebar.
I don’t even want the titlebar, but I had to enable it to get rounded corners on the NSWindow.
Problem
An NSTextView, when placed near the top edge, doesn’t react to any clicks. It doesn‘t let me select any text, and doesn’t let me click links I added via NSAttributedString.
This issue disappears when I disable the titlebar altogether.
Any Help would be greatly appreciated. Thanks!
Big Context
I’m trying to implement little “in-app notifications” that show peripheral status updates. I considered using NSAlert but I don’t want to prevent the user from interacting with the rest of the interface while the notifications are showing, so I decided to implement it myself.
The notifications are little, non-movable windows without a titlebar. They are basically just grey rectangles with rounded corners and a shadow that draw inside the main application window and contain one or a few lines of text. The first line of text is almost entirely behind the invisible titlebar which is why I’m having issues.
The only thing I need the notifications to do besides display text is link to webpages that contain more info about a notification’s message.
I feel like I might be approaching this wrong. If you have any suggestions or ideas on how to solve the problem, I’m eager to hear them. Thanks!
I finally figured it out!
I nailed it down to the contentInsets of the NSScrollView. (which your are for some reason forced to have around your NSTextView when creating it in Interface Builder)
The contentInsets were automatically being set to account for the invisible titlebar, even though the docs say that NSScrollView - automaticallyAdjustsContentInsets (which is set to YES by default and which I assume was causing this) doesn't do automatic insets for transparent titlebars.
After programmatically setting the scrollView's contentInsets to 0, everything works great!
In Objective C, you can set your scrollView's contentInsets to 0 like this:
NSScrollView *scrollView = (NSScrollView *)self.textView.superview.superview;
scrollView.automaticallyAdjustsContentInsets = NO; // Doesn't remove insets // Probably calling this too late
scrollView.contentInsets = NSEdgeInsetsMake(0, 0, 0, 0);
Here's a working example.
Hope this helps!

Problems implementing AdMob because of Spritekit

After following the instructions from AdMob on how to implement their code, I faced the following problem.
I had to link the UIBannerView that was set up in the storyboard with my GameScene, this, as you might know, is not possible. So I decided to link it with my GameViewController. The problem here is that I can't decide when to show the BannerView since the value's and functions that decide this are implemented in the GameScene file. Is there any way I can fix this?
Thanks for your help,
Max Savelkoul
Move the methods from game scene into the view controller and call them by using NSNotificationCenter or delegation.
You could also add the banner code manually instead of using storyboard.
var adMobBannerAdView: GADBannerView!
and than set it up
adMobBannerAdView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
adMobBannerAdView.center = CGPoint...
Alternatively I have a helper on GitHub you could check out. Also helps to keep your code clean.
https://github.com/crashoverride777/Swift2-iAds-AdMob-CustomAds-Helper

Clipping NSWindow

I am quite new to Cocoa MacOSX development and I am facing the following challenge:
There is an app that I have not written and I need to do scissoring of the main window. Said another way, I need to 'hide', let's say the half bottom of the window or any other sides of the window (dynamically). I don't want that the content of the window (views & sub-views) to be resized!
I tried things like playing with the layer.masksToBounds of the window's content view. Also played with the NSView.setBounds. No luck till now :(
Also going this way: Is it possible to clip a child NSWindow to its parent? could also be a solution but the question does not have any answer :-/
Any help of a direction to look for would be highly appreciated !

Animating toolbar with textfield up above the keyboard when the the textfield is edited

Okay I'm looking for some assistance I have researched and read posts that pertain to what I am trying to do, but none of the examples include a toolbar with a URL textfield. I am not looking to make any money off of this browser. I want it for personal use, furthermore I am not trying to insult nor take what you guys do as a profession as a joke. So if I come across that way I sincerely apologize. My toolbar is located at the bottom of the screen and I have a URL textfield. When I use the textfield to enter a website address the keyboard covers the toolbar and I cannot see what I am typing. So if you can offer some assistance that would be greatly appreciated.
I'm getting an error on the CGRect frame =self.scrollView can someone please assist me? Thanks!
I hope my code is not far off the websites load perfectly fine. I just want to move the toolbar up when the textfield is edited and drop back down after go is press....I have tried to include the toolbar inside the scrollview but I do not know what to do after.
Best regards! :)
CGRect frame = self.scrollView;
this line must be:
CGRect frame = self.scrollView.frame;

CAAnimation on a UIButton

I have been trying to create a simple swipe transition. However buttons seem immune to any CAAnimation that crops.
I am trying to get it so that a bar moves across the screen and as it goes over the button it removes the part it has just gone over.
I have tried bounds.width, size.x and many other key-value paths to achieve the affect but I haven't got what I wanted. It just relocates the text which always remains entirely visible
I have also tried changing the UIButton to a UIImage but the text does not seem to print on a UIImage.
I tried using masks too but I have heard they should be used as infrequently as possible as they consume the phones resources. I didn't really get very far with this either anyway as I hadn't used them much before.
I also tried placing it in a container view and then change the dimensions of that but again all of the text remained entirely visible.
I know I could have a view hide the button but I am trying to reveal the view behind as the bar swipes.
Does anyone have any suggestions of how to achieve a swipe transition on a UIButton?
Help would be much appreciated.
Thanks
I think what you're looking for really is a mask. See the tutorial here:
http://iosdevelopertips.com/cocoa/how-to-mask-an-image.html
What I'd do in your situation is create a custom UIButton class, and add a mask as in the tutorial, then animate the position of the mask. Slide the mask of, nothing shows. Slide it on, part shows until the whole thing is visible.
Edit: I haven't really heard anything about hogging resources, especially since it appears to be simple core graphics.

Resources