Search in sources :

Example 1 with ActivityMain

use of net.iGap.activities.ActivityMain in project iGap-Android by KianIranian-STDG.

the class GoToChatActivity method startActivity.

public void startActivity(FragmentActivity activity) {
    String roomName = "";
    if (FragmentChat.mForwardMessages != null || HelperGetDataFromOtherApp.hasSharedData || FragmentChat.structIGSticker != null) {
        roomName = DbManager.getInstance().doRealmTask(realm -> {
            RealmRoom realmRoom = realm.where(RealmRoom.class).equalTo("id", roomid).findFirst();
            if (realmRoom != null) {
                if (realmRoom.getReadOnly() || hasSendMessagePermission() || (realmRoom.getType() != ProtoGlobal.Room.Type.CHAT && FragmentChat.structIGSticker != null) || (realmRoom.getType() == ProtoGlobal.Room.Type.CHAT && realmRoom.getChatRoom() != null && RealmRoom.isBot(realmRoom.getChatRoom().getPeerId()))) {
                    if (activity != null && !(activity).isFinishing()) {
                        new MaterialDialog.Builder(activity).title(R.string.dialog_readonly_chat).positiveText(R.string.ok).show();
                    }
                    return null;
                }
                return realmRoom.getTitle();
            } else if (peerID > 0) {
                RealmRegisteredInfo _RegisteredInfo = RealmRegisteredInfo.getRegistrationInfo(realm, peerID);
                if (_RegisteredInfo != null) {
                    return _RegisteredInfo.getDisplayName();
                }
            }
            return "";
        });
        if (roomName == null) {
            return;
        }
    }
    if (HelperGetDataFromOtherApp.hasSharedData) {
        String message = G.context.getString(R.string.send_message_to) + " " + roomName;
        MaterialDialog.Builder mDialog = new MaterialDialog.Builder(activity).title(message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive(new MaterialDialog.SingleButtonCallback() {

            @Override
            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                FragmentChat fragmentChat = new FragmentChat();
                fragmentChat.setArguments(getBundle());
                fragmentChatBackStack(activity);
                new HelperFragment(activity.getSupportFragmentManager(), fragmentChat).setReplace(false).load();
            }
        }).onNegative((dialog, which) -> {
            HelperGetDataFromOtherApp.hasSharedData = false;
            // revert main rooms list from share mode
            if (activity instanceof ActivityMain) {
                ((ActivityMain) activity).checkHasSharedData(false);
            }
        }).neutralText(R.string.another_room).onNeutral((dialog, which) -> dialog.dismiss());
        if (!activity.isFinishing()) {
            mDialog.show();
        }
    } else if (FragmentChat.structIGSticker != null) {
        String message = G.context.getString(R.string.send_message_to) + " " + roomName;
        MaterialDialog.Builder mDialog = new MaterialDialog.Builder(activity).title(message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive((dialog, which) -> {
            FragmentChat fragmentChat = new FragmentChat();
            fragmentChat.setArguments(getBundle());
            fragmentChatBackStack(activity);
            new HelperFragment(activity.getSupportFragmentManager(), fragmentChat).setReplace(false).load();
        }).onNegative((dialog, which) -> {
            FragmentChat.structIGSticker = null;
            if (activity instanceof ActivityMain) {
                ((ActivityMain) activity).checkHasSharedData(false);
            }
        }).neutralText(R.string.another_room).onNeutral((dialog, which) -> dialog.dismiss());
        if (!activity.isFinishing()) {
            mDialog.show();
        }
    } else if (FragmentChat.mForwardMessages != null) {
        String message = G.context.getString(R.string.send_forward_to) + " " + roomName + "?";
        MaterialDialog.Builder mDialog = new MaterialDialog.Builder(activity).title(message).positiveText(R.string.ok).negativeText(R.string.cancel).onPositive(new MaterialDialog.SingleButtonCallback() {

            @Override
            public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                loadChatFragment(activity);
            }
        }).onNegative((dialog, which) -> {
            disableForwardMessage(activity);
            FragmentChat.mForwardMessages = null;
        }).neutralText(R.string.another_room).onNeutral((dialog, which) -> dialog.dismiss());
        if (!(activity).isFinishing()) {
            mDialog.show();
        }
    } else {
        loadChatFragment(activity);
    }
}
Also used : Bundle(android.os.Bundle) RealmRoomAccess(net.iGap.realm.RealmRoomAccess) ActivityMain(net.iGap.activities.ActivityMain) NonNull(androidx.annotation.NonNull) AccountManager(net.iGap.module.accountManager.AccountManager) DialogAction(com.afollestad.materialdialogs.DialogAction) RealmRoom(net.iGap.realm.RealmRoom) FragmentActivity(androidx.fragment.app.FragmentActivity) G(net.iGap.G) Lifecycle(androidx.lifecycle.Lifecycle) List(java.util.List) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo) FragmentChat(net.iGap.fragments.FragmentChat) Fragment(androidx.fragment.app.Fragment) ProtoGlobal(net.iGap.proto.ProtoGlobal) R(net.iGap.R) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) DbManager(net.iGap.module.accountManager.DbManager) Log(android.util.Log) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo) ActivityMain(net.iGap.activities.ActivityMain) DialogAction(com.afollestad.materialdialogs.DialogAction) NonNull(androidx.annotation.NonNull) RealmRoom(net.iGap.realm.RealmRoom) FragmentChat(net.iGap.fragments.FragmentChat)

