mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Compare commits
3 commits
495ce3be66
...
026ab51e49
Author | SHA1 | Date | |
---|---|---|---|
|
026ab51e49 | ||
|
8103d99b5d | ||
|
707f4a7805 |
5 changed files with 28 additions and 38 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;
|
||||
|
@ -61,8 +62,6 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* An activity representing a list of Drugs is activity
|
||||
* has different presentations for handset and tablet-size devices. On
|
||||
|
@ -189,6 +188,9 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
toolbar.setTitle(getTitle());
|
||||
}
|
||||
|
||||
FloatingActionButton mFloatingActionButton = findViewById(R.id.fab);
|
||||
mFloatingActionButton.setOnClickListener(v-> onButtonClick());
|
||||
|
||||
if (DEMO) {
|
||||
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
|
||||
|
||||
|
@ -307,11 +309,9 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
|
||||
startActivity(new Intent(this, WelcomeActivity.class));
|
||||
return true;
|
||||
} else if (id == R.id.export_prescription) {
|
||||
} else if (id == R.id.ImportExport) {
|
||||
//backupPrescriptions();
|
||||
// TODO: a changer ainsi que le menu.
|
||||
} else if (id == R.id.import_prescription) {
|
||||
//restorePrescriptions();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -327,7 +327,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);
|
||||
|
@ -377,7 +377,14 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
//alert.getButton(alert.BUTTON_POSITIVE).setEnabled(s.length() == 8);
|
||||
ok.setEnabled(s.length() == 8);
|
||||
if (s.length() == 8) {
|
||||
ok.setEnabled(true);
|
||||
ok.setBackground(Objects.requireNonNull(ContextCompat.getDrawable(editText.getContext(), R.drawable.rounded_btn)));
|
||||
}
|
||||
else {
|
||||
ok.setEnabled(false);
|
||||
ok.setBackground(Objects.requireNonNull(ContextCompat.getDrawable(editText.getContext(), R.drawable.rounded_btn_disabled)));
|
||||
}
|
||||
}
|
||||
});
|
||||
ok.setOnClickListener(v -> {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
android:layout_width="371dp"
|
||||
android:layout_height="209dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:labelFor="@+id/cip13_input_dialog"
|
||||
android:background="@drawable/background_dialog"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -20,10 +21,9 @@
|
|||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/notagreed"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
|
@ -32,26 +32,19 @@
|
|||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/button_cancel"
|
||||
android:textColor="#212121"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/agreed"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:ignore="HardcodedText,SpUsage" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/space"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="1dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/agreed"
|
||||
app:layout_constraintStart_toEndOf="@+id/notagreed" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/agreed"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/rounded_btn"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
|
@ -59,7 +52,7 @@
|
|||
android:paddingStart="25dp"
|
||||
android:paddingEnd="25dp"
|
||||
android:text="@string/button_ok"
|
||||
android:textColor="#212121"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/notagreed"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -74,9 +67,8 @@
|
|||
android:layout_marginEnd="28dp"
|
||||
android:autofillHints="cip13"
|
||||
android:ems="10"
|
||||
android:hint="@string/enter_cip_13"
|
||||
android:inputType="number"
|
||||
android:labelFor="@id/editcip13"
|
||||
android:labelFor="@id/startcip13"
|
||||
android:minHeight="48dp"
|
||||
android:textAlignment="textStart"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -102,6 +94,7 @@
|
|||
android:layout_width="55dp"
|
||||
android:layout_height="33dp"
|
||||
android:text="340009"
|
||||
android:hint="@string/enter_cip_13_here"
|
||||
android:textAlignment="textEnd"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
@ -2,15 +2,8 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/about"
|
||||
android:title="@string/about"/>
|
||||
<item android:title="@string/backup">
|
||||
<menu>
|
||||
<item android:id="@+id/export_prescription"
|
||||
android:title="@string/export_prescriptions"/>
|
||||
|
||||
<item android:id="@+id/import_prescription"
|
||||
android:title="@string/import_prescriptions"/>
|
||||
</menu>
|
||||
</item>
|
||||
<item android:id="@+id/ImportExport"
|
||||
android:title="@string/import_export"/>
|
||||
<item android:id="@+id/help"
|
||||
android:title="@string/help"/>
|
||||
</menu>
|
|
@ -74,7 +74,4 @@
|
|||
<string name="Undo">Annuler</string>
|
||||
<string name="trash_icon">Icône de poubelle</string>
|
||||
<string name="addInList">Ajouter à votre liste de médicament</string>
|
||||
<string name="backup">Backup</string>
|
||||
<string name="export_prescriptions">Export</string>
|
||||
<string name="import_prescriptions">Import</string>
|
||||
</resources>
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<string name="Undo">Undo</string>
|
||||
<string name="trash_icon">Trash icon</string>
|
||||
<string name="addInList">add to your list of medicine</string>
|
||||
<string name="backup">Backup</string>
|
||||
<string name="export_prescriptions">Export</string>
|
||||
<string name="import_prescriptions">Import</string>
|
||||
<string name="import_export" translatable="false">Import/Export</string>
|
||||
<string name="import_prescriptions" translatable="false">Import</string>
|
||||
<string name="export_prescriptions" translatable="false">Export</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue