Search in sources :

Example 11 with Pair

use of mpicbg.trakem2.util.Pair in project android-topeka by googlesamples.

the class CategorySelectionFragment method startQuizActivityWithTransition.

private void startQuizActivityWithTransition(Activity activity, View toolbar, Category category) {
    final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, false, new Pair<>(toolbar, activity.getString(R.string.transition_toolbar)));
    @SuppressWarnings("unchecked") ActivityOptionsCompat sceneTransitionAnimation = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
    // Start the activity with the participants, animating from one to the other.
    final Bundle transitionBundle = sceneTransitionAnimation.toBundle();
    Intent startIntent = QuizActivity.getStartIntent(activity, category);
    ActivityCompat.startActivityForResult(activity, startIntent, REQUEST_CATEGORY, transitionBundle);
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 12 with Pair

use of mpicbg.trakem2.util.Pair in project Material-Animations by lgvalle.

the class BaseDetailActivity method transitionTo.

@SuppressWarnings("unchecked")
void transitionTo(Intent i) {
    final Pair<View, String>[] pairs = TransitionHelper.createSafeTransitionParticipants(this, true);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(this, pairs);
    startActivity(i, transitionActivityOptions.toBundle());
}
Also used : ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 13 with Pair

use of mpicbg.trakem2.util.Pair in project android-page-transition by xmuSistone.

the class CommonFragment method gotoDetail.

@Override
public void gotoDetail() {
    Activity activity = (Activity) getContext();
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, new Pair(imageView, DetailActivity.IMAGE_TRANSITION_NAME), new Pair(address1, DetailActivity.ADDRESS1_TRANSITION_NAME), new Pair(address2, DetailActivity.ADDRESS2_TRANSITION_NAME), new Pair(address3, DetailActivity.ADDRESS3_TRANSITION_NAME), new Pair(address4, DetailActivity.ADDRESS4_TRANSITION_NAME), new Pair(address5, DetailActivity.ADDRESS5_TRANSITION_NAME), new Pair(ratingBar, DetailActivity.RATINGBAR_TRANSITION_NAME), new Pair(head1, DetailActivity.HEAD1_TRANSITION_NAME), new Pair(head2, DetailActivity.HEAD2_TRANSITION_NAME), new Pair(head3, DetailActivity.HEAD3_TRANSITION_NAME), new Pair(head4, DetailActivity.HEAD4_TRANSITION_NAME));
    Intent intent = new Intent(activity, DetailActivity.class);
    intent.putExtra(DetailActivity.EXTRA_IMAGE_URL, imageUrl);
    ActivityCompat.startActivity(activity, intent, options.toBundle());
}
Also used : Activity(android.app.Activity) Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) Pair(android.support.v4.util.Pair)

Example 14 with Pair

use of mpicbg.trakem2.util.Pair in project cassandra by apache.

the class SampledOpDistributionFactory method get.

public OpDistribution get(boolean isWarmup, MeasurementSink sink) {
    PartitionGenerator generator = newGenerator();
    List<Pair<Operation, Double>> operations = new ArrayList<>();
    for (Map.Entry<T, Double> ratio : ratios.entrySet()) {
        List<? extends Operation> ops = get(new Timer(ratio.getKey().toString(), sink), generator, ratio.getKey(), isWarmup);
        for (Operation op : ops) operations.add(new Pair<>(op, ratio.getValue() / ops.size()));
    }
    return new SampledOpDistribution(new EnumeratedDistribution<>(operations), clustering.get());
}
Also used : PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) ArrayList(java.util.ArrayList) Operation(org.apache.cassandra.stress.Operation) Timer(org.apache.cassandra.stress.report.Timer) Map(java.util.Map) Pair(org.apache.commons.math3.util.Pair)

Example 15 with Pair

use of mpicbg.trakem2.util.Pair in project android by owncloud.

the class FileSyncAdapter method synchronizeFolder.

/**
     *  Synchronizes the list of files contained in a folder identified with its remote path.
     *  
     *  Fetches the list and properties of the files contained in the given folder, including their 
     *  properties, and updates the local database with them.
     *  
     *  Enters in the child folders to synchronize their contents also, following a recursive
     *  depth first strategy. 
     * 
     *  @param folder                   Folder to synchronize.
     *  @param pushOnly                 When 'true', it's assumed that the folder did not change in the
     *                                  server, so data will not be fetched. Only local changes of
     *                                  available offline files will be pushed.
     */
private void synchronizeFolder(OCFile folder, boolean pushOnly) {
    if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult))
        return;
    // folder synchronization
    SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation(getContext(), folder.getRemotePath(), getAccount(), mCurrentSyncTime, pushOnly, // sync full account
    true, // only sync contents of available offline files
    false);
    RemoteOperationResult result = synchFolderOp.execute(getClient(), getStorageManager());
    // synchronized folder -> notice to UI - ALWAYS, although !result.isSuccess
    sendLocalBroadcast(EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED, folder.getRemotePath(), result);
    // check the result of synchronizing the folder
    if (result.isSuccess() || result.getCode() == ResultCode.SYNC_CONFLICT) {
        if (result.getCode() == ResultCode.SYNC_CONFLICT) {
            mConflictsFound += synchFolderOp.getConflictsFound();
            mFailsInFavouritesFound += synchFolderOp.getFailsInFileSyncsFound();
        }
        if (synchFolderOp.getForgottenLocalFiles().size() > 0) {
            mForgottenLocalFiles.putAll(synchFolderOp.getForgottenLocalFiles());
        }
        if (result.isSuccess()) {
            // synchronize children folders 
            List<Pair<OCFile, Boolean>> children = synchFolderOp.getFoldersToVisit();
            // beware of the 'hidden' recursion here!
            syncSubfolders(children);
        }
    } else if (result.getCode() != ResultCode.FILE_NOT_FOUND) {
        // in failures, the statistics for the global result are updated
        if (RemoteOperationResult.ResultCode.UNAUTHORIZED.equals(result.getCode())) {
            mSyncResult.stats.numAuthExceptions++;
        } else if (result.getException() instanceof DavException) {
            mSyncResult.stats.numParseExceptions++;
        } else if (result.getException() instanceof IOException) {
            mSyncResult.stats.numIoExceptions++;
        }
        mFailedResultsCounter++;
        mLastFailedResult = result;
    }
// else, ResultCode.FILE_NOT_FOUND is ignored, remote folder was
// removed from other thread or other client during the synchronization,
// before this thread fetched its contents
}
Also used : SynchronizeFolderOperation(com.owncloud.android.operations.SynchronizeFolderOperation) DavException(org.apache.jackrabbit.webdav.DavException) RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) IOException(java.io.IOException) Pair(android.support.v4.util.Pair)

Aggregations

Pair (android.support.v4.util.Pair)79 ArrayList (java.util.ArrayList)39 View (android.view.View)28 Pair (org.apache.commons.math3.util.Pair)20 ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)16 TextView (android.widget.TextView)15 Intent (android.content.Intent)14 List (java.util.List)13 ImageView (android.widget.ImageView)10 ByteProcessor (ij.process.ByteProcessor)9 RecyclerView (android.support.v7.widget.RecyclerView)8 HashMap (java.util.HashMap)8 Map (java.util.Map)8 AlertDialog (android.support.v7.app.AlertDialog)7 Pair (mpicbg.trakem2.util.Pair)7 NonNull (android.support.annotation.NonNull)6 Patch (ini.trakem2.display.Patch)6 OsmandSettings (net.osmand.plus.OsmandSettings)6 DialogInterface (android.content.DialogInterface)5 IOException (java.io.IOException)5