Example usage for android.view Menu FIRST

List of usage examples for android.view Menu FIRST

Introduction

In this page you can find the example usage for android.view Menu FIRST.

Prototype

int FIRST

To view the source code for android.view Menu FIRST.

Click Source Link

Document

First value for group and item identifier integers.

Usage

From source file:com.gh4a.activities.IssueListMineActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == Menu.FIRST + 1) {
        toggleStateFilter();//  www  .  java  2  s .c o  m
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.gh4a.activities.Github4AndroidActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case Menu.FIRST:
        doLogin();//ww w  . j  a  v a  2s . co m
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:org.alfresco.mobile.android.application.fragments.workflow.process.ProcessesFragment.java

public static void getMenu(Context context, Menu menu) {
    MenuItem mi;//from  w w w  .j  a va  2  s. co m

    mi = menu.add(Menu.NONE, R.id.menu_workflow_add, Menu.FIRST, R.string.workflow_start);
    mi.setIcon(android.R.drawable.ic_menu_add);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    MenuFragmentHelper.getMenu(context, menu);
}

From source file:org.alfresco.mobile.android.application.fragments.site.browser.SiteAdapter.java

public void getMenu(Menu menu, Site site) {
    if (site.isMember()) {
        menu.add(Menu.NONE, R.id.menu_site_leave, Menu.FIRST + 2, R.string.action_leave_site);
    } else if (!SiteVisibility.PRIVATE.equals(site.getVisibility()) && !site.isPendingMember()) {
        menu.add(Menu.NONE, R.id.menu_site_join, Menu.FIRST + 1,
                (SiteVisibility.MODERATED.equals(site.getVisibility())) ? R.string.action_join_request_site
                        : R.string.action_join_site);
    }//ww  w.  ja v a  2 s .com

    if (site.isFavorite()) {
        menu.add(Menu.NONE, R.id.menu_site_unfavorite, Menu.FIRST + 5, R.string.action_unfavorite_site);
    } else {
        menu.add(Menu.NONE, R.id.menu_site_favorite, Menu.FIRST + 4, R.string.action_favorite_site);
    }

    menu.add(Menu.NONE, R.id.menu_site_members, Menu.FIRST, R.string.members);
}

From source file:ca.cs.ualberta.localpost.view.FreshestTabView.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(0, Menu.FIRST, 0, "UpRad");
    menu.add(0, Menu.FIRST + 1, 0, "DownRad");
    menu.add(0, Menu.FIRST + 2, 0, "Favorite");
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileActions.java

private void getMenu(Menu menu) {
    menu.clear();// w  ww  .j a  v a2s  .  co m

    MenuItem mi;

    if (getFragment() instanceof ListingModeFragment) {
        switch (((ListingModeFragment) getFragment()).getMode()) {
        case FileExplorerFragment.MODE_LISTING:
            if (selectedFolder.isEmpty()) {
                mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload);
                mi.setIcon(R.drawable.ic_upload);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

                mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST + 100, R.string.share);
                mi.setIcon(R.drawable.ic_share);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            }

            mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete);
            mi.setIcon(R.drawable.ic_delete);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            break;

        case FileExplorerFragment.MODE_PICK:

            if (selectedFolder.isEmpty()) {
                mi = menu.add(Menu.NONE, R.id.menu_file_send, Menu.FIRST, R.string.action_upload);
                mi.setIcon(R.drawable.ic_upload);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS);
            }

            break;

        default:
            break;
        }
        mi = menu.add(Menu.NONE, R.id.menu_select_all, Menu.FIRST + 200, R.string.select_all);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }
}

