mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Fix some regression in input_dialog.xml, DrugListActivity.java
This commit is contained in:
parent
495ce3be66
commit
707f4a7805
5 changed files with 22 additions and 27 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 -> {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
<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"
|
||||
|
@ -32,7 +31,7 @@
|
|||
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_constraintStart_toStartOf="parent"
|
||||
|
@ -48,10 +47,9 @@
|
|||
|
||||
<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 +57,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"
|
||||
|
|
|
@ -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