Example usage for android.content Intent CATEGORY_BROWSABLE

List of usage examples for android.content Intent CATEGORY_BROWSABLE

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_BROWSABLE.

Prototype

String CATEGORY_BROWSABLE

To view the source code for android.content Intent CATEGORY_BROWSABLE.

Click Source Link

Document

Activities that can be safely invoked from a browser must support this category.

Usage

From source file:com.linkbubble.MainApplication.java

public static Intent getStoreIntent(Context context, String storeProUrl) {
    PackageManager manager = context.getPackageManager();
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(storeProUrl));
    List<ResolveInfo> infos = manager.queryIntentActivities(intent, PackageManager.GET_RESOLVED_FILTER);
    for (ResolveInfo info : infos) {
        IntentFilter filter = info.filter;
        if (filter != null && filter.hasAction(Intent.ACTION_VIEW)
                && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) {
            if (info.activityInfo.packageName.equals(BuildConfig.STORE_PACKAGE)) {
                Intent result = new Intent(Intent.ACTION_VIEW);
                result.setClassName(info.activityInfo.packageName, info.activityInfo.name);
                result.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP
                        | Intent.FLAG_ACTIVITY_SINGLE_TOP);
                result.setData(Uri.parse(storeProUrl));
                return result;
            }//from w  ww  . j  ava2  s  .c  om
        }
    }

    return null;
}

From source file:com.linkbubble.MainApplication.java

public static void openAppStore(Context context, String url) {
    PackageManager manager = context.getPackageManager();
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));//  w w w  .j  a v a2  s . c o m
    List<ResolveInfo> infos = manager.queryIntentActivities(intent, PackageManager.GET_RESOLVED_FILTER);
    for (ResolveInfo info : infos) {
        IntentFilter filter = info.filter;
        if (filter != null && filter.hasAction(Intent.ACTION_VIEW)
                && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) {
            if (info.activityInfo.packageName.equals(BuildConfig.STORE_PACKAGE)) {
                MainApplication.loadIntent(context, info.activityInfo.packageName, info.activityInfo.name, url,
                        -1, true);
                return;
            }
        }
    }
}

From source file:org.liberty.android.fantastischmemo.ui.StudyActivity.java

private void gotoHelp() {
    Intent myIntent = new Intent();
    myIntent.setAction(Intent.ACTION_VIEW);
    myIntent.addCategory(Intent.CATEGORY_BROWSABLE);
    myIntent.setData(Uri.parse(WEBSITE_HELP_MEMO));
    startActivity(myIntent);//ww  w . java  2s.  c o m
}

From source file:net.bytten.comicviewer.ComicViewerActivity.java

