also show info on rotation

This commit is contained in:
tobiaskaminsky 2018-01-04 07:29:42 +01:00 committed by tobiasKaminsky
parent 2a39e00f3b
commit 44c1c725c0
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -207,8 +207,6 @@ public class UserInfoActivity extends FileActivity {
if (userInfo != null) {
populateUserInfoUi(userInfo);
emptyContentContainer.setVisibility(View.GONE);
userInfoView.setVisibility(View.VISIBLE);
} else {
setMultiListLoadingMessage();
fetchAndSetData();
@ -320,39 +318,36 @@ public class UserInfoActivity extends FileActivity {
}
private void populateUserInfoUi(UserInfo userInfo) {
if (userInfo.getPhone() == null && userInfo.getEmail() == null && userInfo.getAddress() == null
&& userInfo.getTwitter() == null & userInfo.getWebpage() == null) {
setErrorMessageForMultiList(getString(R.string.userinfo_no_info_headline),
getString(R.string.userinfo_no_info_text));
} else {
emptyContentContainer.setVisibility(View.GONE);
userInfoView.setVisibility(View.VISIBLE);
userName.setText(account.name);
DisplayUtils.setAvatar(account, UserInfoActivity.this,
mCurrentAccountAvatarRadiusDimension, getResources(), getStorageManager(), avatar);
int tint = ThemeUtils.primaryColor(account);
if (userInfo != null) {
if (!TextUtils.isEmpty(userInfo.getDisplayName())) {
fullName.setText(userInfo.getDisplayName());
}
populateUserInfoElement(mPhoneNumberContainer, mPhoneNumberTextView, userInfo.getPhone(),
mPhoneNumberIcon, tint);
populateUserInfoElement(mPhoneNumberContainer, mPhoneNumberTextView, userInfo.getPhone(), mPhoneNumberIcon,
tint);
populateUserInfoElement(mEmailContainer, mEmailAddressTextView, userInfo.getEmail(), mEmailIcon, tint);
populateUserInfoElement(mAddressContainer, mAddressTextView, userInfo.getAddress(), mAddressIcon, tint);
populateUserInfoElement(
mWebsiteContainer,
mWebsiteTextView,
DisplayUtils.beautifyURL(userInfo.getWebpage()),
mWebsiteIcon,
tint);
populateUserInfoElement(
mTwitterContainer,
mTwitterHandleTextView,
DisplayUtils.beautifyTwitterHandle(userInfo.getTwitter()),
mTwitterIcon,
tint);
populateUserInfoElement(mWebsiteContainer, mWebsiteTextView,
DisplayUtils.beautifyURL(userInfo.getWebpage()), mWebsiteIcon, tint);
populateUserInfoElement(mTwitterContainer, mTwitterHandleTextView,
DisplayUtils.beautifyTwitterHandle(userInfo.getTwitter()), mTwitterIcon, tint);
}
}
private void populateUserInfoElement(View container, TextView textView, String text, ImageView icon, @ColorInt int
tint) {
private void populateUserInfoElement(View container, TextView textView, String text, ImageView icon,
@ColorInt int tint) {
if (!TextUtils.isEmpty(text)) {
textView.setText(text);
DrawableCompat.setTint(icon.getDrawable(), tint);
@ -471,18 +466,8 @@ public class UserInfoActivity extends FileActivity {
if (result.isSuccess() && result.getData() != null) {
userInfo = (UserInfo) result.getData().get(0);
if (userInfo.getPhone() == null && userInfo.getEmail() == null && userInfo.getAddress() == null
&& userInfo.getTwitter() == null & userInfo.getWebpage() == null) {
runOnUiThread(() -> setErrorMessageForMultiList(getString(R.string.userinfo_no_info_headline),
getString(R.string.userinfo_no_info_text)));
} else {
runOnUiThread(() -> {
populateUserInfoUi(userInfo);
runOnUiThread(() -> populateUserInfoUi(userInfo));
emptyContentContainer.setVisibility(View.GONE);
userInfoView.setVisibility(View.VISIBLE);
});
}
} else {
// show error
runOnUiThread(() -> setErrorMessageForMultiList(sorryMessage, result.getLogMessage()));