From source file:ca.cs.ualberta.localpost.view.LastestTabView.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    ConnectivityCheck conn = new ConnectivityCheck(getActivity());
    // Get item list index
    ElasticSearchOperations es = new ElasticSearchOperations();
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int index = (int) info.id;
    switch (item.getItemId()) {
    case Menu.FIRST:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "UpRad", Toast.LENGTH_SHORT).show();
            model.get(index).incRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {/*from  ww  w.j ava  2 s.  c o  m*/
            Toast.makeText(getActivity(), "You require connectivity to Uprad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 1:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "DownRad", Toast.LENGTH_SHORT).show();
            model.get(index).decRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {
            Toast.makeText(getActivity(), "You require connectivity to Downrad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 2:
        Serialize.SaveComment(model.get(index), getActivity(), "favourite");
        Toast.makeText(getActivity(), "Comment has been Favorited", Toast.LENGTH_SHORT).show();
        Serialize.update(model.get(index), getActivity(), "favoritecomment.json");
        return true;
    }
    return super.onContextItemSelected(item);
}

From source file:ca.cs.ualberta.localpost.view.PicTabView.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    ConnectivityCheck conn = new ConnectivityCheck(getActivity());

    // Get item list index
    ElasticSearchOperations es = new ElasticSearchOperations();
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int index = (int) info.id;
    switch (item.getItemId()) {
    case Menu.FIRST:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "UpRad", Toast.LENGTH_SHORT).show();
            model.get(index).incRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {//  www.  ja  v a2  s .  co m
            Toast.makeText(getActivity(), "You require connectivity to Uprad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 1:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "DownRad", Toast.LENGTH_SHORT).show();
            model.get(index).decRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {
            Toast.makeText(getActivity(), "You require connectivity to Downrad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 2:
        Serialize.SaveComment(model.get(index), getActivity(), "favourite");
        Toast.makeText(getActivity(), "Comment has been Favorited", Toast.LENGTH_SHORT).show();
        Serialize.update(model.get(index), getActivity(), "favoritecomment.json");
        return true;
    }
    return super.onContextItemSelected(item);
}

From source file:ca.cs.ualberta.localpost.view.NoPicTabView.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    ConnectivityCheck conn = new ConnectivityCheck(getActivity());

    // Get item list index
    ElasticSearchOperations es = new ElasticSearchOperations();
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int index = (int) info.id;
    switch (item.getItemId()) {
    case Menu.FIRST:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "UpRad", Toast.LENGTH_SHORT).show();
            model.get(index).incRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {//from   w  ww.j a v  a 2 s  .  c o m
            Toast.makeText(getActivity(), "You require connectivity to Uprad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 1:
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "DownRad", Toast.LENGTH_SHORT).show();
            model.get(index).decRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {
            Toast.makeText(getActivity(), "You require connectivity to Downrad", Toast.LENGTH_SHORT).show();
            return true;
        }

    case Menu.FIRST + 2:
        Serialize.SaveComment(model.get(index), getActivity(), "favourite");
        Toast.makeText(getActivity(), "Comment has been Favorited", Toast.LENGTH_SHORT).show();
        Serialize.update(model.get(index), getActivity(), "favoritecomment.json");
        return true;
    }
    return super.onContextItemSelected(item);
}

From source file:ca.cs.ualberta.localpost.view.GreatestTabView.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    ConnectivityCheck conn = new ConnectivityCheck(getActivity());

    // Get item list index
    ElasticSearchOperations es = new ElasticSearchOperations();
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    int index = (int) info.id;
    switch (item.getItemId()) {
    case Menu.FIRST:// UpRad
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "UpRad", Toast.LENGTH_SHORT).show();
            model.get(index).incRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {/*w  ww. j  av  a 2s  .c o m*/
            Toast.makeText(getActivity(), "You require connectivity to Uprad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 1: // DownRad
        if (conn.isConnectingToInternet()) {
            Toast.makeText(getActivity(), "DownRad", Toast.LENGTH_SHORT).show();
            model.get(index).decRadish();
            es.execute(1, model.get(index).getPostId(), model.get(index), null);
            return true;
        } else {
            Toast.makeText(getActivity(), "You require connectivity to Downrad", Toast.LENGTH_SHORT).show();
            return true;
        }
    case Menu.FIRST + 2: // Favorites
        Serialize.SaveComment(model.get(index), getActivity(), "favourite");
        Toast.makeText(getActivity(), "Comment has been Favorited", Toast.LENGTH_SHORT).show();
        Serialize.update(model.get(index), getActivity(), "favoritecomment.json");
        return true;
    }
    return super.onContextItemSelected(item);
}