public void explain() {
    final IComicInfo comic = comicInfo;
    new AsyncTask<Object, Integer, Integer>() {

        @Override//ww  w  .  ja  v  a  2 s.c o  m
        protected Integer doInBackground(Object... params) {
            try {
                URL url = new URL(provider.getExplainUrl(comic).toString());
                HttpURLConnection http = (HttpURLConnection) url.openConnection();
                return http.getResponseCode();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

        @Override
        protected void onPostExecute(Integer result) {
            super.onPostExecute(result);
            if (result == null || result != 200) {
                toast("This comic has no user-supplied explanation.");
            }

        }
    }.execute(new Object[] {});

    Intent browser = new Intent();
    browser.setAction(Intent.ACTION_VIEW);
    browser.addCategory(Intent.CATEGORY_BROWSABLE);
    browser.setData(provider.getExplainUrl(comic));
    startActivity(browser);
}

From source file:com.egloos.hyunyi.musicinfo.LinkPopUp.java

private void displayArtistInfo_bk(JSONObject j) throws JSONException {
    if (imageLoader == null)
        imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited())
        imageLoader.init(config);/*  w  ww .j a v a 2 s .co  m*/

    Log.i("musicInfo", "LinkPopUp. displayArtistInfo " + j.toString());

    JSONObject j_artist_info = j.getJSONObject("artist");

    tArtistName.setText(j_artist_info.getString("name"));
    final JSONObject urls = j_artist_info.optJSONObject("urls");
    final JSONArray videos = j_artist_info.optJSONArray("video");
    final JSONArray images = j_artist_info.optJSONArray("images");
    final String fm_image = j.optString("fm_image");
    final JSONArray available_images = new JSONArray();
    ArrayList<String> image_urls = new ArrayList<String>();

    if (fm_image != null) {
        image_urls.add(fm_image);
    }

    Log.i("musicInfo", images.toString());

    if (images != null) {
        for (int i = 0; i < images.length(); i++) {
            JSONObject image = images.getJSONObject(i);
            int width = image.optInt("width", 0);
            int height = image.optInt("height", 0);
            String url = image.optString("url", "");
            Log.i("musicInfo", i + ": " + url);
            if ((width * height > 10000) && (width * height < 100000) && (!url.contains("userserve-ak"))) {
                //if ((width>300&&width<100)&&(height>300&&height<1000)&&(!url.contains("userserve-ak"))) {
                image_urls.add(url);
                Log.i("musicInfo", "Selected: " + url);
                //available_images.put(image);
            }
        }

        int random = (int) (Math.random() * image_urls.size());
        final String f_url = image_urls.get(random);

        //int random = (int) (Math.random() * available_images.length());
        //final JSONObject fImage = available_images.length()>0?available_images.getJSONObject(random > images.length() ? 0 : random):images.getJSONObject(0);

        Log.i("musicInfo",
                "Total image#=" + available_images.length() + " Selected image#=" + random + " " + f_url);

        imageLoader.displayImage(f_url, ArtistImage, new ImageLoadingListener() {
            @Override
            public void onLoadingStarted(String imageUri, View view) {

            }

            @Override
            public void onLoadingFailed(String imageUri, View view, FailReason failReason) {

            }

            @Override
            public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {

                lLinkList.removeAllViews();
                //String attr = fImage.optJSONObject("license").optString("attribution");
                //tAttribution.setText("Credit. " + ((attr == null) || (attr.contains("n/a")) ? "Unknown" : attr));
                if (urls != null) {
                    String[] jsonName = { "wikipedia_url", "mb_url", "lastfm_url", "official_url",
                            "twitter_url" };
                    for (int i = 0; i < jsonName.length; i++) {
                        if ((urls.optString(jsonName[i]) != null) && (urls.optString(jsonName[i]) != "")) {
                            Log.d("musicinfo", "Link URL: " + urls.optString(jsonName[i]));
                            TextView tv = new TextView(getApplicationContext());
                            tv.setTextSize(11);
                            tv.setPadding(16, 16, 16, 16);
                            tv.setTextColor(Color.LTGRAY);
                            tv.setTypeface(Typeface.SANS_SERIF);
                            tv.setGravity(Gravity.CENTER_VERTICAL);
                            tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                                    ViewGroup.LayoutParams.WRAP_CONTENT));

                            switch (jsonName[i]) {
                            case "official_url":
                                tv.setText("HOME.");
                                break;
                            case "wikipedia_url":
                                tv.setText("WIKI.");
                                break;
                            case "mb_url":
                                tv.setText("Music Brainz.");
                                break;
                            case "lastfm_url":
                                tv.setText("Last FM.");
                                break;
                            case "twitter_url":
                                tv.setText("Twitter.");
                                break;
                            }

                            try {
                                tv.setTag(urls.getString(jsonName[i]));
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }

                            tv.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    Intent intent = new Intent();
                                    intent.setAction(Intent.ACTION_VIEW);
                                    intent.addCategory(Intent.CATEGORY_BROWSABLE);
                                    intent.setData(Uri.parse((String) v.getTag()));
                                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                    startActivity(intent);
                                    Toast.makeText(getApplicationContext(), "Open the Link...",
                                            Toast.LENGTH_SHORT).show();
                                    //finish();
                                }
                            });
                            lLinkList.addView(tv);
                        }
                    }
                } else {
                    TextView tv = new TextView(getApplicationContext());
                    tv.setTextSize(11);
                    tv.setPadding(16, 16, 16, 16);
                    tv.setTextColor(Color.LTGRAY);
                    tv.setTypeface(Typeface.SANS_SERIF);
                    tv.setGravity(Gravity.CENTER_VERTICAL);
                    tv.setText("Sorry, No Link Here...");
                    lLinkList.addView(tv);
                }

                if (videos != null) {
                    jVideoArray = videos;
                    mAdapter = new StaggeredViewAdapter(getApplicationContext(),
                            android.R.layout.simple_list_item_1, generateImageData(videos));
                    //if (mData == null) {
                    mData = generateImageData(videos);
                    //}

                    //mAdapter.clear();

                    for (JSONObject data : mData) {
                        mAdapter.add(data);
                    }
                    mGridView.setAdapter(mAdapter);
                } else {

                }

                adjBottomColor(((ImageView) view).getDrawable());
            }

            @Override
            public void onLoadingCancelled(String imageUri, View view) {

            }
        });
    }

}

