mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-09-19 18:54:18 +02:00
Use lambda everywhere (#23)
This commit is contained in:
parent
df21e5835f
commit
8269ef4618
6 changed files with 31 additions and 46 deletions
|
@ -57,19 +57,16 @@ public class CustomScannerActivity extends Activity implements DecoratedBarcodeV
|
|||
|
||||
//changeMaskColor(null);
|
||||
changeLaserVisibility(true);
|
||||
barcodeScannerView.decodeSingle(new BarcodeCallback() {
|
||||
@Override
|
||||
public void barcodeResult(BarcodeResult result) {
|
||||
Intent scanResult = new Intent();
|
||||
//Bundle scanResultBundle = new Bundle();
|
||||
scanResult.putExtra("Barcode Content", result.getText());
|
||||
scanResult.putExtra("Barcode Format name", result.getBarcodeFormat().name());
|
||||
scanResult.putExtra("returnCode", captureIntentBundle.getInt("returnCode"));
|
||||
scanResult.putExtra("resultCode", 1);
|
||||
CustomScannerActivity.this.setResult(RESULT_OK, scanResult);
|
||||
Log.d(TAG, "scanResult == " + scanResult);
|
||||
finish();
|
||||
}
|
||||
barcodeScannerView.decodeSingle(result -> {
|
||||
Intent scanResult = new Intent();
|
||||
//Bundle scanResultBundle = new Bundle();
|
||||
scanResult.putExtra("Barcode Content", result.getText());
|
||||
scanResult.putExtra("Barcode Format name", result.getBarcodeFormat().name());
|
||||
scanResult.putExtra("returnCode", captureIntentBundle.getInt("returnCode"));
|
||||
scanResult.putExtra("resultCode", 1);
|
||||
CustomScannerActivity.this.setResult(RESULT_OK, scanResult);
|
||||
Log.d(TAG, "scanResult == " + scanResult);
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -270,14 +270,11 @@ class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
Log.d(TAG, "Before sort == " + drugs);
|
||||
|
||||
drugs.sort(new Comparator<Drug>() {
|
||||
@Override
|
||||
public int compare(Drug lhs, Drug rhs) {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
drugs.sort((lhs, rhs) -> {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
});
|
||||
Log.d(TAG, "After sort " + drugs);
|
||||
|
||||
|
|
|
@ -47,16 +47,13 @@ public class DrugDetailActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
ImageButton fab = findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Log.d(TAG, "Click on save icon");
|
||||
fab.setOnClickListener(v -> {
|
||||
Log.d(TAG, "Click on save icon");
|
||||
|
||||
getDrugChanges();
|
||||
setResult(1);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
|
||||
}
|
||||
getDrugChanges();
|
||||
setResult(1);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
|
||||
});
|
||||
|
||||
// Show the Up button in the action bar.
|
||||
|
|
|
@ -436,7 +436,7 @@ public class DrugListActivity extends AppCompatActivity {
|
|||
msgString = getString(R.string.msgNotFound);
|
||||
msg.setText(msgString);
|
||||
cpl.setText("");
|
||||
icon.setImageResource(R.drawable.tickcross); //TODO: Exception imageResource null Object reference
|
||||
icon.setImageResource(R.drawable.tickcross);
|
||||
btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -49,14 +49,11 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static void sortPrescriptionList(List<Prescription> prescriptionList) {
|
||||
prescriptionList.sort(new Comparator<>() {
|
||||
@Override
|
||||
public int compare(Prescription lhs, Prescription rhs) {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
prescriptionList.sort((lhs, rhs) -> {
|
||||
if (lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock()) != 0)
|
||||
return lhs.getDateEndOfStock().compareTo(rhs.getDateEndOfStock());
|
||||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -156,13 +156,10 @@ public class WelcomeActivity extends AppCompatActivity {
|
|||
}
|
||||
//icon.setImageResource(R.drawable.pilldroid_icon);
|
||||
btn.setText(R.string.Yes);
|
||||
btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
dlg.dismiss();
|
||||
finish();
|
||||
}
|
||||
btn.setOnClickListener(v -> {
|
||||
// TODO Auto-generated method stub
|
||||
dlg.dismiss();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue