mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Add support for creating Megaphones. Includes reactions megaphone.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package org.thoughtcrime.securesms.reactions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.megaphone.Megaphone;
|
||||
import org.thoughtcrime.securesms.megaphone.MegaphoneListener;
|
||||
|
||||
public class ReactionsMegaphoneView extends FrameLayout {
|
||||
|
||||
private View closeButton;
|
||||
|
||||
public ReactionsMegaphoneView(Context context) {
|
||||
super(context);
|
||||
initialize(context);
|
||||
}
|
||||
|
||||
public ReactionsMegaphoneView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize(context);
|
||||
}
|
||||
|
||||
private void initialize(@NonNull Context context) {
|
||||
inflate(context, R.layout.reactions_megaphone, this);
|
||||
|
||||
this.closeButton = findViewById(R.id.reactions_megaphone_x);
|
||||
}
|
||||
|
||||
public void present(@NonNull Megaphone megaphone, @NonNull MegaphoneListener listener) {
|
||||
this.closeButton.setOnClickListener(v -> listener.onMegaphoneCompleted(megaphone));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user