Search in sources :

Example 11 with Theme

use of net.iGap.module.Theme in project iGap-Android by KianIranian-STDG.

the class ElectricityBillListFrag method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    HelperToolbar mHelperToolbar = HelperToolbar.create().setContext(getContext()).setLeftIcon(R.string.icon_back).setLifecycleOwner(getViewLifecycleOwner()).setListener(new ToolbarListener() {

        @Override
        public void onLeftIconClickListener(View view) {
            popBackStackFragment();
        }

        @Override
        public void onRightIconClickListener(View view) {
            List<Integer> items = new ArrayList<>();
            items.add(R.string.elecBill_cell_deleteAccount);
            new TopSheetDialog(getContext()).setListDataWithResourceId(items, -1, position -> {
                if (position == 0) {
                    final MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.elecBill_deleteAccount_title).content(R.string.elecBill_deleteAccount_desc).positiveText(R.string.elecBill_deleteAccount_pos).negativeText(R.string.elecBill_deleteAccount_neg).positiveColor(getContext().getResources().getColor(R.color.red)).widgetColor(new Theme().getAccentColor(getContext())).onPositive((dialog1, which) -> viewModel.deleteAccount()).build();
                    dialog.show();
                }
            }).show();
        }
    }).setLogoShown(true);
    LinearLayout toolbarLayout = binding.Toolbar;
    toolbarLayout.addView(mHelperToolbar.getView());
    binding.billRecycler.setHasFixedSize(true);
    onDataChangedListener();
    viewModel.getBillsList();
}
Also used : TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) NonNull(androidx.annotation.NonNull) ProtoMplGetBillToken(net.iGap.proto.ProtoMplGetBillToken) Theme(net.iGap.module.Theme) ElectricityBillListVM(net.iGap.viewmodel.electricity_bill.ElectricityBillListVM) ArrayList(java.util.ArrayList) MobileDebit(net.iGap.model.bill.MobileDebit) FragmentElecBillListBinding(net.iGap.databinding.FragmentElecBillListBinding) Toast(android.widget.Toast) Map(java.util.Map) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) HelperError(net.iGap.helper.HelperError) HelperFragment(net.iGap.helper.HelperFragment) BillList(net.iGap.model.bill.BillList) DataBindingUtil(androidx.databinding.DataBindingUtil) Debit(net.iGap.model.bill.Debit) LayoutInflater(android.view.LayoutInflater) TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) ViewGroup(android.view.ViewGroup) BaseAPIViewFrag(net.iGap.api.apiService.BaseAPIViewFrag) BillInfo(net.iGap.model.bill.BillInfo) ElectricityBillListAdapter(net.iGap.adapter.electricity_bill.ElectricityBillListAdapter) List(java.util.List) Nullable(androidx.annotation.Nullable) R(net.iGap.R) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Snackbar(com.google.android.material.snackbar.Snackbar) HelperToolbar(net.iGap.helper.HelperToolbar) ServiceDebit(net.iGap.model.bill.ServiceDebit) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ToolbarListener(net.iGap.observers.interfaces.ToolbarListener) ArrayList(java.util.ArrayList) Theme(net.iGap.module.Theme) HelperToolbar(net.iGap.helper.HelperToolbar) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 12 with Theme

use of net.iGap.module.Theme 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 13 with Theme

use of net.iGap.module.Theme in project iGap-Android by KianIranian-STDG.

