Search in sources :

Example 21 with HelperFragment

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();
}
Also used : GalleryItemModel(net.iGap.model.GalleryItemModel) HelperFragment(net.iGap.helper.HelperFragment)

Example 22 with HelperFragment

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);
        }
    });
}
Also used : FragmentGallery(net.iGap.fragments.FragmentGallery) FragmentEditImage(net.iGap.fragments.FragmentEditImage) OnRotateImage(net.iGap.observers.interfaces.OnRotateImage) HelperFragment(net.iGap.helper.HelperFragment) ImageHelper(net.iGap.helper.ImageHelper)

Example 23 with HelperFragment

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());
}
Also used : RequestGeoGetComment(net.iGap.request.RequestGeoGetComment) StateChangeListener(net.iGap.libs.floatingAddButton.StateChangeListener) Theme(net.iGap.module.Theme) HelperFragment(net.iGap.helper.HelperFragment)

Example 24 with HelperFragment

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();
    }
}
Also used : HelperFragment(net.iGap.helper.HelperFragment) Fragment(androidx.fragment.app.Fragment) HelperFragment(net.iGap.helper.HelperFragment)

Example 25 with HelperFragment

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);
}
Also used : MutableLiveData(androidx.lifecycle.MutableLiveData) BeepTunesLocalSongFragment(net.iGap.fragments.beepTunes.BeepTunesLocalSongFragment) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ProgressBar(android.widget.ProgressBar) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) NonNull(androidx.annotation.NonNull) BeepTunesProfileFragment(net.iGap.fragments.beepTunes.BeepTunesProfileFragment) AccountManager(net.iGap.module.accountManager.AccountManager) RealmDownloadSong(net.iGap.realm.RealmDownloadSong) SYNC_FRAGMENT(net.iGap.fragments.beepTunes.BeepTunesProfileFragment.SYNC_FRAGMENT) FAVORITE_FRAGMENT(net.iGap.fragments.beepTunes.BeepTunesProfileFragment.FAVORITE_FRAGMENT) Album(net.iGap.module.api.beepTunes.Album) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) BeepTunesMainAdapter(net.iGap.adapter.beepTunes.BeepTunesMainAdapter) HelperFragment(net.iGap.helper.HelperFragment) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) LayoutInflater(android.view.LayoutInflater) BaseFragment(net.iGap.fragments.BaseFragment) ViewGroup(android.view.ViewGroup) List(java.util.List) Nullable(androidx.annotation.Nullable) BeepTunesLocalSongAdapter(net.iGap.adapter.beepTunes.BeepTunesLocalSongAdapter) R(net.iGap.R) PlayingSong(net.iGap.module.api.beepTunes.PlayingSong) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DbManager(net.iGap.module.accountManager.DbManager) BeepTunesAlbumFragment(net.iGap.fragments.beepTunes.album.BeepTunesAlbumFragment) HelperToolbar(net.iGap.helper.HelperToolbar) RealmDownloadSong(net.iGap.realm.RealmDownloadSong) BeepTunesAlbumFragment(net.iGap.fragments.beepTunes.album.BeepTunesAlbumFragment) RecyclerView(androidx.recyclerview.widget.RecyclerView) List(java.util.List) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) HelperFragment(net.iGap.helper.HelperFragment) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Aggregations

HelperFragment (net.iGap.helper.HelperFragment)93 Bundle (android.os.Bundle)32 View (android.view.View)31 Fragment (androidx.fragment.app.Fragment)25 IOException (java.io.IOException)18 ArrayList (java.util.ArrayList)15 RecyclerView (androidx.recyclerview.widget.RecyclerView)14 ToolbarListener (net.iGap.observers.interfaces.ToolbarListener)14 ViewGroup (android.view.ViewGroup)13 NonNull (androidx.annotation.NonNull)13 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)13 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)13 Theme (net.iGap.module.Theme)13 R (net.iGap.R)12 OnGetPermission (net.iGap.observers.interfaces.OnGetPermission)12 LayoutInflater (android.view.LayoutInflater)11 TextView (android.widget.TextView)11 Nullable (androidx.annotation.Nullable)11 HelperString (net.iGap.helper.HelperString)10 BackDrawable (net.iGap.messenger.ui.toolBar.BackDrawable)10