Corrections après merge

This commit is contained in:
Jacques Foucry 2016-08-30 23:54:23 +02:00
parent 194549b907
commit 957a9b09ac
2 changed files with 14 additions and 20 deletions

View file

@ -21,15 +21,14 @@ public class DBMedoc extends SQLiteOpenHelper{
private static final int DATABASE_VERSION = 1;
private static String DATABASE_PATH = "/data/data/net.foucry.pilldroid/databases/";
private static String DATABASE_NAME = "medicaments.db";
private static String dbName = "medicaments.db";
private SQLiteDatabase myDataBase;
private final Context myContext;
File dbFile = new File(DATABASE_PATH + dbName);
private static final String TABLE_NAME = "medicaments";
// private static final String MEDOC_ID = "id";
private static final String MEDOC_CIS = "cis";
private static final String MEDOC_CIP13 = "cip13";
// private static final String MEDOC_CIP7 = "cip7";
private static final String MEDOC_ADMIN = "mode_administration";
private static final String MEDOC_NOM = "nom";
private static final String MEDOC_PRES = "presentation";
@ -70,30 +69,26 @@ public class DBMedoc extends SQLiteOpenHelper{
private void copyDatabase(String dbPath) {
try {
InputStream assestDB = myContext.getAssets().open(dbName);
InputStream assetDB = myContext.getAssets().open(dbName);
OutputStream appDB = new FileOutputStream(dbPath, false);
byte[] buffer = new byte[1024];
int length;
while ((length = assestDB.read(buffer)) > 0) {
while ((length = assetDB.read(buffer)) > 0) {
appDB.write(buffer,0, length);
}
appDB.flush();
appDB.close();
assestDB.close();
assetDB.close();
} catch (IOException e) {
e.printStackTrace();
}
myOutput.flush();
myOutput.close();
myInput.close();
}
public void openDatabase() throws SQLiteException {
Log.e(TAG, "openDatabase called");
String myPath = DATABASE_PATH + DATABASE_NAME;
String myPath = DATABASE_PATH + dbName;
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
}
@ -104,15 +99,6 @@ public class DBMedoc extends SQLiteOpenHelper{
myDataBase.close();
}
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
private DBMedoc dbMedoc;

View file

@ -113,6 +113,14 @@ public class UtilDate {
public static long tomorrowAtNoon() {
Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR,1);
Date tomorrowAtNoon = dateAtNoon(calendar.getTime());
return (tomorrowAtNoon.getTime() - now.getTime());
}
public static String convertDate(long dateInMilliseconds) {
DateFormat formatter = new SimpleDateFormat("dd/MM/yy hh:mm:ss");