use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class StoryGalleryFragment method sendSelectedPhotos.
private void sendSelectedPhotos(List<GalleryItemModel> selectedPhotos) {
if (getActivity() == null || selectedPhotos.size() == 0)
return;
FragmentEditImage.checkItemGalleryList();
for (GalleryItemModel photo : selectedPhotos) {
FragmentEditImage.insertItemList(photo.getAddress(), "", false);
}
PhotoViewer photoViewer = PhotoViewer.newInstance((ArrayList<GalleryItemModel>) selectedPhotos, isForRoom, roomId, listMode, roomTitle);
new HelperFragment(getActivity().getSupportFragmentManager(), photoViewer).setReplace(false).load();
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class StoryGalleryFragment method openImageForEdit.
private void openImageForEdit(String path) {
FragmentEditImage fragmentEditImage = FragmentEditImage.newInstance(null, true, false, 0);
fragmentEditImage.setIsReOpenChatAttachment(false);
ImageHelper imageHelper = new ImageHelper();
imageHelper.correctRotateImage(path, true, new OnRotateImage() {
@Override
public void startProcess() {
}
@Override
public void success(String newPath) {
G.handler.post(() -> {
FragmentEditImage.checkItemGalleryList();
PhotoViewer photoViewer = PhotoViewer.newInstance(newPath, isForRoom, roomId, listMode, roomTitle);
FragmentEditImage.insertItemList(newPath, "", false);
if (getActivity() != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), photoViewer).setReplace(false).load();
}
});
}
});
fragmentEditImage.setGalleryListener(() -> {
if (getActivity() != null) {
getActivity().getSupportFragmentManager().popBackStack(FragmentGallery.class.getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
});
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class FragmentiGapMap method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
HelperTracker.sendTracker(HelperTracker.TRACKER_NEARBY_PAGE);
G.onLocationChanged = this;
G.onGetNearbyCoordinate = this;
G.onMapRegisterState = this;
G.onMapClose = this;
G.onGeoGetComment = this;
G.onMapUsersGet = this;
attentionDialog();
map = view.findViewById(R.id.map);
initToolbar(view);
startMap(view);
// clickDrawMarkActive();
fabStateSwitcher = view.findViewById(R.id.st_fab_state);
/* fabStateSwitcher.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(G.fabBottom)));
fabStateSwitcher.setColorFilter(Color.WHITE);*/
fabStateSwitcher.setBackgroundTintColor();
fabStateSwitcher.setFabSize();
fabStateSwitcher.setStateChangeListener(new StateChangeListener() {
@Override
public void onMenuOpened() {
}
@Override
public void onMenuClosed() {
isMenuButtonAddShown = false;
}
});
btnOrginView = view.findViewById(R.id.ac_fab_orgin);
btnOrginView.setBackgroundTintList(ColorStateList.valueOf(new Theme().getPrimaryColor(getContext())));
btnOrginView.setOnClickListener(view12 -> {
deleteMapFileCash();
if (getActivity() != null && isAdded()) {
changeState = getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).getBoolean("state", false);
if (!changeState) {
deleteMapFileCash();
getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).edit().putBoolean("state", true).apply();
new HelperFragment(G.currentActivity.getSupportFragmentManager(), FragmentiGapMap.getInstance()).setImmediateRemove(true).remove();
new HelperFragment(G.currentActivity.getSupportFragmentManager(), FragmentiGapMap.getInstance()).load();
}
}
if (fabStateSwitcher.isMenuOpened()) {
fabStateSwitcher.toggleMenu();
}
});
btnSatelliteView = view.findViewById(R.id.ac_fab_satellite);
btnSatelliteView.setBackgroundTintList(ColorStateList.valueOf(new Theme().getPrimaryColor(getContext())));
btnSatelliteView.setOnClickListener(view1 -> {
if (getActivity() != null && isAdded()) {
changeState = getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).getBoolean("state", false);
if (changeState) {
deleteMapFileCash();
getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).edit().putBoolean("state", false).apply();
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentiGapMap.getInstance()).setImmediateRemove(true).remove();
if (getActivity() != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentiGapMap.getInstance()).load();
}
}
}
if (fabStateSwitcher.isMenuOpened()) {
fabStateSwitcher.toggleMenu();
}
});
fabStateSwitcher.fabMenu.setOnClickListener(v -> fabStateSwitcher.toggleMenu());
/* if (HelperCalander.isPersianUnicode)
fabStateSwitcher.chanegMenuItem(false);
else
fabStateSwitcher.chanegMenuItem(true);*/
/* fabStateSwitcher.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
dialog = new MaterialDialog.Builder(G.fragmentActivity).customView(R.layout.chat_popup_dialog_custom, true).build();
View v = dialog.getCustomView();
*/
/* DialogAnimation.animationUp(dialog);*/
/*
dialog.getWindow().setLayout(ViewMaker.dpToPx(220), WindowManager.LayoutParams.WRAP_CONTENT);
DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();
if (G.selectedLanguage.equals("en")) {
wmlp.gravity = Gravity.TOP | Gravity.LEFT;
wmlp.x = ViewMaker.dpToPx(10); //x position
} else {
wmlp.gravity = Gravity.TOP | Gravity.RIGHT;
wmlp.x = ViewMaker.dpToPx(10); //x position
}
int s = getActivity().getChangingConfigurations();
*/
/* if (orientation==0){
if (G.isLandscape)
wmlp.y = ViewMaker.dpToPx(160);
else
wmlp.y = ViewMaker.dpToPx(400);
}else */
/*
if (orientation == 1 || orientation == 0) {
//Do some stuff
wmlp.y = ViewMaker.dpToPx(400); //y
} else if (orientation == 2) {
//Do some stuff
wmlp.y = ViewMaker.dpToPx(160); //y
}
dialog.show();
ViewGroup root1 = (ViewGroup) v.findViewById(R.id.dialog_root_item1_notification);
ViewGroup root2 = (ViewGroup) v.findViewById(R.id.dialog_root_item2_notification);
ViewGroup root3 = (ViewGroup) v.findViewById(R.id.dialog_root_item3_notification);
root1.setVisibility(View.GONE);
root2.setVisibility(View.VISIBLE);
root3.setVisibility(View.VISIBLE);
TextView txtItem1 = (TextView) v.findViewById(R.id.dialog_text_item1_notification);
TextView icon1 = (TextView) v.findViewById(R.id.dialog_icon_item1_notification);
txtItem1.setText(G.fragmentActivity.getResources().getString(R.string.satellite_view));
icon1.setText(G.fragmentActivity.getResources().getString(R.string.md_nearby));
TextView txtItem2 = (TextView) v.findViewById(R.id.dialog_text_item2_notification);
TextView icon2 = (TextView) v.findViewById(R.id.dialog_icon_item2_notification);
txtItem2.setText(G.fragmentActivity.getResources().getString(R.string.default_view));
icon2.setText(G.fragmentActivity.getResources().getString(R.string.md_map));
TextView txtItem3 = (TextView) v.findViewById(R.id.dialog_text_item3_notification);
TextView icon3 = (TextView) v.findViewById(R.id.dialog_icon_item3_notification);
txtItem3.setText(G.fragmentActivity.getResources().getString(R.string.satellite_view));
icon3.setText(G.fragmentActivity.getResources().getString(R.string.md_satellite_variant));
root1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
fabGps.setVisibility(View.GONE);
fabStateSwitcher.setVisibility(View.GONE);
rippleMoreMap.setVisibility(View.GONE);
page = pageUserList;
try {
new HelperFragment(FragmentMapUsers.newInstance()).setResourceContainer(R.id.mapContainer_main).setReplace(false).load();
} catch (Exception e) {
e.getStackTrace();
}
}
});
root2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
if (isAdded()) {
changeState = getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE)
.getBoolean("state", false);
if (changeState) {
deleteMapFileCash();
getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).edit().putBoolean("state", false).apply();
new HelperFragment(FragmentiGapMap.getInstance()).remove();
new HelperFragment(FragmentiGapMap.getInstance()).load();
}
}
}
});
root3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
dialog.dismiss();
deleteMapFileCash();
if (isAdded()) {
changeState = getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE)
.getBoolean("state", false);
if (!changeState) {
deleteMapFileCash();
getActivity().getSharedPreferences("KEY_SWITCH_MAP_STATE", Context.MODE_PRIVATE).edit().putBoolean("state", true).apply();
new HelperFragment(FragmentiGapMap.getInstance()).remove();
new HelperFragment(FragmentiGapMap.getInstance()).load();
}
}
}
});
*/
/* SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
//Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this));
Configuration.getInstance().load(getActivity(), PreferenceManager.getDefaultSharedPreferences(getActivity()));*/
/*
// map.onDetach();
*/
/* if (changeState)
changeState = false;
else
changeState = true;
map.invalidate();
startMap(view);*/
/*
// setTile(false);
}
});*/
page = 1;
new RequestGeoGetComment().getComment(AccountManager.getInstance().getCurrentUser().getId());
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class FragmentUserProfile method goToFragmentGallery.
private void goToFragmentGallery() {
if (getActivity() != null) {
Fragment fragment = FragmentGallery.newInstance(false, FragmentGallery.GalleryMode.PHOTO, true, getString(R.string.gallery), "-1", new FragmentGallery.GalleryFragmentListener() {
@Override
public void openOsGallery() {
}
@Override
public void onGalleryResult(String path) {
handleGalleryImageResult(path);
}
});
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
}
use of net.iGap.helper.HelperFragment in project iGap-Android by KianIranian-STDG.
the class BeepTunesMainFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
ProgressBar loadingProgress = rootView.findViewById(R.id.pb_beepTunes_loading);
LinearLayout toolBar = rootView.findViewById(R.id.tb_beepTunes);
RecyclerView recyclerView = rootView.findViewById(R.id.rv_beepTunes_main);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
initToolBar(toolBar);
viewModel.getFirstPageMutableLiveData().observe(this, firstPage -> {
if (firstPage != null)
adapter.setData(firstPage.getData());
});
adapter.setOnItemClick(album -> {
new HelperFragment(getFragmentManager(), new BeepTunesAlbumFragment().getInstance(album, toAlbumAdapter, fromAlbumAdapter)).setResourceContainer(R.id.fl_beepTunes_Container).setReplace(false).load();
});
profileFragment.setCallBack(type -> {
if (type.equals(SYNC_FRAGMENT)) {
List<RealmDownloadSong> downloadSongs = DbManager.getInstance().doRealmTask(realm -> {
return realm.copyFromRealm(realm.where(RealmDownloadSong.class).findAll());
});
new HelperFragment(getFragmentManager(), BeepTunesLocalSongFragment.getInstance(downloadSongs, "Sync Song", this)).setResourceContainer(R.id.fl_beepTunes_Container).setReplace(false).load();
} else if (type.equals(FAVORITE_FRAGMENT)) {
List<RealmDownloadSong> downloadSongs = DbManager.getInstance().doRealmTask(realm -> {
return realm.copyFromRealm(realm.where(RealmDownloadSong.class).equalTo("isFavorite", true).findAll());
});
new HelperFragment(getFragmentManager(), BeepTunesLocalSongFragment.getInstance(downloadSongs, "Favorite Song", this)).setResourceContainer(R.id.fl_beepTunes_Container).setReplace(false).load();
}
});
viewModel.getProgressMutableLiveData().observe(getViewLifecycleOwner(), loadingProgress::setVisibility);
}
Aggregations