use of net.iGap.helper.HelperToolbar 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.helper.HelperToolbar 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.helper.HelperToolbar 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.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class FragmentOtpAuthentication method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperToolbar toolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLogoShown(true).setRightIcons(R.string.icon_sent).setLeftIcon(R.string.icon_back).setDefaultTitle(requireArguments().getString("title", getString(R.string.unknown))).setListener(this);
((ViewGroup) view.findViewById(R.id.toolbar)).addView(toolbar.getView());
smsCodeEditText = view.findViewById(R.id.smsCodeEditText);
ViewGroup ltTime = view.findViewById(R.id.stda_layout_time);
TextView txtPhoneNumber = view.findViewById(R.id.stda_txt_phoneNumber);
TextView descriptionTextView = view.findViewById(R.id.description_authentication);
TextView txtTimerLand = view.findViewById(R.id.stda_txt_time);
txtPhoneNumber.setText(requireArguments().getString("phone", getString(R.string.unknown)));
descriptionTextView.setText(requireArguments().getString("description"));
smsCodeEditText.setHint(requireArguments().getString("editTextHint"));
countDownTimer = new CountDownTimer(1000 * 60, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int seconds = (int) ((millisUntilFinished) / 1000);
int minutes = seconds / 60;
seconds = seconds % 60;
txtTimerLand.setText("" + String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
}
@Override
public void onFinish() {
ltTime.setVisibility(View.GONE);
}
};
start();
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class NewsDetailFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle arg = getArguments();
HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).setLogoShown(true);
LinearLayout toolbarLayout = binding.Toolbar;
toolbarLayout.addView(mHelperToolbar.getView());
binding.shareNews.setOnClickListener(v -> Toast.makeText(getContext(), "share", Toast.LENGTH_SHORT).show());
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false);
binding.relatedNewsList.setLayoutManager(layoutManager);
LinearLayoutManager layoutManager2 = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
binding.commentList.setLayoutManager(layoutManager2);
binding.shareNewsBTN.setOnClickListener(v -> {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, viewModel.getData().getValue().getTitle() + "\n" + viewModel.getData().getValue().getLead() + "\n" + "تاریخ انتشار: " + viewModel.getData().getValue().getDate() + "\n" + "قدرت گرفته از آیگپ" + "\n" + "این خبر را در آیگپ بخوانید: " + "igap://news/showDetail/" + arg.getString("NewsID") + "\n" + "لینک خبر: " + viewModel.getData().getValue().getLink());
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share via"));
});
binding.writeComment.setOnClickListener(v -> {
NewsAddCommentBottomSheetFrag bottomSheetFragment = new NewsAddCommentBottomSheetFrag().setData(arg.getString("NewsID"), result -> {
if (result)
Toast.makeText(getContext(), R.string.news_add_comment_successToast, Toast.LENGTH_SHORT).show();
else
Toast.makeText(getContext(), R.string.news_add_comment_failToast, Toast.LENGTH_SHORT).show();
});
bottomSheetFragment.show(getFragmentManager(), "AddCommentBottomSheet");
});
viewModel.getDataFromServer(arg.getString("NewsID"));
onErrorObserver();
onDataChanged();
onProgress();
}
Aggregations