From source file:com.dycody.android.idealnote.ListFragment.java

/**
 * Notes list adapter initialization and association to view
 *///from w  ww . j a  v  a2  s  .  c om
void initNotesList(Intent intent) {
    Log.d(Constants.TAG, "initNotesList intent: " + intent.getAction());

    progress_wheel.setAlpha(1);
    list.setAlpha(0);

    // Search for a tag
    // A workaround to simplify it's to simulate normal search
    if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getCategories() != null
            && intent.getCategories().contains(Intent.CATEGORY_BROWSABLE)) {
        searchTags = intent.getDataString().replace(UrlCompleter.HASHTAG_SCHEME, "");
        goBackOnToggleSearchLabel = true;
    }

    // Searching
    searchQuery = searchQueryInstant;
    searchQueryInstant = null;
    if (searchTags != null || searchQuery != null || Intent.ACTION_SEARCH.equals(intent.getAction())) {

        // Using tags
        if (searchTags != null && intent.getStringExtra(SearchManager.QUERY) == null) {
            searchQuery = searchTags;
            NoteLoaderTask.getInstance().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "getNotesByTag",
                    searchQuery);
        } else {
            // Get the intent, verify the action and get the query
            if (intent.getStringExtra(SearchManager.QUERY) != null) {
                searchQuery = intent.getStringExtra(SearchManager.QUERY);
                searchTags = null;
            }
            NoteLoaderTask.getInstance().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "getNotesByPattern",
                    searchQuery);
        }

        toggleSearchLabel(true);

    } else {
        // Check if is launched from a widget with categories
        if ((Constants.ACTION_WIDGET_SHOW_LIST.equals(intent.getAction())
                && intent.hasExtra(Constants.INTENT_WIDGET))
                || !TextUtils.isEmpty(mainActivity.navigationTmp)) {
            String widgetId = intent.hasExtra(Constants.INTENT_WIDGET)
                    ? intent.getExtras().get(Constants.INTENT_WIDGET).toString()
                    : null;
            if (widgetId != null) {
                String sqlCondition = prefs.getString(Constants.PREF_WIDGET_PREFIX + widgetId, "");
                String categoryId = TextHelper.checkIntentCategory(sqlCondition);
                mainActivity.navigationTmp = !TextUtils.isEmpty(categoryId) ? categoryId : null;
            }
            intent.removeExtra(Constants.INTENT_WIDGET);
            if (mainActivity.navigationTmp != null) {
                Long categoryId = Long.parseLong(mainActivity.navigationTmp);
                NoteLoaderTask.getInstance().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
                        "getNotesByCategory", categoryId);
            } else {
                NoteLoaderTask.getInstance().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "getAllNotes",
                        true);
            }

        } else {
            NoteLoaderTask.getInstance().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "getAllNotes", true);
        }
    }
}

From source file:org.planetmono.dcuploader.ActivityUploader.java

