Use extend floating button (#42)

This commit is contained in:
Jean-Baptiste 2024-04-17 14:35:16 +02:00 committed by GitHub
parent 381b937a01
commit 081759fcfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -11,7 +11,7 @@ import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import net.foucry.pilldroid.dao.PrescriptionsDAO;
import net.foucry.pilldroid.databases.PrescriptionDatabase;
import net.foucry.pilldroid.models.Prescription;
@ -46,7 +46,7 @@ public class DrugDetailActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
}
FloatingActionButton fab = findViewById(R.id.fab);
ExtendedFloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(v -> {
Log.d(TAG, "Click on save icon");

View file

@ -41,16 +41,18 @@
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fabSize="normal"
android:layout_gravity="end|bottom"
android:layout_gravity="center|bottom"
android:scaleType="center"
android:layout_margin="@dimen/fab_margin"
android:contentDescription="@string/save_button"
app:srcCompat="@drawable/ic_save_black_24dp"
android:text="@string/save_button"
android:textColor="@color/white"
app:icon="@drawable/ic_save_black_24dp"
app:backgroundTint="@color/colorPrimary"
app:tint="@color/white"/>
app:iconTint="@color/white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>