@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);
    }
  }
 private void commitChanges() {
   if (desk.getSenator().getList() != null && desk.getSenator().getList().size() > 0) {
     ArrayList<MovableButton> buttons = desk.getButtons();
     ArrayList<AskTag> sections = new ArrayList<>();
     for (int i = 0; i < buttons.size(); i++) {
       AskTag askTag = (AskTag) buttons.get(i).getSection();
       if (!askTag.getSelected()) {
         askTag.setOrder(1024 + askTag.getOrder());
       }
       sections.add(askTag);
     }
     if (sections.size() > 0) {
       AskTagHelper.putAllMyTags(sections);
     }
     setResult(RESULT_OK);
   }
 }
  public void getButtons() {

    List<AskTag> selectedSections = AskTagHelper.getSelectedTags();
    List<AskTag> unselectedSections = AskTagHelper.getUnselectedTags();

    ArrayList<MovableButton> selectedButtons = new ArrayList<>();
    for (int i = 0; i < selectedSections.size(); i++) {
      AskTag section = selectedSections.get(i);
      AskTagMovableButton button = new AskTagMovableButton(this);
      button.setSection(section);
      selectedButtons.add(button);
    }

    ArrayList<MovableButton> unselectedButtons = new ArrayList<>();
    for (int i = 0; i < unselectedSections.size(); i++) {
      AskTag section = unselectedSections.get(i);
      AskTagMovableButton button = new AskTagMovableButton(this);
      button.setSection(section);
      unselectedButtons.add(button);
    }
    desk.setSelectedButtons(selectedButtons);
    desk.setUnselectedButtons(unselectedButtons);
  }
 private void initView() {
   desk.InitDatas();
   desk.initView();
 }