mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-12-23 13:26:59 +00:00
Fix post view button colors wrong for some themes
This commit is contained in:
parent
eb1e55470a
commit
5daec513ba
@ -102,7 +102,6 @@ import static androidx.core.content.PermissionChecker.checkSelfPermission;
|
||||
import static awais.instagrabber.fragments.HashTagFragment.ARG_HASHTAG;
|
||||
import static awais.instagrabber.fragments.settings.PreferenceKeys.PREF_SHOWN_COUNT_TOOLTIP;
|
||||
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION;
|
||||
import static awais.instagrabber.utils.Utils.getAttrValue;
|
||||
import static awais.instagrabber.utils.Utils.settingsHelper;
|
||||
|
||||
public class PostViewV2Fragment extends Fragment implements EditTextDialogFragment.EditTextDialogFragmentCallback {
|
||||
@ -133,6 +132,9 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
private boolean isInFullScreenMode;
|
||||
private StyledPlayerView playerView;
|
||||
private int playerViewOriginalHeight;
|
||||
private Drawable originalRootBackground;
|
||||
private ColorStateList originalLikeColorStateList;
|
||||
private ColorStateList originalSaveColorStateList;
|
||||
|
||||
private final Observer<Object> backStackSavedStateObserver = result -> {
|
||||
if (result == null) return;
|
||||
@ -143,7 +145,6 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
// clear result
|
||||
backStackSavedStateResultLiveData.postValue(null);
|
||||
};
|
||||
private Drawable originalRootBackground;
|
||||
|
||||
public void setOnDeleteListener(final OnDeleteListener onDeleteListener) {
|
||||
if (onDeleteListener == null) return;
|
||||
@ -443,6 +444,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
}
|
||||
|
||||
private void setupLike() {
|
||||
originalLikeColorStateList = bottom.like.getIconTint();
|
||||
final boolean likableMedia = viewModel.hasPk() /*&& viewModel.getMedia().isCommentLikesEnabled()*/;
|
||||
if (!likableMedia) {
|
||||
bottom.like.setVisibility(View.GONE);
|
||||
@ -505,25 +507,25 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
|
||||
private void setLikedResources(final boolean liked) {
|
||||
final int iconResource;
|
||||
final int tintResource;
|
||||
final ColorStateList tintColorStateList;
|
||||
final Context context = getContext();
|
||||
if (context == null) return;
|
||||
final Resources resources = context.getResources();
|
||||
if (resources == null) return;
|
||||
if (liked) {
|
||||
iconResource = R.drawable.ic_like;
|
||||
tintResource = resources.getColor(R.color.red_600);
|
||||
// textResId = R.string.unlike_without_count;
|
||||
tintColorStateList = ColorStateList.valueOf(resources.getColor(R.color.red_600));
|
||||
} else {
|
||||
iconResource = R.drawable.ic_not_liked;
|
||||
tintResource = getAttrValue(context, R.attr.colorPrimary);
|
||||
// textResId = R.string.like_without_count;
|
||||
tintColorStateList = originalLikeColorStateList != null ? originalLikeColorStateList
|
||||
: ColorStateList.valueOf(resources.getColor(R.color.white));
|
||||
}
|
||||
bottom.like.setIconResource(iconResource);
|
||||
bottom.like.setIconTint(ColorStateList.valueOf(tintResource));
|
||||
bottom.like.setIconTint(tintColorStateList);
|
||||
}
|
||||
|
||||
private void setupSave() {
|
||||
originalSaveColorStateList = bottom.save.getIconTint();
|
||||
if (!viewModel.isLoggedIn() || !viewModel.hasPk() || !viewModel.getMedia().canViewerSave()) {
|
||||
bottom.save.setVisibility(View.GONE);
|
||||
return;
|
||||
@ -576,22 +578,21 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
|
||||
private void setSavedResources(final boolean saved) {
|
||||
final int iconResource;
|
||||
final int tintResource;
|
||||
final ColorStateList tintColorStateList;
|
||||
final Context context = getContext();
|
||||
if (context == null) return;
|
||||
final Resources resources = context.getResources();
|
||||
if (resources == null) return;
|
||||
if (saved) {
|
||||
iconResource = R.drawable.ic_bookmark;
|
||||
tintResource = resources.getColor(R.color.blue_700);
|
||||
// textResId = R.string.saved;
|
||||
tintColorStateList = ColorStateList.valueOf(resources.getColor(R.color.blue_700));
|
||||
} else {
|
||||
iconResource = R.drawable.ic_round_bookmark_border_24;
|
||||
tintResource = getAttrValue(context, R.attr.colorPrimary);
|
||||
// textResId = R.string.save;
|
||||
tintColorStateList = originalSaveColorStateList != null ? originalSaveColorStateList
|
||||
: ColorStateList.valueOf(resources.getColor(R.color.white));
|
||||
}
|
||||
bottom.save.setIconResource(iconResource);
|
||||
bottom.save.setIconTint(ColorStateList.valueOf(tintResource));
|
||||
bottom.save.setIconTint(tintColorStateList);
|
||||
}
|
||||
|
||||
private void setupProfilePic(final User user) {
|
||||
|
Loading…
Reference in New Issue
Block a user