mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-25 04:06:14 +00:00
Add new chat colors megaphone.
This commit is contained in:
@@ -10,15 +10,17 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class BasicMegaphoneView extends FrameLayout {
|
||||
|
||||
private ImageView image;
|
||||
private TextView titleText;
|
||||
private TextView bodyText;
|
||||
private Button actionButton;
|
||||
private Button secondaryButton;
|
||||
private LottieAnimationView image;
|
||||
private TextView titleText;
|
||||
private TextView bodyText;
|
||||
private Button actionButton;
|
||||
private Button secondaryButton;
|
||||
|
||||
private Megaphone megaphone;
|
||||
private MegaphoneActionController megaphoneListener;
|
||||
@@ -62,6 +64,10 @@ public class BasicMegaphoneView extends FrameLayout {
|
||||
} else if (megaphone.getImageRequest() != null) {
|
||||
image.setVisibility(VISIBLE);
|
||||
megaphone.getImageRequest().into(image);
|
||||
} else if (megaphone.getLottieRes() != 0) {
|
||||
image.setVisibility(VISIBLE);
|
||||
image.setAnimation(megaphone.getLottieRes());
|
||||
image.playAnimation();
|
||||
} else {
|
||||
image.setVisibility(GONE);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.thoughtcrime.securesms.util.LocaleFeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.VersionTracker;
|
||||
import org.thoughtcrime.securesms.util.dynamiclanguage.DynamicLanguageContextWrapper;
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaperActivity;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -132,7 +133,7 @@ public final class Megaphones {
|
||||
case NOTIFICATIONS:
|
||||
return buildNotificationsMegaphone(context);
|
||||
case CHAT_COLORS:
|
||||
return buildChatColorsMegaphone();
|
||||
return buildChatColorsMegaphone(context);
|
||||
default:
|
||||
throw new IllegalArgumentException("Event not handled!");
|
||||
}
|
||||
@@ -304,11 +305,18 @@ public final class Megaphones {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static @NonNull Megaphone buildChatColorsMegaphone() {
|
||||
return new Megaphone.Builder(Event.CHAT_COLORS, Megaphone.Style.POPUP)
|
||||
private static @NonNull Megaphone buildChatColorsMegaphone(@NonNull Context context) {
|
||||
return new Megaphone.Builder(Event.CHAT_COLORS, Megaphone.Style.BASIC)
|
||||
.setTitle(R.string.ChatColorsMegaphone__new_chat_colors)
|
||||
.setBody(R.string.ChatColorsMegaphone__we_switched_up_chat_colors)
|
||||
.setLottie(R.raw.color_bubble_64)
|
||||
.setActionButton(R.string.ChatColorsMegaphone__appearance, (megaphone, listener) -> {
|
||||
listener.onMegaphoneNavigationRequested(ChatWallpaperActivity.createIntent(context));
|
||||
listener.onMegaphoneCompleted(Event.CHAT_COLORS);
|
||||
})
|
||||
.setSecondaryButton(R.string.ChatColorsMegaphone__not_now, (megaphone, listener) -> {
|
||||
listener.onMegaphoneCompleted(Event.CHAT_COLORS);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user