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

The following examples show how to use android.view.MenuItem#setIntent() . These examples are extracted from open source projects. 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 Project: YiBo   File: UserContextMenuListener.java    License: Apache License 2.0 6 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 Project: NanoIconPack   File: MainActivity.java    License: 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 Project: Camera2   File: CameraActivity.java    License: 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 4
@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 5
@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 6
@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
@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 8
@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 9
@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 Project: coursera-android   File: DialtactsActivity.java    License: 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 11
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    ShareCompatICS.configureMenuItem(item, shareIntent.getActivity(),
            shareIntent.getIntent());
    if (shouldAddChooserIntent(item)) {
        item.setIntent(shareIntent.createChooserIntent());
    }
}
 
Example 12
@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 Project: ResearchStack   File: MainActivity.java    License: 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 14
Source Project: MiBandDecompiled   File: aa.java    License: 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 15
Source Project: V.FlyoutTest   File: ShareCompat.java    License: MIT License 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 16
Source Project: letv   File: ShareCompat.java    License: Apache License 2.0 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 17
Source Project: letv   File: ShareCompat.java    License: 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
private void finishCreatingMenu(Menu menu) {
    // Retrieve the share menu item
    MenuItem menuItem = menu.findItem(R.id.action_share);
    menuItem.setIntent(createShareForecastIntent());
}
 
Example 19
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}
 
Example 20
Source Project: guideshow   File: ShareCompat.java    License: MIT License 4 votes vote down vote up
public void configureMenuItem(MenuItem item, IntentBuilder shareIntent) {
    item.setIntent(shareIntent.createChooserIntent());
}