mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-21 20:19:23 +01:00
Update DrugListActivity (#22)
This commit is contained in:
parent
2f54326206
commit
3ba1c906cb
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.recyclerview.widget.RecyclerView;
|
||||||
import androidx.room.Room;
|
import androidx.room.Room;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.zxing.client.android.BuildConfig;
|
import com.google.zxing.client.android.BuildConfig;
|
||||||
import com.google.zxing.client.android.Intents;
|
import com.google.zxing.client.android.Intents;
|
||||||
|
@ -182,6 +183,8 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
toolbar.setTitle(getTitle());
|
toolbar.setTitle(getTitle());
|
||||||
}
|
}
|
||||||
|
FloatingActionButton mFloatingActionButton = findViewById(R.id.fab);
|
||||||
|
mFloatingActionButton.setOnClickListener(v-> onButtonClick());
|
||||||
|
|
||||||
if (DEMO) {
|
if (DEMO) {
|
||||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||||
|
@ -315,7 +318,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launch scan
|
// Launch scan
|
||||||
public void onButtonClick(View v) {
|
public void onButtonClick() {
|
||||||
Log.d(TAG, "add medication");
|
Log.d(TAG, "add medication");
|
||||||
ScanOptions options = new ScanOptions();
|
ScanOptions options = new ScanOptions();
|
||||||
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
|
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
|
||||||
|
@ -330,6 +333,7 @@ public class DrugListActivity extends AppCompatActivity {
|
||||||
|
|
||||||
Log.d(TAG, "scanOptions == " + options);
|
Log.d(TAG, "scanOptions == " + options);
|
||||||
mBarcodeScannerLauncher.launch(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:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/app_bar_height"
|
android:layout_height="?attr/actionBarSize"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
android:background="@color/colorPrimary"
|
||||||
|
app:layout_collapseMode="pin"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||||
|
app:titleTextColor="@color/white"/>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
@ -25,7 +28,7 @@
|
||||||
android:id="@+id/frameLayout"
|
android:id="@+id/frameLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
android:layout_marginTop="?attr/actionBarSize">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/drug_list"
|
layout="@layout/drug_list"
|
||||||
|
@ -36,20 +39,13 @@
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
android:layout_width="60dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="60dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:accessibilityHeading="true"
|
android:accessibilityHeading="true"
|
||||||
android:adjustViewBounds="true"
|
android:backgroundTint="@color/colorPrimary"
|
||||||
android:backgroundTint="@android:color/transparent"
|
|
||||||
android:baselineAlignBottom="false"
|
|
||||||
android:clickable="false"
|
|
||||||
android:contentDescription="@string/add_button"
|
android:contentDescription="@string/add_button"
|
||||||
android:onClick="onButtonClick"
|
android:src="@drawable/ic_add"
|
||||||
android:src="@drawable/ic_add_circle_black_24dp"
|
app:backgroundTint="@color/colorPrimary" />
|
||||||
app:backgroundTint="@android:color/darker_gray"
|
|
||||||
app:fabCustomSize="60dp"
|
|
||||||
app:maxImageSize="60dp"
|
|
||||||
tools:ignore="OnClick" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="backgroundTint">@color/white</item>
|
||||||
|
<item name="android:textColorSecondary">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar">
|
||||||
|
|
Loading…
Reference in a new issue