Example usage for android.content.res Resources getConfiguration

List of usage examples for android.content.res Resources getConfiguration

Introduction

In this page you can find the example usage for android.content.res Resources getConfiguration.

Prototype

public Configuration getConfiguration() 

Source Link

Document

Return the current configuration that is in effect for this resource object.

Usage

From source file:org.mariotaku.twidere.util.Utils.java

public static boolean isRTL(final Context context) {
    if (context == null)
        return false;
    final Resources res = context.getResources();
    return ConfigurationAccessor.getLayoutDirection(res.getConfiguration()) == SCREENLAYOUT_LAYOUTDIR_RTL;
}

From source file:com.example.ray.firstapp.bottombar.BottomBar.java

private static void navBarMagic(Activity activity, final BottomBar bottomBar) {
    Resources res = activity.getResources();
    int softMenuIdentifier = res.getIdentifier("config_showNavigationBar", "bool", "android");
    int navBarIdentifier = res.getIdentifier("navigation_bar_height", "dimen", "android");
    int navBarHeight = 0;

    if (navBarIdentifier > 0) {
        navBarHeight = res.getDimensionPixelSize(navBarIdentifier);
    }//from  w w  w . j  av  a 2 s.  c  o  m

    if (!bottomBar.drawBehindNavBar() || navBarHeight == 0
            || (!(softMenuIdentifier > 0 && res.getBoolean(softMenuIdentifier)))) {
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
            && ViewConfiguration.get(activity).hasPermanentMenuKey()) {
        return;
    }

    /**
     * Copy-paste coding made possible by:
     * http://stackoverflow.com/a/14871974/940036
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display d = activity.getWindowManager().getDefaultDisplay();

        DisplayMetrics realDisplayMetrics = new DisplayMetrics();
        d.getRealMetrics(realDisplayMetrics);

        int realHeight = realDisplayMetrics.heightPixels;
        int realWidth = realDisplayMetrics.widthPixels;

        DisplayMetrics displayMetrics = new DisplayMetrics();
        d.getMetrics(displayMetrics);

        int displayHeight = displayMetrics.heightPixels;
        int displayWidth = displayMetrics.widthPixels;

        boolean hasSoftwareKeys = (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;

        if (!hasSoftwareKeys) {
            return;
        }
    }
    /**
     * End of delicious copy-paste code
     */

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
            && res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        activity.getWindow().getAttributes().flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;

        if (bottomBar.useTopOffset()) {
            int offset;
            int statusBarResource = res.getIdentifier("status_bar_height", "dimen", "android");

            if (statusBarResource > 0) {
                offset = res.getDimensionPixelSize(statusBarResource);
            } else {
                offset = MiscUtils.dpToPixel(activity, 25);
            }

            if (!bottomBar.useOnlyStatusbarOffset()) {
                TypedValue tv = new TypedValue();
                if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
                    offset += TypedValue.complexToDimensionPixelSize(tv.data, res.getDisplayMetrics());
                } else {
                    offset += MiscUtils.dpToPixel(activity, 56);
                }
            }

            bottomBar.getUserContainer().setPadding(0, offset, 0, 0);
        }

        final View outerContainer = bottomBar.getOuterContainer();
        final int navBarHeightCopy = navBarHeight;
        bottomBar.getViewTreeObserver()
                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                    @SuppressWarnings("deprecation")
                    @Override
                    public void onGlobalLayout() {
                        bottomBar.shyHeightAlreadyCalculated();

                        int newHeight = outerContainer.getHeight() + navBarHeightCopy;
                        outerContainer.getLayoutParams().height = newHeight;

                        if (bottomBar.isShy()) {
                            int defaultOffset = bottomBar.useExtraOffset() ? navBarHeightCopy : 0;
                            bottomBar.setTranslationY(defaultOffset);
                            ((CoordinatorLayout.LayoutParams) bottomBar.getLayoutParams())
                                    .setBehavior(new BottomNavigationBehavior(newHeight, defaultOffset));
                        }

                        ViewTreeObserver obs = outerContainer.getViewTreeObserver();

                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                            obs.removeOnGlobalLayoutListener(this);
                        } else {
                            obs.removeGlobalOnLayoutListener(this);
                        }
                    }
                });
    }
}

