Ejemplo n.º 1
0
 @Override
 protected void onDestroy() {
   if (netTask != null && netTask.getStatus() == AAsyncTask.Status.RUNNING) {
     netTask.cancel(false);
   }
   if (dbTask != null && dbTask.getStatus() == AAsyncTask.Status.RUNNING) {
     dbTask.cancel(false);
   }
   super.onDestroy();
 }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_shuffle);
    toolbar = (Toolbar) findViewById(R.id.action_bar);
    setSupportActionBar(toolbar);
    desk = (ShuffleDesk) findViewById(R.id.shuffle_desk);
    desk.getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {

              @Override
              public void onGlobalLayout() {
                desk.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                initView();
              }
            });
    ((TextView) desk.findViewById(R.id.text_main_sections)).setText(R.string.selected_tags);
    ((TextView) desk.findViewById(R.id.text_other_sections)).setText(R.string.more_unselected_tags);
    if (getIntent().getBooleanExtra(Consts.Extra_Should_Load_Before_Shuffle, false)) {
      netTask = new LoaderFromNetTask(this);
      netTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
      dbTask = new LoaderFromDBTask(this);
      dbTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
  }