本文整理汇总了Java中org.robovm.objc.block.VoidBlock1类的典型用法代码示例。如果您正苦于以下问题:Java VoidBlock1类的具体用法?Java VoidBlock1怎么用?Java VoidBlock1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoidBlock1类属于org.robovm.objc.block包,在下文中一共展示了VoidBlock1类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: viewDidLoad
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
@Override
public void viewDidLoad() {
super.viewDidLoad();
FBSDKProfile.Notifications.observeCurrentProfileDidChange(new VoidBlock1<FBSDKProfileChangeNotification>() {
@Override
public void invoke(FBSDKProfileChangeNotification notification) {
if (FBSDKProfile.getCurrentProfile() != null && PAPUser.getCurrentUser() != null) {
PAPUser.getCurrentUser().fetchInBackground(new PFGetCallback<PAPUser>() {
@Override
public void done(PAPUser object, NSError error) {
refreshCurrentUser(object, error);
}
});
}
}
});
}
示例2: startIconDownload
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
private void startIconDownload(AppRecord appRecord, final NSIndexPath indexPath) {
IconDownloader iconDownloader = imageDownloadsInProgress.get(indexPath.getRow());
if (iconDownloader == null) {
iconDownloader = new IconDownloader(appRecord, new VoidBlock1<AppRecord>() {
@Override
public void invoke(AppRecord a) {
UITableViewCell cell = getTableView().getCellForRow(indexPath);
// Display the newly loaded image
cell.getImageView().setImage(a.appIcon);
// Remove the IconDownloader from the in progress list.
// This will result in it being deallocated.
imageDownloadsInProgress.remove(indexPath.getRow());
}
});
imageDownloadsInProgress.put(indexPath.getRow(), iconDownloader);
iconDownloader.startDownload();
}
}
示例3: IOSProductsList
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
public IOSProductsList() {
// Register for StoreManager's notifications
NSNotificationCenter.getDefaultCenter().addObserver(StoreManager.IAPProductRequestNotification,
StoreManager.getInstance(), NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() {
@Override
public void invoke(NSNotification a) {
handleProductRequestNotification(a);
}
});
// The tableview is organized into 2 sections: AVAILABLE PRODUCTS and
// INVALID PRODUCT IDS
products.add(new MyModel("AVAILABLE PRODUCTS"));
products.add(new MyModel("INVALID PRODUCT IDS"));
fetchProductInformation();
getTableView().registerReusableCellClass(UITableViewCell.class, "availableProductID");
getTableView().registerReusableCellClass(UITableViewCell.class, "invalidIdentifierID");
}
示例4: viewWillAppear
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
@Override
public void viewWillAppear(boolean animated) {
super.viewWillAppear(animated);
/*
* Load our preferences. Preloading the relevant preferences here will
* prevent possible diskIO latency from stalling our code in more time
* critical areas, such as tableView:cellForRowAtIndexPath:, where the
* values associated with these preferences are actually needed.
*/
onDefaultsChanged();
/*
* Begin listening for changes to our preferences when the Settings app
* does so, when we are resumed from the backround, this will give us a
* chance to update our UI.
*/
notification = NSUserDefaults.Notifications.observeDidChange(null, new VoidBlock1<NSUserDefaults>() {
@Override
public void invoke(NSUserDefaults a) {
onDefaultsChanged();
}
});
}
示例5: showSimpleAlert
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
/**
* Show an alert with an "Okay" button.
*/
private void showSimpleAlert() {
String title = "A Short Title Is Best";
String message = "A message should be a short, complete sentence.";
String cancelButtonTitle = "OK";
UIAlertController alertController = new UIAlertController(title, message, UIAlertControllerStyle.Alert);
// Create the action.
UIAlertAction cancelAction = new UIAlertAction(cancelButtonTitle, UIAlertActionStyle.Cancel,
new VoidBlock1<UIAlertAction>() {
@Override
public void invoke(UIAlertAction a) {
System.out.println("The simple alert's cancel action occured.");
}
});
// Add the action.
alertController.addAction(cancelAction);
presentViewController(alertController, true, null);
}
示例6: willTerminate
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
void willTerminate () {
// shutdown the GL and AL systems after our configured delay
new NSTimer(config.timeForTermination, new VoidBlock1<NSTimer>() {
public void invoke (NSTimer timer) {
// shutdown the GL view completely
EAGLContext.setCurrentContext(null);
// stop and release the AL resources (if audio was ever initialized)
if (audio != null) audio.terminate();
}
}, null, false);
// let the app know that we're terminating
dispatchEvent(lifecycle, Lifecycle.EXIT);
}
示例7: viewDidLoad
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
@Override
public void viewDidLoad() {
super.viewDidLoad();
FBSDKProfile.Notifications.observeCurrentProfileDidChange(new VoidBlock1<FBSDKProfileChangeNotification>() {
@Override
public void invoke(FBSDKProfileChangeNotification notification) {
if (notification.getNewProfile() != null) {
getTableView().reloadData();
}
}
});
}
示例8: FacebookHandler
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
private FacebookHandler() {
loginManager = new FBSDKLoginManager();
loginManager.setDefaultAudience(FBSDKDefaultAudience.Everyone);
FBSDKProfile.enableUpdatesOnAccessTokenChange(true);
FBSDKProfile.Notifications.observeCurrentProfileDidChange(new VoidBlock1<FBSDKProfileChangeNotification>() {
@Override
public void invoke(FBSDKProfileChangeNotification notification) {
if (notification != null && notification.getNewProfile() != null) {
FBSDKProfile currentProfile = notification.getNewProfile();
// TODO Store the profile and update the profile ui.
}
}
});
}
示例9: viewDidLoad
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
@Override
public void viewDidLoad() {
getTableView().setSeparatorStyle(UITableViewCellSeparatorStyle.SingleLine);
super.viewDidLoad();
UIView texturedBackgroundView = new UIView(getView().getBounds());
texturedBackgroundView.setBackgroundColor(UIColor.black());
getTableView().setBackgroundView(texturedBackgroundView);
getNavigationItem().setTitleView(new UIImageView(UIImage.getImage("LogoNavigationBar")));
// Add Settings button
getNavigationItem().setRightBarButtonItem(new PAPSettingsButtonItem(settingsButtonAction));
applicationDidReceiveRemoteNotification = PAPNotificationManager.addObserver(
PAPNotification.DID_RECEIVE_REMOTE_NOTIFICATION, new VoidBlock1<NSNotification>() {
@Override
public void invoke(NSNotification notification) {
loadObjects();
}
});
blankTimelineView = new UIView(getTableView().getBounds());
UIButton button = new UIButton(UIButtonType.Custom);
button.setBackgroundImage(UIImage.getImage("ActivityFeedBlank"), UIControlState.Normal);
button.setFrame(new CGRect(24, 113, 271, 140));
button.addOnTouchUpInsideListener(inviteFriendsButtonAction);
blankTimelineView.addSubview(button);
lastRefresh = PAPCache.getSharedCache().getLastActivityFeedRefresh();
}
示例10: addObserver
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
public static NSObject addObserver(PAPNotification notification, VoidBlock1<NSNotification> callback) {
return NSNotificationCenter.getDefaultCenter().addObserver(notification.getName(), null,
NSOperationQueue.getMainQueue(), callback);
}
示例11: IconDownloader
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
public IconDownloader (AppRecord appRecord, VoidBlock1<AppRecord> completionHandler) {
this.appRecord = appRecord;
this.completionHandler = completionHandler;
}
示例12: setErrorHandler
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
public void setErrorHandler (VoidBlock1<NSError> errorHandler) {
this.errorHandler = errorHandler;
}
示例13: ParentViewController
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
public ParentViewController() {
NSNotificationCenter.getDefaultCenter().addObserver(StoreObserver.IAPPurchaseNotification,
StoreObserver.getInstance(),
NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() {
@Override
public void invoke(NSNotification a) {
handlePurchasesNotification(a);
}
});
segmentedControl = new UISegmentedControl(NSArray.fromStrings("Products", "Purchases"));
segmentedControl.setSelectedSegment(0);
segmentedControl.addOnValueChangedListener(new UIControl.OnValueChangedListener() {
@Override
public void onValueChanged(UIControl control) {
segmentValueChanged(control);
}
});
getNavigationItem().setTitleView(segmentedControl);
getNavigationItem().setRightBarButtonItem(
new UIBarButtonItem("Restore", UIBarButtonItemStyle.Done, new UIBarButtonItem.OnClickListener() {
@Override
public void onClick(UIBarButtonItem barButtonItem) {
restore();
}
}));
UIView view = getView();
view.setBackgroundColor(UIColor.white());
statusMessage = new UILabel(new CGRect(0, 64, 320, 44));
statusMessage.setTextAlignment(NSTextAlignment.Center);
statusMessage.setFont(UIFont.getSystemFont(14));
containerView = new UIView(UIScreen.getMainScreen().getApplicationFrame());
view.addSubview(containerView);
productsList = new IOSProductsList();
purchasesList = new IOSPurchasesList();
// Add iOSProductsList and iOSPurchasesList as child view controllers
addChildViewController(productsList);
productsList.didMoveToParentViewController(this);
addChildViewController(purchasesList);
purchasesList.didMoveToParentViewController(this);
// iOSProductsList is the default child view controller
cycleViewControllers(null, productsList);
}
示例14: search
import org.robovm.objc.block.VoidBlock1; //导入依赖的package包/类
/**
* Asynchronously runs a query for topic summaries. Wraps
* {@link AnswerMeService#search(String, org.robovm.answerme.core.Callback, org.robovm.answerme.core.Callback)}
* and makes it callable from Objective-C using the
* {@code searchWithQuery:onSuccess:onFailure:} selector.
*
* @param query the query to run.
* @param onSuccess Objective-C block which will be run when a result is
* returned successfully.
* @param onFailure Objective-C block which will be run on failure.
*/
@Method(selector = "searchWithQuery:onSuccess:onFailure:")
public void search(String query, final @Block VoidBlock1<NSArray<AMTopicImpl>> onSuccess,
final @Block VoidBlock1<NSString> onFailure) {
answerMeService.search(
query,
l -> onSuccess.invoke(new NSArray<>(toAMTopics(l))),
t -> onFailure.invoke(new NSString(t.getMessage())));
}