Example 2 with ActivityMain

use of net.iGap.activities.ActivityMain in project iGap-Android by KianIranian-STDG.

the class FragmentGroupProfile method onViewCreated.

@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    isNeedResume = true;
    // because actionbar not in this view do that and not correct in viewModel
    imvGroupAvatar = binding.toolbarAvatar;
    imvGroupAvatar.setOnClickListener(v -> viewModel.onClickRippleGroupAvatar());
    if (currentRoomAccess != null) {
        checkRoomAccess(currentRoomAccess);
        roomAccessChangeListener = (realmRoomAccess, changeSet) -> checkRoomAccess(realmRoomAccess);
        currentRoomAccess.addChangeListener(roomAccessChangeListener);
    }
    binding.toolbarMore.setOnClickListener(v -> viewModel.onClickRippleMenu());
    binding.toolbarBack.setOnClickListener(v -> popBackStackFragment());
    binding.toolbarEdit.setOnClickListener(v -> {
        if (getActivity() != null && currentRoomAccess != null && currentRoomAccess.isCanModifyRoom()) {
            new HelperFragment(getActivity().getSupportFragmentManager(), EditGroupFragment.newInstance(viewModel.roomId)).setReplace(false).load();
        }
    });
    viewModel.groupName.observe(getViewLifecycleOwner(), s -> {
        binding.toolbarTxtNameCollapsed.setText(EmojiManager.getInstance().replaceEmoji(s, binding.toolbarTxtNameCollapsed.getPaint().getFontMetricsInt()));
        binding.toolbarTxtNameExpanded.setText(EmojiManager.getInstance().replaceEmoji(s, binding.toolbarTxtNameExpanded.getPaint().getFontMetricsInt()));
    });
    viewModel.groupNumber.observe(getViewLifecycleOwner(), s -> binding.toolbarTxtStatusExpanded.setText(String.format("%s %s", s, getString(R.string.member))));
    viewModel.showMoreMenu.observe(getViewLifecycleOwner(), isShow -> {
        if (isShow != null) {
            binding.toolbarMore.setVisibility(isShow ? View.VISIBLE : View.GONE);
        }
    });
    viewModel.goToShearedMediaPage.observe(getViewLifecycleOwner(), model -> {
        if (getActivity() != null && model != null) {
            new HelperFragment(getActivity().getSupportFragmentManager(), FragmentShearedMedia.newInstance(model)).setReplace(false).load();
        }
    });
    viewModel.goToShowAvatarPage.observe(getViewLifecycleOwner(), roomId -> {
        if (getActivity() != null && roomId != null) {
            new HelperFragment(getActivity().getSupportFragmentManager(), FragmentShowAvatars.newInstance(roomId, FragmentShowAvatars.From.group)).setReplace(false).load();
        }
    });
    viewModel.showMenu.observe(getViewLifecycleOwner(), menuList -> {
        if (getActivity() != null && menuList != null) {
            new TopSheetDialog(getActivity()).setListDataWithResourceId(menuList, -1, position -> {
                if (menuList.get(position) == R.string.clear_history) {
                    new MaterialDialog.Builder(getActivity()).title(R.string.clear_history).content(R.string.clear_history_content).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {

                        @Override
                        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                            getMessageController().clearHistoryMessage(viewModel.roomId);
                        }
                    }).negativeText(R.string.no).show();
                } else if (menuList.get(position) == R.string.group_title_convert_to_public || menuList.get(position) == R.string.group_title_convert_to_private) {
                    viewModel.convertMenuClick();
                }
            }).show();
        }
    });
    viewModel.goToShowMemberPage.observe(getViewLifecycleOwner(), type -> {
        if (getActivity() != null && type != null) {
            FragmentShowMember fragment = FragmentShowMember.newInstance2(this, viewModel.roomId, viewModel.role.toString(), AccountManager.getInstance().getCurrentUser().getId(), type, viewModel.isNeedgetContactlist, true);
            new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
        }
    });
    viewModel.showDialogConvertToPublic.observe(getViewLifecycleOwner(), isShow -> {
        if (getActivity() != null && isShow != null && isShow) {
            new MaterialDialog.Builder(getActivity()).title(getString(R.string.group_title_convert_to_public)).content(getString(R.string.group_text_convert_to_public)).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {

                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    dialog.dismiss();
                    setUsername();
                }
            }).negativeText(R.string.no).show();
        }
    });
    viewModel.showDialogConvertToPrivate.observe(getViewLifecycleOwner(), isShow -> {
        if (getActivity() != null && isShow != null && isShow) {
            new MaterialDialog.Builder(getActivity()).title(R.string.group_title_convert_to_private).content(R.string.group_text_convert_to_private).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {

                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    viewModel.sendRequestRemoveGroupUsername();
                }
            }).negativeText(R.string.no).show();
        }
    });
    viewModel.showRequestError.observe(getViewLifecycleOwner(), errorMessage -> {
        if (errorMessage != null) {
            HelperError.showSnackMessage(getString(errorMessage), false);
        }
    });
    viewModel.goToShowCustomListPage.observe(getViewLifecycleOwner(), listItem -> {
        if (getActivity() != null && listItem != null) {
            ShowCustomList showCustomListFragment = new ShowCustomList();
            showCustomListFragment.setFields(ProtoGlobal.Room.Type.GROUP, listItem, (result, message, countForShowLastMessage, list) -> {
                for (int i = 0; i < list.size(); i++) {
                    new RequestGroupAddMember().groupAddMember(viewModel.roomId, list.get(i).peerId, RealmRoomMessage.findCustomMessageId(viewModel.roomId, countForShowLastMessage));
                }
            });
            Bundle bundle = new Bundle();
            bundle.putBoolean("DIALOG_SHOWING", true);
            bundle.putLong("COUNT_MESSAGE", 0);
            showCustomListFragment.setArguments(bundle);
            new HelperFragment(getActivity().getSupportFragmentManager(), showCustomListFragment).setReplace(false).load();
        }
    });
    viewModel.goBack.observe(getViewLifecycleOwner(), isGoBack -> {
        if (isGoBack != null && isGoBack) {
            popBackStackFragment();
        }
    });
    BetterLinkMovementMethod.linkify(Linkify.ALL, binding.description).setOnLinkClickListener((tv, url) -> {
        return false;
    }).setOnLinkLongClickListener((tv, url) -> {
        if (HelperUrl.isTextLink(url)) {
            G.isLinkClicked = true;
            HelperUrl.openLinkDialog(getActivity(), url);
        }
        return true;
    });
    viewModel.groupDescription.observe(getViewLifecycleOwner(), groupDescription -> {
        if (getActivity() != null && groupDescription != null) {
            binding.description.setText(EmojiManager.getInstance().replaceEmoji(HelperUrl.setUrlLink(getActivity(), groupDescription, true, false, null, true), binding.description.getPaint().getFontMetricsInt()));
        }
    });
    viewModel.goToRoomListPage.observe(getViewLifecycleOwner(), isGo -> {
        if (getActivity() instanceof ActivityMain && isGo != null) {
            Log.wtf(this.getClass().getName(), "goToRoomListPage observe");
            ((ActivityMain) getActivity()).removeAllFragmentFromMain();
        /*new HelperFragment(getActivity().getSupportFragmentManager()).popBackStack(2);*/
        }
    });
    viewModel.showDialogEditLink.observe(getViewLifecycleOwner(), link -> {
        if (getActivity() != null && link != null) {
            MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.group_link).positiveText(R.string.array_Copy).customView(createDialogLayout(link), true).widgetColor(new Theme().getPrimaryColor(getContext())).negativeText(R.string.edit).onPositive((dialog1, which) -> {
                ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
                ClipData clip = ClipData.newPlainText("LINK_GROUP", link);
                clipboard.setPrimaryClip(clip);
            }).onNegative((dialog12, which) -> {
                if (viewModel.isPrivate) {
                    viewModel.sendRequestRevokeGroupUsername();
                } else {
                    setUsername();
                }
            }).build();
            dialog.show();
        }
    });
    viewModel.showDialogCopyLink.observe(getViewLifecycleOwner(), link -> {
        if (getActivity() != null && link != null) {
            MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.group_link).positiveText(R.string.array_Copy).customView(createDialogLayout(link), true).widgetColor(new Theme().getPrimaryColor(getContext())).onPositive((dialog1, which) -> {
                ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
                ClipData clip = ClipData.newPlainText("LINK_GROUP", link);
                clipboard.setPrimaryClip(clip);
                Toast.makeText(getActivity(), R.string.copied, Toast.LENGTH_SHORT).show();
            }).build();
            dialog.show();
        }
    });
    viewModel.goToCustomNotificationPage.observe(getViewLifecycleOwner(), roomId -> {
        if (getActivity() != null && roomId != null) {
            FragmentNotification fragmentNotification = new FragmentNotification();
            Bundle bundle = new Bundle();
            bundle.putLong("ID", roomId);
            fragmentNotification.setArguments(bundle);
            new HelperFragment(getActivity().getSupportFragmentManager(), fragmentNotification).setReplace(false).load();
        }
    });
    viewModel.showDialogLeaveGroup.observe(getViewLifecycleOwner(), isShow -> {
        if (isShow != null && isShow) {
            groupLeft();
        }
    });
    if (viewModel.role.equals(GroupChatRole.OWNER)) {
        binding.editGroupPermission.setVisibility(View.VISIBLE);
        binding.editGroupPermission.setOnClickListener(v -> {
            openChatEditRightsFragment(viewModel.getRealmRoom());
        });
    }
    initComponent();
    attachFile = new AttachFile(getActivity());
    G.onGroupAvatarDelete = this;
    initialToolbar();
}
Also used : TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) AppUtils(net.iGap.module.AppUtils) OnGroupAvatarDelete(net.iGap.observers.interfaces.OnGroupAvatarDelete) ProgressBar(android.widget.ProgressBar) NonNull(androidx.annotation.NonNull) WindowManager(android.view.WindowManager) AttachFile(net.iGap.module.AttachFile) Theme(net.iGap.module.Theme) OnGroupCheckUsername(net.iGap.observers.interfaces.OnGroupCheckUsername) Selection(android.text.Selection) G(net.iGap.G) GroupChatRole(net.iGap.module.enums.GroupChatRole) RequestGroupUpdateUsername(net.iGap.request.RequestGroupUpdateUsername) Fragment(androidx.fragment.app.Fragment) ActivityGroupProfileBinding(net.iGap.databinding.ActivityGroupProfileBinding) ClipboardManager(android.content.ClipboardManager) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) HelperError(net.iGap.helper.HelperError) HelperFragment(net.iGap.helper.HelperFragment) RequestGroupAddMember(net.iGap.request.RequestGroupAddMember) Log(android.util.Log) DataBindingUtil(androidx.databinding.DataBindingUtil) ParamWithAvatarType(net.iGap.helper.avatar.ParamWithAvatarType) OnComplete(net.iGap.observers.interfaces.OnComplete) MEditText(net.iGap.module.MEditText) RealmObjectChangeListener(io.realm.RealmObjectChangeListener) RealmRoom(net.iGap.realm.RealmRoom) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) ProtoGroupCheckUsername(net.iGap.proto.ProtoGroupCheckUsername) AlphaAnimation(android.view.animation.AlphaAnimation) CLIPBOARD_SERVICE(android.content.Context.CLIPBOARD_SERVICE) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) EventManager(net.iGap.observers.eventbus.EventManager) NotNull(org.jetbrains.annotations.NotNull) TextWatcher(android.text.TextWatcher) EmojiManager(net.iGap.libs.emojiKeyboard.emoji.EmojiManager) Context(android.content.Context) Config(net.iGap.Config) ResourcesCompat(androidx.core.content.res.ResourcesCompat) ActivityMain(net.iGap.activities.ActivityMain) HelperUrl(net.iGap.helper.HelperUrl) TextInputLayout(com.google.android.material.textfield.TextInputLayout) AccountManager(net.iGap.module.accountManager.AccountManager) Linkify(android.text.util.Linkify) Editable(android.text.Editable) InputMethodManager(android.view.inputmethod.InputMethodManager) ClipData(android.content.ClipData) Toast(android.widget.Toast) RequestGroupCheckUsername(net.iGap.request.RequestGroupCheckUsername) RealmRoomMessage(net.iGap.realm.RealmRoomMessage) Build(android.os.Build) AvatarHandler(net.iGap.helper.avatar.AvatarHandler) RealmRoomAccess(net.iGap.realm.RealmRoomAccess) LayoutInflater(android.view.LayoutInflater) FragmentGroupProfileViewModel(net.iGap.viewmodel.FragmentGroupProfileViewModel) DialogAction(com.afollestad.materialdialogs.DialogAction) TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) CircleImageView(net.iGap.module.CircleImageView) Gravity(android.view.Gravity) CountDownTimer(android.os.CountDownTimer) TypedValue(android.util.TypedValue) HelperString(net.iGap.helper.HelperString) OnGroupUpdateUsername(net.iGap.observers.interfaces.OnGroupUpdateUsername) ProtoGlobal(net.iGap.proto.ProtoGlobal) R(net.iGap.R) BetterLinkMovementMethod(me.saket.bettermovementmethod.BetterLinkMovementMethod) DbManager(net.iGap.module.accountManager.DbManager) ClipboardManager(android.content.ClipboardManager) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Bundle(android.os.Bundle) RequestGroupAddMember(net.iGap.request.RequestGroupAddMember) ActivityMain(net.iGap.activities.ActivityMain) DialogAction(com.afollestad.materialdialogs.DialogAction) AttachFile(net.iGap.module.AttachFile) NonNull(androidx.annotation.NonNull) Theme(net.iGap.module.Theme) HelperFragment(net.iGap.helper.HelperFragment) ClipData(android.content.ClipData)

Example 3 with ActivityMain

use of net.iGap.activities.ActivityMain in project iGap-Android by KianIranian-STDG.

the class FragmentPassCode method onViewCreated.

@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    initDataBinding();
    passCodeToolbar = new Toolbar(getContext());
    passCodeToolbar.setBackIcon(new BackDrawable(false));
    passCodeToolbar.setTitle(getString(R.string.two_step_pass_code));
    ToolbarItem toolbarItem;
    toolbarItem = passCodeToolbar.addItem(rippleOkTag, R.string.icon_sent, Color.WHITE);
    passCodeToolbar.setListener(i -> {
        switch(i) {
            case -1:
                popBackStackFragment();
                AppUtils.closeKeyboard(view);
                break;
            case rippleOkTag:
                fragmentPassCodeViewModel.onClickRippleOk(view);
                break;
        }
    });
    fragmentPassCodeBinding.fpcLayoutToolbar.addView(passCodeToolbar, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.dp(56), Gravity.TOP));
    toolbarItem.setVisibility(View.GONE);
    // observe to show tick (ok) button or not
    fragmentPassCodeViewModel.rippleOkVisibility.observe(getViewLifecycleOwner(), visibility -> {
        if (visibility != null) {
            if (visibility == View.VISIBLE) {
                toolbarItem.setVisibility(View.VISIBLE);
            } else {
                toolbarItem.setVisibility(View.GONE);
            }
        }
    });
    fragmentPassCodeViewModel.passCodeStateChangeListener.observe(getViewLifecycleOwner(), aBoolean -> {
        if (getActivity() != null) {
            ((ActivityMain) getActivity()).updatePassCodeState();
        }
    });
    boolean isLinePattern;
    if (isPattern) {
        SharedPreferences sharedPreferences = G.currentActivity.getSharedPreferences(SHP_SETTING.FILE_NAME, MODE_PRIVATE);
        isLinePattern = sharedPreferences.getBoolean(SHP_SETTING.KEY_PATTERN_TACTILE_DRAWN, true);
    } else {
        isLinePattern = true;
    }
    // Set the current view more
    fragmentPassCodeBinding.patternLockView.setViewMode(PatternLockView.PatternViewMode.WRONG);
    // Set the pattern in stealth mode (pattern drawing is hidden)
    fragmentPassCodeBinding.patternLockView.setInStealthMode(!isLinePattern);
    // Enables vibration feedback when the pattern is drawn
    fragmentPassCodeBinding.patternLockView.setTactileFeedbackEnabled(true);
    // Disables any input from the pattern lock view completely
    fragmentPassCodeBinding.patternLockView.setInputEnabled(true);
}
Also used : ToolbarItem(net.iGap.messenger.ui.toolBar.ToolbarItem) ActivityMain(net.iGap.activities.ActivityMain) SharedPreferences(android.content.SharedPreferences) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) Toolbar(net.iGap.messenger.ui.toolBar.Toolbar)

