mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Some cleaning according to code analysis
This commit is contained in:
parent
f31a5a2550
commit
bf88d1e64f
10 changed files with 15 additions and 18 deletions
|
@ -33,8 +33,8 @@ public class CustomScannerActivity extends Activity {
|
||||||
private ImageButton switchFlashlightButton;
|
private ImageButton switchFlashlightButton;
|
||||||
private ViewfinderView viewfinderView;
|
private ViewfinderView viewfinderView;
|
||||||
|
|
||||||
Intent captureIntent = new Intent();
|
final Intent captureIntent = new Intent();
|
||||||
Bundle captureIntentBundle = new Bundle();
|
final Bundle captureIntentBundle = new Bundle();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -88,7 +88,7 @@ public class CustomScannerActivity extends Activity {
|
||||||
scanResult.putExtra("returnCode", captureIntentBundle.getInt("returnCode"));
|
scanResult.putExtra("returnCode", captureIntentBundle.getInt("returnCode"));
|
||||||
scanResult.putExtra("resultCode", 1);
|
scanResult.putExtra("resultCode", 1);
|
||||||
CustomScannerActivity.this.setResult(RESULT_OK, scanResult);
|
CustomScannerActivity.this.setResult(RESULT_OK, scanResult);
|
||||||
Log.d(TAG, "scanResult == " + scanResult.toString());
|
Log.d(TAG, "scanResult == " + scanResult);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -155,7 +155,7 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
drug.setAlertThreshold(7);
|
drug.setAlertThreshold(7);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
|
||||||
|
|
||||||
// Return drug
|
// Return drug
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class DBDrugs extends SQLiteOpenHelper {
|
||||||
drug.setAlertThreshold(7);
|
drug.setAlertThreshold(7);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug(" + cip7 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip7 + ")" + drug);
|
||||||
|
|
||||||
// Return drug
|
// Return drug
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
drug.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
|
drug.setDateLastUpdate(Long.parseLong(cursor.getString(10)));
|
||||||
}
|
}
|
||||||
// Log
|
// Log
|
||||||
Log.d(TAG, "getDrug("+id+")" + drug.toString());
|
Log.d(TAG, "getDrug("+id+")" + drug);
|
||||||
|
|
||||||
assert cursor != null;
|
assert cursor != null;
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
@ -212,7 +212,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
assert cursor != null;
|
assert cursor != null;
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
||||||
Log.d(TAG, "getDrug(" + cip13 + ")" + drug.toString());
|
Log.d(TAG, "getDrug(" + cip13 + ")" + drug);
|
||||||
|
|
||||||
return drug;
|
return drug;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Log.d(TAG, "Before sort == " + drugs.toString());
|
Log.d(TAG, "Before sort == " + drugs);
|
||||||
|
|
||||||
/*drugs.sort(Comparator.comparing(Drug::getDateEndOfStock)
|
/*drugs.sort(Comparator.comparing(Drug::getDateEndOfStock)
|
||||||
.thenComparing(Drug::getStock));*/
|
.thenComparing(Drug::getStock));*/
|
||||||
|
@ -288,7 +288,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
return (int) (lhs.getStock() - rhs.getStock());
|
return (int) (lhs.getStock() - rhs.getStock());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Log.d(TAG, "After sort " + drugs.toString());
|
Log.d(TAG, "After sort " + drugs);
|
||||||
|
|
||||||
// Move drug with prise = 0 at the end of the list
|
// Move drug with prise = 0 at the end of the list
|
||||||
// todo: If some drug moved, must redo all the loop
|
// todo: If some drug moved, must redo all the loop
|
||||||
|
@ -343,7 +343,7 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
// Close DB
|
// Close DB
|
||||||
db.close();
|
db.close();
|
||||||
Log.d(TAG, "values == " + values.toString());
|
Log.d(TAG, "values == " + values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class Drug implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void newStock() {
|
void newStock() {
|
||||||
Log.d(TAG, "current drug = " + this.toString());
|
Log.d(TAG, "current drug = " + this);
|
||||||
|
|
||||||
Date lastUpdate = new Date(getDateLastUpdate());
|
Date lastUpdate = new Date(getDateLastUpdate());
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DrugDetailActivity extends AppCompatActivity {
|
||||||
drug = (Drug) extras.getSerializable("drug");
|
drug = (Drug) extras.getSerializable("drug");
|
||||||
|
|
||||||
assert drug != null;
|
assert drug != null;
|
||||||
Log.d(TAG, "drug == " + drug.toString());
|
Log.d(TAG, "drug == " + drug);
|
||||||
|
|
||||||
setContentView(R.layout.activity_drug_detail);
|
setContentView(R.layout.activity_drug_detail);
|
||||||
Toolbar toolbar = findViewById(detail_toolbar);
|
Toolbar toolbar = findViewById(detail_toolbar);
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
|
|
@ -8,11 +8,11 @@ import android.content.SharedPreferences;
|
||||||
* Created by Lincoln on 05/05/16.
|
* Created by Lincoln on 05/05/16.
|
||||||
*/
|
*/
|
||||||
public class PrefManager {
|
public class PrefManager {
|
||||||
SharedPreferences pref;
|
final SharedPreferences pref;
|
||||||
SharedPreferences.Editor editor;
|
SharedPreferences.Editor editor;
|
||||||
|
|
||||||
// shared pref mode
|
// shared pref mode
|
||||||
int PRIVATE_MODE = 0;
|
final int PRIVATE_MODE = 0;
|
||||||
|
|
||||||
// Shared preferences file name
|
// Shared preferences file name
|
||||||
private static final String PREF_NAME = "Pildroid-Prefs";
|
private static final String PREF_NAME = "Pildroid-Prefs";
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.util.Log;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParsePosition;
|
import java.text.ParsePosition;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
// viewpager change listener
|
// viewpager change listener
|
||||||
ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
final ViewPager.OnPageChangeListener viewPagerPageChangeListener = new ViewPager.OnPageChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
|
|
Loading…
Reference in a new issue