Beispiel #1
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();
    mContent = (CellLayout) findViewById(R.id.folder_content);
    mContent.setGridSize(0, 0);
    mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
    mFolderName = (FolderEditText) findViewById(R.id.folder_name);
    mFolderName.setFolder(this);
    mFolderName.setOnFocusChangeListener(this);

    // 算出TextView最终需要多大,以便可以给它腾出适合大小的地方
    int measureSpec = MeasureSpec.UNSPECIFIED;
    mFolderName.measure(measureSpec, measureSpec);
    mFolderNameHeight = mFolderName.getMeasuredHeight();

    // We disable action mode for now since it messes up the view on phones
    // 暂时禁止action mode,因为它有可能会情致view混乱
    mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
    mFolderName.setOnEditorActionListener(this);
    mFolderName.setSelectAllOnFocus(true);
    mFolderName.setInputType(
        mFolderName.getInputType()
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
  }
Beispiel #2
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();
    mContent = (CellLayout) findViewById(R.id.folder_content);
    mContent.setGridSize(0, 0);
    mContent.getChildrenLayout().setMotionEventSplittingEnabled(false);
    mFolderName = (FolderEditText) findViewById(R.id.folder_name);
    mFolderName.setFolder(this);
    mFolderName.setOnFocusChangeListener(this);

    // We find out how tall the text view wants to be (it is set to wrap_content), so that
    // we can allocate the appropriate amount of space for it.
    int measureSpec = MeasureSpec.UNSPECIFIED;
    mFolderName.measure(measureSpec, measureSpec);
    mFolderNameHeight = mFolderName.getMeasuredHeight();

    // We disable action mode for now since it messes up the view on phones
    mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
    mFolderName.setOnEditorActionListener(this);
    mFolderName.setSelectAllOnFocus(true);
    mFolderName.setInputType(
        mFolderName.getInputType()
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
  }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();
    mScrollView = (ScrollView) findViewById(R.id.scroll_view);
    mContent = (CellLayout) findViewById(R.id.folder_content);

    mFocusIndicatorHandler = new FocusIndicatorView(getContext());
    mContent.addView(mFocusIndicatorHandler, 0);
    mFocusIndicatorHandler.getLayoutParams().height = FocusIndicatorView.DEFAULT_LAYOUT_SIZE;
    mFocusIndicatorHandler.getLayoutParams().width = FocusIndicatorView.DEFAULT_LAYOUT_SIZE;

    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();

    mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx);
    mContent.setGridSize(0, 0);
    mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
    mContent.setInvertIfRtl(true);
    mFolderName = (FolderEditText) findViewById(R.id.folder_name);
    mFolderName.setFolder(this);
    if (mLauncher.getLockWorkspace()) {
      mFolderName.setKeyListener(null);
      mFolderName.setFocusable(false);
    } else {
      mFolderName.setOnFocusChangeListener(this);
    }

    // We find out how tall the text view wants to be (it is set to wrap_content), so that
    // we can allocate the appropriate amount of space for it.
    int measureSpec = MeasureSpec.UNSPECIFIED;
    mFolderName.measure(measureSpec, measureSpec);
    mFolderNameHeight = mFolderName.getMeasuredHeight();

    // We disable action mode for now since it messes up the view on phones
    mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
    mFolderName.setOnEditorActionListener(this);
    mFolderName.setSelectAllOnFocus(true);
    mFolderName.setInputType(
        mFolderName.getInputType()
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    mAutoScrollHelper = new FolderAutoScrollHelper(mScrollView);

    boolean hideFolderName =
        SettingsProvider.getBoolean(mLauncher, SettingsProvider.HIDE_FOLDER_NAME, false);
    if (hideFolderName) {
      mFolderName.setVisibility(View.GONE);
      mFolderNameHeight = 0;
    }
  }