@@ -12,6 +12,8 @@ import android.widget.TextView; |
||
| 12 | 12 |
import android.widget.Toast; |
| 13 | 13 |
|
| 14 | 14 |
import ai.pai.client.R; |
| 15 |
+import ai.pai.client.beans.GroupInfo; |
|
| 16 |
+import ai.pai.client.db.DBService; |
|
| 15 | 17 |
import ai.pai.client.db.Preferences; |
| 16 | 18 |
import ai.pai.client.services.GroupService; |
| 17 | 19 |
import ai.pai.client.utils.SystemUtils; |
@@ -114,6 +116,9 @@ public class GroupRenameActivity extends BaseActivity implements View.OnClickLis |
||
| 114 | 116 |
|
| 115 | 117 |
@Override |
| 116 | 118 |
public void onCommandCommitSuccess(int command, Object response) {
|
| 119 |
+ GroupInfo groupInfo = DBService.getInstance(getApplicationContext()).getGroupInfoByGroupId(groupId); |
|
| 120 |
+ groupInfo.groupName = newGroupName; |
|
| 121 |
+ DBService.getInstance(getApplicationContext()).updateGroupInfo(groupInfo); |
|
| 117 | 122 |
Toast.makeText(getApplicationContext(), R.string.group_name_modify_success,Toast.LENGTH_SHORT).show(); |
| 118 | 123 |
Bundle bundle = new Bundle(); |
| 119 | 124 |
bundle.putString("group_name",newGroupName);
|
@@ -26,6 +26,7 @@ import java.util.ArrayList; |
||
| 26 | 26 |
import ai.pai.client.R; |
| 27 | 27 |
import ai.pai.client.beans.GroupMemberInfo; |
| 28 | 28 |
import ai.pai.client.db.DBService; |
| 29 |
+import ai.pai.client.db.Preferences; |
|
| 29 | 30 |
import ai.pai.client.services.GroupService; |
| 30 | 31 |
import ai.pai.client.utils.PhotoLoader; |
| 31 | 32 |
import ai.pai.client.utils.SystemUtils; |
@@ -136,7 +137,6 @@ public class GroupSettingActivity extends BaseActivity implements View.OnClickLi |
||
| 136 | 137 |
bundle.putInt("command", GroupService.GroupCommand.COMMAND_QUIT_GROUP);
|
| 137 | 138 |
intent.putExtras(bundle); |
| 138 | 139 |
startService(intent); |
| 139 |
- finish(); |
|
| 140 | 140 |
} else {
|
| 141 | 141 |
Toast.makeText(this, R.string.can_not_delete_self, Toast.LENGTH_SHORT).show(); |
| 142 | 142 |
} |
@@ -250,6 +250,7 @@ public class GroupSettingActivity extends BaseActivity implements View.OnClickLi |
||
| 250 | 250 |
case GroupService.GroupCommand.COMMAND_QUIT_GROUP: |
| 251 | 251 |
Toast.makeText(getApplicationContext(), R.string.quit_group_success, Toast.LENGTH_SHORT).show(); |
| 252 | 252 |
DBService.getInstance(getApplicationContext()).deleteGroupByGroupId(groupId); |
| 253 |
+ finish(); |
|
| 253 | 254 |
break; |
| 254 | 255 |
} |
| 255 | 256 |
} |
@@ -358,6 +358,14 @@ public class DBService {
|
||
| 358 | 358 |
} |
| 359 | 359 |
} |
| 360 | 360 |
|
| 361 |
+ public void updateGroupInfo(GroupInfo newGroupInfo){
|
|
| 362 |
+ if(newGroupInfo==null){
|
|
| 363 |
+ return; |
|
| 364 |
+ } |
|
| 365 |
+ deleteGroupByGroupId(newGroupInfo.groupId); |
|
| 366 |
+ addNewGroup(newGroupInfo); |
|
| 367 |
+ } |
|
| 368 |
+ |
|
| 361 | 369 |
public void deleteGroupByGroupId(String groupId) {
|
| 362 | 370 |
if (TextUtils.isEmpty(groupId)) {
|
| 363 | 371 |
return; |