use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class NewsGroupPagerFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle arg = getArguments();
String groupID = arg.getString("GroupID");
HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLifecycleOwner(getViewLifecycleOwner()).setLeftIcon(R.string.icon_back).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
popBackStackFragment();
}
}).setDefaultTitle(arg.getString("GroupTitle")).setRoundBackground(// cause of imageView below toolbar use flat toolbar is better than round
false).setLogoShown(true);
binding.Toolbar.addView(mHelperToolbar.getView());
if (!arg.getString("GroupPic").equals(""))
Glide.with(G.context).load(arg.getString("GroupPic")).placeholder(R.mipmap.news_temp_banner).into(binding.groupImage);
ViewPager viewPager = binding.secondaryLayout.viewPager;
tabLayout = binding.secondaryLayout.pagerTabLayout;
// TabAdapter adapter = new TabAdapter(getFragmentManager());
NewsListFrag frag = new NewsListFrag();
frag.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.GROUP_NEWS));
frag.setHandler(news -> {
Glide.with(G.context).load(news.getImage()).into(binding.groupImage);
binding.groupTitle.setText(news.getTitle());
binding.headerNews.setOnClickListener(v -> {
FragmentManager fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment fragment = fragmentManager.findFragmentByTag(NewsDetailFrag.class.getName());
if (fragment == null) {
fragment = NewsDetailFrag.newInstance();
fragmentTransaction.addToBackStack(fragment.getClass().getName());
}
Bundle args = new Bundle();
args.putString("NewsID", news.getId());
fragment.setArguments(args);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
});
});
// adapter.addFragment(frag, getResources().getString(R.string.news_latest));
NewsListFrag frag2 = new NewsListFrag();
frag2.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.MOST_HITS));
// adapter.addFragment(frag2, getResources().getString(R.string.news_MHits));
NewsListFrag frag3 = new NewsListFrag();
frag3.setApiArg(new NewsApiArg(1, 10, Integer.parseInt(groupID), NewsApiArg.NewsType.CONTROVERSIAL_NEWS));
// adapter.addFragment(frag3, getResources().getString(R.string.news_ergent));
// viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
updateFontTabLayout();
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class NewsPublisherListFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
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);
binding.toolbar.addView(mHelperToolbar.getView());
binding.pullToRefresh.setOnRefreshListener(() -> {
viewModel.getData();
binding.noItemInListError.setVisibility(View.GONE);
});
binding.rcGroup.setHasFixedSize(true);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
binding.rcGroup.setLayoutManager(layoutManager);
viewModel.getData();
onErrorObserver();
onDataChanged();
onProgress();
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class MplTransactionFragment method setUpViews.
private void setUpViews() {
LinearLayout toolBarContainer = rootView.findViewById(R.id.ll_mplTransaction_toolBar);
recyclerView = rootView.findViewById(R.id.rv_mplTransaction);
swipeRefreshLayout = rootView.findViewById(R.id.sl_itemMplTransAction);
typeAllTv = rootView.findViewById(R.id.tv_mplTransaction_all);
typeTopUpTv = rootView.findViewById(R.id.tv_mplTransaction_topup);
typeCardToCardTv = rootView.findViewById(R.id.tv_mplTransaction_cardToCard);
typeSalesTv = rootView.findViewById(R.id.tv_mplTransaction_sales);
typeBillTv = rootView.findViewById(R.id.tv_mplTransaction_bill);
emptyView = rootView.findViewById(R.id.tv_mplTransaction_emptyView);
layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
setEnableButton(typeAllTv, typeBillTv, typeCardToCardTv, typeSalesTv, typeTopUpTv);
viewModel.getFirstPageMplTransactionList(ProtoGlobal.MplTransaction.Type.NONE);
HelperToolbar toolbar = HelperToolbar.create().setContext(G.fragmentActivity).setLifecycleOwner(getViewLifecycleOwner()).setListener(this).setLogoShown(true).setDefaultTitle(getResources().getString(R.string.payment_history)).setLeftIcon(R.string.icon_back);
toolBarContainer.addView(toolbar.getView());
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class MplTransactionInfoFragment method setupViews.
private void setupViews() {
LinearLayout toolBarContainer = rootView.findViewById(R.id.ll_mplTransactionInfo_toolBar);
swipeRefreshLayout = rootView.findViewById(R.id.sl_mplTransactionInfo);
RecyclerView recyclerView = rootView.findViewById(R.id.rv_mplTransActionInfo);
rvContainer = rootView.findViewById(R.id.cl_mplTransactionInfo_rv);
statusTv = rootView.findViewById(R.id.tv_mplTransactionInfo_stats);
dataTv = rootView.findViewById(R.id.tv_mplTransactionInfo_data);
timeTv = rootView.findViewById(R.id.tv_mplTransactionInfo_time);
statusIv = rootView.findViewById(R.id.fv_mplTransactionInfo_status);
statusRootView = rootView.findViewById(R.id.cv_mplTransactionInfo);
emptyView = rootView.findViewById(R.id.tv_mplTransactionInfo_emptyView);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
HelperToolbar toolbar = HelperToolbar.create().setContext(G.fragmentActivity).setLifecycleOwner(getViewLifecycleOwner()).setListener(this).setLogoShown(true).setRightIcons(R.string.icon_download).setDefaultTitle(getResources().getString(R.string.payment_history)).setLeftIcon(R.string.icon_back);
toolBarContainer.addView(toolbar.getView());
}
use of net.iGap.helper.HelperToolbar in project iGap-Android by KianIranian-STDG.
the class StickerSettingFragment method setupViews.
@Override
public void setupViews() {
RecyclerView recyclerView = rootView.findViewById(R.id.rv_removeSticker);
LinearLayout linearLayout = rootView.findViewById(R.id.ll_stickerSetting_toolBar);
HelperToolbar helperToolbar = HelperToolbar.create().setLeftIcon(R.string.icon_back).setLogoShown(true).setDefaultTitle(getResources().getString(R.string.sticker_setting)).setListener(new ToolbarListener() {
@Override
public void onLeftIconClickListener(View view) {
finish();
}
}).setContext(getContext());
linearLayout.addView(helperToolbar.getView());
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
viewModel.getStickersLiveData().observe(getViewLifecycleOwner(), structIGStickerGroups -> adapter.updateAdapter(structIGStickerGroups));
adapter.setListener(new RemoveStickerAdapter.RemoveStickerDialogListener() {
@Override
public void onStickerClick(StructIGStickerGroup stickerGroup) {
openFragmentAddStickerToFavorite(stickerGroup);
}
@Override
public void onRemoveStickerClick(StructIGStickerGroup stickerGroup, int pos, RemoveStickerAdapter.ProgressStatus progressStatus) {
if (getContext() != null) {
new MaterialDialog.Builder(getContext()).title(getResources().getString(R.string.remove_sticker)).content(getResources().getString(R.string.remove_sticker_text)).positiveText(getString(R.string.yes)).negativeText(getString(R.string.no)).onPositive((dialog, which) -> {
progressStatus.setVisibility(true);
viewModel.removeStickerFromMySticker(stickerGroup, (response, error) -> {
if (error == null) {
adapter.removeItem(pos);
} else {
progressStatus.setVisibility(false);
}
});
dialog.dismiss();
}).show();
}
}
});
viewModel.getRemoveStickerLiveData().observe(getViewLifecycleOwner(), removedItemPosition -> adapter.removeItem(removedItemPosition));
TextView removeRecentTv = rootView.findViewById(R.id.tv_stickerSetting_clearRecent);
removeRecentTv.setOnClickListener(v -> onClearRecentStickerClicked());
ProgressBar progressBar = rootView.findViewById(R.id.pb_stickerSetting_clearRecent);
viewModel.getClearRecentStickerLiveData().observe(getViewLifecycleOwner(), progressBar::setVisibility);
TextView clearInternalStorage = rootView.findViewById(R.id.tv_stickerSetting_clearStorage);
clearInternalStorage.setOnClickListener(v -> viewModel.clearStickerFromInternalStorage());
TextView storageSize = rootView.findViewById(R.id.tv_stickerSetting_clearStorageSize);
viewModel.getStickerFileSizeLiveData().observe(getViewLifecycleOwner(), storageSize::setText);
TextView clearFavoriteStickerTv = rootView.findViewById(R.id.tv_stickerSetting_clearFavorite);
clearFavoriteStickerTv.setOnClickListener(v -> onClearFavoriteStickerClicked());
ProgressBar clearFavoriteStickerPb = rootView.findViewById(R.id.pb_stickerSetting_clearFavorite);
TextView clearRecentEmojiTv = rootView.findViewById(R.id.tv_stickerSetting_clearEmoji);
clearRecentEmojiTv.setOnClickListener(v -> onClearRecentEmojiClicked());
ImageView emptyIv = rootView.findViewById(R.id.iv_stickerSetting_empty);
TextView emptyTv = rootView.findViewById(R.id.tv_stickerSetting_empty);
TextView headerTv = rootView.findViewById(R.id.tv_stickerSetting_header);
viewModel.getEmptyRecentStickerLiveData().observe(getViewLifecycleOwner(), visibility -> {
emptyIv.setVisibility(visibility);
emptyTv.setVisibility(visibility);
});
viewModel.getRecyclerVisibilityRecentStickerLiveData().observe(getViewLifecycleOwner(), visibility -> {
recyclerView.setVisibility(visibility);
headerTv.setVisibility(visibility);
});
}
Aggregations