android.view.MenuItem源码实例Demo

android.view.animation.AnticipateInterpolator#android.view.MenuItem源码实例Demo

下面列出了android.view.animation.AnticipateInterpolator#android.view.MenuItem 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SmartProxy   文件: MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main_activity_actions, menu);

    MenuItem menuItem = menu.findItem(R.id.menu_item_switch);
    if (menuItem == null) {
        return false;
    }

    switchProxy = (Switch) menuItem.getActionView();
    if (switchProxy == null) {
        return false;
    }

    switchProxy.setChecked(LocalVpnService.IsRunning);
    switchProxy.setOnCheckedChangeListener(this);

    return true;
}
 
源代码2 项目: codeexamples-android   文件: CardFlipActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            // Navigate "up" the demo structure to the launchpad activity.
            // See http://developer.android.com/design/patterns/navigation.html for more.
            NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class));
            return true;

        case R.id.action_flip:
            flipCard();
            return true;
    }

    return super.onOptionsItemSelected(item);
}
 
源代码3 项目: PagerTabIndicator   文件: MainActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.text:
            changeTabAdapter(TabAdapterType.TEXT);
            break;
        case R.id.image:
            changeTabAdapter(TabAdapterType.IMAGE);
            break;
        case R.id.web:
            changeTabAdapter(TabAdapterType.WEB);
            break;
        case R.id.custom:
            changeTabAdapter(TabAdapterType.CUSTOM);
            break;
        case R.id.custom_anim:
            changeTabAdapter(TabAdapterType.CUSTOM_ANIM);
            break;
    }
    return true;
}
 
源代码4 项目: MyBookshelf   文件: SearchBookActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case R.id.action_book_source_manage:
            BookSourceActivity.startThis(this, requestSource);
            break;
        case android.R.id.home:
            SoftInputUtil.hideIMM(getCurrentFocus());
            finish();
            break;
        default:
            if (item.getGroupId() == R.id.source_group) {
                item.setChecked(true);
                if (Objects.equals(getString(R.string.all_source), item.getTitle().toString())) {
                    MApplication.SEARCH_GROUP = null;
                } else {
                    MApplication.SEARCH_GROUP = item.getTitle().toString();
                }
                mPresenter.initSearchEngineS(MApplication.SEARCH_GROUP);
            }
    }
    return super.onOptionsItemSelected(item);
}
 
源代码5 项目: odyssey   文件: AllTracksFragment.java
/**
 * Hook called when an menu item in the context menu is selected.
 *
 * @param item The menu item that was selected.
 * @return True if the hook was consumed here.
 */
@Override
public boolean onContextItemSelected(@NonNull MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

    if (info == null) {
        return super.onContextItemSelected(item);
    }

    switch (item.getItemId()) {
        case R.id.fragment_all_tracks_action_enqueue:
            enqueueTrack(info.position, false);
            return true;
        case R.id.fragment_all_tracks_action_enqueueasnext:
            enqueueTrack(info.position, true);
            return true;
        case R.id.fragment_all_tracks_action_play:
            playTrack(info.position, false);
            return true;
        case R.id.fragment_all_tracks_showartist:
            showArtist(info.position);
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
 
源代码6 项目: BrokenView   文件: MainActivity.java
private void initToolbar(){
    toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.action_refresh:
                    mBrokenView.reset();
                    refreshDate();
                    setOnTouchListener();
                    setViewVisible();
                    break;
            }
            return true;
        }
    });
}
 
源代码7 项目: MultiStateView   文件: MainActivity.java
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_camera) {
        // Handle the camera action
    } else if (id == R.id.nav_gallery) {

    } else if (id == R.id.nav_slideshow) {

    } else if (id == R.id.nav_manage) {

    } else if (id == R.id.nav_share) {

    } else if (id == R.id.nav_send) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
源代码8 项目: CoolChat   文件: MainActivity.java
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.nav_menu_setting:
            startActivity(new Intent(MainActivity.this, SettingActivity.class));
            break;
        default:
            showToast("暂未开发");
            DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
            drawer.closeDrawer(GravityCompat.START);

            startActivity(new Intent(MainActivity.this, TestActivity.class));
            break;
    }
    return true;
}
 
源代码9 项目: Ruisi   文件: UserDetailActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.menu_add) {
        if (!App.isLogin(this)) {
            Snackbar.make(coordinatorLayout, "你还没有登录,无法进行操作", Snackbar.LENGTH_LONG)
                    .setAction("点我登录", view -> startActivity(new Intent(getApplicationContext(), LoginActivity.class))).show();
        } else {
            AddFriendDialog dialogFragment = AddFriendDialog.newInstance(
                    this, username, imageUrl);
            dialogFragment.show(getSupportFragmentManager(), "add");
        }

    }
    return super.onOptionsItemSelected(item);
}
 
