|
|
@ -84,6 +84,7 @@ public class AccountActivity extends BaseActivity implements ActionButtonActivit |
|
|
|
private ImageView header; |
|
|
|
private ImageView header; |
|
|
|
private FloatingActionButton floatingBtn; |
|
|
|
private FloatingActionButton floatingBtn; |
|
|
|
private Button followBtn; |
|
|
|
private Button followBtn; |
|
|
|
|
|
|
|
private TextView followsYouView; |
|
|
|
private TabLayout tabLayout; |
|
|
|
private TabLayout tabLayout; |
|
|
|
private ImageView accountLockedView; |
|
|
|
private ImageView accountLockedView; |
|
|
|
private View container; |
|
|
|
private View container; |
|
|
@ -99,6 +100,7 @@ public class AccountActivity extends BaseActivity implements ActionButtonActivit |
|
|
|
header = (ImageView) findViewById(R.id.account_header); |
|
|
|
header = (ImageView) findViewById(R.id.account_header); |
|
|
|
floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn); |
|
|
|
floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn); |
|
|
|
followBtn = (Button) findViewById(R.id.follow_btn); |
|
|
|
followBtn = (Button) findViewById(R.id.follow_btn); |
|
|
|
|
|
|
|
followsYouView = (TextView) findViewById(R.id.account_follows_you); |
|
|
|
tabLayout = (TabLayout) findViewById(R.id.tab_layout); |
|
|
|
tabLayout = (TabLayout) findViewById(R.id.tab_layout); |
|
|
|
accountLockedView = (ImageView) findViewById(R.id.account_locked); |
|
|
|
accountLockedView = (ImageView) findViewById(R.id.account_locked); |
|
|
|
container = findViewById(R.id.activity_account); |
|
|
|
container = findViewById(R.id.activity_account); |
|
|
@ -179,6 +181,7 @@ public class AccountActivity extends BaseActivity implements ActionButtonActivit |
|
|
|
// Initialise the default UI states.
|
|
|
|
// Initialise the default UI states.
|
|
|
|
floatingBtn.hide(); |
|
|
|
floatingBtn.hide(); |
|
|
|
followBtn.setVisibility(View.GONE); |
|
|
|
followBtn.setVisibility(View.GONE); |
|
|
|
|
|
|
|
followsYouView.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
|
|
|
// Obtain information to fill out the profile.
|
|
|
|
// Obtain information to fill out the profile.
|
|
|
|
obtainAccount(); |
|
|
|
obtainAccount(); |
|
|
@ -340,8 +343,7 @@ public class AccountActivity extends BaseActivity implements ActionButtonActivit |
|
|
|
Response<List<Relationship>> response) { |
|
|
|
Response<List<Relationship>> response) { |
|
|
|
if (response.isSuccessful()) { |
|
|
|
if (response.isSuccessful()) { |
|
|
|
Relationship relationship = response.body().get(0); |
|
|
|
Relationship relationship = response.body().get(0); |
|
|
|
onObtainRelationshipsSuccess(relationship.requested, relationship.following, |
|
|
|
onObtainRelationshipsSuccess(relationship); |
|
|
|
relationship.blocking, relationship.muting); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
onObtainRelationshipsFailure(new Exception(response.message())); |
|
|
|
onObtainRelationshipsFailure(new Exception(response.message())); |
|
|
|
} |
|
|
|
} |
|
|
@ -354,22 +356,27 @@ public class AccountActivity extends BaseActivity implements ActionButtonActivit |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void onObtainRelationshipsSuccess(boolean followRequested, boolean following, |
|
|
|
private void onObtainRelationshipsSuccess(Relationship relation) { |
|
|
|
boolean blocking, boolean muting) { |
|
|
|
if (relation.following) { |
|
|
|
if (following) { |
|
|
|
|
|
|
|
followState = FollowState.FOLLOWING; |
|
|
|
followState = FollowState.FOLLOWING; |
|
|
|
} else if (followRequested) { |
|
|
|
} else if (relation.requested) { |
|
|
|
followState = FollowState.REQUESTED; |
|
|
|
followState = FollowState.REQUESTED; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
followState = FollowState.NOT_FOLLOWING; |
|
|
|
followState = FollowState.NOT_FOLLOWING; |
|
|
|
} |
|
|
|
} |
|
|
|
this.blocking = blocking; |
|
|
|
this.blocking = relation.blocking; |
|
|
|
this.muting = muting; |
|
|
|
this.muting = relation.muting; |
|
|
|
|
|
|
|
|
|
|
|
if (followState != FollowState.NOT_FOLLOWING || !blocking || !muting) { |
|
|
|
if (followState != FollowState.NOT_FOLLOWING || !blocking || !muting) { |
|
|
|
invalidateOptionsMenu(); |
|
|
|
invalidateOptionsMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(relation.followedBy) { |
|
|
|
|
|
|
|
followsYouView.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
followsYouView.setVisibility(View.GONE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateButtons(); |
|
|
|
updateButtons(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|