Example 4 with ActivityMain

use of net.iGap.activities.ActivityMain in project iGap-Android by KianIranian-STDG.

the class FragmentGallery method checkVideoMultiSelectAndSendToEdit.

private void checkVideoMultiSelectAndSendToEdit() {
    if (mGalleryVideoAdapter == null)
        return;
    if (mGalleryVideoAdapter.getMultiSelectState()) {
        mHelperToolbar.getRightButton().setText(R.string.icon_new_conversation);
        if (mGalleryVideoAdapter.getSelectedVideos().size() > 0) {
            List<String> videos = new ArrayList<>();
            for (GalleryVideoModel video : mGalleryVideoAdapter.getSelectedVideos()) {
                videos.add(video.getPath());
            }
            mGalleryListener.onVideoPickerResult(videos);
            popBackStackFragment();
            if (getActivity() instanceof ActivityMain) {
                ((ActivityMain) getActivity()).goneDetailFrameInTabletMode();
            }
        }
    } else {
        mHelperToolbar.getRightButton().setText(R.string.icon_close);
    }
    mGalleryVideoAdapter.setMultiSelectState(!mGalleryVideoAdapter.getMultiSelectState());
}
Also used : ActivityMain(net.iGap.activities.ActivityMain) ArrayList(java.util.ArrayList) GalleryVideoModel(net.iGap.model.GalleryVideoModel)

