mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
convert switch back to if-then (auto)
This commit is contained in:
parent
8f4e72e960
commit
5ab794941e
@ -494,12 +494,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.layout: {
|
if (itemId == R.id.layout) {
|
||||||
showPostsLayoutPreferences();
|
showPostsLayoutPreferences();
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.restrict) {
|
||||||
case R.id.restrict: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
final String action = profileModel.getFriendshipStatus().isRestricted() ? "Unrestrict" : "Restrict";
|
final String action = profileModel.getFriendshipStatus().isRestricted() ? "Unrestrict" : "Restrict";
|
||||||
friendshipRepository.toggleRestrict(
|
friendshipRepository.toggleRestrict(
|
||||||
@ -517,8 +516,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}), Dispatchers.getIO())
|
}), Dispatchers.getIO())
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.block) {
|
||||||
case R.id.block: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
// changeCb
|
// changeCb
|
||||||
friendshipRepository.changeBlock(
|
friendshipRepository.changeBlock(
|
||||||
@ -536,16 +534,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}), Dispatchers.getIO())
|
}), Dispatchers.getIO())
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.chaining) {
|
||||||
case R.id.chaining: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
bundle.putString("type", "chaining");
|
bundle.putString("type", "chaining");
|
||||||
bundle.putLong("targetId", profileModel.getPk());
|
bundle.putLong("targetId", profileModel.getPk());
|
||||||
NavHostFragment.findNavController(this).navigate(R.id.action_global_notificationsViewerFragment, bundle);
|
NavHostFragment.findNavController(this).navigate(R.id.action_global_notificationsViewerFragment, bundle);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.mute_stories) {
|
||||||
case R.id.mute_stories: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
final String action = profileModel.getFriendshipStatus().isMutingReel() ? "Unmute stories" : "Mute stories";
|
final String action = profileModel.getFriendshipStatus().isMutingReel() ? "Unmute stories" : "Mute stories";
|
||||||
friendshipRepository.changeMute(
|
friendshipRepository.changeMute(
|
||||||
@ -564,8 +560,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}), Dispatchers.getIO())
|
}), Dispatchers.getIO())
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.mute_posts) {
|
||||||
case R.id.mute_posts: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
final String action = profileModel.getFriendshipStatus().getMuting() ? "Unmute stories" : "Mute stories";
|
final String action = profileModel.getFriendshipStatus().getMuting() ? "Unmute stories" : "Mute stories";
|
||||||
friendshipRepository.changeMute(
|
friendshipRepository.changeMute(
|
||||||
@ -584,8 +579,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}), Dispatchers.getIO())
|
}), Dispatchers.getIO())
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.remove_follower) {
|
||||||
case R.id.remove_follower: {
|
|
||||||
if (!isLoggedIn) return false;
|
if (!isLoggedIn) return false;
|
||||||
friendshipRepository.removeFollower(
|
friendshipRepository.removeFollower(
|
||||||
csrfToken,
|
csrfToken,
|
||||||
@ -601,15 +595,13 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}), Dispatchers.getIO())
|
}), Dispatchers.getIO())
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.share_link) {
|
||||||
case R.id.share_link: {
|
final Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||||
final Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
|
||||||
sharingIntent.setType("text/plain");
|
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);
|
startActivity(sharingIntent);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (itemId == R.id.share_dm) {
|
||||||
case R.id.share_dm: {
|
|
||||||
final UserSearchNavGraphDirections.ActionGlobalUserSearch actionGlobalUserSearch = UserSearchFragmentDirections
|
final UserSearchNavGraphDirections.ActionGlobalUserSearch actionGlobalUserSearch = UserSearchFragmentDirections
|
||||||
.actionGlobalUserSearch()
|
.actionGlobalUserSearch()
|
||||||
.setTitle(getString(R.string.share))
|
.setTitle(getString(R.string.share))
|
||||||
@ -625,10 +617,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
Loading…
Reference in New Issue
Block a user