florent37 / ShapeOfView

Give a custom shape to any android view, Material Design 2 ready
Apache License 2.0
3.12k stars 400 forks source link

requiresBitmap? #29

Closed enriquebautista closed 5 years ago

enriquebautista commented 5 years ago

my view is rare when it requiresBitmap = false, but is this parameter really needed or am I doing something wrong? CutoutTicketView screenshot_20180911-183501

When requiresBitmap= true works fine. screenshot_20180911-183956

Layout: `<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent">

<com.vipulasri.ticketview.TicketView
    android:id="@+id/ticketView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:scallopRadius="10dp"
    app:scallopPositionPercent="45"
    app:cornerType="rounded"
    app:ticketElevation="6dp"
    app:orientation="horizontal" />

<android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    app:layout_constraintGuide_percent="0.45" />

<app.pasaporte.ui.widget.CutoutTicketView
    android:id="@+id/frameLayout"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toTopOf="@+id/guideline"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <ImageView
        android:id="@+id/backdrop"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        tools:ignore="ContentDescription"
        tools:src="@drawable/splash_bg_img" />

    <View
        android:id="@+id/scrim"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/immersive_bars" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        android:orientation="vertical">

        <TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/open_sans_semibold"
            android:textColor="@android:color/white"
            android:textSize="22sp"
            tools:text="Paseo a Matacanes " />

        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/open_sans"
            android:textColor="@android:color/white"
            android:textSize="18sp"
            tools:text="25 de julio de 2018" />

        <Button
            android:id="@+id/see_detail"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/padding_normal"
            android:background="@drawable/button_default"
            android:fontFamily="@font/open_sans"
            android:minHeight="?attr/actionBarSize"
            android:minWidth="190dp"
            android:text="@string/see_detail"
            android:textAllCaps="false"
            android:textColor="@android:color/white"
            android:textSize="16sp" />

    </LinearLayout>

    <ImageButton
        android:id="@+id/share"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_gravity="top|end"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:src="@drawable/share_icon"
        tools:ignore="ContentDescription" />

</app.pasaporte.ui.widget.CutoutTicketView>

<ImageView
    android:id="@+id/qr_view"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:scaleType="centerCrop"
    app:layout_constraintBottom_toTopOf="@id/qr_code"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/guideline"
    tools:ignore="ContentDescription"
    tools:src="@drawable/ic_qr_code" />

<TextView
    android:id="@+id/qr_code"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/spacing_normal"
    android:fontFamily="@font/open_sans_light"
    android:textSize="16sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/qr_view"
    tools:text="400&#8211;2000&#8211;2020" />

</android.support.constraint.ConstraintLayout>`

florent37 commented 5 years ago

I added this boolean tout prevent this case :) si keep it

Le mer. 12 sept. 2018 à 01:42, Enrique Bautista notifications@github.com a écrit :

my view is rare when it requiresBitmap = false, but is this parameter really needed or am I doing something wrong? CutoutTicketView https://gist.github.com/enriquebautista/e3d4b8d0801ea4fb77cd7dbd813df67b [image: screenshot_20180911-183501] https://user-images.githubusercontent.com/37681056/45393508-cd3ef080-b5f1-11e8-923d-660df42b82a3.png

When requiresBitmap= true works fine. [image: screenshot_20180911-183956] https://user-images.githubusercontent.com/37681056/45393596-42122a80-b5f2-11e8-9db8-b274d63e3d78.png

Layout: ` <android.support.constraint.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:background="@android https://github.com/android :color/transparent">

<com.vipulasri.ticketview.TicketView android:id="@+id/ticketView" android:layout_width="match_parent" android:layout_height="match_parent" app:scallopRadius="10dp" app:scallopPositionPercent="45" app:cornerType="rounded" app:ticketElevation="6dp" app:orientation="horizontal" />

<android.support.constraint.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintGuide_percent="0.45" />

<app.pasaporte.ui.widget.CutoutTicketView android:id="@+id/frameLayout" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toTopOf="@+id/guideline" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent">

<ImageView
    android:id="@+id/backdrop"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop"
    tools:ignore="ContentDescription"
    tools:src="@drawable/splash_bg_img" />

<View
    android:id="@+id/scrim"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/immersive_bars" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <TextView
        android:id="@+id/description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/open_sans_semibold"
        android:textColor="@android:color/white"
        android:textSize="22sp"
        tools:text="Paseo a Matacanes " />

    <TextView
        android:id="@+id/date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/open_sans"
        android:textColor="@android:color/white"
        android:textSize="18sp"
        tools:text="25 de julio de 2018" />

    <Button
        android:id="@+id/see_detail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/padding_normal"
        android:background="@drawable/button_default"
        android:fontFamily="@font/open_sans"
        android:minHeight="?attr/actionBarSize"
        android:minWidth="190dp"
        android:text="@string/see_detail"
        android:textAllCaps="false"
        android:textColor="@android:color/white"
        android:textSize="16sp" />

</LinearLayout>

<ImageButton
    android:id="@+id/share"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_gravity="top|end"
    android:background="?attr/selectableItemBackgroundBorderless"
    android:src="@drawable/share_icon"
    tools:ignore="ContentDescription" />

</app.pasaporte.ui.widget.CutoutTicketView>

<ImageView android:id="@+id/qr_view" android:layout_width="200dp" android:layout_height="200dp" android:scaleType="centerCrop" app:layout_constraintBottom_toTopOf="@id/qr_code" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/guideline" tools:ignore="ContentDescription" tools:src="@drawable/ic_qr_code" />

<TextView android:id="@+id/qr_code" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/spacing_normal" android:fontFamily="@font/open_sans_light" android:textSize="16sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/qr_view" tools:text="400–2000–2020" />

</android.support.constraint.ConstraintLayout>`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/florent37/ShapeOfView/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfQXGSFAoOIbenh0h3EYsTx_pw8l5-dks5uaEpOgaJpZM4WkZ4p .

florent37 commented 5 years ago

I use a path operation to revert it in a rect sometimes it create a border like your case...

it's why I keep the old bitmap feature