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


Java SubMenu.clear方法代码示例

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


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

示例1: populateProjectsMenu

import android.view.SubMenu; //导入方法依赖的package包/类
private void populateProjectsMenu() {
    if (mProjectList == null) {
        if (BuildConfig.DEBUG) Log.d("Kandroid", "Tried to populate drawer, but mDashboard was null");
        return;
    }
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getBaseContext());
    List<KanboardProject> projList = mProjectList;
    if (preferences.getBoolean("projects_sort_alphabetic", false))
        Collections.sort(projList);
    NavigationView nav = (NavigationView) findViewById(R.id.nav_view);
    SubMenu projMenu = nav.getMenu().findItem(R.id.projects).getSubMenu();
    projMenu.clear();
    for (KanboardProject item: projList)
        projMenu.add(Menu.NONE, item.getId(), Menu.NONE, item.getName())
                .setIcon(R.drawable.project);
}
 
开发者ID:andresth,项目名称:Kandroid,代码行数:17,代码来源:MainActivity.java

示例2: onPrepareSubMenu

import android.view.SubMenu; //导入方法依赖的package包/类
public void onPrepareSubMenu(SubMenu subMenu) {
    int i;
    subMenu.clear();
    ActivityChooserModel dataModel = ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName);
    PackageManager packageManager = this.mContext.getPackageManager();
    int expandedActivityCount = dataModel.getActivityCount();
    int collapsedActivityCount = Math.min(expandedActivityCount, this.mMaxShownActivityCount);
    for (i = 0; i < collapsedActivityCount; i++) {
        ResolveInfo activity = dataModel.getActivity(i);
        subMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
    }
    if (collapsedActivityCount < expandedActivityCount) {
        SubMenu expandedSubMenu = subMenu.addSubMenu(0, collapsedActivityCount, collapsedActivityCount, this.mContext.getString(R.string.abc_activity_chooser_view_see_all));
        for (i = 0; i < expandedActivityCount; i++) {
            activity = dataModel.getActivity(i);
            expandedSubMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ShareActionProvider.java

示例3: onPrepareSubMenu

import android.view.SubMenu; //导入方法依赖的package包/类
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
    subMenu.clear();
    subMenu.add(Menu.NONE,0,Menu.NONE,mContext.getString(R.string.multi_chat))
            .setIcon(R.drawable.multi_chat)
            .setOnMenuItemClickListener(this);
    subMenu.add(Menu.NONE,1,Menu.NONE,mContext.getString(R.string.add_friends))
            .setIcon(R.drawable.add_friends)
            .setOnMenuItemClickListener(this);
    subMenu.add(Menu.NONE,2,Menu.NONE,mContext.getString(R.string.scan))
            .setIcon(R.drawable.scan)
            .setOnMenuItemClickListener(this);
    subMenu.add(Menu.NONE,3,Menu.NONE,mContext.getString(R.string.pay_money))
            .setIcon(R.drawable.pay_money)
            .setOnMenuItemClickListener(this);
    subMenu.add(Menu.NONE,4,Menu.NONE,mContext.getString(R.string.help_devise))
            .setIcon(R.drawable.help_advise)
            .setOnMenuItemClickListener(this);
}
 
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:20,代码来源:PlusActionProvider.java

示例4: onPrepareSubMenu

import android.view.SubMenu; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
	if (replayItem != null) {
		return;
	}
	
	subMenu.clear();
	replayItem = subMenu.add(0, 1, 1, R.string.newly_reply).setIcon(R.drawable.ic_new_replay_checked);
	publishItem = subMenu.add(0, 2, 2, R.string.newly_publish).setIcon(R.drawable.ic_new_publish_unchecked);
	if (mListener != null) {
		replayItem.setOnMenuItemClickListener(mListener);
		publishItem.setOnMenuItemClickListener(mListener);
	}

}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:19,代码来源:ForumFilterProvider.java

示例5: onCreateOptionsMenu

import android.view.SubMenu; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	super.onCreateOptionsMenu(menu, inflater);

	MenuItem filterItem = menu.findItem(R.id.songbook_filter_category);
	if (null != filterItem) {
		SubMenu subMenu = filterItem.getSubMenu();
		subMenu.clear();

		if (null != mSongbook) {
			subMenu.add(Menu.NONE, MENU_CLEAR_FILTER_ID, Menu.NONE, R.string.songbook_show_all);

			List<String> categories = mSongbook.categories();
			for (int i = 0; i < categories.size(); i++) {
				subMenu.add(MENU_CATEGORIES_ID, MENU_CATEGORIES_ID + i, Menu.NONE, categories.get(i));
			}
		}
	}
}
 
开发者ID:wsv-accidis,项目名称:in-sangbok,代码行数:20,代码来源:SongbookFragment.java

示例6: onActionItemClicked

import android.view.SubMenu; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, actionMode, menuItem);

    switch (menuItem.getItemId()) {
        case R.id.query_cab_schedule:
            displayScheduleTimestampDialog(R.id.query_cab_schedule, mSelection.getIds());
            break;

        case R.id.query_cab_state:
            /* Add all known states to menu. */
            SubMenu subMenu = menuItem.getSubMenu();
            if (subMenu != null) {
                subMenu.clear();
                for (String str: new NoteStateSpinner(getActivity(), null).getValues()) {
                    subMenu.add(STATE_ITEM_GROUP, Menu.NONE, Menu.NONE, str);
                }
            }
            break;

        default:
            /* Click on one of the state keywords. */
            if (menuItem.getGroupId() == STATE_ITEM_GROUP) {
                if (mListener != null) {
                    mListener.onStateChangeRequest(mSelection.getIds(), menuItem.getTitle().toString());
                }
                return true;
            }

            return false; // Not handled.
    }

    return true; // Handled.
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:35,代码来源:SearchFragment.java

示例7: onActionItemClicked

import android.view.SubMenu; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, actionMode, menuItem);
    TreeSet<Long> selectionIds;
    switch (menuItem.getItemId()) {
        case R.id.query_cab_schedule:
            selectionIds = originalSelectedIds();
            if (!selectionIds.isEmpty()) {
                displayScheduleTimestampDialog(R.id.query_cab_schedule, selectionIds);
            }
            break;

        case R.id.query_cab_state:
            /* Add all known states to menu. */
            SubMenu subMenu = menuItem.getSubMenu();
            if (subMenu != null) {
                subMenu.clear();
                for (String str: new NoteStateSpinner(getActivity(), null).getValues()) {
                    subMenu.add(STATE_ITEM_GROUP, Menu.NONE, Menu.NONE, str);
                }
            }
            break;

        default:
            /* Click on one of the state keywords. */
            if (menuItem.getGroupId() == STATE_ITEM_GROUP) {
                if (mListener != null) {
                    selectionIds = originalSelectedIds();
                    if (!selectionIds.isEmpty()) {
                        mListener.onStateChangeRequest(selectionIds, menuItem.getTitle().toString());
                    }
                }
                return true;
            }

            return false; // Not handled.
    }

    return true; // Handled.
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:41,代码来源:AgendaFragment.java

示例8: makePlaylistMenu

import android.view.SubMenu; //导入方法依赖的package包/类
public static void makePlaylistMenu(Context context, SubMenu sub, int groupdId) {
    String[] cols = new String[]{
            MediaStore.Audio.Playlists._ID,
            MediaStore.Audio.Playlists.NAME
    };
    ContentResolver resolver = context.getContentResolver();
    if (resolver == null) {
        System.out.println("resolver = null");
    } else {
        String whereclause = MediaStore.Audio.Playlists.NAME + " != ''";
        Cursor cur = resolver.query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
                cols, whereclause, null,
                MediaStore.Audio.Playlists.NAME);
        sub.clear();
        sub.add(groupdId, Defs.NEW_PLAYLIST, 0, R.string.new_playlist);
        if (cur != null && cur.getCount() > 0) {
            //sub.addSeparator(1, 0);
            cur.moveToFirst();
            while (!cur.isAfterLast()) {
                Intent intent = new Intent();
                intent.putExtra("playlist", cur.getLong(0));
                sub.add(groupdId, Defs.PLAYLIST_SELECTED, 0, cur.getString(1)).setIntent(intent);
                cur.moveToNext();
            }
        }
        if (cur != null) {
            cur.close();
        }
    }
}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:31,代码来源:MusicUtils.java

示例9: overflowsubmenu

