Java Code Examples for android.view.MenuItem#setIntent()

The following examples show how to use android.view.MenuItem#setIntent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserContextMenuListener.java    From YiBo with Apache License 2.0 7 votes vote down vote up
private void analyzeUserMenu(final Adapter adapter, final User user, ContextMenu menu, final Context context) {
	menu.setHeaderTitle(R.string.menu_title_blog);
    int order = 0;

    MenuItem commentMenu = menu.add(0, 1, order++, R.string.menu_group_member_user_profile);
    Intent commentIntent = new Intent(context, ProfileActivity.class);
    commentIntent.putExtra("USER", user);
    commentMenu.setIntent(commentIntent);

    MenuItem unfollowMenu = menu.add(0, 2, order++, R.string.menu_group_member_unfollow);
    unfollowMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem item) {
			CacheAdapter<User> cacheAdapter = (CacheAdapter<User>)AdapterUtil.getCacheAdapter(adapter);
			GroupMemberUnfollowTask task = new GroupMemberUnfollowTask(cacheAdapter, user);
			task.execute();
			return false;
		}
    });
    
    MenuItem messageMenu = menu.add(0, 2, order++, R.string.menu_group_member_message);
    Intent messageIntent = new Intent(context, EditDirectMessageActivity.class);
    messageIntent.putExtra("DISPLAY_NAME", user.getDisplayName());
	messageMenu.setIntent(messageIntent);
}
 
Example 2
Source File: MainActivity.java    From NanoIconPack with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.menu_whats_new) {
        sp.save("hideLatest" + PkgUtil.getAppVer(this, "%1$s"), true);
        item.setIntent(new Intent(this, WhatsNewActivity.class));
        return super.onOptionsItemSelected(item);
    } else if (id == R.id.menu_search) {
        item.setIntent(new Intent(this, SearchActivity.class));
        return super.onOptionsItemSelected(item);
    } else if (id == R.id.menu_apply) {
        (new ApplyDialog()).show(getSupportFragmentManager(), "applyDialog");
        return true;
    } else if (id == R.id.menu_about) {
        item.setIntent(new Intent(this, AboutActivity.class));
        return super.onOptionsItemSelected(item);
    }
    return super.onOptionsItemSelected(item);
}
 
Example 3
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 4
Source File: aa.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void a(MenuItem menuitem, ShareCompat.IntentBuilder intentbuilder)
{
    ac.a(menuitem, intentbuilder.a(), intentbuilder.getIntent());
    if (a(menuitem))
    {
        menuitem.setIntent(intentbuilder.createChooserIntent());
    }
}
 
Example 5
Source File: MainActivity.java    From ResearchStack with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    for (ActionItem item : UiManager.getInstance().getMainActionBarItems()) {
        MenuItem menuItem = menu.add(item.getGroupId(),
                item.getId(),
                item.getOrder(),
                item.getTitle());
        menuItem.setIcon(item.getIcon());
        menuItem.setShowAsAction(item.getAction());
        menuItem.setIntent(new Intent(this, item.getClazz()));
    }

    return super.onCreateOptionsMenu(menu);
}
 
Example 6
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 7
Source File: ShareCompat.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    ShareCompatICS.configureMenuItem(item, shareIntent.getActivity(),
            shareIntent.getIntent());
    if (shouldAddChooserIntent(item)) {
        item.setIntent(shareIntent.createChooserIntent());
    }
}
 
Example 8
Source File: DialtactsActivity.java    From coursera-android with MIT License 5 votes vote down vote up
@Override
public void onClick(View view) {
    final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view);
    final Menu menu = popupMenu.getMenu();
    popupMenu.inflate(R.menu.dialtacts_search_options);
    final MenuItem filterOptionMenuItem = menu.findItem(R.id.filter_option);
    filterOptionMenuItem.setOnMenuItemClickListener(mFilterOptionsMenuItemClickListener);
    final MenuItem addContactOptionMenuItem = menu.findItem(R.id.add_contact);
    addContactOptionMenuItem.setIntent(
            new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
    popupMenu.show();
}
 
Example 9
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 10
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 11
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 12
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 13
Source File: DetailActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.detail, menu);
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
    return true;
}
 
Example 14
Source File: CameraActivity.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.filmstrip_menu, menu);
    mActionBarMenu = menu;

    // add a button for launching the gallery
    if (mGalleryIntent != null)
    {
        CharSequence appName = IntentHelper.getGalleryAppName(mAppContext, mGalleryIntent);
        if (appName != null)
        {
            MenuItem menuItem = menu.add(appName);
            menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
            menuItem.setIntent(mGalleryIntent);

            Drawable galleryLogo = IntentHelper.getGalleryIcon(mAppContext, mGalleryIntent);
            if (galleryLogo != null)
            {
                menuItem.setIcon(galleryLogo);
            }
        }
    }

    return super.onCreateOptionsMenu(menu);
}
 
Example 15
Source File: ShareCompat.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 16
Source File: ShareCompat.java    From letv with Apache License 2.0 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 17
Source File: ShareCompat.java    From letv with Apache License 2.0 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    ShareCompatICS.configureMenuItem(item, shareIntent.getActivity(), shareIntent.getIntent());
    if (shouldAddChooserIntent(item)) {
        item.setIntent(shareIntent.createChooserIntent());
    }
}
 
Example 18
Source File: DetailFragment.java    From Advanced_Android_Development with Apache License 2.0 4 votes vote down vote up
private void finishCreatingMenu(Menu menu) {
    // Retrieve the share menu item
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
}
 
Example 19
Source File: ShareCompat.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 20
Source File: ShareCompat.java    From guideshow with MIT License 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}