void move() {
   MyServiceManager.setServiceUnavailable();
   if (MyServiceManager.getServiceState() == MyServiceState.STOPPED) {
     new MoveDataBetweenStoragesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
   } else {
     MyServiceManager.stopService();
     Toast.makeText(
             parentActivity.getActivity(),
             mContext.getText(R.string.system_is_busy_try_later),
             Toast.LENGTH_LONG)
         .show();
   }
 }
 void move() {
   MyServiceManager.setServiceUnavailable();
   if (MyServiceManager.getServiceState() == MyServiceState.STOPPED) {
     AsyncTaskLauncher.execute(this, true, new MoveDataBetweenStoragesTask());
   } else {
     MyServiceManager.stopService();
     Toast.makeText(
             parentFragment.getActivity(),
             mContext.getText(R.string.system_is_busy_try_later),
             Toast.LENGTH_LONG)
         .show();
   }
 }
 @Override
 MessageEditorData executeAsync(MyAccount maIn, long msgId) {
   MyAccount ma =
       MyContextHolder.get()
           .persistentAccounts()
           .fromUserId(MyQuery.msgIdToLongColumnValue(MyDatabase.Msg.SENDER_ID, msgId));
   CommandData commandData = CommandData.updateStatus(ma.getAccountName(), msgId);
   MyServiceManager.sendManualForegroundCommand(commandData);
   return null;
 }
 public void test() throws InterruptedException {
   PreferenceFragment fragment =
       (PreferenceFragment)
           mActivity
               .getFragmentManager()
               .findFragmentByTag(MySettingsFragment.class.getSimpleName());
   CheckBoxPreference mUseExternalStorage =
       (CheckBoxPreference) fragment.findPreference(MyPreferences.KEY_USE_EXTERNAL_STORAGE_NEW);
   assertTrue(mUseExternalStorage != null);
   Thread.sleep(500);
   assertFalse("MyService is not available", MyServiceManager.isServiceAvailable());
 }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    TestSuite.initializeWithData(this);
    iteration = (iteration >= 4 ? 1 : iteration + 1);
    switch (iteration) {
      case 2:
        showAttachedImages = showAttachedImagesOld;
        showAvatars = !showAvatarsOld;
        break;
      case 3:
        showAttachedImages = !showAttachedImagesOld;
        showAvatars = showAvatarsOld;
        break;
      case 4:
        showAttachedImages = !showAttachedImagesOld;
        showAvatars = !showAvatarsOld;
        break;
      default:
        showAttachedImagesOld = MyPreferences.showAttachedImages();
        showAvatarsOld = MyPreferences.showAvatars();
        showAttachedImages = showAttachedImagesOld;
        showAvatars = showAvatarsOld;
        break;
    }
    setPreferences();
    MyLog.setLogToFile(true);
    logStartStop("setUp started");

    MyAccount ma =
        MyContextHolder.get()
            .persistentAccounts()
            .fromAccountName(TestSuite.CONVERSATION_ACCOUNT_NAME);
    assertTrue(ma.isValid());
    MyContextHolder.get().persistentAccounts().setCurrentAccount(ma);

    Intent intent =
        new Intent(
            Intent.ACTION_VIEW,
            MatchedUri.getTimelineUri(ma.getUserId(), TimelineType.HOME, false, 0));
    setActivityIntent(intent);

    activity = getActivity();

    assertTrue("MyService is available", MyServiceManager.isServiceAvailable());
    logStartStop("setUp ended");
  }
 void sendCommandMsg(CommandEnum command, MessageEditorData editorData) {
   MyServiceManager.sendManualForegroundCommand(
       new CommandData(command, editorData.ma.getAccountName(), editorData.getMsgId()));
 }
 void sendCommandUser(CommandEnum command, MessageEditorData editorData) {
   MyServiceManager.sendManualForegroundCommand(
       new CommandData(command, editorData.ma.getAccountName(), editorData.recipientId));
 }
 private void retrieveFromInternet(long msgId) {
   MyLog.v(this, "Message id=" + msgId + " should be retrieved from the Internet");
   MyServiceManager.sendCommand(
       new CommandData(CommandEnum.GET_STATUS, ma.getAccountName(), msgId));
 }