use of net.iGap.messenger.ui.toolBar.Toolbar in project iGap-Android by KianIranian-STDG.
the class NewsMainFrag method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (specificGroupID != null && !specificGroupID.equals("") && !specificGroupID.equals("showDetail"))
openGroupNews(new NewsFPList(getResources().getString(R.string.news_mainTitle), specificGroupID, null));
else if (specificNewsID != null && !specificNewsID.equals(""))
openNewsDetail(specificNewsID);
Toolbar newsMainToolbar = new Toolbar(getContext());
newsMainToolbar.setTitle(getString(R.string.news_mainTitle));
newsMainToolbar.setBackIcon(new BackDrawable(false));
newsMainToolbar.setListener(i -> {
if (i == -1) {
popBackStackFragment();
}
});
LinearLayout toolbarLayout = binding.Toolbar;
toolbarLayout.addView(newsMainToolbar);
binding.rcMain.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
binding.rcMain.setLayoutManager(layoutManager);
binding.pullToRefresh.setOnRefreshListener(() -> {
viewModel.getNews();
binding.noItemInListError.setVisibility(View.GONE);
});
viewModel.getNews();
onErrorObserver();
onDataChanged();
onProgress();
}
use of net.iGap.messenger.ui.toolBar.Toolbar in project iGap-Android by KianIranian-STDG.
the class PopularChannelHomeFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RecyclerView recyclerView = view.findViewById(R.id.rv_popularChannel_home);
swipeRefreshLayout = view.findViewById(R.id.sr_popularChannel_home);
epmtyView = view.findViewById(R.id.emptyRecycle);
Toolbar popularChannelsToolbar = new Toolbar(getContext());
popularChannelsToolbar.setBackIcon(new BackDrawable(false));
popularChannelsToolbar.setTitle(getString(R.string.popular_channel));
popularChannelsToolbar.setListener(i -> {
if (i == -1) {
if (getActivity() != null)
getActivity().onBackPressed();
}
});
recyclerView.setAdapter(new PopularChannelHomeAdapter(viewModel.getRecyclerItemClick()));
((ViewGroup) view.findViewById(R.id.ll_popularChannel_toolBar)).addView(popularChannelsToolbar);
viewModel.getFirstPageMutableLiveData().observe(getViewLifecycleOwner(), parentChannel -> {
if (recyclerView.getAdapter() instanceof PopularChannelHomeAdapter && parentChannel != null) {
((PopularChannelHomeAdapter) recyclerView.getAdapter()).setData(parentChannel.getData());
}
});
viewModel.getProgressMutableLiveData().observe(getViewLifecycleOwner(), progress -> {
if (progress != null && progress)
swipeRefreshLayout.setRefreshing(true);
else
swipeRefreshLayout.setRefreshing(false);
});
swipeRefreshLayout.setOnRefreshListener(() -> {
viewModel.getFirstPage();
});
viewModel.getEmptyViewMutableLiveData().observe(getViewLifecycleOwner(), visibility -> {
if (visibility != null)
epmtyView.setVisibility(visibility);
});
viewModel.getGoToMorePage().observe(getViewLifecycleOwner(), data -> {
if (getActivity() != null && data != null) {
PopularMoreChannelFragment moreChannelFragment = new PopularMoreChannelFragment();
Bundle bundle = new Bundle();
bundle.putString("id", data.getId());
bundle.putString("title", G.isAppRtl ? data.getTitle() : data.getTitleEn());
moreChannelFragment.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), moreChannelFragment).setReplace(false).load(true);
}
});
viewModel.getGoToRoom().observe(getViewLifecycleOwner(), link -> {
if (getActivity() != null && link != null) {
HelperUrl.checkUsernameAndGoToRoom(getActivity(), link, HelperUrl.ChatEntry.chat);
}
});
viewModel.getGoToChannel().observe(getViewLifecycleOwner(), data -> {
if (getActivity() != null && data != null) {
if (data.isPrivate()) {
HelperUrl.checkAndJoinToRoom(getActivity(), data.getSlug());
} else {
HelperUrl.checkUsernameAndGoToRoom(getActivity(), data.getSlug(), HelperUrl.ChatEntry.chat);
}
}
});
viewModel.getGoToWebViewPage().observe(getViewLifecycleOwner(), link -> {
if (getActivity() != null && link != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentWebView.newInstance(link, false, null)).setReplace(false).load();
}
});
viewModel.getOpenBrowser().observe(getViewLifecycleOwner(), link -> {
if (getActivity() != null && link != null) {
SharedPreferences sharedPreferences = getActivity().getSharedPreferences(SHP_SETTING.FILE_NAME, Context.MODE_PRIVATE);
int checkedInAppBrowser = sharedPreferences.getInt(SHP_SETTING.KEY_IN_APP_BROWSER, 1);
if (checkedInAppBrowser == 1 && !HelperUrl.isNeedOpenWithoutBrowser(link)) {
HelperUrl.openBrowser(link);
} else {
HelperUrl.openWithoutBrowser(link);
}
}
});
epmtyView.setOnClickListener(v -> viewModel.getFirstPage());
}
use of net.iGap.messenger.ui.toolBar.Toolbar in project iGap-Android by KianIranian-STDG.
the class EnterCodeQRCodePaymentFragment method initToolbar.
@SuppressLint("ResourceType")
private void initToolbar() {
mToolbar = new Toolbar(getActivity());
mToolbar.setTitle(G.isAppRtl ? R.string.logo_igap_fa : R.string.logo_igap_en);
mToolbar.setBackIcon(new BackDrawable(false));
mToolbar.setListener(new Toolbar.ToolbarListener() {
@Override
public void onItemClick(int i) {
if (i == -1) {
getActivity().onBackPressed();
}
}
});
mBinding.toolbarContainer.addView(mToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 64, Gravity.TOP));
}
use of net.iGap.messenger.ui.toolBar.Toolbar in project iGap-Android by KianIranian-STDG.
the class ScanCodeQRCodePaymentFragment method initToolbar.
@SuppressLint("ResourceType")
private void initToolbar() {
mToolbar = new Toolbar(getActivity());
mToolbar.setTitle(G.isAppRtl ? R.string.logo_igap_fa : R.string.logo_igap_en);
mToolbar.setBackIcon(new BackDrawable(false));
mToolbar.setListener(new Toolbar.ToolbarListener() {
@Override
public void onItemClick(int i) {
if (i == -1) {
getActivity().onBackPressed();
}
}
});
mBinding.toolbarContainer.addView(mToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 64, Gravity.TOP));
}
use of net.iGap.messenger.ui.toolBar.Toolbar in project iGap-Android by KianIranian-STDG.
the class MyStatusStoryListFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (getContext() == null)
return super.onCreateView(inflater, container, savedInstanceState);
Toolbar myStoryToolbar = new Toolbar(getContext());
myStoryToolbar.setTitle(getString(R.string.my_status));
myStoryToolbar.setBackIcon(new BackDrawable(false));
myStoryToolbar.setListener(i -> {
switch(i) {
case -1:
requireActivity().onBackPressed();
break;
}
});
FrameLayout rootView = new FrameLayout(new ContextThemeWrapper(context, R.style.IGapRootViewStyle));
rootView.addView(myStoryToolbar, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.TOP));
recyclerListView = new RecyclerListView(getContext());
adapter = new ListAdapter();
recyclerListView.setAdapter(adapter);
recyclerListView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
recyclerListView.setClipToPadding(false);
recyclerListView.setVisibility(View.GONE);
recyclerListView.setPadding(0, 0, 0, LayoutCreator.dp(30));
rootView.addView(recyclerListView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT, Gravity.TOP, 0, LayoutCreator.getDimen(R.dimen.toolbar_height), 0, 0));
progressBar = new ProgressBar(context);
progressBar.setVisibility(View.GONE);
rootView.addView(progressBar, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
actionButtonsRootView = new LinearLayout(context);
actionButtonsRootView.setOrientation(LinearLayout.VERTICAL);
rootView.addView(actionButtonsRootView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, (isAppRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, 16, 0, 16, 16));
customStatusActionLayout = new FrameLayout(context);
Drawable customStatusDrawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
customStatusActionLayout.setBackground(customStatusDrawable);
IconView customStatusAddButton = new IconView(context);
customStatusAddButton.setIcon(R.string.icon_edit);
customStatusAddButton.setIconColor(Color.WHITE);
customStatusActionLayout.addView(customStatusAddButton);
actionButtonsRootView.addView(customStatusActionLayout, LayoutCreator.createLinear(42, 42, Gravity.CENTER, 0, 0, 0, 0));
floatActionLayout = new FrameLayout(context);
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
floatActionLayout.setBackground(drawable);
IconView addButton = new IconView(context);
addButton.setIcon(R.string.icon_camera);
addButton.setIconColor(Color.WHITE);
floatActionLayout.addView(addButton);
actionButtonsRootView.addView(floatActionLayout, LayoutCreator.createLinear(52, 52, Gravity.CENTER, 0, 10, 0, 0));
return rootView;
}
Aggregations