Esempio n. 1
0
 public void pauseSubOutput() {
   MtkLog.i(TAG, "~~~~~~~~~~~~~~~~~enter pauseSubOutput");
   TVOutput subOutput = mTvInputManager.getOutput("sub");
   if (null != subOutput) {
     subOutput.stop();
   }
 }
Esempio n. 2
0
  public void resumeMainOutputWithNoConnect() {
    setTvNormal(true);
    MtkLog.i(TAG, "~~~~~~~~~~~~~~~~~enter resumeMainOutputWithNoConnect");

    mTvContent.enterTV();

    mTvInputManager.enterOutputMode(TVInputCommon.OUTPUT_MODE_NORMAL);
    DestroyApp.getTVDialogView(mContext.getApplicationContext()).hide();
  }
Esempio n. 3
0
 public void pauseMainOutput() {
   setTvNormal(false);
   MtkLog.i(TAG, "~~~~~~~~~~~~~~~~~enter pauseMainOutput");
   TVOutput output = mTvInputManager.getOutput("main");
   if (null != output) {
     output.stop();
   }
   mTvContent.leaveTV();
 }
Esempio n. 4
0
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case MessageType.MESSAGE_FOR_PIPSIZE_DELAY:
       //				setTvViewPosition();
       DestroyApp.getTVDialogView(mContext.getApplicationContext()).show(mContext);
       break;
     case MessageType.MESSAGE_FOR_CHECK_SWAP:
       MtkLog.d(TAG, "come in myHandler MESSAGE_FOR_CHECK_SWAP");
       GetCurrentTask currentTask = GetCurrentTask.getInstance(mContext);
       if (currentTask.isCurActivityTkuiMainActivity() && !isTvNormal()) {
         MtkLog.d(TAG, "come in myHandler MESSAGE_FOR_CHECK_SWAP to resume TV");
         resumeMainOutput();
       } else {
         MtkLog.i(TAG, "~~~~~~~~~~~~" + currentTask.getCurRunningClass());
       }
       break;
     default:
       break;
   }
 }
Esempio n. 5
0
  public void switchOutputMode() {
    if (TurnkeyUiMainActivity.isResume) {
      MtkLog.i(TAG, "tk ui is running, can't change output mode.");
      return;
    }

    GetCurrentTask ctask = GetCurrentTask.getInstance(mContext);

    if (ctask.isCurActivtyMeidaMainActivity()) {
      toastNofunction();
      return;
    }

    if (!ctask.isCurTaskTKUI() && null != mtv) {
      try {
        int currentOutputMode = mtv.getCurrentOutputMode();
        if (ITVCommon.OUTPUT_MODE_NORMAL == currentOutputMode) {
          pipOn = false;
        }
      } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      //			 if (isCurrentModePIP()) {
      //			 DestroyApp.getTVDialogView(mContext.getApplicationContext())
      //			 .hide();
      //			 // changeModeToNormal();
      //			 TVOutputCommon common = TVOutputCommon.getInstance(mContext);
      //			 common.stop("sub");
      //			 } else {
      //			 changeModeToPip();
      //			 DestroyApp.getTVDialogView(mContext.getApplicationContext())
      //			 .show(mContext);
      //			 }
      if (pipOn) {
        DestroyApp.getTVDialogView(mContext.getApplicationContext()).hide();
        // changeModeToNormal();
        TVOutputCommon common = TVOutputCommon.getInstance(mContext);
        mTvContent.setScreenPosition("sub", 0, 0, 0, 0);
        // common.stop("sub");
        common.stopEx("sub", true);
        pipOn = false;
      } else {
        changeModeToPip();
        DestroyApp.getTVDialogView(mContext.getApplicationContext()).show(mContext);
        //				DestroyApp.getTVDialogView(mContext.getApplicationContext())
        //						.startCheckPosition();
        pipOn = true;
      }
    }
  }
Esempio n. 6
0
 protected void sortFile() {
   MtkLog.i("sort", "sortFile");
   int type = MultiFilesManager.getInstance(mContext).getSortType();
   if (FilesManager.SORT_BY_NAME == type) {
     new com.mediatek.ui.mmp.util.SortList().sort(mFiles, "getName", null);
   } else if (FilesManager.SORT_BY_DATE == type) {
     int source = MultiFilesManager.getInstance(mContext).getCurrentSourceType();
     if (MultiFilesManager.SOURCE_DLNA != source) {
       new com.mediatek.ui.mmp.util.SortList().sort(mFiles, "getSize", null);
     }
   } else if (FilesManager.SORT_BY_TYPE == type) {
     new com.mediatek.ui.mmp.util.SortList().sort(mFiles, "getSuffix", "getName");
   }
 }
Esempio n. 7
0
  @Override
  protected String retriveParentPath(String path) {
    String parent;
    String newPath = path.substring(0, path.length() - 1);

    if (newPath.indexOf("/") + 1 == newPath.lastIndexOf("/")) {
      parent = newPath.substring(0, newPath.lastIndexOf("/") + 1);
    } else {
      parent = super.retriveParentPath(newPath) + "/";
    }

    MtkLog.d(TAG, "RetriveParentPath : " + parent);
    return parent;
  }
Esempio n. 8
0
  public boolean login(String path, String domain, String userName, String userPwd) {
    boolean success = false;
    try {
      SambaManager.login(path, domain, userName, userPwd);
      success = true;
    } catch (SmbAuthException e) {
      MtkLog.w(TAG, "Login SmbAuthException!!");
      e.printStackTrace();
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (SmbException e) {
      e.printStackTrace();
    }

    return success;
  }
Esempio n. 9
0
  public void resumeMainOutput() {
    setTvNormal(true);
    MtkLog.i(TAG, "~~~~~~~~~~~~~~~~~enter resumeMainOutput");

    mTvContent.enterTV();

    //		mTvInputManager.enterOutputMode(TVInputCommon.OUTPUT_MODE_NORMAL);
    try {
      if (null != mtv) {
        mtv.enterOutputMode(ITVCommon.OUTPUT_MODE_NORMAL);
      }

    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    TVOutput output = mTvInputManager.getOutput("main");
    if (null != output) {
      output.connect(output.getInput());
    }
    DestroyApp.getTVDialogView(mContext.getApplicationContext()).hide();
  }
Esempio n. 10
0
  public void swap3rdappTvapp() {
    ActivityManager mActivityManager =
        (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningTaskInfo> runningTaskList = mActivityManager.getRunningTasks(8);
    List<RunningTaskInfo> newRunningTaskList = mActivityManager.getMtkRunningTasks();

    if (runningTaskList.size() > newRunningTaskList.size()) {
      int i = 0, j = 0;
      while (i < runningTaskList.size() && j < newRunningTaskList.size()) {
        RunningTaskInfo child = runningTaskList.get(i);
        RunningTaskInfo newChild = newRunningTaskList.get(i);
        if (child.id != newChild.id) {
          runningTaskList.remove(i);
        } else {
          i++;
          j++;
        }
      }
      while (i < runningTaskList.size()) {
        runningTaskList.remove(i);
      }
    }

    if (runningTaskList != null && runningTaskList.size() > 1) {
      RunningTaskInfo currenTaskInfo = runningTaskList.get(0);
      ComponentName currentActivity = runningTaskList.get(0).topActivity;

      GetCurrentTask ct = GetCurrentTask.getInstance(mContext);

      if ("com.mediatek.ui.TurnkeyUiMainActivity".equals(currentActivity.getClassName())) {
        Intent mIntent = new Intent(START_ACTION);
        mContext.sendBroadcast(mIntent);
        if (mBreComponentName) {
          pauseMainOutput();

          try {
            ActivityManagerNative.getDefault().moveTaskToFront(mLastTastId, 0, null);
          } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }

          myHandler.removeMessages(MessageType.MESSAGE_FOR_CHECK_SWAP);
          MtkLog.d(TAG, "come in send MessageType.MESSAGE_FOR_CHECK_SWAP");
          myHandler.sendEmptyMessageDelayed(MessageType.MESSAGE_FOR_CHECK_SWAP, 700);
        }
      } else {
        if (ct.isCurActivtyMeidaMainActivity()) {
          toastNofunction();
          return;
        }

        if (!ct.isCurTaskTKUI()) {
          mBreComponentName = true;
          mLastTastId = currenTaskInfo.id;

          changeModeToNormal();

          try {
            for (int i = 0; i < runningTaskList.size(); i++) {
              if ("com.mediatek.ui.TurnkeyUiMainActivity"
                  .equals(runningTaskList.get(i).baseActivity.getClassName())) {
                ActivityManagerNative.getDefault()
                    .moveTaskToFront(runningTaskList.get(i).id, 0, null);
                break;
              }
            }
          } catch (RemoteException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
    }
  }
Esempio n. 11
0
  private void setScreenPos() {
    switch (currentPos) {
      case PIP_POS_ZERO:
        if (currentSize == PIP_SIZE_SMALL) {
          x = 0.1f;
          y = 0.7f;
          w = 0.3f;
          h = 0.9f;
        } else if (currentSize == PIP_SIZE_MIDDLE) {
          x = 0.1f;
          y = 0.6f;
          w = 0.4f;
          h = 0.9f;
        } else {
          x = 0.1f;
          y = 0.5f;
          w = 0.5f;
          h = 0.9f;
        }
        break;

      case PIP_POS_ONE:
        if (currentSize == PIP_SIZE_SMALL) {
          x = 0.7f;
          y = 0.7f;
          w = 0.9f;
          h = 0.9f;
        } else if (currentSize == PIP_SIZE_MIDDLE) {
          x = 0.6f;
          y = 0.6f;
          w = 0.9f;
          h = 0.9f;
        } else {
          x = 0.5f;
          y = 0.5f;
          w = 0.9f;
          h = 0.9f;
        }
        break;

      case PIP_POS_TWO:
        if (currentSize == PIP_SIZE_SMALL) {
          x = 0.4f;
          y = 0.4f;
          w = 0.6f;
          h = 0.6f;
        } else if (currentSize == PIP_SIZE_MIDDLE) {
          x = 0.35f;
          y = 0.35f;
          w = 0.65f;
          h = 0.65f;
        } else {
          x = 0.3f;
          y = 0.3f;
          w = 0.7f;
          h = 0.7f;
        }
        break;

      case PIP_POS_THREE:
        if (currentSize == PIP_SIZE_SMALL) {
          x = 0.7f;
          y = 0.1f;
          w = 0.9f;
          h = 0.3f;
        } else if (currentSize == PIP_SIZE_MIDDLE) {
          x = 0.6f;
          y = 0.1f;
          w = 0.9f;
          h = 0.4f;
        } else {
          x = 0.5f;
          y = 0.1f;
          w = 0.9f;
          h = 0.5f;
        }
        break;

      case PIP_POS_FOUR:
        if (currentSize == PIP_SIZE_SMALL) {
          x = 0.1f;
          y = 0.1f;
          w = 0.3f;
          h = 0.3f;
        } else if (currentSize == PIP_SIZE_MIDDLE) {
          x = 0.1f;
          y = 0.1f;
          w = 0.4f;
          h = 0.4f;
        } else {
          x = 0.1f;
          y = 0.1f;
          w = 0.5f;
          h = 0.5f;
        }
        break;

      default:
        break;
    }

    MtkLog.i("SCAL", "~~~~~~~(x,y,w,h)" + "(" + x + "," + y + "," + w + "," + h + ")");
  }
Esempio n. 12
0
  @Override
  public List<FileAdapter> listAllFiles(String path) {
    MtkLog.d(TAG, "------List All login Files : " + path);

    try {
      mFiles.clear();
      int type = SambaManager.TYPE_ALL;

      switch (mContentType) {
        case CONTENT_PHOTO:
          type = SambaManager.TYPE_IMAGE;
          break;
        case CONTENT_AUDIO:
          type = SambaManager.TYPE_AUDIO;
          break;
        case CONTENT_VIDEO:
          type = SambaManager.TYPE_VIDEO;
          break;
        case CONTENT_TEXT:
          type = SambaManager.TYPE_TEXT;
          break;
        case CONTENT_THRDPHOTO:
          type = SambaManager.TYPE_THRIMAGE;
          break;
        default:
          break;
      }

      LinkedList<String> filePaths = mOperator.getSmbFileList(path, type);
      filePaths = mOperator.sortByName(filePaths);

      mFiles = wrapFiles(filePaths);
      logFiles(TAG);

    } catch (SmbAuthException e) {
      e.printStackTrace();
      if (localLOGV) MtkLog.d(TAG, "Try to connect to login : "******"Try to connect to login : ?  GUEST  '' ");
          login(path, "?", "GUEST", "");
          mLoginCount++;
          listAllFiles(path);
        } else if (mLoginCount == 1) {
          if (localLOGV) MtkLog.d(TAG, "Try to connect to login : null null null");
          login(path, null, null, null);
          mLoginCount++;
          listAllFiles(path);
        } else if (mLoginCount == 2) {

          if (localLOGV) MtkLog.d(TAG, " --- User name and Password is not correct. ");
          mLoginCount = 0;
          setChanged();
          notifyObservers(REQUEST_LOGIN);
        }
      } else {
        setChanged();
        notifyObservers(REQUEST_LOGIN);
      }
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (SmbException e) {
      e.printStackTrace();
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
    System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
    sortFile();
    return mFiles;
  }