use of net.imglib2.util.Pair in project LookLook by xinghongfei.
the class Help method createSafeTransitionParticipants.
public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) {
// Avoid system UI glitches as described here:
// https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
View decor = activity.getWindow().getDecorView();
View statusBar = null;
if (includeStatusBar) {
statusBar = decor.findViewById(android.R.id.statusBarBackground);
}
View navBar = decor.findViewById(android.R.id.navigationBarBackground);
// Create pair of transition participants.
List<Pair> participants = new ArrayList<>(3);
addNonNullViewToTransitionParticipants(statusBar, participants);
addNonNullViewToTransitionParticipants(navBar, participants);
// only add transition participants if there's at least one none-null element
if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) {
participants.addAll(Arrays.asList(otherParticipants));
}
return participants.toArray(new Pair[participants.size()]);
}
use of net.imglib2.util.Pair in project LookLook by xinghongfei.
the class TransitionHelper method createSafeTransitionParticipants.
/**
* Create the transition participants required during a activity transition while
* avoiding glitches with the system UI.
*
* @param activity The activity used as start for the transition.
* @param includeStatusBar If false, the status bar will not be added as the transition
* participant.
* @return All transition participants.
*/
public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) {
// Avoid system UI glitches as described here:
// https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
View decor = activity.getWindow().getDecorView();
View statusBar = null;
if (includeStatusBar) {
statusBar = decor.findViewById(android.R.id.statusBarBackground);
}
View navBar = decor.findViewById(android.R.id.navigationBarBackground);
// Create pair of transition participants.
List<Pair> participants = new ArrayList<>(3);
addNonNullViewToTransitionParticipants(statusBar, participants);
addNonNullViewToTransitionParticipants(navBar, participants);
// only add transition participants if there's at least one none-null element
if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) {
participants.addAll(Arrays.asList(otherParticipants));
}
return participants.toArray(new Pair[participants.size()]);
}
use of net.imglib2.util.Pair in project GDSC-SMLM by aherbert.
the class Gaussian2DFunction method computeValuesAndJacobian.
/*
* (non-Javadoc)
*
* @see gdsc.smlm.function.ExtendedNonLinearFunction#computeValuesAndJacobian(double[])
*/
public Pair<double[], double[][]> computeValuesAndJacobian(double[] variables) {
initialise1(variables);
final int n = size();
final double[][] jacobian = new double[n][];
final double[] values = new double[n];
forEach(new Gradient1Procedure() {
int i = 0;
public void execute(double value, double[] dy_da) {
values[i] = value;
jacobian[i++] = dy_da.clone();
}
});
return new Pair<double[], double[][]>(values, jacobian);
}
use of net.imglib2.util.Pair in project Rocket.Chat.Android by RocketChat.
the class RoomPresenter method sendMessage.
@Override
public void sendMessage(String messageText) {
final Disposable subscription = getRoomUserPair().flatMap(pair -> messageInteractor.send(pair.first, pair.second, messageText)).subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(success -> {
if (success) {
view.onMessageSendSuccessfully();
}
}, Logger::report);
addSubscription(subscription);
}
use of net.imglib2.util.Pair in project Rocket.Chat.Android by RocketChat.
the class MainPresenter method subscribeToUnreadCount.
private void subscribeToUnreadCount() {
final Disposable subscription = Flowable.combineLatest(roomInteractor.getTotalUnreadRoomsCount(), roomInteractor.getTotalUnreadMentionsCount(), (Pair::new)).subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(pair -> view.showUnreadCount(pair.first, pair.second), Logger::report);
addSubscription(subscription);
}
Aggregations