@SuppressWarnings("unchecked")
@Override//from   w w  w. ja  v a 2 s  . c  om
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    initViews();
    if (formLocation)
        queryLocation(true);

    if (savedState != null) {
        if (savedState.containsKey("tempfile"))
            tempFile = new File(savedState.getString("tempfile"));
        if (savedState.containsKey("target"))
            resolveTarget(savedState.getString("target"));
        if (savedState.containsKey("tempfiles"))
            tempFiles = savedState.getStringArrayList("tempfiles");
        if (savedState.containsKey("contents")) {
            contents = new ArrayList<Uri>();
            String[] carr = savedState.getStringArray("contents");
            for (String s : carr)
                contents.add(Uri.parse(s));
        }
    }

    postfix = "from <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>";

    Button uploadVisit = (Button) findViewById(R.id.upload_visit);
    if (passThrough || target == null)
        uploadVisit.setEnabled(false);
    else
        uploadVisit.setEnabled(true);

    /* populate data by getting STREAM parameter */
    Intent i = getIntent();
    Bundle b = i.getExtras();
    String action = i.getAction();

    if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) {
        called = true;

        if (i.hasExtra(Intent.EXTRA_STREAM)) {
            Object o = b.get(Intent.EXTRA_STREAM);

            /* quick and dirty. any better idea? */
            try {
                contents.add((Uri) o);
            } catch (Exception e1) {
                try {
                    contents = (ArrayList<Uri>) ((ArrayList<Uri>) o).clone();
                } catch (Exception e2) {
                }
            }

            boolean exceeded = false;
            if (contents.size() > 5) {
                exceeded = true;

                do {
                    contents.remove(5);
                } while (contents.size() > 5);
            }

            galleryChanged = true;

            updateImageButtons();
            resetThumbnails();
            updateGallery();

            if (exceeded)
                Toast.makeText(this,
                        " 5  . 5 ??? ? ?.",
                        Toast.LENGTH_LONG).show();
        }
        if (i.hasExtra(Intent.EXTRA_TEXT)) {
            ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TEXT));
        }
    } else if (action.equals("share")) {
        called = true;
        /* HTC web browser uses non-standard intent */

        ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TITLE));
    } else if (action.equals(Intent.ACTION_VIEW)) {
        Uri uri = i.getData();

        if (i.getCategories().contains(Intent.CATEGORY_BROWSABLE)) {
            passThrough = true;

            Pattern p = Pattern.compile("id=([\\-a-zA-Z0-9_]+)");
            Matcher m = p.matcher(uri.toString());

            if (m.find()) {
                resolveTarget(m.group(1));
            } else {
                passThrough = false;
            }

            if (uri.getHost().equals(Application.HOST_DCMYS)) {
                destination = Application.DESTINATION_DCMYS;
                postfix = "from dc.m.dcmys.kr w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>";
            } else if (uri.getHost().equals(Application.HOST_MOOLZO)) {
                destination = Application.DESTINATION_MOOLZO;
                postfix = "- From m.oolzo.com w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>";
            } else if (uri.getHost().equals(Application.HOST_DCINSIDE)) {
                destination = Application.DESTINATION_DCINSIDE;
            }

            setDefaultImage();
        }
    }

    reloadConfigurations();
}

