Skip to content

Commit

Permalink
Hide "Edit Theme" and "Change Name" options if the online theme is no…
Browse files Browse the repository at this point in the history
…t created by the current user.
  • Loading branch information
Docile-Alligator committed Nov 3, 2024
1 parent 8a96e4f commit f087bc5
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
themeName = getArguments().getString(EXTRA_THEME_NAME);
onlineCustomThemeMetadata = getArguments().getParcelable(EXTRA_ONLINE_CUSTOM_THEME_METADATA);

binding.themeNameTextViewCustomThemeOptionsBottomSheetFragment.setText(themeName);
if (onlineCustomThemeMetadata != null && !onlineCustomThemeMetadata.username.equals(activity.accountName)) {
binding.editThemeTextViewCustomThemeOptionsBottomSheetFragment.setVisibility(View.GONE);
binding.changeThemeNameTextViewCustomThemeOptionsBottomSheetFragment.setVisibility(View.GONE);
} else {
binding.editThemeTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).editTheme(themeName, onlineCustomThemeMetadata, getArguments().getInt(EXTRA_INDEX_IN_THEME_LIST, -1));
dismiss();
});

binding.changeThemeNameTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).changeName(themeName);
dismiss();
});
}

binding.editThemeTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).editTheme(themeName, onlineCustomThemeMetadata, getArguments().getInt(EXTRA_INDEX_IN_THEME_LIST, -1));
dismiss();
});
binding.themeNameTextViewCustomThemeOptionsBottomSheetFragment.setText(themeName);

binding.shareThemeTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
if (onlineCustomThemeMetadata != null) {
Expand All @@ -65,11 +75,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
dismiss();
});

binding.changeThemeNameTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).changeName(themeName);
dismiss();
});

binding.deleteThemeTextViewCustomThemeOptionsBottomSheetFragment.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).delete(themeName);
dismiss();
Expand Down

0 comments on commit f087bc5

Please sign in to comment.