From source file:com.harlan.jxust.ui.view.bottombar.BottomBar.java

private static void navBarMagic(Activity activity, final BottomBar bottomBar) {
    Resources res = activity.getResources();
    int softMenuIdentifier = res.getIdentifier("config_showNavigationBar", "bool", "android");
    int navBarIdentifier = res.getIdentifier("navigation_bar_height", "dimen", "android");
    int navBarHeight = 0;

    if (navBarIdentifier > 0) {
        navBarHeight = res.getDimensionPixelSize(navBarIdentifier);
    }//from ww w  .j  a  va 2  s  . c  o  m

    if (!bottomBar.drawBehindNavBar() || navBarHeight == 0
            || (!(softMenuIdentifier > 0 && res.getBoolean(softMenuIdentifier)))) {
        return;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
            && ViewConfiguration.get(activity).hasPermanentMenuKey()) {
        return;
    }

    /**
     * Copy-paste coding made possible by:
     * http://stackoverflow.com/a/14871974/940036
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Display d = activity.getWindowManager().getDefaultDisplay();

        DisplayMetrics realDisplayMetrics = new DisplayMetrics();
        d.getRealMetrics(realDisplayMetrics);

        int realHeight = realDisplayMetrics.heightPixels;
        int realWidth = realDisplayMetrics.widthPixels;

        DisplayMetrics displayMetrics = new DisplayMetrics();
        d.getMetrics(displayMetrics);

        int displayHeight = displayMetrics.heightPixels;
        int displayWidth = displayMetrics.widthPixels;

        boolean hasSoftwareKeys = (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;

        if (!hasSoftwareKeys) {
            return;
        }
    }
    /**
     * End of delicious copy-paste code
     */

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
            && res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        activity.getWindow().getAttributes().flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;

        if (bottomBar.useTopOffset()) {
            int offset;
            int statusBarResource = res.getIdentifier("status_bar_height", "dimen", "android");

            if (statusBarResource > 0) {
                offset = res.getDimensionPixelSize(statusBarResource);
            } else {
                offset = MiscUtils.dpToPixel(activity, 25);
            }

            if (!bottomBar.useOnlyStatusbarOffset()) {
                TypedValue tv = new TypedValue();
                if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
                    offset += TypedValue.complexToDimensionPixelSize(tv.data, res.getDisplayMetrics());
                } else {
                    offset += MiscUtils.dpToPixel(activity, 56);
                }
            }

            bottomBar.getUserContainer().setPadding(0, offset, 0, 0);
        }

        final View outerContainer = bottomBar.getOuterContainer();
        final int navBarHeightCopy = navBarHeight;
        bottomBar.getViewTreeObserver()
                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                    @SuppressWarnings("deprecation")
                    @Override
                    public void onGlobalLayout() {
                        bottomBar.shyHeightAlreadyCalculated();

                        int newHeight = outerContainer.getHeight() + navBarHeightCopy;
                        outerContainer.getLayoutParams().height = newHeight;

                        if (bottomBar.isShy()) {
                            int defaultOffset = bottomBar.useExtraOffset() ? navBarHeightCopy : 0;
                            bottomBar.setTranslationY(defaultOffset);
                            ((CoordinatorLayout.LayoutParams) bottomBar.getLayoutParams())
                                    .setBehavior(new BottomNavigationBehavior(newHeight, defaultOffset,
                                            bottomBar.isShy(), bottomBar.mIsTabletMode));
                        }

                        ViewTreeObserver obs = outerContainer.getViewTreeObserver();

                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                            obs.removeOnGlobalLayoutListener(this);
                        } else {
                            obs.removeGlobalOnLayoutListener(this);
                        }
                    }
                });
    }
}

From source file:com.ifoer.expeditionphone.MainActivity.java

public void switchLanguage(Locale locale) {
    Resources resources = getBaseContext().getResources();
    Configuration config = resources.getConfiguration();
    DisplayMetrics dm = resources.getDisplayMetrics();
    config.locale = locale;//from ww w  .j  ava2  s. c o  m
    resources.updateConfiguration(config, dm);
}

From source file:com.androzic.Androzic.java

