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
package org.khanacademy.core.util; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertTrue; | |
import static org.khanacademy.core.util.test_util.Observables.collectAll; | |
import static org.khanacademy.core.util.test_util.Observables.collectFirst; | |
import org.khanacademy.core.base.BaseTestCase; | |
import org.khanacademy.core.exceptions.TestException; |
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
package org.khanacademy.core.util; | |
import static com.google.common.base.Preconditions.checkNotNull; | |
import com.google.common.base.Optional; | |
import rx.Observable; | |
import rx.Observable.OnSubscribe; | |
import rx.Subscriber; | |
import rx.Subscription; | |
import rx.functions.Action0; |
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
let exerciseTransitioningSignal = exerciseTransitioningSubject | |
.startWithBoxedValue(false) | |
.takeUntil(rac_willDeallocSignal()) | |
controlsEnabledSubscription = exerciseTransitioningSignal | |
.combineLatestWith(isReachableSignal) | |
.map { | |
let tuple = $0 as! RACTuple | |
let isExerciseTransitioning = (tuple.first as! Box<Bool>).value | |
let isReachable = (tuple.second as! Box<Bool>).value |
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
override func loadView() { | |
// Create a KAExerciseControlsDelegate implementation that invokes methods on the delegate | |
// of this instance. | |
weak var weakSelf = self | |
class ViewDelegate: KAExerciseControlsDelegate { | |
// Invokes the given block with the view controller and its delegate, if both are still | |
// allocated. | |
private func callControllerDelegate(caller: (ExerciseControlsViewDelegate, ExerciseControlsViewController) -> Void) { | |
if let strongSelf = weakSelf, strongDelegate = strongSelf.delegate { | |
caller(strongDelegate, strongSelf) |
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
/* | |
getFragmentManager() | |
.beginTransaction() | |
.replace(android.R.id.content, TopicTutorialListFragment.newInstance(subject)) | |
.addToBackStack("subject") | |
.commit(); | |
*/ | |
System.out.println("navigating"); | |
Article article = new Article("xbdcfe503", "An Introduction to the Protestant Reformation"); |
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
package org.khanacademy.core.topictree.models; | |
/** | |
* An enumeration over all exercise frameworks. | |
*/ | |
public enum ExerciseFramework { | |
KHAN_EXERCISES, | |
PERSEUS, | |
} |
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
package org.khanacademy.core.topictree.models; | |
import com.google.common.base.MoreObjects; | |
import com.google.common.base.Objects; | |
import com.google.common.base.Preconditions; | |
/** | |
* Uniquely identifies an {@link Exercise} instance. | |
*/ | |
public final class ExerciseDescriptor { |
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
package org.khanacademy.core.topictree.models; | |
import com.google.common.base.MoreObjects; | |
import com.google.common.base.Preconditions; | |
import org.khanacademy.core.topictree.identifiers.ContentItemIdentifiable; | |
import org.khanacademy.core.topictree.identifiers.ContentItemIdentifier; | |
import org.khanacademy.core.topictree.identifiers.ContentItemKind; | |
/** |
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
// | |
// ViewController.swift | |
// deinit-failure | |
// | |
// Created by Mike Parker on 2/26/15. | |
// Copyright (c) 2015 Mike Parker. All rights reserved. | |
// | |
import UIKit |
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
/** | |
UIAlertViewDelegate used when the user can only go back, and so the associated handler | |
has no parameters. | |
*/ | |
private class BackOnlyErrorDelegate: NSObject, UIAlertViewDelegate { | |
private let handler: () -> Void | |
private init(handler: () -> Void) { | |
self.handler = handler | |
} |