use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentCreateChannel method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// to disable swipe in channel creation mode
getSwipeBackLayout().setEnableGesture(false);
binding.fchLayoutToolbar.addView(HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setRightIcons(R.string.icon_sent).setLeftIcon(R.string.icon_back).setDefaultTitle(getString(R.string.new_channel)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
if (getActivity() != null) {
getActivity().onBackPressed();
}
}
@Override
public void onRightIconClickListener(View view) {
viewModel.onClickFinish();
}
}).getView());
viewModel.getRoom.observe(getViewLifecycleOwner(), roomId -> {
if (getActivity() != null && roomId != null) {
Fragment fragment = ContactGroupFragment.newInstance();
Bundle bundle = new Bundle();
bundle.putLong("RoomId", roomId);
bundle.putString("TYPE", ProtoGlobal.Room.Type.CHANNEL.toString());
bundle.putBoolean("NewRoom", true);
fragment.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
});
viewModel.getShowErrorMessage().observe(getViewLifecycleOwner(), errorMessageId -> {
if (errorMessageId != null) {
HelperError.showSnackMessage(getString(errorMessageId), false);
}
});
viewModel.getCopyChannelLink().observe(getViewLifecycleOwner(), channelLink -> {
if (getActivity() != null && channelLink != null) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("LINK_CHANNEL", channelLink);
clipboard.setPrimaryClip(clip);
Toast.makeText(getActivity(), R.string.copy_link_title, Toast.LENGTH_SHORT).show();
}
});
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class DailNumberFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperToolbar t = HelperToolbar.create().setContext(getContext()).setLeftIcon(R.string.icon_back).setLogoShown(true).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
if (getActivity() != null) {
getActivity().onBackPressed();
}
}
});
binding.toolbar.addView(t.getView());
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class EditGroupFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewModel.onCreateFragment(this);
HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_sent).setDefaultTitle(G.context.getResources().getString(R.string.tab_edit)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
@Override
public void onRightIconClickListener(View view) {
viewModel.setData(binding.groupNameEditText.getEditableText().toString(), binding.groupDescriptionEditText.getEditableText().toString());
hideKeyboard();
}
});
binding.toolbar.addView(mHelperToolbar.getView());
// mHelperToolbar.getTextViewLogo().setText(R.string.tab_edit);
attachFile = new AttachFile(G.fragmentActivity);
viewModel.goToMembersPage.observe(getViewLifecycleOwner(), b -> {
if (b != null && b) {
showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.ALL.toString());
}
});
viewModel.goToAdministratorPage.observe(getViewLifecycleOwner(), b -> {
if (b != null && b) {
showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.ADMIN.toString());
}
});
viewModel.goToPermissionPage.observe(getViewLifecycleOwner(), new Observer<Boolean>() {
@Override
public void onChanged(@Nullable Boolean b) {
}
});
viewModel.goBack.observe(getViewLifecycleOwner(), aBoolean -> popBackStackFragment());
viewModel.showSelectImageDialog.observe(getViewLifecycleOwner(), aBoolean -> {
if (aBoolean != null && aBoolean) {
startDialogSelectPicture();
}
});
viewModel.closePageImediatly.observe(getViewLifecycleOwner(), isClose -> {
if (isClose == null || !isClose)
return;
popBackStackFragment();
});
viewModel.showDialogChatHistory.observe(getViewLifecycleOwner(), aBoolean -> {
if (getActivity() != null && aBoolean != null && aBoolean) {
showDialog();
}
});
viewModel.goToModeratorPage.observe(getViewLifecycleOwner(), aBoolean -> showListForCustomRole(ProtoGroupGetMemberList.GroupGetMemberList.FilterRole.MODERATOR.toString()));
viewModel.initEmoji.observe(getViewLifecycleOwner(), aBoolean -> {
// if (aBoolean != null) {
// emojiPopup.toggle();
// }
});
viewModel.showDialogLeaveGroup.observe(getViewLifecycleOwner(), aBoolean -> {
if (aBoolean != null && aBoolean) {
groupLeft();
}
});
viewModel.goToRoomListPage.observe(getViewLifecycleOwner(), go -> {
if (getActivity() instanceof ActivityMain && go != null && go) {
((ActivityMain) getActivity()).removeAllFragmentFromMain();
}
});
viewModel.getOnGroupAvatarUpdated().observe(getViewLifecycleOwner(), roomId -> {
if (roomId != null && roomId == viewModel.roomId) {
setAvatar();
}
});
// setUpEmojiPopup();
setAvatar();
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentFinancialServices method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperToolbar t = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_other_vertical_dots).setLogoShown(true).setDefaultTitle(getString(R.string.financial_services)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
if (getActivity() != null) {
getActivity().onBackPressed();
}
}
@Override
public void onRightIconClickListener(View view) {
showMenu();
}
});
binding.walletPriceView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// Ensure you call it only once
binding.walletPriceValue.getViewTreeObserver().removeOnGlobalLayoutListener(this);
ConstraintSet set = new ConstraintSet();
set.clone(binding.root);
set.constrainCircle(binding.walletPointer.getId(), binding.walletPriceView.getId(), binding.walletPriceView.getWidth() / 2, 0);
set.applyTo(binding.root);
}
});
viewModel.walletPointerPosition.observe(this, integer -> {
if (integer != null) {
ConstraintSet set = new ConstraintSet();
set.clone(binding.root);
set.constrainCircle(binding.walletPointer.getId(), binding.walletPriceView.getId(), binding.walletPriceView.getWidth() / 2, integer);
set.applyTo(binding.root);
}
});
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentData method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.fdLayoutToolbar.addView(HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setDefaultTitle(getString(R.string.date)).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).getView());
viewModel.getDateChanged().observe(getViewLifecycleOwner(), isChanged -> {
if (getActivity() instanceof ActivityMain && isChanged != null && isChanged) {
Fragment fragment = ((ActivityMain) getActivity()).getFragment(FragmentChatSettings.class.getName());
if (fragment instanceof FragmentChatSettings) {
((FragmentChatSettings) fragment).dateIsChanged();
}
popBackStackFragment();
}
});
}
Aggregations