Fix conversation banner layout issues.

fork-5.53.8
Greyson Parrelli 2021-02-11 21:48:23 -05:00
rodzic c45002d5b6
commit db8dcf6073
3 zmienionych plików z 45 dodań i 38 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -26,9 +27,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
/**
* Banner displayed within a conversation when a review is suggested.
*/
public class ReviewBannerView extends ConstraintLayout {
private static final @Px int ELEVATION = ViewUtil.dpToPx(4);
public class ReviewBannerView extends LinearLayout {
private ImageView bannerIcon;
private TextView bannerMessage;
@ -62,16 +61,6 @@ public class ReviewBannerView extends ConstraintLayout {
bottomRightAvatar.setFallbackPhotoProvider(provider);
bannerClose.setOnClickListener(v -> setVisibility(GONE));
if (Build.VERSION.SDK_INT >= 21) {
setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRect(-100, -100, view.getWidth() + 100, view.getHeight() + ELEVATION);
}
});
setElevation(ELEVATION);
}
}
public void setBannerMessage(@Nullable CharSequence charSequence) {

Wyświetl plik

@ -196,35 +196,38 @@
</org.thoughtcrime.securesms.util.views.DarkOverflowToolbar>
<ViewStub
android:id="@+id/review_banner_stub"
<LinearLayout
android:id="@+id/conversation_banner_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inflatedId="@+id/review_banner"
android:layout="@layout/review_banner_view"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintStart_toStartOf="@id/parent_start_guideline"
app:layout_constraintEnd_toEndOf="@id/parent_end_guideline"/>
app:layout_constraintEnd_toEndOf="@id/parent_end_guideline">
<ViewStub
android:id="@+id/unverified_banner_stub"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inflatedId="@+id/unverified_banner"
android:layout="@layout/conversation_activity_unverified_banner_stub"
app:layout_constraintTop_toBottomOf="@id/review_banner_stub"
app:layout_constraintStart_toStartOf="@id/parent_start_guideline"
app:layout_constraintEnd_toEndOf="@id/parent_end_guideline"/>
<ViewStub
android:id="@+id/unverified_banner_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/unverified_banner"
android:layout="@layout/conversation_activity_unverified_banner_stub" />
<ViewStub
android:id="@+id/reminder_stub"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inflatedId="@+id/reminder"
android:layout="@layout/conversation_activity_reminderview_stub"
app:layout_constraintTop_toBottomOf="@id/unverified_banner_stub"
app:layout_constraintStart_toStartOf="@id/parent_start_guideline"
app:layout_constraintEnd_toEndOf="@id/parent_end_guideline"/>
<ViewStub
android:id="@+id/reminder_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/reminder"
android:layout="@layout/conversation_activity_reminderview_stub" />
<ViewStub
android:id="@+id/review_banner_stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/review_banner"
android:layout="@layout/review_banner_view" />
</LinearLayout>
<View
android:id="@+id/conversation_toolbar_shadow"

Wyświetl plik

@ -1,11 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.profiles.spoofing.ReviewBannerView xmlns:android="http://schemas.android.com/apk/res/android"
<org.thoughtcrime.securesms.profiles.spoofing.ReviewBannerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/review_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="108dp">
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="108dp"
android:background="@color/signal_background_primary">
<FrameLayout
android:id="@+id/banner_icon_frame"
@ -92,4 +99,12 @@
app:layout_constraintStart_toStartOf="@id/banner_message"
app:layout_constraintTop_toBottomOf="@id/banner_message" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/toolbar_shadow"
app:layout_constraintBottom_toBottomOf="parent"/>
</org.thoughtcrime.securesms.profiles.spoofing.ReviewBannerView>