fixed profile layout height, bug fix

This commit is contained in:
nuclearfog 2020-07-11 14:46:14 +02:00
parent b97f77effb
commit a82a8277e5
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
4 changed files with 14 additions and 8 deletions

View File

@ -509,7 +509,9 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
}
if (settings.getImageLoad()) {
if (user.hasBannerImg()) {
profile_layer.getLayoutParams().height = (int) getResources().getDimension(R.dimen.profile_banner_height);
int layoutHeight = profile_layer.getMeasuredWidth() / 3;
int buttonHeight = (int) getResources().getDimension(R.dimen.profile_button_height);
profile_layer.getLayoutParams().height = layoutHeight + buttonHeight;
String bannerLink = user.getBannerLink() + "/600x200";
Picasso.get().load(bannerLink).error(R.drawable.no_banner).into(bannerImage);
} else {
@ -570,7 +572,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
*/
public void onError(EngineException err) {
ErrorHandler.handleFailure(this, err);
if (user == null) {
if (user == null || err.resourceNotFound()) {
finish();
}
}

View File

@ -4,6 +4,7 @@ import twitter4j.TwitterException;
import static org.nuclearfog.twidda.backend.engine.EngineException.ErrorType.NOT_AUTHORIZED;
import static org.nuclearfog.twidda.backend.engine.EngineException.ErrorType.RESOURCE_NOT_FOUND;
import static org.nuclearfog.twidda.backend.engine.EngineException.ErrorType.USER_NOT_FOUND;
public class EngineException extends Exception {
@ -148,7 +149,7 @@ public class EngineException extends Exception {
* @return true if resource not found or access denied
*/
public boolean resourceNotFound() {
return errorType == RESOURCE_NOT_FOUND || errorType == NOT_AUTHORIZED;
return errorType == RESOURCE_NOT_FOUND || errorType == NOT_AUTHORIZED || errorType == USER_NOT_FOUND;
}

View File

@ -79,6 +79,7 @@
android:id="@+id/profile_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/profile_textsize_big"
android:drawablePadding="@dimen/profile_padding_drawable"
android:padding="@dimen/profile_tv_padding"
android:singleLine="true" />
@ -92,6 +93,7 @@
android:id="@+id/profile_screenname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/profile_textsize_big"
android:drawablePadding="@dimen/profile_padding_drawable"
android:padding="@dimen/profile_tv_padding"
android:singleLine="true" />
@ -100,6 +102,7 @@
android:id="@+id/follow_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/profile_textsize_big"
android:drawablePadding="@dimen/profile_padding_drawable"
android:padding="@dimen/profile_tv_padding"
android:singleLine="true"
@ -174,7 +177,7 @@
android:layout_marginRight="@dimen/profile_tv_margin"
android:drawablePadding="@dimen/profile_padding_drawable"
android:singleLine="true"
android:textSize="@dimen/profile_textsize"
android:textSize="@dimen/profile_textsize_small"
app:drawableLeftCompat="@drawable/userlocation"
app:drawableStartCompat="@drawable/userlocation" />
@ -187,7 +190,7 @@
android:drawablePadding="@dimen/profile_padding_drawable"
android:linksClickable="true"
android:singleLine="true"
android:textSize="@dimen/profile_textsize"
android:textSize="@dimen/profile_textsize_small"
app:drawableLeftCompat="@drawable/link"
app:drawableStartCompat="@drawable/link" />
@ -199,7 +202,7 @@
android:layout_marginRight="@dimen/profile_tv_margin"
android:drawablePadding="@dimen/profile_padding_drawable"
android:singleLine="true"
android:textSize="@dimen/profile_textsize"
android:textSize="@dimen/profile_textsize_small"
app:drawableLeftCompat="@drawable/calendar"
app:drawableStartCompat="@drawable/calendar" />

View File

@ -43,7 +43,6 @@
<!--dimens of page_profile.xml-->
<dimen name="profile_toolbar_height">@dimen/toolbar_height</dimen>
<dimen name="profile_image">80dp</dimen>
<dimen name="profile_banner_height">144dp</dimen>
<dimen name="profile_tv_margin">5dp</dimen>
<dimen name="profile_banner_padding">5dp</dimen>
<dimen name="profile_tv_padding">2dp</dimen>
@ -53,7 +52,8 @@
<dimen name="profile_button_height">20sp</dimen>
<dimen name="profile_button_margin">5dp</dimen>
<dimen name="profile_button_padding">5dp</dimen>
<dimen name="profile_textsize">12sp</dimen>
<dimen name="profile_textsize_big">14sp</dimen>
<dimen name="profile_textsize_small">12sp</dimen>
<integer name="profile_text_bio_lines">3</integer>
<!--dimens of page_editprofile.xml-->