Improve code of app (#28)

This commit is contained in:
Jean-Baptiste 2024-03-29 16:08:57 +01:00 committed by GitHub
parent 478b4751fd
commit 2d642d7627
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 15 deletions

View file

@ -12,9 +12,10 @@
p.red { p.red {
color: #ff2600; color: #ff2600;
}</style> }</style>
<title>About</title>
</head> </head>
<body> <body>
<center><img src="file:///android_asset/icon_pilldroid.png" width="64"/></center> <div style="text-align: center;"><img src="file:///android_asset/icon_pilldroid.png" width="64"/></div>
<!--<div class="build">[[[about_string]]]</div>--> <!--<div class="build">[[[about_string]]]</div>-->
<h5>Pilldroid &copy;&nbsp;2022 Jacques Foucry </h5> <h5>Pilldroid &copy;&nbsp;2022 Jacques Foucry </h5>
<p>Pilldroid est une gestion théorique de votre stock de médicaments.</p> <p>Pilldroid est une gestion théorique de votre stock de médicaments.</p>

View file

@ -11,8 +11,6 @@ import android.widget.ImageButton;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.journeyapps.barcodescanner.BarcodeCallback;
import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.CaptureManager; import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView; import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import com.journeyapps.barcodescanner.ViewfinderView; import com.journeyapps.barcodescanner.ViewfinderView;

View file

@ -10,7 +10,6 @@ import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**

View file

@ -333,7 +333,6 @@ public class DrugListActivity extends AppCompatActivity {
Log.d(TAG, "scanOptions == " + options); Log.d(TAG, "scanOptions == " + options);
mBarcodeScannerLauncher.launch(options); mBarcodeScannerLauncher.launch(options);
return;
} }
/** /**
@ -348,11 +347,11 @@ public class DrugListActivity extends AppCompatActivity {
dialog.setCanceledOnTouchOutside(true); dialog.setCanceledOnTouchOutside(true);
dialog.setContentView(R.layout.input_dialog); dialog.setContentView(R.layout.input_dialog);
Button ok = (Button) dialog.findViewById(R.id.agreed); Button ok = dialog.findViewById(R.id.agreed);
Button cancel = (Button) dialog.findViewById(R.id.notagreed); Button cancel = dialog.findViewById(R.id.notagreed);
ok.setEnabled(false); ok.setEnabled(false);
ok.setBackground(getDrawable(R.drawable.rounded_btn_disabled)); ok.setBackground(ContextCompat.getDrawable(this, R.drawable.rounded_btn_disabled));
//TextView title = (TextView ) dialog.findViewById(R.id.title); //TextView title = dialog.findViewById(R.id.title);
final EditText editText= dialog.findViewById(R.id.editcip13); final EditText editText= dialog.findViewById(R.id.editcip13);
String cip13 = String.valueOf(editText.getText()); String cip13 = String.valueOf(editText.getText());
@ -375,7 +374,7 @@ public class DrugListActivity extends AppCompatActivity {
//alert.getButton(alert.BUTTON_POSITIVE).setEnabled(s.length() == 8); //alert.getButton(alert.BUTTON_POSITIVE).setEnabled(s.length() == 8);
if (s.length() == 8) { if (s.length() == 8) {
ok.setEnabled(true); ok.setEnabled(true);
ok.setBackground(getDrawable(R.drawable.rounded_btn)); ok.setBackground(ContextCompat.getDrawable(editText.getContext(), R.drawable.rounded_btn));
} }
} }
}); });
@ -418,7 +417,7 @@ public class DrugListActivity extends AppCompatActivity {
msgString = aMedicine.getName() + " " + getString(R.string.msgFound); msgString = aMedicine.getName() + " " + getString(R.string.msgFound);
msg.setText(msgString); msg.setText(msgString);
cplString = getString(R.string.addInList); cplString = getString(R.string.addInList);
if (cplString.equals("")) { if (cplString.isEmpty()) {
cpl.setEnabled(false); cpl.setEnabled(false);
} }
icon.setImageResource(R.drawable.tickmark); icon.setImageResource(R.drawable.tickmark);

View file

@ -3,7 +3,6 @@ package net.foucry.pilldroid;
import net.foucry.pilldroid.models.Medicine; import net.foucry.pilldroid.models.Medicine;
import net.foucry.pilldroid.models.Prescription; import net.foucry.pilldroid.models.Prescription;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;

View file

@ -151,7 +151,7 @@ public class WelcomeActivity extends AppCompatActivity {
msgString = getString(R.string.understood); msgString = getString(R.string.understood);
msg.setText(msgString); msg.setText(msgString);
if (cplString.equals("")) { if (cplString.isEmpty()) {
cpl.setEnabled(false); cpl.setEnabled(false);
} }
//icon.setImageResource(R.drawable.pilldroid_icon); //icon.setImageResource(R.drawable.pilldroid_icon);

View file

@ -8,7 +8,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:zxing_framing_rect_height="150dp" app:zxing_framing_rect_height="150dp"
app:zxing_framing_rect_width="300dp"></com.journeyapps.barcodescanner.BarcodeView> app:zxing_framing_rect_width="300dp"/>
<com.journeyapps.barcodescanner.ViewfinderView <com.journeyapps.barcodescanner.ViewfinderView
android:id="@+id/zxing_viewfinder_view" android:id="@+id/zxing_viewfinder_view"

View file

@ -19,7 +19,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"></LinearLayout> android:orientation="horizontal"/>
<Button <Button
android:id="@+id/btn_next" android:id="@+id/btn_next"