use of net.iGap.messenger.ui.components.FragmentMediaContainer in project iGap-Android by KianIranian-STDG.
the class FragmentChat method onCreateView.
@Nullable
@Override
public View onCreateView(@NotNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
isNeedResume = true;
G.locationListener = this;
StickerRepository.getInstance().getUserStickersGroup();
notifyFrameLayout = new NotifyFrameLayout(context) {
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
if (topFragmentIsChat() && keyboardViewVisible) {
showPopup(-1);
return true;
}
return false;
}
return super.dispatchKeyEventPreIme(event);
}
};
Bundle extras = getArguments();
if (extras != null) {
mRoomId = extras.getLong("RoomId");
if (mustCheckPermission())
currentRoomAccess = DbManager.getInstance().doRealmTask(realm -> {
return realm.where(RealmRoomAccess.class).equalTo("id", mRoomId + "_" + AccountManager.getInstance().getCurrentUser().getId()).findFirst();
});
}
notifyFrameLayout.setListener(this::onScreenSizeChanged);
rootView = (FrameLayout) inflater.inflate(R.layout.fragment_chat, container, false);
chatContainer = rootView.findViewById(R.id.chatMainContainer);
mediaContainer = new FragmentMediaContainer(getActivity(), this);
mediaContainer.setListener(i -> {
switch(i) {
case FragmentMediaContainer.CALL_TAG:
getActivity().startActivity(new Intent(getContext(), CallActivity.class));
break;
case FragmentMediaContainer.MEDIA_TAG:
if (!MusicPlayer.isVoice) {
Intent intent = new Intent(context, ActivityMain.class);
intent.putExtra(ActivityMain.openMediaPlayer, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
}
break;
case FragmentMediaContainer.PLAY_TAG:
break;
}
});
// mediaContainer.setVisibility(View.GONE);
chatContainer.addView(mediaContainer, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, 59, 0, 0));
mToolbar = new Toolbar(context);
searchFieldItem = mToolbar.addItem(searchFieldTag, R.string.icon_search, Theme.getInstance().getTitleTextColor(getContext())).setIsSearchBox(true).setActionBarMenuItemSearchListener(new ToolbarItem.ActionBarMenuItemSearchListener() {
int textLength;
@Override
public void onSearchExpand() {
if (layoutMute != null) {
layoutMute.setVisibility(View.GONE);
}
if (viewAttachFile != null) {
viewAttachFile.setVisibility(View.GONE);
}
if (rootView.findViewById(R.id.ac_ll_join).getVisibility() == View.VISIBLE) {
rootView.findViewById(R.id.ac_ll_join).setVisibility(View.GONE);
}
if (pinedMessageLayout != null) {
changePinnedMessageVisibility(true, false, MusicPlayer.isMusicPlyerEnable, CallManager.getInstance().isCallAlive());
}
if (vgSpamUser != null) {
vgSpamUser.setVisibility(View.GONE);
}
isSearchVisible = true;
}
@Override
public void onTextChanged(EditText editText) {
String text = editText.getText().toString();
if (text.length() > 0 && !text.startsWith("#")) {
if (!initHash) {
initHash = true;
initHashView();
}
searchHash.setHashString(editText.getText().toString());
searchHash.setPosition("");
if (searchFragment != null) {
searchFragment.onSearchCollapsed();
}
if (ll_navigateHash != null) {
ll_navigateHash.setVisibility(View.VISIBLE);
}
if (viewAttachFile != null) {
viewAttachFile.setVisibility(View.GONE);
}
} else if (text.startsWith("#") && text.length() < 2) {
if (text.length() > textLength) {
searchFragment = SearchFragment.newInstance(mRoomId, text, true);
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.chatContainer, searchFragment).commit();
}
if (keyboardContainer != null) {
keyboardContainer.setVisibility(View.GONE);
}
if (ll_navigateHash != null) {
ll_navigateHash.setVisibility(View.GONE);
}
if (txtFloatingTime != null) {
txtFloatingTime.setVisibility(View.GONE);
}
} else if (text.startsWith("#") && text.length() > 1) {
if (searchFragment != null && searchFragment.isAdded()) {
searchFragment.onTextChanged(editText.getText().toString());
}
} else {
hideKeyboardView();
if (ll_navigateHash != null) {
ll_navigateHash.setVisibility(View.GONE);
}
if (searchFragment != null && searchFragment.isAdded()) {
searchFragment.onSearchCollapsed();
}
}
textLength = editText.getText().length();
}
@Override
public void onSearchCollapse() {
if (muteIcon != null) {
muteIcon.setVisibility(getRoom().getMute() ? View.VISIBLE : View.GONE);
}
if (verifiedIcon != null) {
RealmChannelRoom channelRoom = getRoom().getChannelRoom();
boolean isVerified = false;
if (channelRoom != null) {
isVerified = channelRoom.isVerified();
}
verifiedIcon.setVisibility(isVerified ? View.VISIBLE : View.GONE);
}
if (avatarItem != null) {
avatarItem.setVisibility(View.VISIBLE);
}
if (pinedMessageLayout != null) {
if (isPinAvailable) {
changePinnedMessageVisibility(true, true, MusicPlayer.isMusicPlyerEnable, CallManager.getInstance().isCallAlive());
}
}
if (isNotJoin) {
rootView.findViewById(R.id.ac_ll_join).setVisibility(View.VISIBLE);
}
if (searchFragment != null) {
searchFragment.onSearchCollapsed();
}
if (vgSpamUser != null) {
showSpamBar();
}
goneSearchHashFooter();
hideKeyboardView();
searchFieldItem.setVisibility(View.GONE);
isSearchVisible = false;
}
});
searchFieldItem.setVisibility(View.GONE);
mToolbar.setOnClickListener(view -> {
hideKeyboard();
goToProfile();
});
mToolbar.setListener(i -> {
switch(i) {
case -1:
if (mToolbar.isActionModeShowed()) {
mAdapter.deselect();
return;
}
if (webViewChatPage != null) {
closeWebViewForSpecialUrlChat(false);
return;
}
hideKeyboard();
if (chatType == CHANNEL && !floatingHidden) {
if (channelRole == ChannelChatRole.OWNER && !isRecording) {
hideFloatingButton(true);
micAndAddStoryAnimateVisible(false);
}
return;
}
if (currentRoomAccess != null) {
if (currentRoomAccess != null) {
if (!currentRoomAccess.getRealmPostMessageRights().isCanSendText()) {
G.runOnUiThread(() -> {
viewAttachFile.setVisibility(View.GONE);
});
}
}
}
if (G.twoPaneMode) {
if (getActivity() instanceof ActivityMain) {
((ActivityMain) getActivity()).goToTabletEmptyPage();
}
} else {
if (!mToolbar.isSearchFieldVisible()) {
popBackStackFragment();
}
}
break;
case searchItem:
initLayoutSearchNavigation();
if (!initHash) {
initHash = true;
initHashView();
}
openSearchBox(null);
showPopup(KeyboardView.MODE_KEYBOARD);
G.handler.postDelayed(() -> editTextRequestFocus(searchEditText), 300);
break;
case voiceCallTag:
if (CallManager.getInstance().getCallPeerId() == chatPeerId) {
Intent activityIntent = new Intent(getActivity(), CallActivity.class);
activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(activityIntent);
} else if (!CallManager.getInstance().isCallAlive()) {
CallSelectFragment selectFragment = CallSelectFragment.getInstance(chatPeerId, false, null);
if (getFragmentManager() != null)
selectFragment.show(getFragmentManager(), null);
if (keyboardViewVisible) {
hideKeyboard();
}
} else {
Toast.makeText(getContext(), "NOT ALLOWED", Toast.LENGTH_SHORT).show();
}
break;
case moreTag:
createMoreItems();
break;
case clearHistoryItem:
new MaterialDialog.Builder(G.fragmentActivity).title(R.string.clear_history).content(R.string.clear_history_content).positiveText(R.string.yes).onPositive((dialog, which) -> clearHistory(mRoomId)).negativeText(R.string.no).show();
break;
case deleteItem:
new MaterialDialog.Builder(G.fragmentActivity).title(R.string.delete_chat).content(R.string.delete_chat_content).positiveText(R.string.yes).onPositive((dialog, which) -> deleteChat(mRoomId)).negativeText(R.string.no).show();
break;
case muteItem:
case unMuteItem:
muteNotification(mRoomId);
break;
case chatToGroupItem:
new MaterialDialog.Builder(G.fragmentActivity).title(R.string.convert_chat_to_group_title).content(R.string.convert_chat_to_group_content).positiveText(R.string.yes).negativeText(R.string.no).onPositive((dialog, which) -> {
// finish();
finishChat();
dialog.dismiss();
G.handler.post(() -> G.onConvertToGroup.openFragmentOnActivity("ConvertToGroup", mRoomId));
}).show();
break;
case cleanUpItem:
resetMessagingValue();
setDownBtnGone();
setCountNewMessageZero();
DbManager.getInstance().doRealmTask(realm -> {
RealmRoomMessage.ClearAllMessageRoomAsync(realm, mRoomId, () -> {
recyclerView.addOnScrollListener(scrollListener);
saveMessageIdPositionState(0, 0);
/**
* get history from server
*/
topMore = true;
getOnlineMessage(0, 0, UP);
});
});
break;
case reportItem:
dialogReport(false, 0, 0);
break;
case sendMoneyItem:
showPaymentDialog();
break;
case exportChatItem:
if (HelperPermission.grantedUseStorage()) {
exportChat();
} else {
try {
HelperPermission.getStoragePermission(G.fragmentActivity, new OnGetPermission() {
@Override
public void Allow() {
exportChat();
}
@Override
public void deny() {
Toast.makeText(G.currentActivity, R.string.export_message, Toast.LENGTH_SHORT).show();
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
break;
case stopItem:
new MaterialDialog.Builder(G.fragmentActivity).title(R.string.stop).content(R.string.stop_message_bot).positiveText(R.string.yes).onPositive((dialog, which) -> {
// onSelectRoomMenu("txtClearHistory", mRoomId);
closeWebViewForSpecialUrlChat(true);
// popBackStackFragment();
}).negativeText(R.string.no).show();
break;
case copyMessageTag:
copySelectedItemTextToClipboard();
break;
case forwardMessageTag:
// forward selected messages to room list for selecting room
if (mAdapter != null && mAdapter.getSelectedItems().size() > 0) {
onForwardClick(null);
}
break;
case replyMessageTag:
if (mAdapter != null && !mAdapter.getSelectedItems().isEmpty() && mAdapter.getSelectedItems().size() == 1) {
reply(mAdapter.getSelectedItems().iterator().next().messageObject, false);
}
break;
case deleteMessageTag:
messageIds = new ArrayList<>();
documentIds = new ArrayList<>();
bothDeleteMessageId = new ArrayList<>();
G.handler.post(() -> {
for (final AbstractMessage item : mAdapter.getSelectedItems()) {
if (mAdapter.getSelectedItems().size() == 1) {
confirmAndDeleteMessage(item.messageObject, true);
return;
}
try {
if (item != null && item.messageObject != null) {
Long messageId = item.messageObject.id;
Long documentId = item.messageObject.documentId;
messageIds.add(messageId);
documentIds.add(documentId);
boolean bothDelete = RealmRoomMessage.isBothDelete(item.messageObject.getUpdateOrCreateTime());
if (bothDelete)
bothDeleteMessageId.add(messageId);
}
} catch (NullPointerException e) {
e.printStackTrace();
}
}
if (chatType == CHAT && !isCloudRoom && bothDeleteMessageId.size() > 0 && mAdapter.getSelectedItems().iterator().next().messageObject.userId == AccountManager.getInstance().getCurrentUser().getId()) {
String delete;
String textCheckBox = getContext().getResources().getString(R.string.st_checkbox_delete) + " " + title;
delete = getContext().getResources().getString(R.string.st_desc_deletes);
new MaterialDialog.Builder(getContext()).content(delete).title(R.string.message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
if (!dialog.isPromptCheckBoxChecked()) {
bothDeleteMessageId = null;
}
getMessageController().deleteSelectedMessage(chatType.getNumber(), mRoomId, messageIds, documentIds, bothDeleteMessageId);
// deleteSelectedMessageFromAdapter(messageIds);
}).checkBoxPrompt(textCheckBox, false, null).show();
} else {
new MaterialDialog.Builder(getActivity()).title(R.string.message).content(getActivity().getResources().getString(R.string.st_desc_deletes)).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
bothDeleteMessageId = null;
getMessageController().deleteSelectedMessage(chatType.getNumber(), mRoomId, messageIds, documentIds, bothDeleteMessageId);
// deleteSelectedMessageFromAdapter(messageIds);
}).show();
}
});
break;
}
});
searchEditText = searchFieldItem.getSearchEditText();
mToolbar.setBackIcon(new BackDrawable(false));
verifiedIcon = mToolbar.addVerifiedChannelsIcon();
muteIcon = mToolbar.addMuteIcon();
ToolbarItems toolbarItems = mToolbar.createToolbarItems();
toolbarItems.setBackground(null);
moreItem = toolbarItems.addItemWithWidth(moreTag, R.string.icon_other_vertical_dots, 48);
callItem = toolbarItems.addItemWithWidth(voiceCallTag, R.string.icon_voice_call, 48);
createActionMode();
rootView.addView(mToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 60, Gravity.TOP));
notifyFrameLayout.addView(rootView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
keyboardContainer = rootView.findViewById(R.id.fl_chat_keyboardContainer);
sendMoney = rootView.findViewById(R.id.btn_chatRoom_wallet);
/**
* init chat box edit text and send item because we need change this color in dark mode!
*/
edtChat = rootView.findViewById(R.id.et_chatRoom_writeMessage);
edtChat.setGravity(Gravity.CENTER_VERTICAL);
edtChat.setListener(this::chatMotionEvent);
imvSendButton = rootView.findViewById(R.id.btn_chatRoom_send);
editTextProgress = rootView.findViewById(R.id.editTextProgress);
chatRoom_send_container = rootView.findViewById(R.id.chatRoom_send_container);
getEventManager().addObserver(EventManager.CALL_STATE_CHANGED, this);
getEventManager().addObserver(EventManager.EMOJI_LOADED, this);
getEventManager().addObserver(EventManager.ON_MESSAGE_DELETE, this);
getEventManager().addObserver(EventManager.ON_EDIT_MESSAGE, this);
getEventManager().addObserver(EventManager.ON_PINNED_MESSAGE, this);
getEventManager().addObserver(EventManager.CHAT_CLEAR_MESSAGE, this);
getEventManager().addObserver(EventManager.CHANNEL_ADD_VOTE, this);
getEventManager().addObserver(EventManager.CHANNEL_GET_VOTE, this);
getEventManager().addObserver(EventManager.CHANNEL_UPDATE_VOTE, this);
getEventManager().addObserver(EventManager.CHANNEL_UPDATE_VOTE, this);
getEventManager().addObserver(EventManager.CHAT_UPDATE_STATUS, this);
getEventManager().addObserver(EventManager.MEDIA_PLAYER_STATE_CHANGED, this);
getEventManager().addObserver(EventManager.NEXT_VOICE, this);
getEventManager().addObserver(EventManager.ON_FILE_PICKED_FROM_INTENT, this);
if (twoPaneMode)
EventManager.getInstance(AccountManager.selectedAccount).addObserver(EventManager.CHAT_BACKGROUND_CHANGED, this);
return attachToSwipeBack(notifyFrameLayout);
}
use of net.iGap.messenger.ui.components.FragmentMediaContainer in project iGap-Android by KianIranian-STDG.
the class FragmentCall method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperTracker.sendTracker(HelperTracker.TRACKER_CALL_PAGE);
if (getContext() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StatusBarUtil.setColor(getActivity(), new Theme().getPrimaryDarkColor(getContext()), 50);
}
callToolbar = new Toolbar(getContext());
callToolbar.setTitle(isAppRtl ? R.string.logo_igap_fa : R.string.logo_igap_en);
ToolbarItems toolbarItems = callToolbar.createToolbarItems();
toolbarItems.addItemWithWidth(createCallTag, R.string.icon_add, 54);
toolbarItems.addItemWithWidth(codeScannerTag, R.string.icon_QR_code, 54);
callToolbar.setListener(i -> {
switch(i) {
case -1:
setViewState(!mIsMultiSelectEnable);
hideActionMode();
mSelectedLogList.clear();
break;
case createCallTag:
showContactListForCall();
break;
case codeScannerTag:
onCodeScannerClickListener();
break;
case deleteAllTag:
if (getRequestManager().isUserLogin()) {
new MaterialDialog.Builder(getContext()).title(R.string.clean_log).content(R.string.are_you_sure_clear_call_logs).positiveText(R.string.B_ok).onPositive((dialog, which) -> {
DbManager.getInstance().doRealmTask(realm -> {
// ToDo: add callback to proto request
setViewState(false);
RealmCallLog realmCallLog = realm.where(RealmCallLog.class).findAll().sort("offerTime", Sort.DESCENDING).first();
new RequestSignalingClearLog().signalingClearLog(realmCallLog.getId());
view.findViewById(R.id.empty_layout).setVisibility(View.VISIBLE);
mSelectedLogList.clear();
});
hideActionMode();
}).negativeText(R.string.B_cancel).show();
} else {
HelperError.showSnackMessage(getString(R.string.there_is_no_connection_to_server), false);
}
break;
case deleteTag:
if (mSelectedLogList.size() == 0) {
Toast.makeText(_mActivity, getString(R.string.no_item_selected), Toast.LENGTH_SHORT).show();
return;
}
if (getRequestManager().isUserLogin()) {
new MaterialDialog.Builder(getActivity()).title(R.string.clean_log).content(R.string.are_you_sure_clear_call_log).positiveText(R.string.B_ok).onPositive((dialog, which) -> {
try {
List<Long> logIds = new ArrayList<>();
for (int j = 0; j < mSelectedLogList.size(); j++) {
logIds.add(mSelectedLogList.get(j).getLogId());
}
new RequestSignalingClearLog().signalingClearLog(logIds);
setViewState(false);
mSelectedLogList.clear();
if (realmResults.size() == 0) {
view.findViewById(R.id.empty_layout).setVisibility(View.VISIBLE);
}
} catch (Exception e) {
e.printStackTrace();
}
hideActionMode();
}).negativeText(R.string.B_cancel).show();
} else {
HelperError.showSnackMessage(getString(R.string.there_is_no_connection_to_server), false);
}
break;
}
});
createToolbarActions();
mediaContainer = new FragmentMediaContainer(getContext(), this);
mediaContainer.setListener(i -> {
switch(i) {
case FragmentMediaContainer.CALL_TAG:
getActivity().startActivity(new Intent(getContext(), CallActivity.class));
break;
case FragmentMediaContainer.MEDIA_TAG:
if (!MusicPlayer.isVoice) {
Intent intent = new Intent(context, ActivityMain.class);
intent.putExtra(ActivityMain.openMediaPlayer, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
}
break;
case FragmentMediaContainer.PLAY_TAG:
break;
}
});
ViewGroup layoutToolbar = view.findViewById(R.id.fc_layout_toolbar);
layoutToolbar.addView(mediaContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 38, Gravity.BOTTOM, 0, 60, 0, 0));
layoutToolbar.addView(callToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 64, Gravity.TOP));
mBtnAllCalls = view.findViewById(R.id.fc_btn_all_calls);
mBtnMissedCalls = view.findViewById(R.id.fc_btn_missed_calls);
mBtnCanceledCalls = view.findViewById(R.id.fc_btn_canceled_calls);
mBtnIncomingCalls = view.findViewById(R.id.fc_btn_incoming_calls);
mBtnOutgoingCalls = view.findViewById(R.id.fc_btn_outgoing_calls);
progressBar = view.findViewById(R.id.fc_progress_bar_waiting);
emptuListView = view.findViewById(R.id.empty_layout);
progressBar = view.findViewById(R.id.fc_progress_bar_waiting);
mRecyclerView = view.findViewById(R.id.fc_recycler_view_call);
mFiltersLayout = view.findViewById(R.id.fc_layout_filters);
setEnableButton(mSelectedStatus);
mRecyclerView = view.findViewById(R.id.fc_recycler_view_call);
mRecyclerView.setItemAnimator(null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
if (realmResults == null) {
realmResults = DbManager.getInstance().doRealmTask(realm -> {
return getRealmResult(mSelectedStatus, realm);
});
}
realmResults.addChangeListener((realmCallLogs, changeSet) -> {
checkListIsEmpty();
});
checkListIsEmpty();
mRecyclerView.setAdapter(new CallAdapter(realmResults));
mOffset = 0;
getLogListWithOffset();
mRecyclerView.getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
super.onItemRangeInserted(positionStart, itemCount);
checkListIsEmpty();
}
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
super.onItemRangeRemoved(positionStart, itemCount);
checkListIsEmpty();
}
});
onScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (isThereAnyMoreItemToLoad) {
if (!isSendRequestForLoading) {
int lastVisiblePosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition();
if (lastVisiblePosition + 15 >= mOffset) {
getLogListWithOffset();
}
}
}
}
};
mRecyclerView.addOnScrollListener(onScrollListener);
G.iSignalingGetCallLog = (size, signalingLogList) -> {
if (signalingLogList != null) {
G.handler.post(() -> progressBar.setVisibility(View.GONE));
}
if (size == -1) {
if (attampOnError < 2) {
isSendRequestForLoading = false;
attampOnError++;
} else {
isThereAnyMoreItemToLoad = false;
mRecyclerView.removeOnScrollListener(onScrollListener);
}
} else if (size == 0) {
isThereAnyMoreItemToLoad = false;
mRecyclerView.removeOnScrollListener(onScrollListener);
} else {
isSendRequestForLoading = false;
mOffset += size;
}
};
mBtnAllCalls.setOnClickListener(v -> {
if (mSelectedStatus != ProtoSignalingGetLog.SignalingGetLog.Filter.ALL) {
setEnableButton(ProtoSignalingGetLog.SignalingGetLog.Filter.ALL);
getCallLogsFromRealm(ProtoSignalingGetLog.SignalingGetLog.Filter.ALL);
}
});
mBtnMissedCalls.setOnClickListener(v -> {
if (mSelectedStatus != ProtoSignalingGetLog.SignalingGetLog.Filter.MISSED) {
setEnableButton(ProtoSignalingGetLog.SignalingGetLog.Filter.MISSED);
getCallLogsFromRealm(ProtoSignalingGetLog.SignalingGetLog.Filter.MISSED);
}
});
mBtnOutgoingCalls.setOnClickListener(v -> {
if (mSelectedStatus != ProtoSignalingGetLog.SignalingGetLog.Filter.OUTGOING) {
setEnableButton(ProtoSignalingGetLog.SignalingGetLog.Filter.OUTGOING);
getCallLogsFromRealm(ProtoSignalingGetLog.SignalingGetLog.Filter.OUTGOING);
}
});
mBtnIncomingCalls.setOnClickListener(v -> {
if (mSelectedStatus != ProtoSignalingGetLog.SignalingGetLog.Filter.INCOMING) {
setEnableButton(ProtoSignalingGetLog.SignalingGetLog.Filter.INCOMING);
getCallLogsFromRealm(ProtoSignalingGetLog.SignalingGetLog.Filter.INCOMING);
}
});
mBtnCanceledCalls.setOnClickListener(v -> {
if (mSelectedStatus != ProtoSignalingGetLog.SignalingGetLog.Filter.CANCELED) {
setEnableButton(ProtoSignalingGetLog.SignalingGetLog.Filter.CANCELED);
getCallLogsFromRealm(ProtoSignalingGetLog.SignalingGetLog.Filter.CANCELED);
}
});
// Todo: fixed it, cause load view with delay
setViewState(mIsMultiSelectEnable);
}
use of net.iGap.messenger.ui.components.FragmentMediaContainer in project iGap-Android by KianIranian-STDG.
the class FragmentShearedMedia method initComponent.
private void initComponent(View view) {
FrameLayout toolbarLayout = view.findViewById(R.id.frg_shared_media_ll_toolbar_layout);
FragmentMediaContainer mediaContainer = new FragmentMediaContainer(getContext(), this);
mediaContainer.setListener(i -> {
switch(i) {
case FragmentMediaContainer.CALL_TAG:
getActivity().startActivity(new Intent(getContext(), CallActivity.class));
break;
case FragmentMediaContainer.MEDIA_TAG:
if (!MusicPlayer.isVoice) {
Intent intent = new Intent(context, ActivityMain.class);
intent.putExtra(ActivityMain.openMediaPlayer, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
}
break;
case FragmentMediaContainer.PLAY_TAG:
break;
}
});
sharedMediaToolbar = new Toolbar(getContext());
sharedMediaToolbar.setBackIcon(new BackDrawable(false));
sharedMediaToolbar.createToolbarItems();
sharedMediaToolbar.setTitle(getString(R.string.shared_media));
sharedMediaToolbar.setListener(i -> {
switch(i) {
case -1:
if (isSelectedMode) {
adapter.resetSelected();
sharedMediaToolbar.hideActionToolbar();
return;
}
popBackStackFragment();
break;
case deleteTag:
DbManager.getInstance().doRealmTask(realm -> {
String count = SelectedList.size() + "";
final RealmRoom realmRoom = RealmRoom.getRealmRoom(realm, roomId);
if (roomType == ProtoGlobal.Room.Type.CHAT && bothDeleteMessageId != null && bothDeleteMessageId.size() > 0) {
// TODO: 1/10/21 OPTIMAZE CODE
// show both Delete check box
String delete;
if (HelperCalander.isPersianUnicode) {
delete = HelperCalander.convertToUnicodeFarsiNumber(requireContext().getResources().getString(R.string.st_desc_delete) + count);
} else {
delete = HelperCalander.convertToUnicodeFarsiNumber(requireContext().getResources().getString(R.string.st_desc_delete) + "the");
}
new MaterialDialog.Builder(getContext()).limitIconToDefaultSize().content(delete).title(R.string.message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
if (!dialog.isPromptCheckBoxChecked()) {
bothDeleteMessageId = null;
}
if (realmRoom != null) {
ArrayList<Long> selectedListForDel = new ArrayList<>();
ArrayList<Long> selectedDocumentListForDel = new ArrayList<>();
for (StructShearedMedia item : SelectedList) {
selectedListForDel.add(item.messageId);
selectedDocumentListForDel.add(item.documentId);
}
getMessageController().deleteSelectedMessage(roomType.getNumber(), roomId, selectedListForDel, selectedDocumentListForDel, bothDeleteMessageId);
}
resetItems();
}).checkBoxPromptRes(R.string.delete_item_dialog, false, null).show();
} else {
new MaterialDialog.Builder(requireContext()).title(R.string.message).content(getContext().getResources().getString(R.string.st_desc_delete) + count).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
bothDeleteMessageId = null;
if (realmRoom != null) {
ArrayList<Long> messageIds = new ArrayList<>();
ArrayList<Long> documentIds = new ArrayList<>();
for (StructShearedMedia item : SelectedList) {
messageIds.add(item.messageId);
documentIds.add(item.documentId);
}
getMessageController().deleteSelectedMessage(roomType.getNumber(), roomId, messageIds, documentIds, bothDeleteMessageId);
}
resetItems();
}
}).show();
}
});
break;
case forwardTag:
ArrayList<MessageObject> messageInfos = new ArrayList<>(SelectedList.size());
for (StructShearedMedia media : SelectedList) {
messageInfos.add(MessageObject.create(media.item));
}
FragmentChat.mForwardMessages = messageInfos;
adapter.resetSelected();
if (getActivity() instanceof ActivityMain) {
((ActivityMain) getActivity()).setForwardMessage(true);
((ActivityMain) getActivity()).removeAllFragmentFromMain();
/*new HelperFragment(getActivity().getSupportFragmentManager()).popBackStack(3);*/
}
break;
case seeInChatTag:
if (SelectedList.size() == 1) {
long messageId = SelectedList.get(0).messageId;
long documentId = SelectedList.get(0).documentId;
RealmRoomMessage.setGap(messageId, documentId);
goToPositionFromShardMedia.goToPosition(messageId, documentId);
goToPosition = true;
popBackStackFragment();
adapter.resetSelected();
popBackStackFragment();
}
break;
}
});
createActionMode();
toolbarLayout.addView(mediaContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 39, Gravity.BOTTOM, 0, 60, 0, 0));
toolbarLayout.addView(sharedMediaToolbar);
progressBar = view.findViewById(R.id.asm_progress_bar_waiting);
AppUtils.setProgresColler(progressBar);
mediaTypesLayout = view.findViewById(R.id.asm_ll_media_types_buttons);
complete = new OnComplete() {
@Override
public void complete(boolean result, String messageOne, String MessageTwo) {
int whatAction = 0;
String number = "0";
if (messageOne != null) {
if (messageOne.length() > 0)
whatAction = Integer.parseInt(messageOne);
}
if (MessageTwo != null)
if (MessageTwo.length() > 0)
number = MessageTwo;
callBack(result, whatAction, number);
}
};
recyclerView = view.findViewById(R.id.asm_recycler_view_sheared_media);
recyclerView.setItemViewCacheSize(400);
recyclerView.setItemAnimator(null);
onScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(final RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (isThereAnyMoreItemToLoad) {
if (!isSendRequestForLoading) {
int lastVisiblePosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition();
if (lastVisiblePosition + 30 >= offset) {
new RequestClientSearchRoomHistory().clientSearchRoomHistory(roomId, nextMessageId, nextDocumentId, mFilter);
isSendRequestForLoading = true;
progressBar.setVisibility(View.VISIBLE);
}
}
}
}
};
recyclerView.addOnScrollListener(onScrollListener);
checkSelectedDefaultTab();
makeSharedTypesViews();
checkSharedButtonsBackgrounds();
}
use of net.iGap.messenger.ui.components.FragmentMediaContainer in project iGap-Android by KianIranian-STDG.
the class MainFragment method createView.
@Override
public View createView(Context context) {
if (getContext() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StatusBarUtil.setColor(getActivity(), new Theme().getPrimaryDarkColor(getContext()), 50);
}
fragmentView = new FrameLayout(context);
FrameLayout layout = (FrameLayout) fragmentView;
initRecyclerView(context);
layout.addView(recyclerView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
private boolean scrollUpdated;
private boolean scrollingManually;
private int prevTop;
private int prevPosition;
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
scrollingManually = newState == RecyclerView.SCROLL_STATE_DRAGGING;
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
View view = layoutManager.getChildAt(0);
if (firstVisibleItemPosition > 0 && view != null) {
firstVisibleItemPositionOffset = view.getTop();
}
if (!ClientGetRoomListResponse.roomListFetched) {
if (mOffset > 0) {
int lastVisiblePosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition();
if (lastVisiblePosition + 10 >= mOffset) {
new RequestClientGetRoomList().clientGetRoomList(mOffset, Config.LIMIT_LOAD_ROOM, String.valueOf(System.currentTimeMillis()));
}
}
}
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
if (firstVisibleItem != RecyclerView.NO_POSITION) {
RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(firstVisibleItem);
if (holder != null && holder.getAdapterPosition() != 0) {
int firstViewTop = holder.itemView.getTop();
boolean goingDown;
boolean changed = true;
if (prevPosition == firstVisibleItem) {
final int topDelta = prevTop - firstViewTop;
goingDown = firstViewTop < prevTop;
changed = Math.abs(topDelta) > 1;
} else {
goingDown = firstVisibleItem > prevPosition;
}
if (changed && scrollUpdated && (goingDown || scrollingManually)) {
hideFloatingButton(goingDown);
}
prevPosition = firstVisibleItem;
prevTop = firstViewTop;
scrollUpdated = true;
}
}
}
});
loadMoreProgress = new ProgressBar(context);
loadMoreProgress.setVisibility(View.GONE);
AppUtils.setProgresColler(loadMoreProgress);
layout.addView(loadMoreProgress, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER, 0, 0, 0, 8));
loadingProgress = new ProgressBar(context);
AppUtils.setProgresColler(loadingProgress);
layout.addView(loadingProgress, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
emptyView = new LinearLayout(context);
emptyView.setOrientation(LinearLayout.VERTICAL);
emptyView.setVisibility(View.VISIBLE);
layout.addView(emptyView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
ImageView emptyImageView = new ImageView(context);
emptyImageView.setImageResource(R.drawable.empty_chat);
emptyView.addView(emptyImageView, LayoutCreator.createLinear(160, 160, Gravity.CENTER));
TextView emptyTextView = new TextView(context);
emptyTextView.setText(getResources().getString(R.string.empty_room));
emptyTextView.setTextColor(Theme.getInstance().getTitleTextColor(context));
emptyTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
emptyTextView.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
emptyTextView.setSingleLine();
emptyTextView.setGravity(Gravity.CENTER);
emptyView.addView(emptyTextView, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 16, 0, 8));
floatActionLayout = new FrameLayout(context);
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
floatActionLayout.setBackground(drawable);
floatActionLayout.setAlpha(.9f);
floatActionLayout.setOnClickListener(v -> onFloatActionClick());
layout.addView(floatActionLayout, LayoutCreator.createFrame(52, 52, (isAppRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, 16, 0, 16, 16));
IconView addButton = new IconView(context);
addButton.setIcon(R.string.icon_add);
addButton.setIconColor(Color.WHITE);
floatActionLayout.addView(addButton);
mediaContainer = new FragmentMediaContainer(context, this);
mediaContainer.setListener(i -> {
switch(i) {
case FragmentMediaContainer.CALL_TAG:
getActivity().startActivity(new Intent(getContext(), CallActivity.class));
break;
case FragmentMediaContainer.MEDIA_TAG:
if (!MusicPlayer.isVoice) {
Intent intent = new Intent(context, ActivityMain.class);
intent.putExtra(ActivityMain.openMediaPlayer, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
}
break;
case FragmentMediaContainer.PLAY_TAG:
break;
}
});
layout.addView(mediaContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -40, 0, 0));
return fragmentView;
}
use of net.iGap.messenger.ui.components.FragmentMediaContainer in project iGap-Android by KianIranian-STDG.
the class RegisteredContactsFragment method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getContext() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StatusBarUtil.setColor(getActivity(), new Theme().getPrimaryDarkColor(getContext()), 50);
}
G.onContactImport = this;
G.onUserContactdelete = this;
G.onContactsGetList = this;
tryRequest = 0;
realmRecyclerView = view.findViewById(R.id.recycler_view);
FrameLayout toolbarLayout = view.findViewById(R.id.frg_contact_ll_toolbar_layout);
contactsToolbar = new Toolbar(getContext());
mediaContainer = new FragmentMediaContainer(getContext(), this);
mediaContainer.setListener(i -> {
switch(i) {
case FragmentMediaContainer.CALL_TAG:
getActivity().startActivity(new Intent(getContext(), CallActivity.class));
break;
case FragmentMediaContainer.MEDIA_TAG:
if (!MusicPlayer.isVoice) {
Intent intent = new Intent(context, ActivityMain.class);
intent.putExtra(ActivityMain.openMediaPlayer, true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActivity().startActivity(intent);
}
break;
case FragmentMediaContainer.PLAY_TAG:
break;
}
});
ToolbarItems toolbarItems = contactsToolbar.createToolbarItems();
contactsToolbar.setTitle(getString(R.string.contacts));
contactsToolbar.setBackIcon(new BackDrawable(false));
if (isContact) {
ToolbarItem moreItem = toolbarItems.addItemWithWidth(moreItemTag, R.string.icon_other_vertical_dots, 54);
addItem = moreItem.addSubItem(addUserTag, R.string.icon_add, getResources().getString(R.string.menu_add_contact));
moreItem.addSubItem(syncContactTag, R.string.icon_beeptunes_sync, getResources().getString(R.string.sync_contact));
moreItem.addSubItem(inviteContactTag, R.string.icon_add_contact, getResources().getString(R.string.Invite_Friends));
if (PassCode.getInstance().isPassCode()) {
passCodeItem = toolbarItems.addItemWithWidth(passCodeTag, R.string.icon_unlock, 54);
}
}
searchItem = toolbarItems.addItemWithWidth(searchTag, R.string.icon_search, 54).setIsSearchBox(true).setActionBarMenuItemSearchListener(new ToolbarItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
isSearchEnabled = true;
inSearchMode = true;
}
@Override
public void onSearchCollapse() {
isSearchEnabled = false;
inSearchMode = false;
loadContacts();
}
@Override
public void onTextChanged(EditText editText) {
String text = null;
try {
text = java.net.URLDecoder.decode(editText.getText().toString(), "UTF-8");
if (text.length() > 0) {
searchText = text;
loadContact(text);
} else {
loadContacts();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
});
if (!isContact) {
contactsToolbar.setBackIcon(new BackDrawable(false));
toolbarItems.addItemWithWidth(addUserTag, R.string.icon_add_contact, 54);
} else {
toolbarItems.addItemWithWidth(codeScannerTag, R.string.icon_QR_code, 54);
}
if (mPageMode == CALL) {
contactsToolbar.setTitle(getString(R.string.make_call));
} else if (mPageMode == ADD) {
contactsToolbar.setTitle(getString(R.string.create_chat));
}
createActionMode();
toolbarLayout.addView(mediaContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 38, Gravity.BOTTOM, 0, 60, 0, 0));
toolbarLayout.addView(contactsToolbar);
contactsToolbar.setListener(i -> {
switch(i) {
case -1:
if (!isContact) {
if (!contactsToolbar.isSearchFieldVisible()) {
popBackStackFragment();
}
} else {
if (isMultiSelect) {
contactsToolbar.hideActionToolbar();
contactsToolbar.setBackIcon(new BackDrawable(false));
setMultiSelectState(isMultiSelect);
} else {
if (!isSearchEnabled) {
requireActivity().onBackPressed();
}
}
}
break;
case editTag:
if (results != null) {
for (RealmContacts realmContacts : results) {
if (realmContacts.getPhone() == (Long) selectedList.keySet().toArray()[0]) {
FragmentAddContact fragment = FragmentAddContact.newInstance(realmContacts.getId(), "+" + realmContacts.getPhone(), realmContacts.getFirst_name(), realmContacts.getLast_name(), FragmentAddContact.ContactMode.EDIT, (name1, family1) -> loadContacts());
if (getActivity() != null)
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
contactsToolbar.hideActionToolbar();
setMultiSelectState(isMultiSelect);
contactsToolbar.setBackIcon(null);
return;
}
}
}
break;
case deleteTag:
new MaterialDialog.Builder(G.fragmentActivity).title(R.string.to_delete_contact).content(R.string.delete_text).positiveText(R.string.B_ok).onPositive((dialog, which) -> {
for (ArrayMap.Entry<Long, Boolean> entry : selectedList.entrySet()) {
new RequestUserContactsDelete().contactsDelete("" + entry.getKey());
}
setMultiSelectState(true);
contactsToolbar.hideActionToolbar();
contactsToolbar.setBackIcon(null);
}).negativeText(R.string.B_cancel).show();
break;
case addUserTag:
if (mActionMode != null) {
mActionMode.finish();
}
if (getActivity() != null) {
FragmentAddContact fragment = FragmentAddContact.newInstance(null, FragmentAddContact.ContactMode.ADD);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
break;
case multiSelectTag:
showDialog();
break;
case codeScannerTag:
onCodeScannerClickListener();
break;
case syncContactTag:
if (isMultiSelect)
setMultiSelectState(true);
ContactUtils.syncContacts();
break;
case inviteContactTag:
try {
HelperPermission.getContactPermision(getContext(), new OnGetPermission() {
@Override
public void Allow() {
HelperTracker.sendTracker(HelperTracker.TRACKER_INVITE_FRIEND);
new HelperFragment(getActivity().getSupportFragmentManager(), new LocalContactFragment()).setReplace(false).load();
}
@Override
public void deny() {
showDeniedPermissionMessage(G.context.getString(R.string.permission_contact));
}
});
} catch (IOException e) {
e.printStackTrace();
}
break;
case passCodeTag:
if (passCodeItem == null) {
return;
}
if (ActivityMain.isLock) {
passCodeItem.setIcon(R.string.icon_unlock);
ActivityMain.isLock = false;
HelperPreferences.getInstance().putBoolean(SHP_SETTING.FILE_NAME, SHP_SETTING.KEY_LOCK_STARTUP_STATE, false);
} else {
passCodeItem.setIcon(R.string.icon_lock);
ActivityMain.isLock = true;
HelperPreferences.getInstance().putBoolean(SHP_SETTING.FILE_NAME, SHP_SETTING.KEY_LOCK_STARTUP_STATE, true);
}
checkPassCodeVisibility();
break;
}
});
if (isContact) {
Contacts.localPhoneContactId = 0;
Contacts.getContact = true;
}
prgMainLoader = view.findViewById(R.id.fc_loader_main);
btnAddNewGroupCall = view.findViewById(R.id.menu_layout_new_group_call);
btnDialNumber = view.findViewById(R.id.menu_layout_btn_dial_number);
btnAddNewGroup = view.findViewById(R.id.menu_layout_add_new_group);
btnAddNewChannel = view.findViewById(R.id.menu_layout_add_new_channel);
fastScroller = view.findViewById(R.id.fs_contact_fastScroller);
prgWaitingLoadList = view.findViewById(R.id.prgWaiting_loadList);
realmRecyclerView.setAdapter(new ContactListAdapter());
if (!inSearchMode)
loadContacts();
switch(mPageMode) {
case CALL:
btnDialNumber.setVisibility(View.GONE);
if (addItem != null) {
// addItem.setVisibility(View.GONE);
}
break;
case ADD:
btnAddNewChannel.setVisibility(View.VISIBLE);
btnAddNewGroup.setVisibility(View.VISIBLE);
break;
case CONTACTS:
}
realmRecyclerView = view.findViewById(R.id.recycler_view);
realmRecyclerView.setLayoutManager(new ScrollingLinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false, 1000));
realmRecyclerView.setNestedScrollingEnabled(false);
fastScroller.setRecyclerView(realmRecyclerView);
onClickRecyclerView = (v, position) -> {
if (isMultiSelect) {
multi_select(position);
}
};
onLongClickRecyclerView = (v, position) -> {
if (!isMultiSelect) {
isMultiSelect = true;
refreshAdapter(0, true);
if (!contactsToolbar.isInActionMode()) {
setPageShowingMode(4);
}
}
multi_select(position);
};
try {
if (getPermission && isContact) {
getPermission = false;
HelperPermission.getContactPermision(getContext(), new OnGetPermission() {
@Override
public void Allow() throws IOException {
/**
* if contacts size is zero send request for get contacts list
* for insure that contacts not exist really or not
*/
LoginActions.importContact();
prgMainLoader.setVisibility(View.GONE);
}
@Override
public void deny() {
if (results.size() == 0) {
new RequestUserContactsGetList().userContactGetList();
}
prgMainLoader.setVisibility(View.GONE);
}
});
} else {
if (results.size() == 0) {
LoginActions.importContact();
}
prgMainLoader.setVisibility(View.GONE);
}
} catch (IOException e) {
e.printStackTrace();
prgMainLoader.setVisibility(View.GONE);
}
btnAddNewChannel.setOnClickListener(v -> {
if (getActivity() != null) {
FragmentNewGroup fragment = FragmentNewGroup.newInstance();
Bundle bundle_ = new Bundle();
bundle_.putString("TYPE", "NewChanel");
fragment.setArguments(bundle_);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
});
btnAddNewGroup.setOnClickListener(v -> {
if (getActivity() != null) {
Fragment fragment = ContactGroupFragment.newInstance();
Bundle bundle1 = new Bundle();
bundle1.putLong("RoomId", -127);
bundle1.putString("LIMIT", "5000");
bundle1.putString("TYPE", ProtoGlobal.Room.Type.GROUP.name());
bundle1.putBoolean("NewRoom", true);
fragment.setArguments(bundle1);
if (FragmentNewGroup.onRemoveFragmentNewGroup != null) {
Log.wtf(this.getClass().getName(), "onRemoveFragmentNewGroup");
FragmentNewGroup.onRemoveFragmentNewGroup.onRemove();
}
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
});
btnDialNumber.setOnClickListener(v -> {
if (getActivity() != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), new DailNumberFragment()).setReplace(false).load();
}
});
// todo: fixed it ,effect in load time
if (isMultiSelect) {
refreshAdapter(0, true);
if (!contactsToolbar.isInActionMode()) {
Log.wtf(this.getClass().getName(), "setPageShowingMode 4");
setPageShowingMode(4);
}
isLongClick = true;
}
}
Aggregations