Example 5 with ActivityMain

use of net.iGap.activities.ActivityMain in project iGap-Android by KianIranian-STDG.

the class AccountsDialog method checkForAssigning.

public void checkForAssigning(boolean assign, long id) {
    if (assign) {
        if (getActivity() instanceof ActivityMain && AccountManager.getInstance().getCurrentUser().getId() != id) {
            new AccountHelper().changeAccount(id);
            ((ActivityMain) getActivity()).updateUiForChangeAccount();
        }
        dismiss();
    } else {
        if (getActivity() != null) {
            HelperTracker.sendTracker(HelperTracker.TRACKER_ADD_NEW_ACCOUNT);
            new AccountHelper().addAccount();
            // WebSocketClient.GGFconnectNewAccount();
            Intent intent = new Intent(getActivity(), ActivityRegistration.class);
            intent.putExtra("add account", true);
            getActivity().startActivity(intent);
            getActivity().finish();
        }
    }
}
Also used : AccountHelper(net.iGap.module.accountManager.AccountHelper) ActivityMain(net.iGap.activities.ActivityMain) Intent(android.content.Intent)

Aggregations

ActivityMain (net.iGap.activities.ActivityMain)28 View (android.view.View)10 HelperFragment (net.iGap.helper.HelperFragment)10 Bundle (android.os.Bundle)9 Intent (android.content.Intent)8 ViewGroup (android.view.ViewGroup)7 NonNull (androidx.annotation.NonNull)7 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)7 ArrayList (java.util.ArrayList)7 HelperString (net.iGap.helper.HelperString)6 DialogAction (com.afollestad.materialdialogs.DialogAction)5 R (net.iGap.R)5 ParamWithAvatarType (net.iGap.helper.avatar.ParamWithAvatarType)5 RealmRoom (net.iGap.realm.RealmRoom)5 LayoutInflater (android.view.LayoutInflater)4 TextView (android.widget.TextView)4 Nullable (androidx.annotation.Nullable)4 DataBindingUtil (androidx.databinding.DataBindingUtil)4 ViewModelProviders (androidx.lifecycle.ViewModelProviders)4 G (net.iGap.G)4