use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentGallery method initToolbar.
private void initToolbar(View view) {
ViewGroup lytToolbar = view.findViewById(R.id.toolbar);
String toolbarTitle = "";
if (mGalleryMode == GalleryMode.PHOTO) {
toolbarTitle = getString(R.string.gallery);
} else if (mGalleryMode == GalleryMode.VIDEO) {
toolbarTitle = getString(R.string.videos);
} else {
toolbarTitle = getString(R.string.audios);
}
mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setIGapLogoCheck(false).setDefaultTitle(isSubFolder ? mFolderName : toolbarTitle).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
galleryOnBackPressed();
}
@Override
public void onRightIconClickListener(View view) {
if (isSubFolder) {
if (mGalleryMode == GalleryMode.PHOTO) {
checkPhotoMultiSelectAndSendToEdit();
} else {
checkVideoMultiSelectAndSendToEdit();
}
} else if (mGalleryMode == GalleryMode.MUSIC) {
if (mGalleryMusicAdapter.getMusicsItem().size() != 0) {
showSortDialog();
} else {
if (getContext() != null)
Toast.makeText(getContext(), getString(R.string.no_item), Toast.LENGTH_SHORT).show();
}
}
/* else {
openAndroidOsGallery();
}*/
}
});
if (!isReturnResultDirectly) {
if (mGalleryMode == GalleryMode.MUSIC) {
mHelperToolbar.setRightIcons(R.string.icon_other_vertical_dots);
} else if (isSubFolder) {
mHelperToolbar.setRightIcons(R.string.icon_new_conversation);
}
}
lytToolbar.addView(mHelperToolbar.getView());
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentMapUsers method initComponent.
private void initComponent(View view) {
((ActivityMain) G.fragmentActivity).setOnBackPressedListener(FragmentMapUsers.this, false);
HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getString(R.string.igap_nearby)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
if (ActivityMain.onBackPressedListener != null) {
ActivityMain.onBackPressedListener.doBack();
}
popBackStackFragment();
}
});
ViewGroup layoutToolbar = view.findViewById(R.id.fmu_toolbar);
layoutToolbar.addView(toolbar.getView());
imvNothingFound = view.findViewById(R.id.sfl_imv_nothing_found);
txtEmptyListComment = view.findViewById(R.id.sfl_txt_empty_list_comment);
mRecyclerView = view.findViewById(R.id.rcy_map_user);
mRecyclerView.setItemAnimator(null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(G.fragmentActivity));
DbManager.getInstance().doRealmTransaction(realm -> {
realm.where(RealmGeoNearbyDistance.class).findAll().deleteAllFromRealm();
});
mAdapter = new MapUserAdapter(DbManager.getInstance().doRealmTask(realm -> {
return realm.where(RealmGeoNearbyDistance.class).findAll();
}), true);
// fastAdapter
// mAdapter = new MapUserAdapterA();
mRecyclerView.setAdapter(mAdapter);
if (mAdapter.getItemCount() > 0) {
imvNothingFound.setVisibility(View.GONE);
txtEmptyListComment.setVisibility(View.GONE);
} else {
imvNothingFound.setVisibility(View.VISIBLE);
txtEmptyListComment.setVisibility(View.VISIBLE);
}
mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
super.onItemRangeInserted(positionStart, itemCount);
if (mAdapter.getItemCount() > 0) {
imvNothingFound.setVisibility(View.GONE);
txtEmptyListComment.setVisibility(View.GONE);
} else {
imvNothingFound.setVisibility(View.VISIBLE);
txtEmptyListComment.setVisibility(View.VISIBLE);
}
}
@Override
public void onItemRangeRemoved(int positionStart, int itemCount) {
super.onItemRangeRemoved(positionStart, itemCount);
if (mAdapter.getItemCount() > 0) {
imvNothingFound.setVisibility(View.GONE);
txtEmptyListComment.setVisibility(View.GONE);
} else {
imvNothingFound.setVisibility(View.VISIBLE);
txtEmptyListComment.setVisibility(View.VISIBLE);
}
}
});
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentSecurityRecovery method onViewCreated.
@Override
public void onViewCreated(@NotNull final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setDefaultTitle(G.context.getResources().getString(R.string.recovery_Password)).setLeftIcon(R.string.icon_back).setRightIcons(R.string.icon_sent).setLogoShown(true).setShowConnectionState(false).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
closeKeyboard(view);
if (page == Security.SETTING) {
pageSetting();
} else {
pageRegister();
}
}
@Override
public void onRightIconClickListener(View v) {
closeKeyboard(v);
if (rootRecoveryEmail.getVisibility() == View.VISIBLE) {
if (edtSetRecoveryEmail.length() > 0) {
setLoaderState(true);
new RequestUserTwoStepVerificationRecoverPasswordByToken().recoveryPasswordByToken(edtSetRecoveryEmail.getText().toString(), new TwoStepVerificationRecoverPasswordByToken() {
@Override
public void recoveryByEmail(String tokenR) {
setLoaderState(false);
if (getActivity() instanceof ActivityRegistration) {
openMainActivity(tokenR);
} else if (getActivity() instanceof ActivityMain) {
backToSettings();
}
}
@Override
public void errorRecoveryByEmail(int major, int minor) {
setLoaderState(false);
}
});
} else {
error(G.fragmentActivity.getResources().getString(R.string.please_enter_code));
}
} else {
if (edtSetRecoveryAnswerPassOne.length() > 0 && edtSetRecoveryAnswerPassTwo.length() > 0) {
setLoaderState(true);
new RequestUserTwoStepVerificationRecoverPasswordByAnswers().RecoveryPasswordByAnswer(edtSetRecoveryAnswerPassOne.getText().toString(), edtSetRecoveryAnswerPassTwo.getText().toString(), new TwoStepVerificationRecoverPasswordByAnswersCallback() {
@Override
public void recoveryByQuestion(String tokenR) {
setLoaderState(false);
// Todo:fixed it and move to repository
if (getActivity() instanceof ActivityRegistration) {
openMainActivity(tokenR);
} else if (getActivity() instanceof ActivityMain) {
backToSettings();
}
}
@Override
public void errorRecoveryByQuestion(int major, int minor) {
setLoaderState(false);
}
});
} else {
error(G.fragmentActivity.getResources().getString(R.string.please_complete_all_item));
}
}
}
});
ViewGroup toolbarLayout = view.findViewById(R.id.fsr_layout_toolbar);
toolbarLayout.addView(mHelperToolbar.getView());
new RequestUserTwoStepVerificationRequestRecoveryToken().requestRecoveryToken();
Bundle bundle = this.getArguments();
if (bundle != null) {
page = (Security) bundle.get("PAGE");
questionOne = bundle.getString("QUESTION_ONE");
questionTwo = bundle.getString("QUESTION_TWO");
txtPaternEmail = bundle.getString("PATERN_EMAIL");
isRecoveryByEmail = bundle.getBoolean("IS_EMAIL");
isConfirmedRecoveryEmail = bundle.getBoolean("IS_CONFIRM_EMAIL");
}
view.findViewById(R.id.rootRecoveryPassword).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
pbLoading = view.findViewById(R.id.pbLoading);
rootRecoveryEmail = view.findViewById(R.id.rootRecoveryEmailPassword);
rootRecoveryQuestionPassword = view.findViewById(R.id.rootRecoveryQuestionPassword);
txtSetRecoveryByQuestion = view.findViewById(R.id.txtSetRecoveryByQuestion);
txtSetRecoveryByEmail = view.findViewById(R.id.txtSetRecoveryByEmail);
if (!isConfirmedRecoveryEmail) {
txtSetRecoveryByEmail.setVisibility(View.GONE);
}
txtSetRecoveryQuestionPassOne = view.findViewById(R.id.txtSetRecoveryQuestionPassOne);
txtSetRecoveryQuestionPassTwo = view.findViewById(R.id.txtSetRecoveryQuestionPassTwo);
txtSetRecoveryQuestionPassOne.setText(questionOne);
txtSetRecoveryQuestionPassTwo.setText(questionTwo);
TextView txtResendConfirmEmail = view.findViewById(R.id.txtResendConfirmEmail);
txtResendConfirmEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new RequestUserTwoStepVerificationRequestRecoveryToken().requestRecoveryToken();
closeKeyboard(v);
HelperError.showSnackMessage(G.fragmentActivity.getResources().getString(R.string.resend_verify_email_code), false);
}
});
edtSetRecoveryAnswerPassOne = view.findViewById(R.id.edtSetRecoveryAnswerPassOne);
edtSetRecoveryAnswerPassTwo = view.findViewById(R.id.edtSetRecoveryAnswerPassTwo);
edtSetRecoveryEmail = view.findViewById(R.id.edtSetRecoveryEmail);
edtSetRecoveryEmail.setHint("");
if (page == Security.REGISTER) {
G.onRecoveryEmailToken = new OnRecoveryEmailToken() {
@Override
public void getEmailPatern(final String patern) {
G.handler.post(new Runnable() {
@Override
public void run() {
edtSetRecoveryEmail.setHint(patern);
}
});
}
};
}
if (isRecoveryByEmail) {
rootRecoveryEmail.setVisibility(View.VISIBLE);
rootRecoveryQuestionPassword.setVisibility(View.GONE);
} else {
rootRecoveryQuestionPassword.setVisibility(View.VISIBLE);
rootRecoveryEmail.setVisibility(View.GONE);
}
txtSetRecoveryByEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rootRecoveryQuestionPassword.setVisibility(View.GONE);
rootRecoveryEmail.setVisibility(View.VISIBLE);
}
});
txtSetRecoveryByQuestion.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rootRecoveryEmail.setVisibility(View.GONE);
rootRecoveryQuestionPassword.setVisibility(View.VISIBLE);
}
});
if (page == Security.SETTING) {
G.onRecoverySecurityPassword = new OnRecoverySecurityPassword() {
@Override
public void getEmailPatern(final String patern) {
G.handler.post(new Runnable() {
@Override
public void run() {
edtSetRecoveryEmail.setHint(patern);
}
});
}
};
}
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentNotification method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
roomId = getArguments().getLong("ID");
initDataBinding();
HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getString(R.string.ntg_title_toolbar)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
try {
popBackStackFragment();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
});
fragmentNotificationBinding.ntgLayoutToolbar.addView(toolbar.getView());
}
use of net.iGap.observers.interfaces.ToolbarListener in project iGap-Android by KianIranian-STDG.
the class FragmentPaymentBill method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (isPolice) {
HelperTracker.sendTracker(HelperTracker.TRACKER_FINE_BILL_PAGE);
} else {
HelperTracker.sendTracker(HelperTracker.TRACKER_SERVICE_BILL_PAGE);
}
billBinding.fpbLayoutToolbar.addView(HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setDefaultTitle(getString(getArguments() != null ? getArguments().getInt("title") : R.string.pay_bills_crime)).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).getView());
viewModel.getShowErrorMessage().observe(getViewLifecycleOwner(), errorMessageId -> {
if (errorMessageId != null) {
HelperError.showSnackMessage(getString(errorMessageId), false);
}
});
viewModel.getGoToScannerPage().observe(getViewLifecycleOwner(), isGo -> {
if (getActivity() != null && isGo != null && isGo) {
PermissionHelper permissionHelper = new PermissionHelper(getActivity());
if (permissionHelper.grantCameraPermission()) {
goToScannerActivity();
}
}
});
viewModel.getGoBack().observe(getViewLifecycleOwner(), isGoBack -> {
if (isGoBack != null && isGoBack) {
popBackStackFragment();
}
});
viewModel.getHideKeyword().observe(getViewLifecycleOwner(), isHide -> {
if (isHide != null && isHide) {
hideKeyboard();
}
});
viewModel.getBillTypeImage().observe(getViewLifecycleOwner(), integer -> billBinding.billTypeImage.setImageResource(integer));
}
Aggregations