@Override protected void onCreate(Bundle savedInstanceState) { LogUtil.d(TAG, "onCreate"); super.onCreate(null); getWindow().setFormat(PixelFormat.TRANSPARENT); String recipients = getIntent().getStringExtra(ChattingFragment.RECIPIENTS); if (recipients == null) { finish(); LogUtil.e(TAG, "recipients is null !!"); return; } setContentView(R.layout.chattingui_activity_container); mChattingFragment = new ChattingFragment(); Bundle bundle = getIntent().getExtras(); bundle.putBoolean(ChattingFragment.FROM_CHATTING_ACTIVITY, true); mChattingFragment.setArguments(bundle); getSupportFragmentManager() .beginTransaction() .add(R.id.ccp_root_view, mChattingFragment) .commit(); onActivityCreate(); if (isChatToSelf(recipients) || isPeerChat(recipients)) { AppPanelControl.setShowVoipCall(false); } }
/** 开始网络同步群组列表信息 */ @SuppressWarnings("deprecation") public static void syncGroup(Callback callback) { getInstance().mGroupManager = SDKCoreHelper.getECGroupManager(); if (getInstance().mGroupManager == null || getInstance().isSync) { LogUtil.e(TAG, "SDK not ready or isSync " + getInstance().isSync); return; } getInstance().isSync = true; getInstance().mCallback = callback; getInstance() .mGroupManager .queryOwnGroups( Target.GROUP, new ECGroupManager.OnQueryOwnGroupsListener() { @Override public void onQueryOwnGroupsComplete(ECError error, List<ECGroup> groups) { if (getInstance().isSuccess(error)) { if (groups == null || groups.isEmpty()) { GroupSqlManager.delALLGroup(); } else { LogUtil.d(TAG, "[syncGroup] groups size :" + groups.size()); List<String> allGroupIdByJoin = GroupSqlManager.getAllGroupIdBy(true); ArrayList<String> ids = new ArrayList<String>(); for (ECGroup group : groups) { ids.add(group.getGroupId()); } // 查找不是我的群组 if (!allGroupIdByJoin.isEmpty()) { for (String id : allGroupIdByJoin) { if (ids.contains(id)) { continue; } // 不是我的群组 GroupSqlManager.updateUNJoin(id); } } GroupSqlManager.insertGroupInfos(groups, 1); } getInstance().isSync = false; // 更新公共所有群组 // syncPublicGroups(); if (getInstance().mCallback != null) { getInstance().mCallback.onSyncGroup(); } if (CCPAppManager.getContext() != null) { CCPAppManager.getContext().sendBroadcast(new Intent((ACTION_SYNC_GROUP))); } return; } onErrorCallback(error.errorCode, "同步群组失败"); } }); }