From source file:org.mariotaku.twidere.fragment.UserFragment.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    final Context context = getContext();
    final AsyncTwitterWrapper twitter = mTwitterWrapper;
    final ParcelableUser user = getUser();
    final UserRelationship userRelationship = mRelationship;
    if (user == null || twitter == null)
        return false;
    switch (item.getItemId()) {
    case R.id.block: {
        if (userRelationship == null)
            return true;
        if (userRelationship.blocking) {
            twitter.destroyBlockAsync(user.account_key, user.key);
        } else {//from   www.  ja  v  a2  s  . c  o m
            CreateUserBlockDialogFragment.show(getFragmentManager(), user);
        }
        break;
    }
    case R.id.report_spam: {
        ReportSpamDialogFragment.show(getFragmentManager(), user);
        break;
    }
    case R.id.add_to_filter: {
        if (userRelationship == null)
            return true;
        final ContentResolver cr = getContentResolver();
        if (userRelationship.filtering) {
            final String where = Expression.equalsArgs(Filters.Users.USER_KEY).getSQL();
            final String[] whereArgs = { user.key.toString() };
            cr.delete(Filters.Users.CONTENT_URI, where, whereArgs);
            Utils.showInfoMessage(getActivity(), R.string.message_user_unmuted, false);
        } else {
            cr.insert(Filters.Users.CONTENT_URI, ContentValuesCreator.createFilteredUser(user));
            Utils.showInfoMessage(getActivity(), R.string.message_user_muted, false);
        }
        getFriendship();
        break;
    }
    case R.id.mute_user: {
        if (userRelationship == null)
            return true;
        if (userRelationship.muting) {
            twitter.destroyMuteAsync(user.account_key, user.key);
        } else {
            CreateUserMuteDialogFragment.show(getFragmentManager(), user);
        }
        break;
    }
    case R.id.mention: {
        final Intent intent = new Intent(INTENT_ACTION_MENTION);
        final Bundle bundle = new Bundle();
        bundle.putParcelable(EXTRA_USER, user);
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case R.id.send_direct_message: {
        final Uri.Builder builder = new Uri.Builder();
        builder.scheme(SCHEME_TWIDERE);
        builder.authority(AUTHORITY_DIRECT_MESSAGES_CONVERSATION);
        builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, user.account_key.toString());
        builder.appendQueryParameter(QUERY_PARAM_USER_KEY, user.key.toString());
        final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
        intent.putExtra(EXTRA_ACCOUNT,
                ParcelableCredentialsUtils.getCredentials(getActivity(), user.account_key));
        intent.putExtra(EXTRA_USER, user);
        startActivity(intent);
        break;
    }
    case R.id.set_color: {
        final Intent intent = new Intent(getActivity(), ColorPickerDialogActivity.class);
        intent.putExtra(EXTRA_COLOR, mUserColorNameManager.getUserColor(user.key));
        intent.putExtra(EXTRA_ALPHA_SLIDER, false);
        intent.putExtra(EXTRA_CLEAR_BUTTON, true);
        startActivityForResult(intent, REQUEST_SET_COLOR);
        break;
    }
    case R.id.clear_nickname: {
        mUserColorNameManager.clearUserNickname(user.key);
        break;
    }
    case R.id.set_nickname: {
        final String nick = mUserColorNameManager.getUserNickname(user.key);
        SetUserNicknameDialogFragment.show(getFragmentManager(), user.key, nick);
        break;
    }
    case R.id.add_to_list: {
        final Intent intent = new Intent(INTENT_ACTION_SELECT_USER_LIST);
        intent.setClass(getActivity(), UserListSelectorActivity.class);
        intent.putExtra(EXTRA_ACCOUNT_KEY, user.account_key);
        intent.putExtra(EXTRA_SCREEN_NAME,
                DataStoreUtils.getAccountScreenName(getActivity(), user.account_key));
        startActivityForResult(intent, REQUEST_ADD_TO_LIST);
        break;
    }
    case R.id.open_with_account: {
        final Intent intent = new Intent(INTENT_ACTION_SELECT_ACCOUNT);
        intent.setClass(getActivity(), AccountSelectorActivity.class);
        intent.putExtra(EXTRA_SINGLE_SELECTION, true);
        intent.putExtra(EXTRA_ACCOUNT_HOST, user.key.getHost());
        startActivityForResult(intent, REQUEST_SELECT_ACCOUNT);
        break;
    }
    case R.id.follow: {
        if (userRelationship == null)
            return true;
        final boolean updatingRelationship = twitter.isUpdatingRelationship(user.account_key, user.key);
        if (!updatingRelationship) {
            if (userRelationship.following) {
                DestroyFriendshipDialogFragment.show(getFragmentManager(), user);
            } else {
                twitter.createFriendshipAsync(user.account_key, user.key);
            }
        }
        return true;
    }
    case R.id.enable_retweets: {
        final boolean newState = !item.isChecked();
        final FriendshipUpdate update = new FriendshipUpdate();
        update.retweets(newState);
        twitter.updateFriendship(user.account_key, user.key.getId(), update);
        item.setChecked(newState);
        return true;
    }
    case R.id.muted_users: {
        IntentUtils.openMutesUsers(getActivity(), user.account_key);
        return true;
    }
    case R.id.blocked_users: {
        IntentUtils.openUserBlocks(getActivity(), user.account_key);
        return true;
    }
    case R.id.incoming_friendships: {
        IntentUtils.openIncomingFriendships(getActivity(), user.account_key);
        return true;
    }
    case R.id.user_mentions: {
        IntentUtils.openUserMentions(context, user.account_key, user.screen_name);
        return true;
    }
    case R.id.saved_searches: {
        IntentUtils.openSavedSearches(context, user.account_key);
        return true;
    }
    case R.id.scheduled_statuses: {
        IntentUtils.openScheduledStatuses(context, user.account_key);
        return true;
    }
    case R.id.open_in_browser: {
        final Uri uri = LinkCreator.getUserWebLink(user);
        final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setPackage(IntentUtils.getDefaultBrowserPackage(context, uri, true));
        if (intent.resolveActivity(context.getPackageManager()) != null) {
            startActivity(intent);
        }
        return true;
    }
    default: {
        final Intent intent = item.getIntent();
        if (intent != null && intent.resolveActivity(context.getPackageManager()) != null) {
            startActivity(intent);
        }
        break;
    }
    }
    return true;
}

From source file:org.getlantern.firetweet.util.Utils.java

