@@ -119,6 +119,7 @@ public class GroupRenameActivity extends BaseActivity implements View.OnClickLis |
||
| 119 | 119 |
GroupInfo groupInfo = DBService.getInstance(getApplicationContext()).getGroupInfoByGroupId(groupId); |
| 120 | 120 |
groupInfo.groupName = newGroupName; |
| 121 | 121 |
DBService.getInstance(getApplicationContext()).updateGroupInfo(groupInfo); |
| 122 |
+ DBService.getInstance(getApplicationContext()).updateGroupPhotoListAfterRename(groupId,newGroupName); |
|
| 122 | 123 |
Toast.makeText(getApplicationContext(), R.string.group_name_modify_success,Toast.LENGTH_SHORT).show(); |
| 123 | 124 |
Bundle bundle = new Bundle(); |
| 124 | 125 |
bundle.putString("group_name",newGroupName);
|
@@ -106,7 +106,32 @@ public class DBService {
|
||
| 106 | 106 |
addNewGroup(info); |
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 |
+ public void updateGroupPhotoListAfterRename(String groupId,String newGroupName) {
|
|
| 110 |
+ LogHelper.d(TAG, "dbservice updateGroupPhotoListAfterRename :" + groupId); |
|
| 109 | 111 |
|
| 112 |
+ SQLiteDatabase db = null; |
|
| 113 |
+ Cursor c = null; |
|
| 114 |
+ synchronized (DB_LOCK) {
|
|
| 115 |
+ try {
|
|
| 116 |
+ db = dbHelper.getReadableDatabase(); |
|
| 117 |
+ db.beginTransaction(); |
|
| 118 |
+ ContentValues cv = new ContentValues(); |
|
| 119 |
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.GROUP_NAME,newGroupName); |
|
| 120 |
+ String[] args = {groupId};
|
|
| 121 |
+ db.update(DBHelper.PHOTO_INFO_TABLE,cv,DBHelper.PHOTO_INFO_COLUMNS.PHOTO_GROUP_ID + " =?",args); |
|
| 122 |
+ db.setTransactionSuccessful(); |
|
| 123 |
+ } catch (Exception e) {
|
|
| 124 |
+ LogHelper.d(TAG, "dbservice updateGroupPhotoListAfterRename error happen " + e); |
|
| 125 |
+ } finally {
|
|
| 126 |
+ try {
|
|
| 127 |
+ db.endTransaction(); |
|
| 128 |
+ } catch (Exception e) {
|
|
| 129 |
+ e.printStackTrace(); |
|
| 130 |
+ } |
|
| 131 |
+ closeCursorAndDB(c, db); |
|
| 132 |
+ } |
|
| 133 |
+ } |
|
| 134 |
+ } |
|
| 110 | 135 |
public ArrayList<GroupPhotoItem> getGroupPhotoListByGroupId(String groupId) {
|
| 111 | 136 |
LogHelper.d(TAG, "dbservice getGroupPhotoListByGroupId :" + groupId); |
| 112 | 137 |
ArrayList<GroupPhotoItem> photoItems = new ArrayList<GroupPhotoItem>(); |