List of usage examples for android.content.res Resources getDisplayMetrics
public DisplayMetrics getDisplayMetrics()
From source file:org.distantshoresmedia.keyboard.LatinIME.java
private void initSuggest(String locale) { mInputLocale = locale;//from w w w .jav a2 s .c o 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:de.vanita5.twittnuker.fragment.support.UserProfileFragment.java
public void displayUser(final ParcelableUser user) { mRelationship = null;//from w w w.j av a 2s . co m mUser = null; mAdapter.clear(); if (user == null || user.id <= 0 || getActivity() == null) return; final Resources res = getResources(); final LoaderManager lm = getLoaderManager(); lm.destroyLoader(LOADER_ID_USER); lm.destroyLoader(LOADER_ID_FRIENDSHIP); final boolean userIsMe = user.account_id == user.id; mErrorRetryContainer.setVisibility(View.GONE); mUser = user; mProfileNameContainer.drawStart(getUserColor(getActivity(), user.id, true)); mProfileNameContainer.drawEnd(getAccountColor(getActivity(), user.account_id)); final String nick = getUserNickname(getActivity(), user.id, true); mNameView.setText( TextUtils.isEmpty(nick) ? user.name : getString(R.string.name_with_nickname, user.name, nick)); mProfileImageView.setUserType(user.is_verified, user.is_protected); mScreenNameView.setText("@" + user.screen_name); mDescriptionContainer.setVisibility(userIsMe || !isEmpty(user.description_html) ? View.VISIBLE : View.GONE); mDescriptionView.setText(user.description_html != null ? Html.fromHtml(user.description_html) : null); final TwidereLinkify linkify = new TwidereLinkify(this); linkify.setLinkTextColor(ThemeUtils.getUserLinkTextColor(getActivity())); linkify.applyAllLinks(mDescriptionView, user.account_id, false); mDescriptionView.setMovementMethod(null); mLocationContainer.setVisibility(userIsMe || !isEmpty(user.location) ? View.VISIBLE : View.GONE); mLocationView.setText(user.location); mURLContainer.setVisibility( userIsMe || !isEmpty(user.url) || !isEmpty(user.url_expanded) ? View.VISIBLE : View.GONE); mURLView.setText(isEmpty(user.url_expanded) ? user.url : user.url_expanded); mURLView.setMovementMethod(null); final String createdAt = formatToLongTimeString(getActivity(), user.created_at); final float daysSinceCreated = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24; final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreated)); mCreatedAtView.setText(res.getQuantityString(R.plurals.created_at_with_N_tweets_per_day, dailyTweets, createdAt, dailyTweets)); mTweetCount.setText(getLocalizedNumber(mLocale, user.statuses_count)); mFollowersCount.setText(getLocalizedNumber(mLocale, user.followers_count)); mFriendsCount.setText(getLocalizedNumber(mLocale, user.friends_count)); if (mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true)) { mProfileImageLoader.displayProfileImage(mProfileImageView, getOriginalTwitterProfileImage(user.profile_image_url)); final int def_width = res.getDisplayMetrics().widthPixels; final int width = mBannerWidth > 0 ? mBannerWidth : def_width; mProfileBannerView.setImageBitmap(null); mProfileImageLoader.displayProfileBanner(mProfileBannerView, user.profile_banner_url, width); } else { mProfileImageView.setImageResource(R.drawable.ic_profile_image_default); mProfileBannerView.setImageResource(android.R.color.transparent); } if (isMyAccount(getActivity(), user.id)) { final ContentResolver resolver = getContentResolver(); final ContentValues values = new ContentValues(); values.put(Accounts.NAME, user.name); values.put(Accounts.SCREEN_NAME, user.screen_name); values.put(Accounts.PROFILE_IMAGE_URL, user.profile_image_url); values.put(Accounts.PROFILE_BANNER_URL, user.profile_banner_url); final String where = Accounts.ACCOUNT_ID + " = " + user.id; resolver.update(Accounts.CONTENT_URI, values, where, null); } mAdapter.add(new FavoritesAction(1)); mAdapter.add(new UserMentionsAction(2)); mAdapter.add(new UserListsAction(3)); mAdapter.add(new UserListMembershipsAction(4)); if (userIsMe) { mAdapter.add(new SavedSearchesAction(11)); if (user.is_protected) { mAdapter.add(new IncomingFriendshipsAction(12)); } mAdapter.add(new UserBlocksAction(13)); mAdapter.add(new MutesUsersAction(14)); } mAdapter.notifyDataSetChanged(); if (!user.is_cache) { getFriendship(); } invalidateOptionsMenu(); setMenu(mMenuBar.getMenu()); mMenuBar.show(); }
From source file:edu.mit.viral.shen.DroidFish.java
private final void updateButtons() { boolean largeButtons = settings.getBoolean("largeButtons", true); Resources r = getResources(); int bWidth = (int) Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics())); int bHeight = (int) Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics())); if (largeButtons) { if (custom1ButtonActions.isEnabled() && custom2ButtonActions.isEnabled() && custom3ButtonActions.isEnabled()) { Configuration config = getResources().getConfiguration(); if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) { bWidth = bWidth * 7 / 6; bHeight = bHeight * 7 / 6; } else { bWidth = bWidth * 6 / 5; bHeight = bHeight * 6 / 5; }/*from ww w. j a va2s . com*/ } else { bWidth = bWidth * 3 / 2; bHeight = bHeight * 3 / 2; } } SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.touch); setButtonData(custom1Button, bWidth, bHeight, custom1ButtonActions.getIcon(), svg); setButtonData(custom2Button, bWidth, bHeight, custom2ButtonActions.getIcon(), svg); setButtonData(custom3Button, bWidth, bHeight, custom3ButtonActions.getIcon(), svg); setButtonData(commentButton, bWidth, bHeight, R.raw.comment, svg); setButtonData(undoButton, bWidth, bHeight, R.raw.left, svg); setButtonData(redoButton, bWidth, bHeight, R.raw.right, svg); }
From source file:com.androzic.Androzic.java
public void onCreateEx() { try {//from w ww .ja va 2s .c o 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:org.getlantern.firetweet.fragment.support.UserFragment.java
public void displayUser(final ParcelableUser user) { mUser = user;/*from www . j ava 2s . c om*/ final FragmentActivity activity = getActivity(); if (user == null || user.id <= 0 || activity == null) return; final Resources res = getResources(); final LoaderManager lm = getLoaderManager(); lm.destroyLoader(LOADER_ID_USER); lm.destroyLoader(LOADER_ID_FRIENDSHIP); final boolean userIsMe = user.account_id == user.id; mCardContent.setVisibility(View.VISIBLE); mErrorRetryContainer.setVisibility(View.GONE); mProgressContainer.setVisibility(View.GONE); mUser = user; final int userColor = getUserColor(activity, user.id, true); mProfileImageView.setBorderColor(userColor != 0 ? userColor : Color.WHITE); mProfileNameContainer.drawEnd(getAccountColor(activity, user.account_id)); final String nick = getUserNickname(activity, user.id, true); mNameView.setText( TextUtils.isEmpty(nick) ? user.name : getString(R.string.name_with_nickname, user.name, nick)); final int typeIconRes = getUserTypeIconRes(user.is_verified, user.is_protected); if (typeIconRes != 0) { mProfileTypeView.setImageResource(typeIconRes); mProfileTypeView.setVisibility(View.VISIBLE); } else { mProfileTypeView.setImageDrawable(null); mProfileTypeView.setVisibility(View.GONE); } mScreenNameView.setText("@" + user.screen_name); mDescriptionContainer.setVisibility(isEmpty(user.description_html) ? View.GONE : View.VISIBLE); mDescriptionView.setText( user.description_html != null ? Html.fromHtml(user.description_html) : user.description_plain); final FiretweetLinkify linkify = new FiretweetLinkify(this); linkify.applyAllLinks(mDescriptionView, user.account_id, false); mDescriptionView.setMovementMethod(null); mLocationContainer.setVisibility(isEmpty(user.location) ? View.GONE : View.VISIBLE); mLocationView.setText(user.location); mURLContainer.setVisibility(isEmpty(user.url) && isEmpty(user.url_expanded) ? View.GONE : View.VISIBLE); mURLView.setText(isEmpty(user.url_expanded) ? user.url : user.url_expanded); mURLView.setMovementMethod(null); final String createdAt = formatToLongTimeString(activity, user.created_at); final float daysSinceCreation = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24; final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreation)); mCreatedAtView.setText(res.getQuantityString(R.plurals.created_at_with_N_tweets_per_day, dailyTweets, createdAt, dailyTweets)); mListedCount.setText(getLocalizedNumber(mLocale, user.listed_count)); mFollowersCount.setText(getLocalizedNumber(mLocale, user.followers_count)); mFriendsCount.setText(getLocalizedNumber(mLocale, user.friends_count)); mProfileImageLoader.displayProfileImage(mProfileImageView, getOriginalTwitterProfileImage(user.profile_image_url)); if (userColor != 0) { setUserUiColor(userColor); } else { setUserUiColor(user.link_color); } final int defWidth = res.getDisplayMetrics().widthPixels; final int width = mBannerWidth > 0 ? mBannerWidth : defWidth; mProfileImageLoader.displayProfileBanner(mProfileBannerView, user.profile_banner_url, width); mUuckyFooter.setVisibility(isUucky(user.id, user.screen_name, user) ? View.VISIBLE : View.GONE); final Relationship relationship = mRelationship; if (relationship == null || relationship.getTargetUserId() != user.id) { getFriendship(); } activity.setTitle(UserColorNameUtils.getDisplayName(activity, user, true)); updateTitleColor(); invalidateOptionsMenu(); }
From source file:org.mariotaku.twidere.fragment.support.UserFragment.java
public void displayUser(final ParcelableUser user) { mUser = user;//from w ww . j a v a2 s . c om final FragmentActivity activity = getActivity(); if (user == null || user.id <= 0 || activity == null) return; final Resources resources = getResources(); final UserColorNameManager manager = UserColorNameManager.getInstance(activity); final LoaderManager lm = getLoaderManager(); lm.destroyLoader(LOADER_ID_USER); lm.destroyLoader(LOADER_ID_FRIENDSHIP); final boolean userIsMe = user.account_id == user.id; mCardContent.setVisibility(View.VISIBLE); mHeaderErrorContainer.setVisibility(View.GONE); mProgressContainer.setVisibility(View.GONE); mUser = user; final int userColor = manager.getUserColor(user.id, true); mProfileImageView.setBorderColor(userColor != 0 ? userColor : Color.WHITE); mProfileNameContainer.drawEnd(Utils.getAccountColor(activity, user.account_id)); final String nick = manager.getUserNickname(user.id, true); mNameView.setText( TextUtils.isEmpty(nick) ? user.name : getString(R.string.name_with_nickname, user.name, nick)); final int typeIconRes = Utils.getUserTypeIconRes(user.is_verified, user.is_protected); if (typeIconRes != 0) { mProfileTypeView.setImageResource(typeIconRes); mProfileTypeView.setVisibility(View.VISIBLE); } else { mProfileTypeView.setImageDrawable(null); mProfileTypeView.setVisibility(View.GONE); } mScreenNameView.setText("@" + user.screen_name); mDescriptionContainer.setVisibility(TextUtils.isEmpty(user.description_html) ? View.GONE : View.VISIBLE); mDescriptionView.setText( user.description_html != null ? Html.fromHtml(user.description_html) : user.description_plain); final TwidereLinkify linkify = new TwidereLinkify(this); linkify.applyAllLinks(mDescriptionView, user.account_id, false); mDescriptionView.setMovementMethod(null); mLocationContainer.setVisibility(TextUtils.isEmpty(user.location) ? View.GONE : View.VISIBLE); mLocationView.setText(user.location); mURLContainer.setVisibility( TextUtils.isEmpty(user.url) && TextUtils.isEmpty(user.url_expanded) ? View.GONE : View.VISIBLE); mURLView.setText(TextUtils.isEmpty(user.url_expanded) ? user.url : user.url_expanded); mURLView.setMovementMethod(null); final String createdAt = Utils.formatToLongTimeString(activity, user.created_at); final float daysSinceCreation = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24; final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreation)); mCreatedAtView.setText(resources.getQuantityString(R.plurals.created_at_with_N_tweets_per_day, dailyTweets, createdAt, dailyTweets)); mListedCount.setText(Utils.getLocalizedNumber(mLocale, user.listed_count)); mFollowersCount.setText(Utils.getLocalizedNumber(mLocale, user.followers_count)); mFriendsCount.setText(Utils.getLocalizedNumber(mLocale, user.friends_count)); mProfileImageLoader.displayProfileImage(mProfileImageView, Utils.getOriginalTwitterProfileImage(user.profile_image_url)); if (userColor != 0) { setUiColor(userColor); } else { setUiColor(user.link_color); } final int defWidth = resources.getDisplayMetrics().widthPixels; final int width = mBannerWidth > 0 ? mBannerWidth : defWidth; mProfileImageLoader.displayProfileBanner(mProfileBannerView, user.profile_banner_url, width); mUuckyFooter.setVisibility(isUucky(user.id, user.screen_name, user) ? View.VISIBLE : View.GONE); final Relationship relationship = mRelationship; if (relationship == null || relationship.getTargetUserId() != user.id) { getFriendship(); } activity.setTitle(manager.getDisplayName(user, mNameFirst, true)); updateTitleAlpha(); invalidateOptionsMenu(); updateSubtitle(); }
From source file:com.if3games.chessonline.DroidFish.java
private final void updateButtons() { boolean largeButtons = settings.getBoolean("largeButtons", false); Resources r = getResources(); int bWidth = (int) Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics())); int bHeight = (int) Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics())); if (largeButtons) { if (custom1ButtonActions.isEnabled() && custom2ButtonActions.isEnabled() && custom3ButtonActions.isEnabled()) { Configuration config = getResources().getConfiguration(); if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) { bWidth = bWidth * 6 / 5; bHeight = bHeight * 6 / 5; } else { bWidth = bWidth * 5 / 4; bHeight = bHeight * 5 / 4; }/*from w w w. j a va2 s . c o m*/ } else { bWidth = bWidth * 3 / 2; bHeight = bHeight * 3 / 2; } } SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.touch); setButtonData(custom1Button, bWidth, bHeight, custom1ButtonActions.getIcon(), svg); setButtonData(custom2Button, bWidth, bHeight, custom2ButtonActions.getIcon(), svg); setButtonData(custom3Button, bWidth, bHeight, custom3ButtonActions.getIcon(), svg); setButtonData(modeButton, bWidth, bHeight, R.raw.mode, svg); setButtonData(undoButton, bWidth, bHeight, R.raw.left, svg); setButtonData(redoButton, bWidth, bHeight, R.raw.right, svg); }
From source file:org.mariotaku.twidere.fragment.UserFragment.java
@UiThread public void displayUser(final ParcelableUser user, ParcelableAccount account) { final FragmentActivity activity = getActivity(); if (activity == null) return;//from w w w . j ava2 s .c o m mUser = user; mAccount = account; if (user == null || user.key == null) { mProfileImageView.setVisibility(View.GONE); mProfileTypeView.setVisibility(View.GONE); if (activity instanceof ATEActivity) { setUiColor(Config.primaryColor(activity, ((ATEActivity) activity).getATEKey())); } return; } mProfileImageView.setVisibility(View.VISIBLE); final Resources resources = getResources(); final LoaderManager lm = getLoaderManager(); lm.destroyLoader(LOADER_ID_USER); lm.destroyLoader(LOADER_ID_FRIENDSHIP); mCardContent.setVisibility(View.VISIBLE); mHeaderErrorContainer.setVisibility(View.GONE); mProgressContainer.setVisibility(View.GONE); mUser = user; mProfileImageView.setBorderColor(user.color != 0 ? user.color : Color.WHITE); mProfileNameContainer.drawEnd(user.account_color); mNameView.setText(mBidiFormatter.unicodeWrap(TextUtils.isEmpty(user.nickname) ? user.name : getString(R.string.name_with_nickname, user.name, user.nickname))); final int typeIconRes = Utils.getUserTypeIconRes(user.is_verified, user.is_protected); if (typeIconRes != 0) { mProfileTypeView.setImageResource(typeIconRes); mProfileTypeView.setVisibility(View.VISIBLE); } else { mProfileTypeView.setImageDrawable(null); mProfileTypeView.setVisibility(View.GONE); } mScreenNameView.setText(String.format("@%s", user.screen_name)); final TwidereLinkify linkify = new TwidereLinkify(this); if (user.description_unescaped != null) { final SpannableStringBuilder text = SpannableStringBuilder.valueOf(user.description_unescaped); ParcelableStatusUtils.applySpans(text, user.description_spans); linkify.applyAllLinks(text, user.account_key, false, false); mDescriptionView.setText(text); } else { mDescriptionView.setText(user.description_plain); Linkify.addLinks(mDescriptionView, Linkify.WEB_URLS); } mDescriptionContainer.setVisibility(mDescriptionView.length() > 0 ? View.VISIBLE : View.GONE); mLocationContainer.setVisibility(TextUtils.isEmpty(user.location) ? View.GONE : View.VISIBLE); mLocationView.setText(user.location); mURLContainer.setVisibility( TextUtils.isEmpty(user.url) && TextUtils.isEmpty(user.url_expanded) ? View.GONE : View.VISIBLE); mURLView.setText(TextUtils.isEmpty(user.url_expanded) ? user.url : user.url_expanded); final String createdAt = Utils.formatToLongTimeString(activity, user.created_at); final float daysSinceCreation = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24; final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreation)); mCreatedAtView.setText(resources.getQuantityString(R.plurals.created_at_with_N_tweets_per_day, dailyTweets, createdAt, dailyTweets)); mListedCount.setText(Utils.getLocalizedNumber(mLocale, user.listed_count)); final long groupsCount = user.extras != null ? user.extras.groups_count : -1; mGroupsCount.setText(Utils.getLocalizedNumber(mLocale, groupsCount)); mFollowersCount.setText(Utils.getLocalizedNumber(mLocale, user.followers_count)); mFriendsCount.setText(Utils.getLocalizedNumber(mLocale, user.friends_count)); mListedContainer.setVisibility(user.listed_count < 0 ? View.GONE : View.VISIBLE); mGroupsContainer.setVisibility(groupsCount < 0 ? View.GONE : View.VISIBLE); mMediaLoader.displayOriginalProfileImage(mProfileImageView, user); if (user.color != 0) { setUiColor(user.color); } else if (user.link_color != 0) { setUiColor(user.link_color); } else if (activity instanceof ATEActivity) { setUiColor(Config.primaryColor(activity, ((ATEActivity) activity).getATEKey())); } final int defWidth = resources.getDisplayMetrics().widthPixels; final int width = mBannerWidth > 0 ? mBannerWidth : defWidth; final String bannerUrl = ParcelableUserUtils.getProfileBannerUrl(user); if (ObjectUtils.notEqual(mProfileBannerView.getTag(), bannerUrl) || mProfileBannerView.getDrawable() == null) { mProfileBannerView.setTag(bannerUrl); mMediaLoader.displayProfileBanner(mProfileBannerView, bannerUrl, width); } final UserRelationship relationship = mRelationship; if (relationship == null) { getFriendship(); } activity.setTitle( UserColorNameManager.decideDisplayName(user.nickname, user.name, user.screen_name, mNameFirst)); Calendar cal = Calendar.getInstance(); final int currentMonth = cal.get(Calendar.MONTH), currentDay = cal.get(Calendar.DAY_OF_MONTH); cal.setTimeInMillis(user.created_at); if (cal.get(Calendar.MONTH) == currentMonth && cal.get(Calendar.DAY_OF_MONTH) == currentDay && !mHideBirthdayView) { mProfileBirthdayBannerView.setVisibility(View.VISIBLE); } else { mProfileBirthdayBannerView.setVisibility(View.GONE); } updateTitleAlpha(); invalidateOptionsMenu(); updateSubtitle(); }