import android.view.SubMenu; //导入方法依赖的package包/类
public static void overflowsubmenu(Context context, SubMenu subMenu) {
    String[] cols = new String[]{
            MediaStore.Audio.Playlists._ID,
            MediaStore.Audio.Playlists.NAME
    };
    ContentResolver resolver = context.getContentResolver();
    if (resolver == null) {
        System.out.println("resolver = null");
    } else {
        String whereclause = MediaStore.Audio.Playlists.NAME + " != ''";
        Cursor cur = resolver.query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
                cols, whereclause, null,
                MediaStore.Audio.Playlists.NAME);
        subMenu.clear();
        subMenu.add(0, Defs.NEW_PLAYLIST, 0, R.string.new_playlist);
        if (cur != null && cur.getCount() > 0) {
            //sub.addSeparator(1, 0);
            cur.moveToFirst();
            while (!cur.isAfterLast()) {
                Intent intent = new Intent();
                intent.putExtra("playlist", cur.getLong(0));
                subMenu.add(0, Defs.PLAYLIST_SELECTED, 0, cur.getString(1)).setIntent(intent);
                cur.moveToNext();
            }
        }
        if (cur != null) {
            cur.close();
        }
    }
}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:31,代码来源:MusicUtils.java

示例10: makePlaylistMenuOnline

import android.view.SubMenu; //导入方法依赖的package包/类
/**
 * Same as makePlaylistMenu, but only for online provides
 *
 * @param context The context to use for creating the menu items
 * @param sub     The submenu to add the items to.
 */
public static void makePlaylistMenuOnline(Context context, SubMenu sub) {
    String[] cols = new String[]{MediaStore.Audio.Playlists._ID,
            MediaStore.Audio.Playlists.NAME};
    ContentResolver resolver = context.getContentResolver();
    if (resolver == null) {
    } else {
        String whereclause = MediaStore.Audio.Playlists.NAME + " != ''";
        Cursor cur = resolver.query(
                MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, cols,
                whereclause, null, MediaStore.Audio.Playlists.NAME);
        sub.clear();
        sub.add(1, Defs.QUEUE, 0, R.string.queue);
        sub.add(1, Defs.NEW_PLAYLIST, 0, R.string.new_playlist);
        if (cur != null && cur.getCount() > 0) {
            // sub.addSeparator(1, 0);
            cur.moveToFirst();
            while (!cur.isAfterLast()) {
                if (cur.getLong(0) == MusicUtils.getPlaylistiD(cur
                        .getString(1))) {
                    Intent intent = new Intent();
                    intent.putExtra("playlist", cur.getLong(0));
                    intent.putExtra("name", cur.getString(1));
                    // if (cur.getInt(0) == mLastPlaylistSelected) {
                    // sub.add(0, MusicBaseActivity.PLAYLIST_SELECTED,
                    // cur.getString(1)).setIntent(intent);
                    // } else {
                    sub.add(1, Defs.PLAYLIST_SELECTED, 0, cur.getString(1))
                            .setIntent(intent);
                    // }
                }
                cur.moveToNext();
            }
        }
        if (cur != null) {
            cur.close();
        }
    }
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:45,代码来源:MusicUtils.java

示例11: refresh

import android.view.SubMenu; //导入方法依赖的package包/类
public void refresh(boolean loadFromFile)
{
    //Chargement de la liste des groupes
    if (loadFromFile) {
        groups = GroupManager.readGroups(this);
    }

    if (groups.isEmpty()) {
        this.startActivity(new Intent(this, AddGroupActivity.class));
        finish();
        return;
    }

    SubMenu subMenu = navigationView.getMenu().getItem(0).getSubMenu();
    subMenu.clear();

    for (int i = 0; i < groups.size(); i++) {
        Group g = groups.get(i);
        subMenu.add(DRAWER_GROUP_ID, i, Menu.FIRST, g.name);
    }
    subMenu.setGroupCheckable(DRAWER_GROUP_ID, true, true);

    navigationView.invalidate();

    Group lastSelectedGroup = GroupManager.getSelectedGroup(this);
    //Si on a un SELECT_LAST_ONE de défini
    if (getIntent().getBooleanExtra(INTENT_SELECT_LAST_ONE, false))
    {
        selectGroup(groups.get(groups.size()-1));
    }
    else if (lastSelectedGroup != null && groups.contains(lastSelectedGroup))
    {
        selectGroup(lastSelectedGroup);
    }
    else
    {
        selectGroup(groups.get(0));
    }
}
 
开发者ID:natinusala,项目名称:openedt,代码行数:40,代码来源:MainActivity.java


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