mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Remove unused code
This commit is contained in:
parent
ce67c45c95
commit
33c3b6141a
2 changed files with 1 additions and 65 deletions
|
@ -57,67 +57,7 @@ public class Utils {
|
|||
else
|
||||
return (int) (lhs.getStock() - rhs.getStock());
|
||||
}
|
||||
if(id == R.id.action_save_db) {
|
||||
});
|
||||
}
|
||||
|
||||
public void backupDB() {
|
||||
int permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if(permission == PackageManager.PERMISSION_GRANTED) {
|
||||
//AppDatabase.getInstance(this).getDatabase().close();
|
||||
PrescriptionDatabase.getInstanceDatabase(this).getDatabase().close();
|
||||
|
||||
File db = getDatabasePath("PrescriptionDatabase");
|
||||
File dbShm = new File(db.getParent(), "PrescriptionDatabase-shm");
|
||||
File dbWal = new File(db.getParent(), "PrescriptionDatabase-wal");
|
||||
|
||||
File db2 = new File("/sdcard/", "PrescriptionDatabase");
|
||||
File dbShm2 = new File(db2.getParent(), "PrescriptionDatabase-shm");
|
||||
File dbWal2 = new File(db2.getParent(), "PrescriptionDatabase-wal");
|
||||
|
||||
try {
|
||||
FileUtils.copyFile(db, db2);
|
||||
FileUtils.copyFile(dbShm, dbShm2);
|
||||
FileUtils.copyFile(dbWal, dbWal2);
|
||||
} catch (Exception e) {
|
||||
Log.e("SAVEDB", e.toString());
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(mDrawer, "Please allow access to your storage", Snackbar.LENGTH_LONG)
|
||||
.setAction("Allow", view -> ActivityCompat.requestPermissions(this, new String[] {
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
}, 0)).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void restoreDB ()
|
||||
{
|
||||
int permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
if(permission == PackageManager.PERMISSION_GRANTED) {
|
||||
//AppDatabase.getInstance(this).getDatabase().close();
|
||||
PrescriptionDatabase.getInstanceDatabase(this).getDatabase().close();
|
||||
|
||||
File db = new File("/sdcard/", "PrescriptionDatabaseb");
|
||||
File dbShm = new File(db.getParent(), "PrescriptionDatabase-shm");
|
||||
File dbWal = new File(db.getParent(), "PrescriptionDatabase-wal");
|
||||
|
||||
File db2 = getDatabasePath("PrescriptionDatabase");
|
||||
File dbShm2 = new File(db2.getParent(), "PrescriptionDatabase-shm");
|
||||
File dbWal2 = new File(db2.getParent(), "PrescriptionDatabase-wal");
|
||||
|
||||
try {
|
||||
FileUtils.copyFile(db, db2);
|
||||
FileUtils.copyFile(dbShm, dbShm2);
|
||||
FileUtils.copyFile(dbWal, dbWal2);
|
||||
} catch (Exception e) {
|
||||
Loge("RESTOREDB", e.toString());
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(mDrawer, "Please allow access to your storage", Snackbar.LENGTH_LONG)
|
||||
.setAction("Allow", view -> ActivityCompat.requestPermissions(this, new String[] {
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
}, 0)).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -173,8 +173,4 @@ public class Prescription implements Serializable {
|
|||
setLast_update(new Date().getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue