Skip to content

Instantly share code, notes, and snippets.

Avatar

Chelsea Troy chelseatroy

View GitHub Profile
@chelseatroy
chelseatroy / AppDelegate.swift
Created May 8, 2016
Code-Only UI Demonstration: AppDelegate
View AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//let splitViewController = self.window!.rootViewController as! UISplitViewController
//splitViewController.delegate = self
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window = window
window.rootViewController = MasterViewController()
window.makeKeyAndVisible()
@chelseatroy
chelseatroy / MasterViewController.swift
Created May 8, 2016
Code-only UI Demonstration: ViewController
View MasterViewController.swift
class MasterViewController: UIViewController {
var activityIndicatorView: UIActivityIndicatorView = UIActivityIndicatorView()
var baseView: UIView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
baseView.frame = CGRect.zero;
baseView.translatesAutoresizingMaskIntoConstraints = false
View Airport Integration Flow
@Configuration
@EnableIntegration
public class ExampleConfiguration {
@Bean
IntegrationFlow inboundFlow(
ErrorManager errorManager,
SeatSelector seatSelector,
Prioritizer priority
) {
View XML Batch Example
@Configuration
@EnableBatchProcessing
public class XmlParsingApplication {
@Bean
public StaxEventItemReader itemReader() throws Exception {
StaxEventItemReader reader = new StaxEventItemReader<>();
reader.setName("birthday");
reader.setResource(new ClassPathResource("all_members.xml"));
View onLoadFinished with two cursor loaders
@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
switch (loader.getId()) {
case FRUIT_LOADER:
//do things with the fruits data
break;
case VEGGIE_LOADER:
//do things with the vegetables data
break;
}
View onCreateLoader with two cursor loaders, incomplete
public class NutritionFactFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
public static final int FRUIT_LOADER = 1;
public static final int VEGGIE_LOADER = 2;
...
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case FRUIT_LOADER:
View onCreateLoader with two cursor loaders, complete
public class NutritionFactFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
public static final int FRUIT_LOADER = 1;
public static final int VEGGIE_LOADER = 2;
...
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case FRUIT_LOADER:
View build for card flip animation.gradle
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
//Design and Aminations
compile 'com.android.support:cardview-v7:23.1.1'
compile (name:'library-2.4.1', ext:'aar')
View parent fragment card flip animation.java
flipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (mCardSideShowing.equals(CardSide.FRONT)) {
getActivity().getFragmentManager()
.beginTransaction()
.setCustomAnimations(R.animator.card_flip_right_in, R.animator.card_flip_right_out, R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.card_fragment_container, new CardBackFragment())
.commit();
@chelseatroy
chelseatroy / ExampleViewController.swift
Last active Sep 7, 2016
View Controller for Testing with Storyboard
View ExampleViewController.swift
class ExampleViewController: UITableViewController {
@IBOutlet var someTextLabel: UITextLabel!
class func loadFromStoryboard() -> ExampleViewController
{
let controller = UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
.instantiateViewControllerWithIdentifier("ExampleViewController")
as! ExampleViewController