public void onCreateEx() {
    try {/* w w  w  .  j  a va 2 s.  co m*/
        (new File(Environment.getExternalStorageDirectory(), WordManager.FOLDER)).mkdirs();
        (new File(Environment.getExternalStorageDirectory(), WordManager.FOLDER + "/ghiam")).mkdirs();
    } catch (Throwable e) {
    }

    if (initialized)
        return;

    AndroidGraphicFactory.createInstance(this);
    try {
        OzfDecoder.useNativeCalls();
    } catch (UnsatisfiedLinkError e) {
        Toast.makeText(Androzic.this, "Failed to initialize native library: " + e.getMessage(),
                Toast.LENGTH_LONG).show();
    }

    Resources resources = getResources();
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    Configuration config = resources.getConfiguration();

    renderingThread = new HandlerThread("RenderingThread");
    renderingThread.start();

    longOperationsThread = new HandlerThread("LongOperationsThread");
    longOperationsThread.setPriority(Thread.MIN_PRIORITY);
    longOperationsThread.start();

    uiHandler = new Handler();
    mapsHandler = new Handler(longOperationsThread.getLooper());

    // We silently initialize data uri to let location service restart after crash
    File datadir = new File(
            settings.getString(getString(R.string.pref_folder_data), Environment.getExternalStorageDirectory()
                    + File.separator + resources.getString(R.string.def_folder_data)));
    setDataPath(Androzic.PATH_DATA, datadir.getAbsolutePath());

    setInstance(this);

    String intentToCheck = "com.androzic.donate";
    String myPackageName = getPackageName();
    PackageManager pm = getPackageManager();
    PackageInfo pi;
    try {
        pi = pm.getPackageInfo(intentToCheck, 0);
        isPaid = (pm.checkSignatures(myPackageName, pi.packageName) == PackageManager.SIGNATURE_MATCH);
    } catch (NameNotFoundException e) {
        //         e.printStackTrace();
    }

    File sdcard = Environment.getExternalStorageDirectory();
    Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this, sdcard.getAbsolutePath()));

    DisplayMetrics displayMetrics = new DisplayMetrics();

    WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    if (wm != null) {
        wm.getDefaultDisplay().getMetrics(displayMetrics);
    } else {
        displayMetrics.setTo(resources.getDisplayMetrics());
    }
    BaseMap.viewportWidth = displayMetrics.widthPixels;
    BaseMap.viewportHeight = displayMetrics.heightPixels;

    charset = settings.getString(getString(R.string.pref_charset), "UTF-8");
    String lang = settings.getString(getString(R.string.pref_locale), "");
    if (!"".equals(lang) && !config.locale.getLanguage().equals(lang)) {
        locale = new Locale(lang);
        Locale.setDefault(locale);
        config.locale = locale;
        resources.updateConfiguration(config, resources.getDisplayMetrics());
    }

    magInterval = resources.getInteger(R.integer.def_maginterval) * 1000;

    overlayManager = new OverlayManager(longOperationsThread.getLooper());
    TooltipManager.initialize(this);

    onSharedPreferenceChanged(settings, getString(R.string.pref_unitcoordinate));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitdistance));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitspeed));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitelevation));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitangle));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitanglemagnetic));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitprecision));
    onSharedPreferenceChanged(settings, getString(R.string.pref_unitsunrise));
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapadjacent));
    onSharedPreferenceChanged(settings, getString(R.string.pref_vectormap_textscale));
    onSharedPreferenceChanged(settings, getString(R.string.pref_onlinemapprescalefactor));
    onSharedPreferenceChanged(settings, getString(R.string.pref_onlinemapexpiration));
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapcropborder));
    onSharedPreferenceChanged(settings, getString(R.string.pref_mapdrawborder));
    onSharedPreferenceChanged(settings, getString(R.string.pref_showwaypoints));
    onSharedPreferenceChanged(settings, getString(R.string.pref_showcurrenttrack));
    onSharedPreferenceChanged(settings, getString(R.string.pref_showaccuracy));
    onSharedPreferenceChanged(settings, getString(R.string.pref_showdistance_int));

    settings.registerOnSharedPreferenceChangeListener(this);

    initialized = true;
}