the class FragmentProfile method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    viewModel.getGoToWalletPage().observe(getViewLifecycleOwner(), phoneNumber -> {
        if (getActivity() != null && phoneNumber != null) {
        // getActivity().startActivityForResult(new HelperWallet().goToWallet(getActivity(), new Intent(getActivity(), WalletActivity.class), phoneNumber, false), WALLET_REQUEST_CODE);
        }
    });
    viewModel.getGoToAddMemberPage().observe(getViewLifecycleOwner(), aBoolean -> {
        if (getActivity() != null && aBoolean != null && aBoolean) {
            try {
                Fragment fragment = RegisteredContactsFragment.newInstance(true, false, RegisteredContactsFragment.ADD);
                new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
            } catch (Exception e) {
                e.getStackTrace();
            }
        }
    });
    viewModel.goToChatPage.observe(getViewLifecycleOwner(), data -> {
        if (getActivity() != null && data != null) {
            new GoToChatActivity(data.getRoomId()).setPeerID(data.getPeerId()).startActivity(getActivity());
        }
    });
    viewModel.goToScannerPage.observe(getViewLifecycleOwner(), go -> {
        if (go != null && go) {
            try {
                HelperPermission.getCameraPermission(getActivity(), new OnGetPermission() {

                    @Override
                    public void Allow() throws IllegalStateException {
                        IntentIntegrator integrator = new IntentIntegrator(getActivity());
                        integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE);
                        integrator.setRequestCode(ActivityMain.requestCodeQrCode);
                        integrator.setBeepEnabled(false);
                        integrator.setPrompt("");
                        integrator.initiateScan();
                    }

                    @Override
                    public void deny() {
                        showDeniedPermissionMessage(G.context.getString(R.string.permission_camera));
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    viewModel.checkLocationPermission.observe(getViewLifecycleOwner(), isCheck -> {
        if (isCheck != null && isCheck) {
            try {
                HelperPermission.getLocationPermission(getActivity(), new OnGetPermission() {

                    @Override
                    public void Allow() {
                        viewModel.haveLocationPermission();
                    }

                    @Override
                    public void deny() {
                        showDeniedPermissionMessage(G.context.getString(R.string.permission_location));
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    viewModel.shareInviteLink.observe(getViewLifecycleOwner(), link -> {
        if (link != null) {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, link);
            sendIntent.setType("text/plain");
            Intent openInChooser = Intent.createChooser(sendIntent, "Open in...");
            startActivity(openInChooser);
        }
    });
    viewModel.goToContactsPage.observe(getViewLifecycleOwner(), go -> {
        if (getActivity() != null && go != null && go) {
            new HelperFragment(getActivity().getSupportFragmentManager(), RegisteredContactsFragment.newInstance(false, false, RegisteredContactsFragment.CONTACTS)).setReplace(false).load();
        }
    });
    viewModel.goToUserScorePage.observe(getViewLifecycleOwner(), go -> {
        if (getActivity() != null && go != null && go) {
            new HelperFragment(getActivity().getSupportFragmentManager(), new FragmentUserScore()).setReplace(false).load();
        }
    });
    viewModel.goToIGapMapPage.observe(getViewLifecycleOwner(), isGo -> {
        if (getActivity() != null && isGo != null && isGo) {
            new HelperFragment(getActivity().getSupportFragmentManager(), FragmentiGapMap.getInstance()).setReplace(false).load();
        }
    });
    viewModel.goToFAQPage.observe(getViewLifecycleOwner(), link -> {
        if (link != null) {
            HelperUrl.openBrowser(link);
        }
    });
    viewModel.goToSettingPage.observe(getViewLifecycleOwner(), go -> {
        if (getActivity() != null && go != null && go) {
            new HelperFragment(getActivity().getSupportFragmentManager(), new FragmentSetting()).setReplace(false).load();
        }
    });
    viewModel.getUpdateNewTheme().observe(getViewLifecycleOwner(), isUpdate -> {
        if (getActivity() != null && isUpdate != null && isUpdate) {
            Fragment frg;
            frg = getActivity().getSupportFragmentManager().findFragmentByTag(BottomNavigationFragment.class.getName());
            FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
            ft.detach(frg);
            ft.attach(frg);
            ft.commit();
        }
    });
    viewModel.showDialogBeLastVersion.observe(getViewLifecycleOwner(), isShow -> {
        if (getActivity() != null && isShow != null && isShow) {
            new MaterialDialog.Builder(getActivity()).cancelable(false).title(R.string.app_version_change_log).titleGravity(GravityEnum.CENTER).titleColor(new Theme().getPrimaryColor(getActivity())).content(R.string.updated_version_title).contentGravity(GravityEnum.CENTER).positiveText(R.string.ok).itemsGravity(GravityEnum.START).show();
        }
    });
    viewModel.showDialogUpdate.observe(getViewLifecycleOwner(), body -> {
        if (getActivity() != null && body != null) {
            new MaterialDialog.Builder(getActivity()).cancelable(false).title(R.string.app_version_change_log).titleGravity(GravityEnum.CENTER).titleColor(new Theme().getPrimaryColor(getActivity())).content(body).contentGravity(GravityEnum.CENTER).positiveText(R.string.startUpdate).itemsGravity(GravityEnum.START).onPositive((dialog, which) -> {
                String url = BuildConfig.UPDATE_LINK;
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
            }).negativeText(R.string.cancel).show();
        }
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) IntentIntegrator(com.google.zxing.integration.android.IntentIntegrator) Intent(android.content.Intent) IOException(java.io.IOException) Fragment(androidx.fragment.app.Fragment) HelperFragment(net.iGap.helper.HelperFragment) IOException(java.io.IOException) OnGetPermission(net.iGap.observers.interfaces.OnGetPermission) FragmentTransaction(androidx.fragment.app.FragmentTransaction) Theme(net.iGap.module.Theme) GoToChatActivity(net.iGap.helper.GoToChatActivity) HelperFragment(net.iGap.helper.HelperFragment)

Example 14 with Theme

use of net.iGap.module.Theme in project iGap-Android by KianIranian-STDG.

the class FragmentMap method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle saveInctanceState) {
    super.onViewCreated(view, saveInctanceState);
    /* */
    /**/
    /* itemIcon = (MaterialDesignTextView) view.findViewById(R.id.mf_icon);*/
    rvIcon = view.findViewById(R.id.rv_icon);
    Drawable mDrawableSkip = ContextCompat.getDrawable(getContext(), R.drawable.ic_circle_shape);
    if (mDrawableSkip != null) {
        mDrawableSkip.setColorFilter(new PorterDuffColorFilter(new Theme().getPrimaryColor(getContext()), PorterDuff.Mode.SRC_IN));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            rvIcon.setBackground(mDrawableSkip);
        }
    }
    imgProfile = view.findViewById(R.id.mf_imgProfile);
    rvSendPosition = view.findViewById(R.id.mf_rv_send_position);
    rvSeePosition = view.findViewById(R.id.mf_rv_see_position);
    rvSendPosition.setEnabled(false);
    accuracy = view.findViewById(R.id.mf_txt_accuracy);
    accuracy.setText(getResources().getString(R.string.get_location_data));
    txtTitle = view.findViewById(R.id.mf_txt_message);
    txtUserName = view.findViewById(R.id.mf_txt_userName);
    txtDistance = view.findViewById(R.id.mf_txt_distance);
    txtDistance.setText(getResources().getString(R.string.calculation));
    txtUserName.setTextColor(new Theme().getPrimaryColor(getContext()));
    accuracy.setTextColor(new Theme().getPrimaryColor(getContext()));
    txtDistance.setTextColor(new Theme().getPrimaryColor(getContext()));
    rvSendPosition.setBackgroundColor(new Theme().getPrimaryColor(getContext()));
    txtTitle.setTextColor(new Theme().getPrimaryColor(getContext()));
    fabOpenMap = view.findViewById(R.id.mf_fab_openMap);
    fabOpenMap.setBackgroundTintList(ColorStateList.valueOf(new Theme().getButtonColor(getContext())));
    fabOpenMap.setColorFilter(Color.WHITE);
    bundle = getArguments();
    if (bundle != null) {
        latitude = bundle.getDouble(FragmentMap.Latitude);
        longitude = bundle.getDouble(FragmentMap.Longitude);
        mode = (Mode) bundle.getSerializable(PosoitionMode);
        if (mode == Mode.sendPosition) {
            if (G.onHelperSetAction != null) {
                G.onHelperSetAction.onAction(ProtoGlobal.ClientAction.SENDING_LOCATION);
            }
        }
        initComponent(view, bundle.getInt("type", 0), bundle.getLong("roomId", 00), bundle.getString("senderId", null));
    } else {
        close();
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) Theme(net.iGap.module.Theme) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter)

Example 15 with Theme

use of net.iGap.module.Theme in project iGap-Android by KianIranian-STDG.

the class DefaultRoundDialog method show.

@Override
public AlertDialog show() {
    AlertDialog dialog = this.create();
    dialog.getWindow().setBackgroundDrawable(new Theme().tintDrawable(ContextCompat.getDrawable(getContext(), R.drawable.dialog_background_dark), getContext(), R.attr.rootBackgroundColor));
    dialog.show();
    return dialog;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Theme(net.iGap.module.Theme)

Aggregations

Theme (net.iGap.module.Theme)41 View (android.view.View)22 TextView (android.widget.TextView)21 HelperFragment (net.iGap.helper.HelperFragment)17 LinearLayout (android.widget.LinearLayout)15 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)13 Bundle (android.os.Bundle)12 ViewGroup (android.view.ViewGroup)12 Nullable (androidx.annotation.Nullable)12 RecyclerView (androidx.recyclerview.widget.RecyclerView)12 ArrayList (java.util.ArrayList)12 R (net.iGap.R)11 NonNull (androidx.annotation.NonNull)10 LayoutInflater (android.view.LayoutInflater)9 HelperError (net.iGap.helper.HelperError)9 ParamWithAvatarType (net.iGap.helper.avatar.ParamWithAvatarType)9 Drawable (android.graphics.drawable.Drawable)8 FrameLayout (android.widget.FrameLayout)8 ProgressBar (android.widget.ProgressBar)8 Fragment (androidx.fragment.app.Fragment)8