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


Java MenuItem.expandActionView方法代码示例

本文整理汇总了Java中android.view.MenuItem.expandActionView方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.expandActionView方法的具体用法?Java MenuItem.expandActionView怎么用?Java MenuItem.expandActionView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MenuItem的用法示例。


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

示例1: onOptionsItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.users_action_filter:
            sortItem.collapseActionView();
            item.expandActionView();
            return true;
        case R.id.users_action_sort:
            filterItem.collapseActionView();
            item.expandActionView();
            return true;
        case R.id.filter_default:
            presenter.sortDefault();
            sortItem.collapseActionView();
            return true;
        case R.id.filter_name_asc:
            presenter.sortByNameAsc();
            sortItem.collapseActionView();
            return true;
        case R.id.filter_name_desc:
            presenter.sortByNameDesc();
            sortItem.collapseActionView();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:27,代码来源:UsersFragment.java

示例2: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.fragment_courses, menu);
    MenuItem item = menu.findItem(R.id.action_courses_search);
    SearchView searchView = (SearchView) item.getActionView();
    searchView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    searchView.setOnQueryTextListener(this);
    if (!"".equals(lastQuery)) {
        searchView.setQuery(lastQuery, false);
        item.expandActionView();
    }
}
 
开发者ID:whirlwind-studios,项目名称:School1-Android,代码行数:13,代码来源:CoursesFragment.java

示例3: onPrepareOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();
    final MenuItem createDir = menu.findItem(R.id.menu_create_dir);
    final MenuItem search = menu.findItem(R.id.menu_search);
    final MenuItem sort = menu.findItem(R.id.menu_sort);
    final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
    final MenuItem grid = menu.findItem(R.id.menu_grid);
    final MenuItem list = menu.findItem(R.id.menu_list);
    sort.setVisible(cwd != null);
    grid.setVisible(mState.derivedMode != State.MODE_GRID);
    list.setVisible(mState.derivedMode != State.MODE_LIST);
    if (mState.currentSearch != null) {
        // Search uses backend ranking; no sorting
        sort.setVisible(false);
        search.expandActionView();
        mSearchView.setIconified(false);
        mSearchView.clearFocus();
        mSearchView.setQuery(mState.currentSearch, false);
    } else {
        mIgnoreNextClose = true;
        mSearchView.setIconified(true);
        mSearchView.clearFocus();
        mIgnoreNextCollapse = true;
        search.collapseActionView();
    }
    // Only sort by size when visible
    sortSize.setVisible(mState.showSize);
    search.setVisible(true);
    createDir.setVisible(true);
    return true;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:36,代码来源:StandaloneActivity.java

示例4: onCreateOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    getMenuInflater().inflate(R.menu.menu_user_search, menu);
    final MenuItem searchActionMenuItem = menu.findItem(R.id.menu_search);
    searchView = (SearchView) searchActionMenuItem.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            if (!searchView.isIconified()) {
                searchView.setIconified(true);
            }
            userSearchPresenter.search(query);
            toolbar.setTitle(query);
            searchActionMenuItem.collapseActionView();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String s) {
            return false;
        }
    });
    searchActionMenuItem.expandActionView();
    return true;
}
 
开发者ID:moyheen,项目名称:github-user-search,代码行数:28,代码来源:UserSearchActivity.java

示例5: onOptionsItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case R.id.action_save:
            ownerId = spinnerProjectUsers.getSelectedItemPosition();
            if (spinnerProjectUsers.getSelectedItemPosition() != 0) {
                for (Enumeration<Integer> iter = projectUsers.keys(); iter.hasMoreElements();) {
                    Integer key = iter.nextElement();
                    if (projectUsers.get(key).contentEquals((String) spinnerProjectUsers.getSelectedItem())) {
                        ownerId = key;
                        break;
                    }
                }
            }
            if (isNewTask) {
                kanboardAPI.createTask(editTextTitle.getText().toString(), projectid, colorId != null ? colorId : defaultColor, columnId, ownerId, null, dueDate, editTextDescription.getText().toString(), null, null, swimlaneId, null, null, null, null, null, null, null, startDate);

            } else {
                kanboardAPI.updateTask(task.getId(), editTextTitle.getText().toString(), colorId != null ? colorId : defaultColor, ownerId, dueDate, editTextDescription.getText().toString(), null, null, null, null, null, null, null, null, null, startDate);
            }
            ProgressBar prog = new ProgressBar(TaskEditActivity.this);
            prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY);
            item.setActionView(prog);
            item.expandActionView();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:andresth,项目名称:Kandroid,代码行数:34,代码来源:TaskEditActivity.java

示例6: updateMenuItems