From source file:de.vanita5.twittnuker.util.Utils.java

public static boolean isRTL(final Context context) {
    if (context == null)
        return false;
    final Resources res = context.getResources();
    return "ar".equals(res.getConfiguration().locale.getLanguage());
    // return/*from www.  j  ava 2  s  .  c o m*/
    // ConfigurationAccessor.getLayoutDirection(res.getConfiguration()) ==
    // SCREENLAYOUT_LAYOUTDIR_RTL;
}

From source file:org.distantshoresmedia.keyboard.LatinIME.java

private void initSuggest(String locale) {
    mInputLocale = locale;/* w  w  w. j  a va  2  s. co  m*/

    Resources orig = getResources();
    Configuration conf = orig.getConfiguration();
    Locale saveLocale = conf.locale;
    conf.locale = new Locale(locale);
    orig.updateConfiguration(conf, orig.getDisplayMetrics());
    if (mSuggest != null) {
        mSuggest.close();
    }
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    mQuickFixes = sp.getBoolean(PREF_QUICK_FIXES, getResources().getBoolean(R.bool.default_quick_fixes));

    int[] dictionaries = getDictionary(orig);
    mSuggest = new Suggest(this, dictionaries);
    updateAutoTextEnabled(saveLocale);
    if (mUserDictionary != null)
        mUserDictionary.close();
    mUserDictionary = new UserDictionary(this, mInputLocale);
    //if (mContactsDictionary == null) {
    //    mContactsDictionary = new ContactsDictionary(this,
    //            Suggest.DIC_CONTACTS);
    //}
    if (mAutoDictionary != null) {
        mAutoDictionary.close();
    }
    mAutoDictionary = new AutoDictionary(this, this, mInputLocale, Suggest.DIC_AUTO);
    if (mUserBigramDictionary != null) {
        mUserBigramDictionary.close();
    }
    mUserBigramDictionary = new UserBigramDictionary(this, this, mInputLocale, Suggest.DIC_USER);
    mSuggest.setUserBigramDictionary(mUserBigramDictionary);
    mSuggest.setUserDictionary(mUserDictionary);
    //mSuggest.setContactsDictionary(mContactsDictionary);
    mSuggest.setAutoDictionary(mAutoDictionary);
    updateCorrectionMode();
    mWordSeparators = mResources.getString(R.string.word_separators);
    mSentenceSeparators = mResources.getString(R.string.sentence_separators);
    initSuggestPuncList();

    conf.locale = saveLocale;
    orig.updateConfiguration(conf, orig.getDisplayMetrics());
}

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   ww  w . ja  va 2s .  c om*/
        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;
}

From source file:org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder.java

