当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedEditText类代码示例

本文整理汇总了Java中com.android.launcher3.ExtendedEditText的典型用法代码示例。如果您正苦于以下问题:Java ExtendedEditText类的具体用法?Java ExtendedEditText怎么用?Java ExtendedEditText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExtendedEditText类属于com.android.launcher3包,在下文中一共展示了ExtendedEditText类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.android.launcher3.ExtendedEditText; //导入依赖的package包/类
/**
 * Sets the references to the apps model and the search result callback.
 */
public final void initialize(
        AlphabeticalAppsList apps, ExtendedEditText input,
        Launcher launcher, Callbacks cb) {
    mApps = apps;
    mCb = cb;
    mLauncher = launcher;

    mInput = input;
    mInput.addTextChangedListener(this);
    mInput.setOnEditorActionListener(this);
    mInput.setOnBackKeyListener(this);

    mInputMethodManager = (InputMethodManager)
            mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

    mSearchAlgorithm = onInitializeSearch();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:AllAppsSearchBarController.java

示例2: getView

import com.android.launcher3.ExtendedEditText; //导入依赖的package包/类
@Override
public View getView(ViewGroup parent) {
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    mSearchView = inflater.inflate(R.layout.all_apps_search_bar, parent, false);
    mSearchView.setOnClickListener(this);

    mSearchButtonView = mSearchView.findViewById(R.id.search_button);
    mSearchBarContainerView = mSearchView.findViewById(R.id.search_container);
    mDismissSearchButtonView = mSearchBarContainerView.findViewById(R.id.dismiss_search_button);
    mDismissSearchButtonView.setOnClickListener(this);
    mSearchBarEditView = (ExtendedEditText)
            mSearchBarContainerView.findViewById(R.id.search_box_input);
    mSearchBarEditView.addTextChangedListener(this);
    mSearchBarEditView.setOnEditorActionListener(this);
    mSearchBarEditView.setOnBackKeyListener(
            new ExtendedEditText.OnBackKeyListener() {
                @Override
                public boolean onBackKey() {
                    // Only hide the search field if there is no query, or if there
                    // are no filtered results
                    String query = Utilities.trim(
                            mSearchBarEditView.getEditableText().toString());
                    if (query.isEmpty() || mApps.hasNoFilteredResults()) {
                        hideSearchField(true, mFocusRecyclerViewRunnable);
                        return true;
                    }
                    return false;
                }
            });
    return mSearchView;
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:32,代码来源:DefaultAppSearchController.java

示例3: onFinishInflate

import com.android.launcher3.ExtendedEditText; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    // This is a focus listener that proxies focus from a view into the list view.  This is to
    // work around the search box from getting first focus and showing the cursor.
    getContentView().setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                mAppsRecyclerView.requestFocus();
            }
        }
    });

    mSearchContainer = findViewById(R.id.search_container);

    if(Utilities.isAllowNightModePrefEnabled(getContext())) {
        mSearchContainer.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.night_color));
    }else{
        if(Utilities.getDrawerBackgroundPrefEnabled(getContext()) != -1){
            mSearchContainer.setBackgroundColor(Utilities.getDrawerBackgroundPrefEnabled(getContext()));
        }else {
            mSearchContainer.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.white));
        }
    }
    mSearchInput = (ExtendedEditText) findViewById(R.id.search_box_input);

    // Update the hint to contain the icon.
    // Prefix the original hint with two spaces. The first space gets replaced by the icon
    // using span. The second space is used for a singe space character between the hint
    // and the icon.
    SpannableString spanned = new SpannableString("  " + mSearchInput.getHint());
    spanned.setSpan(new TintedDrawableSpan(getContext(), R.drawable.ic_allapps_search),
            0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
    mSearchInput.setHint(spanned);

    mSearchContainerOffsetTop = getResources().getDimensionPixelSize(
            R.dimen.all_apps_search_bar_margin_top);

    mElevationController = Utilities.ATLEAST_LOLLIPOP
            ? new HeaderElevationController.ControllerVL(mSearchContainer)
            : new HeaderElevationController.ControllerV16(mSearchContainer);

    // Load the all apps recycler view
    mAppsRecyclerView = (AllAppsRecyclerView) findViewById(R.id.apps_list_view);
    mAppsRecyclerView.setApps(mApps);
    mAppsRecyclerView.setLayoutManager(mLayoutManager);
    mAppsRecyclerView.setAdapter(mAdapter);
    mAppsRecyclerView.setHasFixedSize(true);
    mAppsRecyclerView.addOnScrollListener(mElevationController);
    mAppsRecyclerView.setElevationController(mElevationController);

    if (mItemDecoration != null) {
        mAppsRecyclerView.addItemDecoration(mItemDecoration);
    }

    FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mAppsRecyclerView);
    mAppsRecyclerView.addItemDecoration(focusedItemDecorator);
    mAppsRecyclerView.preMeasureViews(mAdapter);
    mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());

    if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
        getRevealView().setVisibility(View.VISIBLE);
        getContentView().setVisibility(View.VISIBLE);
        getContentView().setBackground(null);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:69,代码来源:AllAppsContainerView.java

示例4: onFinishInflate

import com.android.launcher3.ExtendedEditText; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    // This is a focus listener that proxies focus from a view into the list view.  This is to
    // work around the search box from getting first focus and showing the cursor.
    getContentView().setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                mAppsRecyclerView.requestFocus();
            }
        }
    });

    mSearchContainer = findViewById(R.id.search_container);
    mSearchInput = (ExtendedEditText) findViewById(R.id.search_box_input);

    // Update the hint to contain the icon.
    // Prefix the original hint with two spaces. The first space gets replaced by the icon
    // using span. The second space is used for a singe space character between the hint
    // and the icon.
    SpannableString spanned = new SpannableString("  " + mSearchInput.getHint());
    spanned.setSpan(new TintedDrawableSpan(getContext(), R.drawable.ic_allapps_search),
            0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
    mSearchInput.setHint(spanned);

    mSearchContainerOffsetTop = getResources().getDimensionPixelSize(
            R.dimen.all_apps_search_bar_margin_top);

    mElevationController = Utilities.ATLEAST_LOLLIPOP
            ? new HeaderElevationController.ControllerVL(mSearchContainer)
            : new HeaderElevationController.ControllerV16(mSearchContainer);

    // Load the all apps recycler view
    mAppsRecyclerView = (AllAppsRecyclerView) findViewById(R.id.apps_list_view);
    mAppsRecyclerView.setApps(mApps);
    mAppsRecyclerView.setLayoutManager(mLayoutManager);
    mAppsRecyclerView.setAdapter(mAdapter);
    mAppsRecyclerView.setHasFixedSize(true);
    mAppsRecyclerView.addOnScrollListener(mElevationController);
    mAppsRecyclerView.setElevationController(mElevationController);

    if (mItemDecoration != null) {
        mAppsRecyclerView.addItemDecoration(mItemDecoration);
    }

    FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mAppsRecyclerView);
    mAppsRecyclerView.addItemDecoration(focusedItemDecorator);
    mAppsRecyclerView.preMeasureViews(mAdapter);
    mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());

    if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
        getRevealView().setVisibility(View.VISIBLE);
        getContentView().setVisibility(View.VISIBLE);
        getContentView().setBackground(null);
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:59,代码来源:AllAppsContainerView.java


注:本文中的com.android.launcher3.ExtendedEditText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。