Android Open Source - clusterkraf Cluster Transitions Building Task






From Project

Back to project page clusterkraf.

License

The source code is released under:

Apache License

If you think the Android project clusterkraf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.twotoasters.clusterkraf;
/*from www .  j  a  va  2  s  .  com*/
import java.util.ArrayList;

import android.os.AsyncTask;
import android.os.Process;

import com.google.android.gms.maps.Projection;
import com.twotoasters.clusterkraf.ClusterTransitionsBuildingTask.Argument;
import com.twotoasters.clusterkraf.ClusterTransitionsBuildingTask.Result;

/**
 *
 */
public class ClusterTransitionsBuildingTask extends AsyncTask<Argument, Void, Result> {

  private final Host host;

  ClusterTransitionsBuildingTask(Host host) {
    this.host = host;
  }

  /**
   * @see android.os.AsyncTask#doInBackground(Params[])
   */
  @Override
  protected Result doInBackground(Argument... args) {
    Result result = new Result();
    if (args != null && args.length == 1) {
      Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT + Process.THREAD_PRIORITY_LESS_FAVORABLE);

      Argument arg = args[0];
      ClusterTransitions.Builder ctb = new ClusterTransitions.Builder(arg.projection, arg.previousClusters);
      if (arg.currentClusters != null) {
        for (ClusterPoint currentClusterPoint : arg.currentClusters) {
          ctb.add(currentClusterPoint);
        }
      }
      result.clusterTransitions = ctb.build();

      Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
    }
    return result;
  }

  /**
   * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
   */
  @Override
  protected void onPostExecute(Result result) {
    super.onPostExecute(result);
    if (isCancelled() == false && result != null && host != null) {
      host.onClusterTransitionsBuildingTaskPostExecute(result);
    }
  }

  static class Argument {
    Projection projection;
    ArrayList<ClusterPoint> previousClusters;
    ArrayList<ClusterPoint> currentClusters;
  }

  static class Result {
    ClusterTransitions clusterTransitions;
  }

  interface Host {
    void onClusterTransitionsBuildingTaskPostExecute(Result result);
  }

}




Java Source Code List

android.UnusedStub.java
com.twotoasters.clusterkraf.AnimatedTransition.java
com.twotoasters.clusterkraf.BasePoint.java
com.twotoasters.clusterkraf.ClusterPoint.java
com.twotoasters.clusterkraf.ClusterTransitionsAnimation.java
com.twotoasters.clusterkraf.ClusterTransitionsBuildingTask.java
com.twotoasters.clusterkraf.ClusterTransitions.java
com.twotoasters.clusterkraf.ClusteringOnCameraChangeListener.java
com.twotoasters.clusterkraf.ClusteringTask.java
com.twotoasters.clusterkraf.Clusterkraf.java
com.twotoasters.clusterkraf.ClustersBuilder.java
com.twotoasters.clusterkraf.InfoWindowDownstreamAdapter.java
com.twotoasters.clusterkraf.InputPoint.java
com.twotoasters.clusterkraf.MarkerOptionsChooser.java
com.twotoasters.clusterkraf.OnInfoWindowClickDownstreamListener.java
com.twotoasters.clusterkraf.OnMarkerClickDownstreamListener.java
com.twotoasters.clusterkraf.Options.java
com.twotoasters.clusterkraf.sample.AdvancedModeFragment.java
com.twotoasters.clusterkraf.sample.DelayedIndeterminateProgressBarRunnable.java
com.twotoasters.clusterkraf.sample.MainActivity.java
com.twotoasters.clusterkraf.sample.MarkerData.java
com.twotoasters.clusterkraf.sample.NormalModeFragment.java
com.twotoasters.clusterkraf.sample.RandomPointsProvider.java
com.twotoasters.clusterkraf.sample.SampleActivity.java
com.twotoasters.clusterkraf.sample.SingleChoiceDialogFragment.java
com.twotoasters.clusterkraf.sample.ToastedMarkerOptionsChooser.java
com.twotoasters.clusterkraf.sample.ToastedOnMarkerClickDownstreamListener.java
com.twotoasters.clusterkraf.sample.TwoToastersActivity.java
com.twotoasters.clusterkraf.util.Distance.java