public void displayActivity(ParcelableActivity activity, boolean byFriends) {
    final Context context = adapter.getContext();
    final Resources resources = adapter.getContext().getResources();
    switch (activity.action) {
    case Activity.ACTION_FOLLOW: {
        activityTypeView.setImageResource(R.drawable.ic_activity_action_follow);
        activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_follow),
                Mode.SRC_ATOP);/*from www.  java 2s . c  o  m*/
        if (byFriends) {
            titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_follow,
                    R.string.activity_by_friends_follow_multi, activity.sources, activity.target_users));
        } else {
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_follow,
                    R.string.activity_about_me_follow_multi, activity.sources));
        }
        displayUserProfileImages(activity.sources);
        summaryView.setVisibility(View.GONE);
        break;
    }
    case Activity.ACTION_FAVORITE: {
        if (adapter.shouldUseStarsForLikes()) {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite),
                    Mode.SRC_ATOP);

            if (byFriends) {
                titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_favorite,
                        R.string.activity_by_friends_favorite_multi, activity.sources,
                        activity.target_statuses));
            } else {
                titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorite,
                        R.string.activity_about_me_favorite_multi, activity.sources));
            }
        } else {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_like);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like),
                    Mode.SRC_ATOP);

            if (byFriends) {
                titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_like,
                        R.string.activity_by_friends_like_multi, activity.sources, activity.target_statuses));
            } else {
                titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_like,
                        R.string.activity_about_me_like_multi, activity.sources));
            }
        }
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_RETWEET: {
        activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet);
        activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet),
                Mode.SRC_ATOP);
        if (byFriends) {
            titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_retweet,
                    R.string.activity_by_friends_retweet_multi, activity.sources, activity.target_statuses));
        } else
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweet,
                    R.string.activity_about_me_retweet_multi, activity.sources));
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_FAVORITED_RETWEET: {
        if (byFriends) {
            showNotSupported();
            return;
        }
        if (adapter.shouldUseStarsForLikes()) {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite),
                    Mode.SRC_ATOP);
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorited_retweet,
                    R.string.activity_about_me_favorited_retweet_multi, activity.sources));
        } else {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_like);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like),
                    Mode.SRC_ATOP);
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_liked_retweet,
                    R.string.activity_about_me_liked_retweet_multi, activity.sources));
        }
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_RETWEETED_RETWEET: {
        if (byFriends) {
            showNotSupported();
            return;
        }
        activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet);
        activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet),
                Mode.SRC_ATOP);
        titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweeted_retweet,
                R.string.activity_about_me_retweeted_retweet_multi, activity.sources));
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_RETWEETED_MENTION: {
        if (byFriends) {
            showNotSupported();
            return;
        }
        activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet);
        activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet),
                Mode.SRC_ATOP);
        titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweeted_mention,
                R.string.activity_about_me_retweeted_mention_multi, activity.sources));
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_FAVORITED_MENTION: {
        if (byFriends) {
            showNotSupported();
            return;
        }
        if (adapter.shouldUseStarsForLikes()) {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite),
                    Mode.SRC_ATOP);
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorited_mention,
                    R.string.activity_about_me_favorited_mention_multi, activity.sources));
        } else {
            activityTypeView.setImageResource(R.drawable.ic_activity_action_like);
            activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like),
                    Mode.SRC_ATOP);
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_liked_mention,
                    R.string.activity_about_me_liked_mention_multi, activity.sources));
        }
        displayUserProfileImages(activity.sources);
        summaryView.setText(activity.target_statuses[0].text_unescaped);
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_LIST_CREATED: {
        if (!byFriends) {
            showNotSupported();
            return;
        }
        activityTypeView.setImageResource(R.drawable.ic_activity_action_list_added);
        activityTypeView.setColorFilter(activityTypeView.getDefaultColor(), Mode.SRC_ATOP);
        titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_list_created,
                R.string.activity_by_friends_list_created_multi, activity.sources,
                activity.target_object_user_lists));
        displayUserProfileImages(activity.sources);
        boolean firstLine = true;
        summaryView.setText("");
        for (ParcelableUserList item : activity.target_object_user_lists) {
            if (!firstLine) {
                summaryView.append("\n");
            }
            summaryView.append(item.description);
            firstLine = false;
        }
        summaryView.setVisibility(View.VISIBLE);
        break;
    }
    case Activity.ACTION_LIST_MEMBER_ADDED: {
        if (byFriends) {
            showNotSupported();
            return;
        }
        activityTypeView.setImageResource(R.drawable.ic_activity_action_list_added);
        activityTypeView.setColorFilter(activityTypeView.getDefaultColor(), Mode.SRC_ATOP);
        if (activity.sources.length == 1 && activity.target_object_user_lists != null
                && activity.target_object_user_lists.length == 1) {
            final UserColorNameManager manager = adapter.getUserColorNameManager();
            final SpannableString firstDisplayName = new SpannableString(
                    manager.getDisplayName(activity.sources[0], adapter.isNameFirst(), false));
            final SpannableString listName = new SpannableString(activity.target_object_user_lists[0].name);
            firstDisplayName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstDisplayName.length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            listName.setSpan(new StyleSpan(Typeface.BOLD), 0, listName.length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            final String format = context.getString(R.string.activity_about_me_list_member_added_with_name);
            final Configuration configuration = resources.getConfiguration();
            titleView.setText(SpanFormatter.format(configuration.locale, format, firstDisplayName, listName));
        } else {
            titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_list_member_added,
                    R.string.activity_about_me_list_member_added_multi, activity.sources));
        }
        displayUserProfileImages(activity.sources);
        summaryView.setVisibility(View.GONE);
        break;
    }
    }
}