This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dispatch_queue_t myQueue = dispatch_queue_create("my queue",NULL); | |
| //... | |
| //... | |
| //... | |
| dispatch_async(imageQueue, ^{ | |
| // This will run the method in a separate thread | |
| [self doSomeLongRunningTask]; | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSThread *thread = [[NSThread alloc] initWithTarget:self | |
| selector:@selector(run:) | |
| object:nil]; | |
| [thread start]; | |
| //... | |
| //... | |
| - (void) run: (id) object{ | |
| NSLog(@"I'm running in another thread :D"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final String username = "[email protected]"; | |
| final String password = "password"; | |
| Properties props = new Properties(); | |
| props.put("mail.smtp.auth", "true"); | |
| props.put("mail.smtp.starttls.enable", "true"); | |
| props.put("mail.smtp.host", "smtp.gmail.com"); | |
| props.put("mail.smtp.port", "587"); | |
| Session session = Session.getInstance(props, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected boolean isAvailable() { | |
| if (getActivity() == null) return false; | |
| if (getActivity().isFinishing()) return false; | |
| if (!isAdded()) return false; | |
| if (isDetached()) return false; | |
| if (!isVisible()) return false; | |
| return true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SomeFragment extends Fragment { | |
| MapView mapView; | |
| GoogleMap map; | |
| @Override | |
| public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
| View v = inflater.inflate(R.layout.some_layout, container, false); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <LocalAuthentication/LocalAuthentication.h> | |
| /* A very simple way to scan your fingerprint... */ | |
| - (IBAction)didPressScan:(UIButton *)sender { | |
| NSLog(@"Hallo...!"); | |
| LAContext *myContext = [[LAContext alloc] init]; | |
| NSError *authError = nil; | |
| NSString *myLocalizedReasonString = @"Used for quick and secure access to the Remob app :P"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Application theme. --> | |
| <style name="MyTheme" parent="@android:style/Theme.Holo"> | |
| <item name="android:windowActionBarOverlay">true</item> | |
| <item name="android:actionBarStyle">@style/MyTheme.ActionBar</item> | |
| <item name="android:windowContentOverlay">@null</item> | |
| <item name="android:windowBackground">@color/red_background</item> | |
| </style> | |
| <style name="MyTheme.ActionBar" parent="android:Widget.Holo.ActionBar"> | |
| <item name="android:background">@android:color/transparent</item> | |
| <item name="android:backgroundStacked">@android:color/transparent</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Built application files | |
| /*/build/ | |
| # Crashlytics configuations | |
| com_crashlytics_export_strings.xml | |
| # Local configuration file (sdk path, etc) | |
| local.properties | |
| # Gradle generated files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void) startRotatingWithDuration: (double) duration { | |
| NSString *animKey = @"rotation"; | |
| if([self.layer animationForKey: animKey] == nil) { | |
| CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath: @"transform.rotation"]; | |
| animation.duration = duration; | |
| animation.repeatCount = INFINITY; | |
| /*animation.fromValue = [NSNumber numberWithFloat: 0.0];*/ | |
| animation.toValue = [NSNumber numberWithFloat: 2*M_PI]; | |
| [self.layer addAnimation: animation forKey: animKey]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat; | |
| { | |
| CABasicAnimation* rotationAnimation; | |
| rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
| rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; | |
| rotationAnimation.duration = duration; | |
| rotationAnimation.cumulative = YES; | |
| rotationAnimation.repeatCount = repeat; | |
| [view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; |