layout bug fix

This commit is contained in:
NudeDude 2019-05-12 01:42:25 +02:00
parent 99b01af4fb
commit b536f1ccc5
2 changed files with 43 additions and 45 deletions

View File

@ -53,8 +53,8 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
private int highlight;
private boolean imgEnabled;
private boolean isHome;
private boolean isFollowing;
private boolean isFollowed;
private boolean isFriend;
private boolean isFollower;
private boolean isBlocked;
private boolean isMuted;
private boolean canDm;
@ -96,8 +96,8 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
if (!isHome) {
boolean[] connection = mTwitter.getConnection(UID);
isFollowing = connection[0];
isFollowed = connection[1];
isFriend = connection[0];
isFollower = connection[1];
isBlocked = connection[2];
isMuted = connection[3];
canDm = connection[4];
@ -106,17 +106,17 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
switch (mode) {
case ACTION_FOLLOW:
if (user.isLocked()) {
if (isFollowing)
if (isFriend)
user = mTwitter.unfollowUser(UID);
else if (!user.followRequested())
user = mTwitter.followUser(UID);
// TODO purge follow request
} else {
if (!isFollowing)
if (!isFriend)
user = mTwitter.followUser(UID);
else
user = mTwitter.unfollowUser(UID);
isFollowing = !isFollowing;
isFriend = !isFriend;
}
publishProgress();
break;
@ -155,6 +155,7 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
protected void onProgressUpdate(Void... v) {
if (ui.get() == null) return;
ImageView profile = ui.get().findViewById(R.id.profile_img);
TextView txtUser = ui.get().findViewById(R.id.profile_username);
TextView txtScrName = ui.get().findViewById(R.id.profile_screenname);
TextView txtBio = ui.get().findViewById(R.id.bio);
@ -162,49 +163,37 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
TextView txtLink = ui.get().findViewById(R.id.links);
TextView txtFollowing = ui.get().findViewById(R.id.following);
TextView txtFollower = ui.get().findViewById(R.id.follower);
ImageView profile = ui.get().findViewById(R.id.profile_img);
TextView txtCreated = ui.get().findViewById(R.id.profile_date);
View location_ico = ui.get().findViewById(R.id.loction_ico);
View link_ico = ui.get().findViewById(R.id.links_ico);
View locked = ui.get().findViewById(R.id.profile_locked);
View verified = ui.get().findViewById(R.id.profile_verify);
View following = ui.get().findViewById(R.id.followback);
View profile_head = ui.get().findViewById(R.id.profile_header);
if (mode == Mode.LDR_PROFILE) {
View profile_head = ui.get().findViewById(R.id.profile_header);
if (profile_head.getVisibility() != VISIBLE) {
profile_head.setVisibility(VISIBLE);
View verified = ui.get().findViewById(R.id.profile_verify);
View followback = ui.get().findViewById(R.id.followback);
View locked = ui.get().findViewById(R.id.profile_locked);
TextView txtCreated = ui.get().findViewById(R.id.profile_date);
String date = sdf.format(new Date(user.getCreatedAt()));
txtCreated.setText(date);
if (user.isVerified())
verified.setVisibility(VISIBLE);
if (isFollowed)
followback.setVisibility(VISIBLE);
if (user.isLocked()) {
locked.setVisibility(VISIBLE);
}
profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent image = new Intent(ui.get(), ImageDetail.class);
image.putExtra("link", new String[]{user.getImageLink()});
image.putExtra("storable", true);
ui.get().startActivity(image);
}
});
}
}
Spanned bio = Tagger.makeText(user.getBio(), highlight, ui.get());
txtBio.setMovementMethod(LinkMovementMethod.getInstance());
txtBio.setText(bio);
txtUser.setText(user.getUsername());
txtScrName.setText(user.getScreenname());
txtFollower.setText(formatter.format(user.getFollower()));
txtFollowing.setText(formatter.format(user.getFollowing()));
String date = sdf.format(new Date(user.getCreatedAt()));
txtCreated.setText(date);
txtBio.setText(bio);
if (profile_head.getVisibility() != VISIBLE)
profile_head.setVisibility(VISIBLE);
if (isFollower)
following.setVisibility(VISIBLE);
else
following.setVisibility(GONE);
if (user.isVerified())
verified.setVisibility(VISIBLE);
else
verified.setVisibility(GONE);
if (user.isLocked())
locked.setVisibility(VISIBLE);
else
locked.setVisibility(GONE);
if (user.getLocation() != null && !user.getLocation().isEmpty()) {
txtLocation.setText(user.getLocation());
txtLocation.setVisibility(VISIBLE);
@ -225,7 +214,17 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
String link = user.getImageLink() + "_bigger";
Picasso.get().load(link).into(profile);
}
if (!profile.isClickable()) {
profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent image = new Intent(ui.get(), ImageDetail.class);
image.putExtra("link", new String[]{user.getImageLink()});
image.putExtra("storable", true);
ui.get().startActivity(image);
}
});
}
ui.get().setTweetCount(user.getTweetCount(), user.getFavorCount());
}
@ -238,7 +237,7 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
switch (mode) {
case ACTION_FOLLOW:
if (!user.isLocked())
if (isFollowing)
if (isFriend)
Toast.makeText(ui.get(), R.string.followed, Toast.LENGTH_SHORT).show();
else
Toast.makeText(ui.get(), R.string.unfollowed, Toast.LENGTH_SHORT).show();
@ -259,7 +258,7 @@ public class ProfileLoader extends AsyncTask<Long, Void, Boolean> {
break;
}
if (!isHome) {
ui.get().setConnection(isFollowing, isMuted, isBlocked, user.isLocked(), canDm, user.followRequested());
ui.get().setConnection(isFriend, isMuted, isBlocked, user.isLocked(), canDm, user.followRequested());
ui.get().invalidateOptionsMenu();
}
} else {

View File

@ -87,7 +87,6 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/icon_margin"
android:layout_marginRight="@dimen/icon_margin"
android:layout_weight="1"
android:contentDescription="@string/verify"
android:visibility="gone"
app:srcCompat="@drawable/lock" />