Wrap emoji pages with coordinator layout. Fix issue with bubble coloring in wallpaper preview.

This commit is contained in:
Alex Hart
2021-06-03 14:02:37 -03:00
parent a644c81736
commit a3a4b10f83
6 changed files with 74 additions and 93 deletions

View File

@@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.wallpaper;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
@@ -111,6 +110,7 @@ public class ChatWallpaperPreviewActivity extends PassphraseRequiredActivity {
} else {
onPageChanged = new OnPageChanged();
viewPager.registerOnPageChangeCallback(onPageChanged);
bubble2.addOnLayoutChangeListener(new UpdateChatColorsOnNextLayoutChange(selected.getAutoChatColors()));
}
new FullscreenHelper(this).showSystemUI();
@@ -131,7 +131,6 @@ public class ChatWallpaperPreviewActivity extends PassphraseRequiredActivity {
public void onPageSelected(int position) {
ChatWallpaperSelectionMappingModel model = (ChatWallpaperSelectionMappingModel) adapter.getCurrentList().get(position);
updateChatColors(model.getWallpaper().getAutoChatColors());
}
}
@@ -148,6 +147,21 @@ public class ChatWallpaperPreviewActivity extends PassphraseRequiredActivity {
bubble2.getBackground().setColorFilter(chatColors.getChatBubbleColorFilter());
}
private class UpdateChatColorsOnNextLayoutChange implements View.OnLayoutChangeListener {
private final ChatColors chatColors;
private UpdateChatColorsOnNextLayoutChange(@NonNull ChatColors chatColors) {
this.chatColors = chatColors;
}
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
v.removeOnLayoutChangeListener(this);
updateChatColors(chatColors);
}
}
@Override
protected void onResume() {
super.onResume();