import android.view.MenuItem; //导入方法依赖的package包/类
public void updateMenuItems(Menu menu){
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();

    if(isTelevision()) {
        menu.findItem(R.id.menu_create_dir).setVisible(showActionMenu());
        menu.findItem(R.id.menu_create_file).setVisible(showActionMenu());
    }
    final MenuItem search = menu.findItem(R.id.menu_search);
    final MenuItem sort = menu.findItem(R.id.menu_sort);
    final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
    final MenuItem grid = menu.findItem(R.id.menu_grid);
    final MenuItem list = menu.findItem(R.id.menu_list);
    final MenuItem settings = menu.findItem(R.id.menu_settings);

    // Open drawer means we hide most actions
    if (isRootsDrawerOpen()) {
        search.setVisible(false);
        sort.setVisible(false);
        grid.setVisible(false);
        list.setVisible(false);
        mIgnoreNextCollapse = true;
        search.collapseActionView();
        return;
    }

    sort.setVisible(cwd != null);
    grid.setVisible(!RootInfo.isOtherRoot(getCurrentRoot()) && mState.derivedMode != MODE_GRID);
    list.setVisible(mState.derivedMode != MODE_LIST);

    if (mState.currentSearch != null) {
        // Search uses backend ranking; no sorting
        //sort.setVisible(false);

        search.expandActionView();

        mSearchView.setIconified(false);
        mSearchView.clearFocus();
        mSearchView.setQuery(mState.currentSearch, false);
    } else {
        mIgnoreNextClose = true;
        mSearchView.setIconified(true);
        mSearchView.clearFocus();

        mIgnoreNextCollapse = true;
        search.collapseActionView();
    }

    // Only sort by size when visible
    sortSize.setVisible(mState.showSize);

    final boolean searchVisible;
    if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
        searchVisible = false;

        // No display options in recent directories
        if (cwd == null) {
            grid.setVisible(false);
            list.setVisible(false);
        }
        if (mState.action == State.ACTION_CREATE) {
            if (null != SaveFragment.get(fm))
                SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
        }
    } else {
        searchVisible = root != null
                && ((root.flags & Root.FLAG_SUPPORTS_SEARCH) != 0);
        // TODO: Is this useful?
        if(null != SaveFragment.get(fm))
            SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());

        if(null != MoveFragment.get(fm))
            MoveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isMoveSupported());
    }

    // TODO: close any search in-progress when hiding
    search.setVisible(searchVisible);

    settings.setVisible(mState.action != ACTION_MANAGE);
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:82,代码来源:DocumentsActivity.java

示例7: expandActionView

import android.view.MenuItem; //导入方法依赖的package包/类
public static boolean expandActionView(MenuItem item) {
    return item.expandActionView();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:MenuItemCompatIcs.java

示例8: updateMenuItems

import android.view.MenuItem; //导入方法依赖的package包/类
public void updateMenuItems(Menu menu){
    final FragmentManager fm = getFragmentManager();
    final RootInfo root = getCurrentRoot();
    final DocumentInfo cwd = getCurrentDirectory();

    if(isTelevision()) {
        menu.findItem(R.id.menu_create_dir).setVisible(showActionMenu());
        menu.findItem(R.id.menu_create_file).setVisible(showActionMenu());
    }
    final MenuItem search = menu.findItem(R.id.menu_search);
    final MenuItem sort = menu.findItem(R.id.menu_sort);
    final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
    final MenuItem grid = menu.findItem(R.id.menu_grid);
    final MenuItem list = menu.findItem(R.id.menu_list);
    final MenuItem settings = menu.findItem(R.id.menu_settings);

    // Open drawer means we hide most actions
    if (isRootsDrawerOpen()) {
        search.setVisible(false);
        sort.setVisible(false);
        grid.setVisible(false);
        list.setVisible(false);
        mIgnoreNextCollapse = true;
        search.collapseActionView();
        return;
    }

    sort.setVisible(cwd != null);
    grid.setVisible(!RootInfo.isOtherRoot(getCurrentRoot()) && mState.derivedMode != MODE_GRID);
    list.setVisible(mState.derivedMode != MODE_LIST);

    if (mState.currentSearch != null) {
        // Search uses backend ranking; no sorting
        //sort.setVisible(false);

        search.expandActionView();

        mSearchView.setIconified(false);
        mSearchView.clearFocus();
        mSearchView.setQuery(mState.currentSearch, false);
    } else {
        mIgnoreNextClose = true;
        mSearchView.setIconified(true);
        mSearchView.clearFocus();

        mIgnoreNextCollapse = true;
        search.collapseActionView();
    }

    // Only sort by size when visible
    sortSize.setVisible(mState.showSize);

    final boolean searchVisible;
    if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
        searchVisible = false;

        // No display options in recent directories
        if (cwd == null) {
            grid.setVisible(false);
            list.setVisible(false);
        }
        if (mState.action == State.ACTION_CREATE) {
            if (null != SaveFragment.get(fm))
                SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
        }
    } else {
        searchVisible = root != null
                && ((root.flags & Root.FLAG_SUPPORTS_SEARCH) != 0);
        // TODO: Is this useful?
        if(null != SaveFragment.get(fm))
            SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());

        if(null != MoveFragment.get(fm))
            MoveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isMoveSupported());
    }

    // TODO: close any search in-progress when hiding
    search.setVisible(searchVisible);

    //settings.setVisible(mState.action != ACTION_MANAGE);
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:82,代码来源:DocumentsActivity.java

示例9: onCreateActionMode

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
        public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {


//            mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_menu));
            mSearchView = new SearchView(getSupportActionBar().getThemedContext());
            ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
            mSearchView.setLayoutParams(params);
            mSearchView.setLayoutParams(new ActionBar.LayoutParams(Gravity.LEFT));
            mSearchView.setMaxWidth(Integer.MAX_VALUE);


//            mSearchView = new SearchView();


            setupSearchView(mSearchView);

            // search menu item
            MenuItem searchMenuItem = menu.add(Menu.NONE, Menu.NONE, 2, getString(R.string.menu_search));
            searchMenuItem.setIcon(R.drawable.search);
            searchMenuItem.expandActionView();
            MenuItemCompat.setActionView(searchMenuItem, mSearchView);
            MenuItemCompat.setShowAsAction(searchMenuItem, MenuItem.SHOW_AS_ACTION_ALWAYS);


            MenuItem searchMenuItem3 = menu.add(Menu.NONE, Menu.NONE, 1, getString(R.string.menu_search));
            searchMenuItem3.setIcon(R.drawable.search);
            MenuItemCompat.setActionView(searchMenuItem3, iv);
            MenuItemCompat.setShowAsAction(searchMenuItem3, MenuItem.SHOW_AS_ACTION_ALWAYS);


            return true;
        }
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:34,代码来源:MainActivity.java


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