This commit is contained in:
nuclearfog 2019-12-27 13:23:58 +01:00
parent a4efa68f3f
commit 529b704e5d
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
1 changed files with 5 additions and 3 deletions

View File

@ -90,6 +90,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
@Nullable @Nullable
private TwitterUser user; private TwitterUser user;
private long userId; private long userId;
private boolean isHome;
private int tabIndex = 0; private int tabIndex = 0;
@ -102,6 +103,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
Bundle param = getIntent().getExtras(); Bundle param = getIntent().getExtras();
if (param != null && param.containsKey(KEY_PROFILE_ID)) { if (param != null && param.containsKey(KEY_PROFILE_ID)) {
userId = param.getLong(KEY_PROFILE_ID); userId = param.getLong(KEY_PROFILE_ID);
isHome = userId == settings.getUserId();
} }
Toolbar tool = findViewById(R.id.profile_toolbar); Toolbar tool = findViewById(R.id.profile_toolbar);
TabLayout tab = findViewById(R.id.profile_tab); TabLayout tab = findViewById(R.id.profile_tab);
@ -190,7 +192,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
@Override @Override
public boolean onCreateOptionsMenu(Menu m) { public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.profile, m); getMenuInflater().inflate(R.menu.profile, m);
if (userId == settings.getUserId()) { if (isHome) {
MenuItem dmIcon = m.findItem(R.id.profile_message); MenuItem dmIcon = m.findItem(R.id.profile_message);
MenuItem setting = m.findItem(R.id.profile_settings); MenuItem setting = m.findItem(R.id.profile_settings);
dmIcon.setVisible(true); dmIcon.setVisible(true);
@ -215,7 +217,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
followIcon.setIcon(R.drawable.follow_requested); followIcon.setIcon(R.drawable.follow_requested);
followIcon.setTitle(R.string.follow_requested); followIcon.setTitle(R.string.follow_requested);
} }
if (user.isLocked()) { if (user.isLocked() && !isHome) {
MenuItem listItem = m.findItem(R.id.profile_lists); MenuItem listItem = m.findItem(R.id.profile_lists);
listItem.setVisible(false); listItem.setVisible(false);
} }
@ -256,7 +258,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
case R.id.profile_tweet: case R.id.profile_tweet:
if (user != null) { if (user != null) {
Intent tweet = new Intent(this, TweetPopup.class); Intent tweet = new Intent(this, TweetPopup.class);
if (userId != settings.getUserId()) if (!isHome)
tweet.putExtra(KEY_TWEETPOPUP_PREFIX, user.getScreenname()); tweet.putExtra(KEY_TWEETPOPUP_PREFIX, user.getScreenname());
startActivity(tweet); startActivity(tweet);
} }