當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。