Example usage for android.view MenuItem getTitle

List of usage examples for android.view MenuItem getTitle

Introduction

In this page you can find the example usage for android.view MenuItem getTitle.

Prototype

public CharSequence getTitle();

Source Link

Document

Retrieve the current title of the item.

Usage

From source file:org.mozilla.gecko.BrowserApp.java

/**
 * Add the provided item to the provided menu, which should be
 * the root (mMenu).//from   www  . j  a va 2 s . c om
 */
private void addAddonMenuItemToMenu(final Menu menu, final MenuItemInfo info) {
    info.added = true;

    final Menu destination;
    if (info.parent == 0) {
        destination = menu;
    } else if (info.parent == GECKO_TOOLS_MENU) {
        // The tools menu only exists in our -v11 resources.
        if (Versions.feature11Plus) {
            final MenuItem tools = menu.findItem(R.id.tools);
            destination = tools != null ? tools.getSubMenu() : menu;
        } else {
            destination = menu;
        }
    } else {
        final MenuItem parent = menu.findItem(info.parent);
        if (parent == null) {
            return;
        }

        Menu parentMenu = findParentMenu(menu, parent);

        if (!parent.hasSubMenu()) {
            parentMenu.removeItem(parent.getItemId());
            destination = parentMenu.addSubMenu(Menu.NONE, parent.getItemId(), Menu.NONE, parent.getTitle());
            if (parent.getIcon() != null) {
                ((SubMenu) destination).getItem().setIcon(parent.getIcon());
            }
        } else {
            destination = parent.getSubMenu();
        }
    }

    final MenuItem item = destination.add(Menu.NONE, info.id, Menu.NONE, info.label);

    item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Menu:Clicked",
                    Integer.toString(info.id - ADDON_MENU_OFFSET)));
            return true;
        }
    });

    if (info.icon == null) {
        item.setIcon(R.drawable.ic_menu_addons_filler);
    } else {
        final int id = info.id;
        BitmapUtils.getDrawable(this, info.icon, new BitmapUtils.BitmapLoader() {
            @Override
            public void onBitmapFound(Drawable d) {
                // TODO: why do we re-find the item?
                final MenuItem item = destination.findItem(id);
                if (item == null) {
                    return;
                }
                if (d == null) {
                    item.setIcon(R.drawable.ic_menu_addons_filler);
                    return;
                }
                item.setIcon(d);
            }
        });
    }

    item.setCheckable(info.checkable);
    item.setChecked(info.checked);
    item.setEnabled(info.enabled);
    item.setVisible(info.visible);
}

From source file:hu.zelena.guide.MainActivity.java

public void selectDrawerItem(MenuItem menuItem) {
    Fragment fragment = null;// w w w  . j  a  v  a  2 s . c  o m
    Bundle bundle = new Bundle();

    switch (menuItem.getItemId()) {
    case R.id.alcatel_frag:
        fragment = new PhonesFragment();
        brand = "Alcatel";
        analyticINFO = brand;
        break;
    case R.id.apple_frag:
        fragment = new PhonesFragment();
        brand = "Apple";
        analyticINFO = brand;
        break;
    case R.id.balckberry_frag:
        fragment = new PhonesFragment();
        brand = "BlackBerry";
        analyticINFO = brand;
        break;
    case R.id.cat_frag:
        fragment = new PhonesFragment();
        brand = "CAT";
        analyticINFO = brand;
        break;
    case R.id.honor_frag:
        fragment = new PhonesFragment();
        brand = "Honor";
        analyticINFO = brand;
        break;
    case R.id.HTC_frag:
        fragment = new PhonesFragment();
        brand = "HTC";
        analyticINFO = brand;
        break;
    case R.id.huawei_frag:
        fragment = new PhonesFragment();
        brand = "Huawei";
        analyticINFO = brand;
        break;
    case R.id.lenovo_frag:
        fragment = new PhonesFragment();
        brand = "Lenovo";
        analyticINFO = brand;
        break;
    case R.id.lg_frag:
        fragment = new PhonesFragment();
        brand = "LG";
        analyticINFO = brand;
        break;
    case R.id.samsung_frag:
        fragment = new PhonesFragment();
        brand = "Samsung";
        analyticINFO = brand;
        break;
    case R.id.sony_frag:
        fragment = new PhonesFragment();
        brand = "Sony";
        analyticINFO = brand;
        break;
    case R.id.watch_frag:
        fragment = new WatchFragment();
        analyticINFO = "Watch";
        break;
    case R.id.tablet_frag:
        fragment = new TabletFragment();
        analyticINFO = "Tablet";
        break;
    case R.id.postpaid_frag:
        fragment = new PostPaidFragment();
        analyticINFO = "PostPaid";
        break;
    case R.id.prepaid_frag:
        fragment = new PrePaidFragment();
        analyticINFO = "PrePaid";
        break;
    case R.id.net_frag:
        fragment = new InternetFragment();
        analyticINFO = "Net";
        break;
    case R.id.magicbook_frag:
        fragment = new MagicbookFragment();
        analyticINFO = "MagicBook";
        break;
    case R.id.others_frag:
        fragment = new OthersFragment();
        analyticINFO = "Others";
        break;
    default:
        break;
    }

    if (fragment != null) {
        mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                .setAction(analyticINFO + " drawer select").build());
        firstFrag = false;
        bundle.putString("brand", brand);
        fragment.setArguments(bundle);
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
    } else {
        Intent i = new Intent(this, ErrorActivity.class);
        i.putExtra("error", "Nem sikerlt a FRAGMENT betltse. [Null object]");
        startActivity(i);
        Log.e("MainActivity", "Error in creating fragment");
    }
    // Kivlasztott kijellse
    menuItem.setChecked(true);
    // Cm bellts
    setTitle(menuItem.getTitle());
    // Drawer bezrsa
    mDrawer.closeDrawers();
}

