Skip to content

Commit

Permalink
Rename file while renaming recording
Browse files Browse the repository at this point in the history
  • Loading branch information
gaul committed Jul 1, 2016
1 parent 69efeaa commit 5dfbd14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/danielkim/soundrecorder/DBHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ public long addRecording(String recordingName, String filePath, long length) {
return rowId;
}

public void renameItem(RecordingItem item, String recordingName) {
public void renameItem(RecordingItem item, String recordingName, String filePath) {
SQLiteDatabase db = getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put(DBHelperItem.COLUMN_NAME_RECORDING_NAME, recordingName);
cv.put(DBHelperItem.COLUMN_NAME_RECORDING_FILE_PATH, filePath);
db.update(DBHelperItem.TABLE_NAME, cv,
DBHelperItem._ID + "=" + item.getId(), null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void rename(int position, String name) {
//file name is unique, rename file
File oldFilePath = new File(getItem(position).getFilePath());
oldFilePath.renameTo(f);
mDatabase.renameItem(getItem(position), name);
mDatabase.renameItem(getItem(position), name, mFilePath);
notifyItemChanged(position);
}
}
Expand Down

0 comments on commit 5dfbd14

Please sign in to comment.