mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Update DrugListActivity (#22)
This commit is contained in:
parent
8269ef4618
commit
535de3c259
4 changed files with 28 additions and 17 deletions
|
@ -43,6 +43,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.room.Room;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.zxing.client.android.BuildConfig;
|
||||
import com.google.zxing.client.android.Intents;
|
||||
|
@ -182,6 +183,8 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
setSupportActionBar(toolbar);
|
||||
toolbar.setTitle(getTitle());
|
||||
}
|
||||
FloatingActionButton mFloatingActionButton = findViewById(R.id.fab);
|
||||
mFloatingActionButton.setOnClickListener(v-> onButtonClick());
|
||||
|
||||
if (DEMO) {
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
|
@ -315,7 +318,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
// Launch scan
|
||||
public void onButtonClick(View v) {
|
||||
public void onButtonClick() {
|
||||
Log.d(TAG, "add medication");
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
|
||||
|
@ -330,6 +333,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
|
||||
Log.d(TAG, "scanOptions == " + options);
|
||||
mBarcodeScannerLauncher.launch(options);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
9
app/src/main/res/drawable/ic_add.xml
Normal file
9
app/src/main/res/drawable/ic_add.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M440,520L200,520L200,440L440,440L440,200L520,200L520,440L760,440L760,520L520,520L520,760L440,760L440,520Z"/>
|
||||
</vector>
|
|
@ -13,11 +13,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/app_bar_height"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/colorPrimary"
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:titleTextColor="@color/white"/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
@ -25,7 +28,7 @@
|
|||
android:id="@+id/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
android:layout_marginTop="?attr/actionBarSize">
|
||||
|
||||
<include
|
||||
layout="@layout/drug_list"
|
||||
|
@ -36,20 +39,13 @@
|
|||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:accessibilityHeading="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:backgroundTint="@android:color/transparent"
|
||||
android:baselineAlignBottom="false"
|
||||
android:clickable="false"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:contentDescription="@string/add_button"
|
||||
android:onClick="onButtonClick"
|
||||
android:src="@drawable/ic_add_circle_black_24dp"
|
||||
app:backgroundTint="@android:color/darker_gray"
|
||||
app:fabCustomSize="60dp"
|
||||
app:maxImageSize="60dp"
|
||||
tools:ignore="OnClick" />
|
||||
android:src="@drawable/ic_add"
|
||||
app:backgroundTint="@color/colorPrimary" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="backgroundTint">@color/white</item>
|
||||
<item name="android:textColorSecondary">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
|
|
Loading…
Reference in a new issue