@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_launcher);

    //        SharedPreferences score =
    // PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    //        SharedPreferences.Editor score_inc = score.edit();
    //        int counter = score.getInt("counter",0);
    //        float font_size = score.getFloat("font_size",20.0f);
    //        if(counter == 0) {
    //            //Put your function to copy files here
    //            score_inc.putInt("counter", ++counter);
    //            score_inc.commit();
    //            Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
    //        }

    // Set task count so afterTask() works
    mTaskCount = new AtomicInteger(NUMBER_OF_TASKS);

    // first start the wait thread which ensures the launcher is visible for
    // a minimum amount of time specified by WAIT_TIME
    WaitTask waitTask = new WaitTask();
    waitTask.start();

    // next start a background task to download assets
    //        DownloadAllAssetsTask downloadTask = new DownloadAllAssetsTask();
    //        downloadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    // finally start the task to see if we can authenticate with the server
    CheckAuthTask authTask = new CheckAuthTask();
    authTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
예제 #2
0
 @Override
 public void failed(Throwable exc, ChannelState attachment) {
   if (exc instanceof InterruptedByTimeoutException) {
     isSend.set(false);
     attachment.isWait().set(false);
     waitTask.run();
   } else {
     LOG.error("Read handler error", exc);
   }
 }
예제 #3
0
  @Override
  public void addData(byte[] raw) {
    if (!isSend.get()) {
      buffer = Utils.wrapData(raw);
      buffer.flip();
      waitTask.run();

      return;
    }

    queueRAWDataForSend.add(raw);
  }
예제 #4
0
  @Override
  public void completed(Integer result, ChannelState attachment) {
    attachment.isWait().set(false);
    buffer = null;

    while (!queueRAWDataForSend.isEmpty()) {
      isSend.set(true);
      buffer = Utils.wrapData(queueRAWDataForSend.poll());
      buffer.flip();

      waitTask.run();
    }

    isSend.set(false);
  }