public static boolean handleMenuItemClick(Context context, Fragment fragment, FragmentManager fm,
        AsyncTwitterWrapper twitter, ParcelableStatus status, MenuItem item) {
    switch (item.getItemId()) {
    case MENU_COPY: {
        if (ClipboardUtils.setText(context, status.text_plain)) {
            showOkMessage(context, R.string.text_copied, false);
        }/*from  w w  w  . ja  va  2s . c o  m*/
        break;
    }
    case MENU_RETWEET: {
        if (isMyRetweet(status)) {
            twitter.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
        } else {
            twitter.retweetStatusAsync(status.account_id, status.id);
        }
        break;
    }
    case MENU_QUOTE: {
        final Intent intent = new Intent(INTENT_ACTION_QUOTE);
        intent.putExtra(EXTRA_STATUS, status);
        context.startActivity(intent);
        break;
    }
    case MENU_REPLY: {
        final Intent intent = new Intent(INTENT_ACTION_REPLY);
        intent.putExtra(EXTRA_STATUS, status);
        context.startActivity(intent);
        break;
    }
    case MENU_FAVORITE: {
        if (status.is_favorite) {
            twitter.destroyFavoriteAsync(status.account_id, status.id);
        } else {
            twitter.createFavoriteAsync(status.account_id, status.id);
        }
        break;
    }
    case MENU_DELETE: {
        DestroyStatusDialogFragment.show(fm, status);
        break;
    }
    case MENU_ADD_TO_FILTER: {
        AddStatusFilterDialogFragment.show(fm, status);
        break;
    }
    case MENU_SET_COLOR: {
        final Intent intent = new Intent(context, ColorPickerDialogActivity.class);
        final int color = getUserColor(context, status.user_id, true);
        if (color != 0) {
            intent.putExtra(EXTRA_COLOR, color);
        }
        intent.putExtra(EXTRA_CLEAR_BUTTON, color != 0);
        intent.putExtra(EXTRA_ALPHA_SLIDER, false);
        if (fragment != null) {
            fragment.startActivityForResult(intent, REQUEST_SET_COLOR);
        } else if (context instanceof Activity) {
            ((Activity) context).startActivityForResult(intent, REQUEST_SET_COLOR);
        }
        break;
    }
    case MENU_CLEAR_NICKNAME: {
        clearUserNickname(context, status.user_id);
        break;
    }
    case MENU_SET_NICKNAME: {
        final String nick = getUserNickname(context, status.user_id, true);
        SetUserNicknameDialogFragment.show(fm, status.user_id, nick);
        break;
    }
    case MENU_TRANSLATE: {
        final ParcelableCredentials account = ParcelableAccount.getCredentials(context, status.account_id);
        if (isOfficialCredentials(context, account)) {
            StatusTranslateDialogFragment.show(fm, status);
        } else {
            final Resources resources = context.getResources();
            final Locale locale = resources.getConfiguration().locale;
            try {
                final String template = "http://translate.google.com/#%s|%s|%s";
                final String sourceLang = "auto";
                final String targetLang = URLEncoder.encode(locale.getLanguage(), HTTP.UTF_8);
                final String text = URLEncoder.encode(status.text_unescaped, HTTP.UTF_8);
                final Uri uri = Uri.parse(String.format(Locale.ROOT, template, sourceLang, targetLang, text));
                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                intent.addCategory(Intent.CATEGORY_BROWSABLE);
                context.startActivity(intent);
            } catch (UnsupportedEncodingException ignore) {

            }
        }
        break;
    }
    case MENU_OPEN_WITH_ACCOUNT: {
        final Intent intent = new Intent(INTENT_ACTION_SELECT_ACCOUNT);
        intent.setClass(context, AccountSelectorActivity.class);
        intent.putExtra(EXTRA_SINGLE_SELECTION, true);
        if (fragment != null) {
            fragment.startActivityForResult(intent, REQUEST_SELECT_ACCOUNT);
        } else if (context instanceof Activity) {
            ((Activity) context).startActivityForResult(intent, REQUEST_SELECT_ACCOUNT);
        }
        break;
    }
    default: {
        if (item.getIntent() != null) {
            try {
                context.startActivity(item.getIntent());
            } catch (final ActivityNotFoundException e) {
                Crashlytics.logException(e);
                Log.w(LOGTAG, e);
                return false;
            }
        }
        break;
    }
    }
    return true;
}