From source file:in.shick.diode.threads.ThreadsListActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // This happens when the user begins to hold down the menu key, so
    // allow them to chord to get a shortcut.
    mCanChord = true;/*from w w w  .  j  a v  a  2s .c  om*/

    super.onPrepareOptionsMenu(menu);

    MenuItem src, dest;

    // Login/Logout
    if (mSettings.isLoggedIn()) {
        menu.findItem(R.id.login_menu_id).setVisible(false);

        if (!mSubreddit.equals(Constants.FRONTPAGE_STRING)) {
            if (!mSubreddit.equals(Constants.REDDIT_SAVED_STRING)) {
                ArrayList<SubredditInfo> mSubredditsList = CacheInfo
                        .getCachedSubredditList(getApplicationContext());
                SubredditInfo key = new SubredditInfo();
                key.name = mSubreddit;

                if (mSubredditsList != null && mSubredditsList.contains(key)) {
                    menu.findItem(R.id.unsubscribe_menu_id).setVisible(true);
                    menu.findItem(R.id.subscribe_menu_id).setVisible(false);
                } else {
                    menu.findItem(R.id.subscribe_menu_id).setVisible(true);
                    menu.findItem(R.id.unsubscribe_menu_id).setVisible(false);
                }
                menu.findItem(R.id.sort_by_menu_id).setVisible(true);
                menu.findItem(R.id.open_browser_menu_id).setVisible(true);
            } else {
                // These menu items make no sense when viewing the saved posts.
                menu.findItem(R.id.unsubscribe_menu_id).setVisible(false);
                menu.findItem(R.id.subscribe_menu_id).setVisible(false);
                menu.findItem(R.id.sort_by_menu_id).setVisible(false);
                menu.findItem(R.id.open_browser_menu_id).setVisible(false);
            }
        }

        menu.findItem(R.id.inbox_menu_id).setVisible(true);
        menu.findItem(R.id.user_profile_menu_id).setVisible(true);
        menu.findItem(R.id.user_profile_menu_id).setTitle(
                String.format(getResources().getString(R.string.user_profile), mSettings.getUsername()));
        menu.findItem(R.id.logout_menu_id).setVisible(true);
        menu.findItem(R.id.logout_menu_id)
                .setTitle(String.format(getResources().getString(R.string.logout), mSettings.getUsername()));
        menu.findItem(R.id.saved_comments_menu_id).setVisible(true);
    } else {
        menu.findItem(R.id.login_menu_id).setVisible(true);

        menu.findItem(R.id.unsubscribe_menu_id).setVisible(false);
        menu.findItem(R.id.subscribe_menu_id).setVisible(false);

        menu.findItem(R.id.inbox_menu_id).setVisible(false);
        menu.findItem(R.id.user_profile_menu_id).setVisible(false);
        menu.findItem(R.id.logout_menu_id).setVisible(false);
        menu.findItem(R.id.saved_comments_menu_id).setVisible(false);
    }

    // Theme: Light/Dark
    src = Util.isLightTheme(mSettings.getTheme()) ? menu.findItem(R.id.dark_menu_id)
            : menu.findItem(R.id.light_menu_id);
    dest = menu.findItem(R.id.light_dark_menu_id);
    dest.setTitle(src.getTitle());

    // Sort
    if (Constants.ThreadsSort.SORT_BY_HOT_URL.equals(mSortByUrl))
        src = menu.findItem(R.id.sort_by_hot_menu_id);
    else if (Constants.ThreadsSort.SORT_BY_NEW_URL.equals(mSortByUrl))
        src = menu.findItem(R.id.sort_by_new_menu_id);
    else if (Constants.ThreadsSort.SORT_BY_CONTROVERSIAL_URL.equals(mSortByUrl))
        src = menu.findItem(R.id.sort_by_controversial_menu_id);
    else if (Constants.ThreadsSort.SORT_BY_TOP_URL.equals(mSortByUrl))
        src = menu.findItem(R.id.sort_by_top_menu_id);
    dest = menu.findItem(R.id.sort_by_menu_id);
    dest.setTitle(src.getTitle());

    return true;
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

