Browse Source

convert switch back to if-then (auto)

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
5ab794941e
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 34
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

34
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

@ -494,12 +494,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
switch (item.getItemId()) {
case R.id.layout: {
int itemId = item.getItemId();
if (itemId == R.id.layout) {
showPostsLayoutPreferences();
return true;
}
case R.id.restrict: {
} else if (itemId == R.id.restrict) {
if (!isLoggedIn) return false;
final String action = profileModel.getFriendshipStatus().isRestricted() ? "Unrestrict" : "Restrict";
friendshipRepository.toggleRestrict(
@ -517,8 +516,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}), Dispatchers.getIO())
);
return true;
}
case R.id.block: {
} else if (itemId == R.id.block) {
if (!isLoggedIn) return false;
// changeCb
friendshipRepository.changeBlock(
@ -536,16 +534,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}), Dispatchers.getIO())
);
return true;
}
case R.id.chaining: {
} else if (itemId == R.id.chaining) {
if (!isLoggedIn) return false;
final Bundle bundle = new Bundle();
bundle.putString("type", "chaining");
bundle.putLong("targetId", profileModel.getPk());
NavHostFragment.findNavController(this).navigate(R.id.action_global_notificationsViewerFragment, bundle);
return true;
}
case R.id.mute_stories: {
} else if (itemId == R.id.mute_stories) {
if (!isLoggedIn) return false;
final String action = profileModel.getFriendshipStatus().isMutingReel() ? "Unmute stories" : "Mute stories";
friendshipRepository.changeMute(
@ -564,8 +560,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}), Dispatchers.getIO())
);
return true;
}
case R.id.mute_posts: {
} else if (itemId == R.id.mute_posts) {
if (!isLoggedIn) return false;
final String action = profileModel.getFriendshipStatus().getMuting() ? "Unmute stories" : "Mute stories";
friendshipRepository.changeMute(
@ -584,8 +579,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}), Dispatchers.getIO())
);
return true;
}
case R.id.remove_follower: {
} else if (itemId == R.id.remove_follower) {
if (!isLoggedIn) return false;
friendshipRepository.removeFollower(
csrfToken,
@ -601,15 +595,13 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}), Dispatchers.getIO())
);
return true;
}
case R.id.share_link: {
final Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
} else if (itemId == R.id.share_link) {
final Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "https://instagram.com/" + profileModel.getUsername());
sharingIntent.putExtra(Intent.EXTRA_TEXT, "https://instagram.com/" + profileModel.getUsername());
startActivity(sharingIntent);
return true;
}
case R.id.share_dm: {
} else if (itemId == R.id.share_dm) {
final UserSearchNavGraphDirections.ActionGlobalUserSearch actionGlobalUserSearch = UserSearchFragmentDirections
.actionGlobalUserSearch()
.setTitle(getString(R.string.share))
@ -625,10 +617,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
return true;
}
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onRefresh() {

Loading…
Cancel
Save