Compare commits

..

No commits in common. "026ab51e49f3df526a3624cd4421eed629bb3998" and "495ce3be663e6a94edfe0e2fdff5130338473d85" have entirely different histories.

5 changed files with 38 additions and 28 deletions

View file

@ -43,7 +43,6 @@ 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;
@ -62,6 +61,8 @@ 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
@ -188,9 +189,6 @@ public class DrugListActivity extends AppCompatActivity {
toolbar.setTitle(getTitle());
}
FloatingActionButton mFloatingActionButton = findViewById(R.id.fab);
mFloatingActionButton.setOnClickListener(v-> onButtonClick());
if (DEMO) {
PrescriptionsDAO prescriptionsDAO = prescriptions.getPrescriptionsDAO();
@ -309,9 +307,11 @@ public class DrugListActivity extends AppCompatActivity {
startActivity(new Intent(this, WelcomeActivity.class));
return true;
} else if (id == R.id.ImportExport) {
} else if (id == R.id.export_prescription) {
//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() {
public void onButtonClick(View v) {
Log.d(TAG, "add medication");
ScanOptions options = new ScanOptions();
options.setDesiredBarcodeFormats(ScanOptions.DATA_MATRIX, ScanOptions.CODE_128);
@ -377,14 +377,7 @@ public class DrugListActivity extends AppCompatActivity {
@Override
public void afterTextChanged(Editable s) {
//alert.getButton(alert.BUTTON_POSITIVE).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.setEnabled(s.length() == 8);
}
});
ok.setOnClickListener(v -> {

View file

@ -12,7 +12,6 @@
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"
@ -21,9 +20,10 @@
<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="16dp"
android:layout_marginStart="28dp"
android:layout_marginBottom="16dp"
android:background="@drawable/rounded_btn"
android:gravity="center"
@ -32,19 +32,26 @@
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_cancel"
android:textColor="@color/white"
android:textColor="#212121"
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="16dp"
android:layout_marginEnd="28dp"
android:background="@drawable/rounded_btn"
android:gravity="center"
android:maxLines="1"
@ -52,7 +59,7 @@
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:text="@string/button_ok"
android:textColor="@color/white"
android:textColor="#212121"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@+id/notagreed"
app:layout_constraintEnd_toEndOf="parent"
@ -67,8 +74,9 @@
android:layout_marginEnd="28dp"
android:autofillHints="cip13"
android:ems="10"
android:hint="@string/enter_cip_13"
android:inputType="number"
android:labelFor="@id/startcip13"
android:labelFor="@id/editcip13"
android:minHeight="48dp"
android:textAlignment="textStart"
app:layout_constraintBottom_toBottomOf="parent"
@ -94,7 +102,6 @@
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"

View file

@ -2,8 +2,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/about"
android:title="@string/about"/>
<item android:id="@+id/ImportExport"
android:title="@string/import_export"/>
<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/help"
android:title="@string/help"/>
</menu>

View file

@ -74,4 +74,7 @@
<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>

View file

@ -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="import_export" translatable="false">Import/Export</string>
<string name="import_prescriptions" translatable="false">Import</string>
<string name="export_prescriptions" translatable="false">Export</string>
<string name="backup">Backup</string>
<string name="export_prescriptions">Export</string>
<string name="import_prescriptions">Import</string>
</resources>