/**
 * Respond to the user's selection of the Refresh action item. Start the SwipeRefreshLayout
 * progress bar, then initiate the background task that refreshes the content.
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_refresh:
            Log.i(LOG_TAG, "Refresh menu item selected");

            // We make sure that the SwipeRefreshLayout is displaying it's refreshing indicator
            if (!mSwipeRefreshLayout.isRefreshing()) {
                mSwipeRefreshLayout.setRefreshing(true);
            }

            // Start our refresh background task
            initiateRefresh();

            return true;
    }

    return super.onOptionsItemSelected(item);
}
 
源代码11 项目: BigApp_Discuz_Android   文件: PicSelectActivity.java
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();
        if (itemId == android.R.id.home) {
            this.finish();
            return true;
        } else if (itemId == R.id.action_complete) {

            complete();
            return true;
        }

//            case R.id.action_more:
//                // Get the ActionProvider for later usage
//                provider = (MoreActionProvider) menu.findItem(R.id.menu_share)
//                        .getActionProvider();
//                return true;

        return super.onOptionsItemSelected(item);
    }
 
源代码12 项目: Abelana-Android   文件: FriendsFragment.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    //Uses a built-in Android intent to display email addresses from your contacts
    if (id == R.id.action_find_friends) {
        Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
        intent.setType(ContactsContract.CommonDataKinds.Email.CONTENT_TYPE);
        startActivityForResult(intent, PICK_CONTACT_REQUEST);
    }
    /* Alternatively, the user can manually input an email address of a friend they'd like to follow.
     * Note, currently the user must already have the app for the follow to work.
     */
    if (id == R.id.manual_friend_search) {
        showDialog();
    }

    return super.onOptionsItemSelected(item);

}
 
源代码13 项目: UberClone   文件: Home.java
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    switch (id){
        case R.id.nav_trip_history:
            showTripHistory();
            break;
        case R.id.nav_updateInformation:
            showDialogUpdateInfo();
            break;
        case R.id.nav_signOut:
            signOut();
            break;
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
源代码14 项目: coursera-android   文件: QuotesFragment.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        // Show Toast Messages. Toast Messages are discussed in the lesson on user interface classes
        // return value true indicates that the menu click has been handled

        case R.id.detail_menu_item_main:
            Toast.makeText(getActivity().getApplicationContext(),
                    "This action provided by the QuoteFragment",
                    Toast.LENGTH_SHORT).show();
            return true;

        case R.id.detail_menu_item_secondary:
            Toast.makeText(getActivity().getApplicationContext(),
                    "This action is also provided by the QuoteFragment",
                    Toast.LENGTH_SHORT).show();
            return true;

        default:
            return super.onOptionsItemSelected(item);
    }
}
 
源代码15 项目: material-navigation-drawer   文件: MainActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    // AUTOMATICALLY ONLY ON 4.1+ !!!

    int id = item.getItemId();

    if (id == android.R.id.home) {
        if (mDrawerToggle != null) return mDrawerToggle.onOptionsItemSelected(item);
        if (mSlidingLayout != null) {
            if (mSlidingLayout.isOpen()) mSlidingLayout.closePane();
            else mSlidingLayout.openPane();
            return true;
        }
    }

    return super.onOptionsItemSelected(item);
}
 
源代码16 项目: talk-android   文件: TagEditActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            finish();
            break;

        case R.id.action_done:
            final String text = mEditText.getText().toString().trim();
            if (!TextUtils.isEmpty(text)) {
                mPresenter.updateTag(mTagId, text);
            }
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
源代码17 项目: APDE   文件: PermissionsActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case android.R.id.home:
        	if (isPreviewSetttings) {
        		promptSaveDataPreviewSettings();
} else {
	finish();
}
            return true;
        case R.id.menu_new_permission:
        	newPermission();
        	return true;
        case R.id.action_settings:
        	launchSettings();
        	return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
源代码18 项目: batteryhub   文件: TaskListActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    } else if (id == R.id.action_sort_memory) {
        sortTasksBy(Config.SORT_BY_MEMORY, mSortOrderMemory);
        mSortOrderMemory = -mSortOrderMemory;
        return true;
    } else if (id == R.id.action_sort_name) {
        sortTasksBy(Config.SORT_BY_NAME, mSortOrderName);
        mSortOrderName = -mSortOrderName;
        return true;
    }

    return super.onOptionsItemSelected(item);
}
 
源代码19 项目: RetroMusicPlayer   文件: AlbumsFragment.java
private boolean handleSortOrderMenuItem(@NonNull MenuItem item) {
    String sortOrder = null;
    switch (item.getItemId()) {
        case R.id.action_sort_order_album:
            sortOrder = AlbumSortOrder.ALBUM_A_Z;
            break;
        case R.id.action_sort_order_album_desc:
            sortOrder = AlbumSortOrder.ALBUM_Z_A;
            break;
        case R.id.action_sort_order_artist:
            sortOrder = AlbumSortOrder.ALBUM_ARTIST;
            break;
    }
    if (sortOrder != null) {
        item.setChecked(true);
        setSaveSortOrder(sortOrder);
    }
    return true;
}
 
源代码20 项目: Loop   文件: VideoDetailsFragment.java
@Override
    public boolean onOptionsItemSelected(final MenuItem item) {
        switch (item.getItemId()) {
            case R.id.share:
                if (video != null) {
//                    EventLogger.fire(ProductShareEvent.start(mProduct.getId()));

                    Intent sendIntent = new Intent(Intent.ACTION_SEND);
                    sendIntent.setType("text/plain");
                    sendIntent.putExtra(Intent.EXTRA_TEXT,
                            String.format("I found this on Loop. Check it out.\n\n%s\n\n%s", video.getName(), video.getLink()));

                    String title = getResources().getString(R.string.share_this_video);
                    Intent chooser = Intent.createChooser(sendIntent, title);

                    if (sendIntent.resolveActivity(getActivity().getPackageManager()) != null) {
                        startActivityForResult(chooser, VIDEO_SHARE_REQUEST_CODE);
                    }
                }
                return true;
            default:
                break;
        }

        return super.onOptionsItemSelected(item);
    }
 
源代码21 项目: tapchat-android   文件: MemberListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) {
    long connectionId = getIntent().getLongExtra(BufferFragment.ARG_CONNECTION_ID, -1);
    long bufferId     = getIntent().getLongExtra(BufferFragment.ARG_BUFFER_ID, -1);

    if (item.getItemId() == android.R.id.home) {
        Intent intent = new Intent(this, BuffersActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.setData(Uri.parse(String.format("tapchat://%s/%s", connectionId, bufferId)));
        startActivity(intent);
        return true;
    }
    return false;
}
 
源代码22 项目: BooheeScrollView   文件: MainActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id){
        case R.id.normal:
            booheeScrollView.setAnimType(BooheeScrollView.NORMAL_ANIM);
            break;
        case R.id.rebound:
            booheeScrollView.setAnimType(BooheeScrollView.REBOUND_ANIM);
            break;
    }
    return true;
}
 
源代码23 项目: my-first-realm-app   文件: ChatRoomActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_logout) {
        SyncUser syncUser = SyncUser.current();
        if (syncUser != null) {
            syncUser.logOut();
            Intent intent = new Intent(this, WelcomeActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
源代码24 项目: TemplateAppProject   文件: MainActivity.java
/**
 * 处理侧边栏点击事件
 *
 * @param menuItem
 * @return
 */
private boolean handleNavigationItemSelected(@NonNull MenuItem menuItem) {
    int index = CollectionUtils.arrayIndexOf(mTitles, menuItem.getTitle());
    if (index != -1) {
        toolbar.setTitle(menuItem.getTitle());
        viewPager.setCurrentItem(index, false);
        return true;
    }
    return false;
}
 
源代码25 项目: animation-samples   文件: MainActivity.java
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
    logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
    logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);

    return super.onPrepareOptionsMenu(menu);
}
 
源代码26 项目: android-map-sdk   文件: MapClickEventActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
源代码27 项目: Game-of-Thrones   文件: DetailActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  if (item.getItemId() == android.R.id.home) {
    onBackPressed();
  }

  return true;
}
 
源代码28 项目: intra42   文件: BasicActivity.java
/**
 * Called when an item in the navigation menu is selected.
 *
 * @param item The selected item
 * @return true to display the item as the selected item
 */
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    Navigation.onNavigationItemSelected(this, item);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
源代码29 项目: MessagingAndroidChat   文件: ChatRoomActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
源代码30 项目: twittererer   文件: TimelineActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_tweet) {
        showNewTweetDialog();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。