private ImageButton makeMenuButton(final MenuItem item, ViewGroup parent) {
    ImageButton btn = (ImageButton) getLayoutInflater().inflate(R.layout.toolbar_button, parent, false);
    if (!item.isVisible())
        btn.setVisibility(View.GONE);
    Drawable d = item.getIcon();/*from   ww  w .j a va  2 s  .c  o  m*/
    if (d instanceof BitmapDrawable)
        ((BitmapDrawable) d).setGravity(Gravity.CENTER);
    btn.setImageDrawable(d);
    btn.setId(item.getItemId());
    btn.setOnClickListener(this);
    btn.setLongClickable(true);
    btn.setFocusable(true);
    btn.setOnFocusChangeListener(this);
    btn.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            showToast(item.getTitle());
            return true;
        }
    });
    return btn;
}

From source file:de.gebatzens.sia.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(SIAApp.SIA_APP.school.getTheme());
    super.onCreate(savedInstanceState);
    Log.w("ggvp", "CREATE NEW MAINACTIVITY");
    //Debug.startMethodTracing("sia3");
    SIAApp.SIA_APP.activity = this;
    savedState = savedInstanceState;/*from w w  w  .  ja  va 2 s  .  c  om*/

    final FragmentData.FragmentList fragments = SIAApp.SIA_APP.school.fragments;

    Intent intent = getIntent();
    if (intent != null && intent.getStringExtra("fragment") != null) {
        FragmentData frag = fragments
                .getByType(FragmentData.FragmentType.valueOf(intent.getStringExtra("fragment"))).get(0);
        SIAApp.SIA_APP.setFragmentIndex(fragments.indexOf(frag));
    }

    if (intent != null && intent.getBooleanExtra("reload", false)) {
        SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));
        intent.removeExtra("reload");
    }

    setContentView(R.layout.activity_main);

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    mContent = getFragment();
    transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
    transaction.commit();

    Log.d("ggvp", "DATA: " + fragments.get(SIAApp.SIA_APP.getFragmentIndex()).getData());
    if (fragments.get(SIAApp.SIA_APP.getFragmentIndex()).getData() == null)
        SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));

    if ("Summer".equals(SIAApp.SIA_APP.getCurrentThemeName())) {
        ImageView summerNavigationPalm = (ImageView) findViewById(R.id.summer_navigation_palm);
        summerNavigationPalm.setImageResource(R.drawable.summer_palm);
        ImageView summerBackgroundImage = (ImageView) findViewById(R.id.summer_background_image);
        summerBackgroundImage.setImageResource(R.drawable.summer_background);
    }

    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {

            switch (menuItem.getItemId()) {
            case R.id.action_refresh:
                ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh)).setRefreshing(true);
                SIAApp.SIA_APP.refreshAsync(new Runnable() {
                    @Override
                    public void run() {
                        ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh))
                                .setRefreshing(false);
                    }
                }, true, fragments.get(SIAApp.SIA_APP.getFragmentIndex()));
                return true;
            case R.id.action_settings:
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivityForResult(i, 1);
                return true;
            case R.id.action_addToCalendar:
                showExamDialog();
                return true;
            case R.id.action_help:
                AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                builder.setTitle(getApplication().getString(R.string.help));
                builder.setMessage(getApplication().getString(R.string.exam_explain));
                builder.setPositiveButton(getApplication().getString(R.string.close),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        });
                builder.create().show();
                return true;
            }

            return false;
        }
    });

    updateToolbar(SIAApp.SIA_APP.school.name, fragments.get(SIAApp.SIA_APP.getFragmentIndex()).name);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SIAApp.SIA_APP.setStatusBarColorTransparent(getWindow()); // because of the navigation drawer
    }

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolBar, R.string.drawer_open,
            R.string.drawer_close) {

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    navigationView = (NavigationView) findViewById(R.id.navigation_view);
    mNavigationHeader = navigationView.getHeaderView(0);
    mNavigationSchoolpictureText = (TextView) mNavigationHeader.findViewById(R.id.drawer_image_text);
    mNavigationSchoolpictureText.setText(SIAApp.SIA_APP.school.name);
    mNavigationSchoolpicture = (ImageView) mNavigationHeader.findViewById(R.id.navigation_schoolpicture);
    mNavigationSchoolpicture.setImageBitmap(SIAApp.SIA_APP.school.loadImage());
    mNavigationSchoolpictureLink = mNavigationHeader.findViewById(R.id.navigation_schoolpicture_link);
    mNavigationSchoolpictureLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewIn) {
            mDrawerLayout.closeDrawers();
            Intent linkIntent = new Intent(Intent.ACTION_VIEW);
            linkIntent.setData(Uri.parse(SIAApp.SIA_APP.school.website));
            startActivity(linkIntent);
        }
    });

    final Menu menu = navigationView.getMenu();
    menu.clear();
    for (int i = 0; i < fragments.size(); i++) {
        MenuItem item = menu.add(R.id.fragments, Menu.NONE, i, fragments.get(i).name);
        item.setIcon(fragments.get(i).getIconRes());
    }

    menu.add(R.id.settings, R.id.settings_item, fragments.size(), R.string.settings);
    menu.setGroupCheckable(R.id.fragments, true, true);
    menu.setGroupCheckable(R.id.settings, false, false);

    final Menu navMenu = navigationView.getMenu();
    selectedItem = SIAApp.SIA_APP.getFragmentIndex();
    if (selectedItem != -1)
        navMenu.getItem(selectedItem).setChecked(true);

    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(MenuItem menuItem) {
            if (menuItem.getItemId() == R.id.settings_item) {
                mDrawerLayout.closeDrawers();
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivityForResult(i, 1);
            } else {
                final int index = menuItem.getOrder();
                if (SIAApp.SIA_APP.getFragmentIndex() != index) {
                    SIAApp.SIA_APP.setFragmentIndex(index);
                    menuItem.setChecked(true);
                    updateToolbar(SIAApp.SIA_APP.school.name, menuItem.getTitle().toString());
                    mContent = getFragment();
                    Animation fadeOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
                    fadeOut.setAnimationListener(new Animation.AnimationListener() {

                        @Override
                        public void onAnimationStart(Animation animation) {

                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                            contentFrame.setVisibility(View.INVISIBLE);
                            if (fragments.get(index).getData() == null)
                                SIAApp.SIA_APP.refreshAsync(null, true, fragments.get(index));

                            //removeAllFragments();

                            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                            transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
                            transaction.commit();

                            snowView.updateSnow();
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });
                    FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                    contentFrame.startAnimation(fadeOut);
                    mDrawerLayout.closeDrawers();
                } else {
                    mDrawerLayout.closeDrawers();
                }
            }
            return true;
        }
    });

    if (Build.VERSION.SDK_INT >= 25) {
        ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
        shortcutManager.removeAllDynamicShortcuts();

        for (int i = 0; i < fragments.size(); i++) {
            Drawable drawable = getDrawable(fragments.get(i).getIconRes());
            Bitmap icon;
            if (drawable instanceof VectorDrawable) {
                icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(),
                        Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(icon);
                drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
                drawable.draw(canvas);
            } else {
                icon = BitmapFactory.decodeResource(getResources(), fragments.get(i).getIconRes());
            }

            Bitmap connectedIcon = Bitmap.createBitmap(icon.getWidth(), icon.getHeight(),
                    Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(connectedIcon);
            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setColor(Color.parseColor("#f5f5f5"));
            canvas.drawCircle(icon.getWidth() / 2, icon.getHeight() / 2, icon.getWidth() / 2, paint);
            paint.setColorFilter(
                    new PorterDuffColorFilter(SIAApp.SIA_APP.school.getColor(), PorterDuff.Mode.SRC_ATOP));
            canvas.drawBitmap(icon, null, new RectF(icon.getHeight() / 4.0f, icon.getHeight() / 4.0f,
                    icon.getHeight() - icon.getHeight() / 4.0f, icon.getHeight() - icon.getHeight() / 4.0f),
                    paint);

            Intent newTaskIntent = new Intent(this, MainActivity.class);
            newTaskIntent.setAction(Intent.ACTION_MAIN);
            newTaskIntent.putExtra("fragment", fragments.get(i).type.toString());

            ShortcutInfo shortcut = new ShortcutInfo.Builder(this, fragments.get(i).name)
                    .setShortLabel(fragments.get(i).name).setLongLabel(fragments.get(i).name)
                    .setIcon(Icon.createWithBitmap(connectedIcon)).setIntent(newTaskIntent).build();

            shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut));
        }
    }

    if (SIAApp.SIA_APP.preferences.getBoolean("app_130_upgrade", true)) {
        if (!SIAApp.SIA_APP.preferences.getBoolean("first_use_filter", true)) {
            TextDialog.newInstance(R.string.upgrade1_3title, R.string.upgrade1_3)
                    .show(getSupportFragmentManager(), "upgrade_dialog");
        }

        SIAApp.SIA_APP.preferences.edit().putBoolean("app_130_upgrade", false).apply();
    }

    snowView = (SnowView) findViewById(R.id.snow_view);

    shareToolbar = (Toolbar) findViewById(R.id.share_toolbar);
    shareToolbar.getMenu().clear();
    shareToolbar.inflateMenu(R.menu.share_toolbar_menu);
    shareToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            toggleShareToolbar(false);
            for (Shareable s : MainActivity.this.shared) {
                s.setMarked(false);
            }
            MainActivity.this.shared.clear();

            mContent.updateFragment();
        }
    });

    shareToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            toggleShareToolbar(false);

            HashMap<Date, ArrayList<Shareable>> dates = new HashMap<Date, ArrayList<Shareable>>();

            for (Shareable s : MainActivity.this.shared) {
                ArrayList<Shareable> list = dates.get(s.getDate());
                if (list == null) {
                    list = new ArrayList<Shareable>();
                    dates.put(s.getDate(), list);
                }

                list.add(s);

                s.setMarked(false);
            }
            MainActivity.this.shared.clear();

            List<Date> dateList = new ArrayList<Date>(dates.keySet());
            Collections.sort(dateList);
            String content = "";

            for (Date key : dateList) {
                content += SubstListAdapter.translateDay(key) + "\n\n";

                Collections.sort(dates.get(key));
                for (Shareable s : dates.get(key)) {
                    content += s.getShareContent() + "\n";
                }

                content += "\n";
            }

            content = content.substring(0, content.length() - 1);

            mContent.updateFragment();

            if (item.getItemId() == R.id.action_copy) {
                ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);

                ClipData clip = ClipData.newPlainText(getString(R.string.entries), content);
                clipboard.setPrimaryClip(clip);
            } else if (item.getItemId() == R.id.action_share) {
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TEXT, content);
                sendIntent.setType("text/plain");
                startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
            }

            return true;
        }
    });

    if (shared.size() > 0) {
        shareToolbar.setVisibility(View.VISIBLE);
        updateShareToolbarText();
    }

    // if a fragment is opened via a notification or a shortcut reset the shared entries
    // delete extra fragment because the same intent is used when the device gets rotated and the user could have opened a new fragment
    if (intent != null && intent.hasExtra("fragment")) {
        resetShareToolbar();
        intent.removeExtra("fragment");
    }

}