Search in sources :

Example 26 with Theme

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

the class FragmentShearedMedia method makeButton.

private void makeButton(final int pos) {
    TextView textView = new TextView(getContext());
    textView.setText(mSharedTypesList.get(pos));
    Utils.setTextSize(textView, R.dimen.smallTextSize);
    textView.setTypeface(ResourcesCompat.getFont(textView.getContext(), R.font.main_font));
    textView.setSingleLine(true);
    textView.setBackgroundResource(new Theme().getButtonSelectorBackground(textView.getContext()));
    textView.setTextColor(ContextCompat.getColorStateList(textView.getContext(), R.color.button_text_color_selector));
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (pos == 0 || pos == mSharedTypesList.size() + 1) {
        lp.setMargins(getDimen(R.dimen.dp10), getDimen(R.dimen.dp4), getDimen(R.dimen.dp10), getDimen(R.dimen.dp2));
    } else {
        lp.setMargins(getDimen(R.dimen.dp4), getDimen(R.dimen.dp4), getDimen(R.dimen.dp4), getDimen(R.dimen.dp2));
    }
    textView.setLayoutParams(lp);
    textView.setPadding(getDimen(R.dimen.round_buttons_large_padding), getDimen(R.dimen.round_buttons_small_padding), getDimen(R.dimen.round_buttons_large_padding), getDimen(R.dimen.round_buttons_small_padding));
    mSharedTypeButtonsList.add(new SharedButtons(textView, pos));
    textView.setOnClickListener(v -> {
        if (isSelectedMode && mCurrentSharedMediaType != pos)
            adapter.resetSelected();
        mediaTypesClickHandler(pos);
        checkSharedButtonsBackgrounds();
    });
    mediaTypesLayout.addView(textView);
}
Also used : Theme(net.iGap.module.Theme) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) TextView(android.widget.TextView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) LinearLayout(android.widget.LinearLayout)

Example 27 with Theme

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

the class MainFragment method createView.

@Override
public View createView(Context context) {
    if (getContext() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        StatusBarUtil.setColor(getActivity(), new Theme().getPrimaryDarkColor(getContext()), 50);
    }
    fragmentView = new FrameLayout(context);
    FrameLayout layout = (FrameLayout) fragmentView;
    initRecyclerView(context);
    layout.addView(recyclerView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.MATCH_PARENT));
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        private boolean scrollUpdated;

        private boolean scrollingManually;

        private int prevTop;

        private int prevPosition;

        @Override
        public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);
            scrollingManually = newState == RecyclerView.SCROLL_STATE_DRAGGING;
        }

        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
            firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
            View view = layoutManager.getChildAt(0);
            if (firstVisibleItemPosition > 0 && view != null) {
                firstVisibleItemPositionOffset = view.getTop();
            }
            if (!ClientGetRoomListResponse.roomListFetched) {
                if (mOffset > 0) {
                    int lastVisiblePosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition();
                    if (lastVisiblePosition + 10 >= mOffset) {
                        new RequestClientGetRoomList().clientGetRoomList(mOffset, Config.LIMIT_LOAD_ROOM, String.valueOf(System.currentTimeMillis()));
                    }
                }
            }
            int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
            if (firstVisibleItem != RecyclerView.NO_POSITION) {
                RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(firstVisibleItem);
                if (holder != null && holder.getAdapterPosition() != 0) {
                    int firstViewTop = holder.itemView.getTop();
                    boolean goingDown;
                    boolean changed = true;
                    if (prevPosition == firstVisibleItem) {
                        final int topDelta = prevTop - firstViewTop;
                        goingDown = firstViewTop < prevTop;
                        changed = Math.abs(topDelta) > 1;
                    } else {
                        goingDown = firstVisibleItem > prevPosition;
                    }
                    if (changed && scrollUpdated && (goingDown || scrollingManually)) {
                        hideFloatingButton(goingDown);
                    }
                    prevPosition = firstVisibleItem;
                    prevTop = firstViewTop;
                    scrollUpdated = true;
                }
            }
        }
    });
    loadMoreProgress = new ProgressBar(context);
    loadMoreProgress.setVisibility(View.GONE);
    AppUtils.setProgresColler(loadMoreProgress);
    layout.addView(loadMoreProgress, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER, 0, 0, 0, 8));
    loadingProgress = new ProgressBar(context);
    AppUtils.setProgresColler(loadingProgress);
    layout.addView(loadingProgress, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    emptyView = new LinearLayout(context);
    emptyView.setOrientation(LinearLayout.VERTICAL);
    emptyView.setVisibility(View.VISIBLE);
    layout.addView(emptyView, LayoutCreator.createFrame(LayoutCreator.WRAP_CONTENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER));
    ImageView emptyImageView = new ImageView(context);
    emptyImageView.setImageResource(R.drawable.empty_chat);
    emptyView.addView(emptyImageView, LayoutCreator.createLinear(160, 160, Gravity.CENTER));
    TextView emptyTextView = new TextView(context);
    emptyTextView.setText(getResources().getString(R.string.empty_room));
    emptyTextView.setTextColor(Theme.getInstance().getTitleTextColor(context));
    emptyTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    emptyTextView.setTypeface(ResourcesCompat.getFont(context, R.font.main_font));
    emptyTextView.setSingleLine();
    emptyTextView.setGravity(Gravity.CENTER);
    emptyView.addView(emptyTextView, LayoutCreator.createLinear(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.CENTER, 0, 16, 0, 8));
    floatActionLayout = new FrameLayout(context);
    Drawable drawable = Theme.createSimpleSelectorCircleDrawable(LayoutCreator.dp(56), Theme.getInstance().getToolbarBackgroundColor(context), Theme.getInstance().getAccentColor(context));
    floatActionLayout.setBackground(drawable);
    floatActionLayout.setAlpha(.9f);
    floatActionLayout.setOnClickListener(v -> onFloatActionClick());
    layout.addView(floatActionLayout, LayoutCreator.createFrame(52, 52, (isAppRtl ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, 16, 0, 16, 16));
    IconView addButton = new IconView(context);
    addButton.setIcon(R.string.icon_add);
    addButton.setIconColor(Color.WHITE);
    floatActionLayout.addView(addButton);
    mediaContainer = new FragmentMediaContainer(context, this);
    mediaContainer.setListener(i -> {
        switch(i) {
            case FragmentMediaContainer.CALL_TAG:
                getActivity().startActivity(new Intent(getContext(), CallActivity.class));
                break;
            case FragmentMediaContainer.MEDIA_TAG:
                if (!MusicPlayer.isVoice) {
                    Intent intent = new Intent(context, ActivityMain.class);
                    intent.putExtra(ActivityMain.openMediaPlayer, true);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    getActivity().startActivity(intent);
                }
                break;
            case FragmentMediaContainer.PLAY_TAG:
                break;
        }
    });
    layout.addView(mediaContainer, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -40, 0, 0));
    return fragmentView;
}
Also used : IconView(net.iGap.messenger.ui.components.IconView) FragmentMediaContainer(net.iGap.messenger.ui.components.FragmentMediaContainer) RequestClientGetRoomList(net.iGap.request.RequestClientGetRoomList) Drawable(android.graphics.drawable.Drawable) BackDrawable(net.iGap.messenger.ui.toolBar.BackDrawable) Intent(android.content.Intent) CallActivity(net.iGap.activities.CallActivity) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ImageView(android.widget.ImageView) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) IconView(net.iGap.messenger.ui.components.IconView) SuppressLint(android.annotation.SuppressLint) FrameLayout(android.widget.FrameLayout) Theme(net.iGap.module.Theme) RecyclerView(androidx.recyclerview.widget.RecyclerView) NumberTextView(net.iGap.messenger.ui.toolBar.NumberTextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Example 28 with Theme

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

the class MainFragment method isDeprecated.

@Override
public void isDeprecated() {
    try {
        if (getActivity() != null && !getActivity().isFinishing()) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    if (getActivity().hasWindowFocus()) {
                        new MaterialDialog.Builder(getActivity()).cancelable(false).title(R.string.new_version_alert).titleGravity(GravityEnum.CENTER).titleColor(new Theme().getAccentColor(getActivity())).content(R.string.deprecated).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);
                        }).show();
                    }
                }
            });
        }
    } catch (Exception e) {
        HelperLog.getInstance().setErrorLog(e);
    }
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Theme(net.iGap.module.Theme) Intent(android.content.Intent)

Example 29 with Theme

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

the class FragmentGroupProfile method setUsername.

// TODO: change this and create custom dialog and handle request in it and ...
// TODO: because no time be this and this code is not correct and should be change it
public void setUsername() {
    final LinearLayout layoutUserName = new LinearLayout(getContext());
    layoutUserName.setOrientation(LinearLayout.VERTICAL);
    final View viewUserName = new View(getContext());
    LinearLayout.LayoutParams viewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
    final TextInputLayout inputUserName = new TextInputLayout(getContext());
    final MEditText edtUserName = new MEditText(getContext());
    edtUserName.setHint(getString(R.string.group_title_set_username));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        edtUserName.setTextDirection(View.TEXT_DIRECTION_LTR);
    }
    edtUserName.setTypeface(ResourcesCompat.getFont(edtUserName.getContext(), R.font.main_font));
    edtUserName.setTextSize(TypedValue.COMPLEX_UNIT_PX, getContext().getResources().getDimension(R.dimen.dp14));
    // TODO: fixed this and this will set viewModel
    if (viewModel.isPopup) {
        edtUserName.setText(Config.IGAP_LINK_PREFIX);
    } else {
        edtUserName.setText(Config.IGAP_LINK_PREFIX + viewModel.linkUsername);
    }
    edtUserName.setTextColor(getContext().getResources().getColor(R.color.text_edit_text));
    edtUserName.setHintTextColor(getContext().getResources().getColor(R.color.hint_edit_text));
    edtUserName.setPadding(0, 8, 0, 8);
    edtUserName.setSingleLine(true);
    inputUserName.addView(edtUserName);
    inputUserName.addView(viewUserName, viewParams);
    viewUserName.setBackgroundColor(getContext().getResources().getColor(R.color.line_edit_text));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        edtUserName.setBackground(getContext().getResources().getDrawable(android.R.color.transparent));
    }
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutUserName.addView(inputUserName, layoutParams);
    ProgressBar progressBar = new ProgressBar(getContext());
    LinearLayout.LayoutParams progParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    progParams.gravity = Gravity.CENTER;
    progressBar.setLayoutParams(progParams);
    progressBar.setIndeterminate(true);
    progressBar.setVisibility(View.GONE);
    layoutUserName.addView(progressBar);
    final MaterialDialog dialog = new MaterialDialog.Builder(getContext()).title(R.string.st_username).positiveText(R.string.save).customView(layoutUserName, true).widgetColor(new Theme().getAccentColor(getContext())).negativeText(R.string.B_cancel).build();
    final View positive = dialog.getActionButton(DialogAction.POSITIVE);
    positive.setEnabled(false);
    edtUserName.setSelection((edtUserName.getText().toString().length()));
    G.handler.postDelayed(new Runnable() {

        @Override
        public void run() {
            edtUserName.requestFocus();
            InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            if (inputMethodManager != null) {
                inputMethodManager.showSoftInput(edtUserName, InputMethodManager.SHOW_IMPLICIT);
            }
        }
    }, 100);
    edtUserName.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (!editable.toString().startsWith(Config.IGAP_LINK_PREFIX)) {
                edtUserName.setText(Config.IGAP_LINK_PREFIX);
                Selection.setSelection(edtUserName.getText(), edtUserName.getText().length());
            } else {
                Selection.setSelection(edtUserName.getText(), edtUserName.getText().length());
            }
            if (HelperString.regexCheckUsername(editable.toString().replace(Config.IGAP_LINK_PREFIX, ""))) {
                if (getRequestManager().isUserLogin()) {
                    String userName = edtUserName.getText().toString().replace(Config.IGAP_LINK_PREFIX, "");
                    new RequestGroupCheckUsername().GroupCheckUsername(viewModel.roomId, userName, new OnGroupCheckUsername() {

                        @Override
                        public void onGroupCheckUsername(final ProtoGroupCheckUsername.GroupCheckUsernameResponse.Status status) {
                            G.handler.post(new Runnable() {

                                @Override
                                public void run() {
                                    if (status == ProtoGroupCheckUsername.GroupCheckUsernameResponse.Status.AVAILABLE) {
                                        positive.setEnabled(true);
                                        inputUserName.setErrorEnabled(true);
                                        inputUserName.setError("");
                                    } else if (status == ProtoGroupCheckUsername.GroupCheckUsernameResponse.Status.INVALID) {
                                        positive.setEnabled(false);
                                        inputUserName.setErrorEnabled(true);
                                        inputUserName.setError(getString(R.string.INVALID));
                                    } else if (status == ProtoGroupCheckUsername.GroupCheckUsernameResponse.Status.TAKEN) {
                                        positive.setEnabled(false);
                                        inputUserName.setErrorEnabled(true);
                                        inputUserName.setError(getString(R.string.TAKEN));
                                    } else if (status == ProtoGroupCheckUsername.GroupCheckUsernameResponse.Status.OCCUPYING_LIMIT_EXCEEDED) {
                                        positive.setEnabled(false);
                                        inputUserName.setErrorEnabled(true);
                                        inputUserName.setError("" + getString(R.string.OCCUPYING_LIMIT_EXCEEDED));
                                    }
                                }
                            });
                        }

                        @Override
                        public void onError(int majorCode, int minorCode) {
                            if (majorCode == 5) {
                                positive.setEnabled(false);
                                inputUserName.setErrorEnabled(true);
                                inputUserName.setError(getString(R.string.network_error));
                            } else {
                                positive.setEnabled(false);
                                inputUserName.setErrorEnabled(true);
                                inputUserName.setError(getString(R.string.server_error));
                            }
                        }
                    });
                } else {
                    positive.setEnabled(false);
                    inputUserName.setErrorEnabled(true);
                    inputUserName.setError(getString(R.string.network_error));
                }
            } else {
                positive.setEnabled(false);
                inputUserName.setErrorEnabled(true);
                inputUserName.setError(getString(R.string.INVALID));
            }
        }
    });
    positive.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            hideKeyboard();
            String userName = edtUserName.getText().toString().replace(Config.IGAP_LINK_PREFIX, "");
            if (getRequestManager().isUserLogin()) {
                progressBar.setVisibility(View.VISIBLE);
                positive.setEnabled(false);
                new RequestGroupUpdateUsername().groupUpdateUsername(viewModel.roomId, userName, new OnGroupUpdateUsername() {

                    @Override
                    public void onGroupUpdateUsername(final long roomId, final String username) {
                        G.handler.post(new Runnable() {

                            @Override
                            public void run() {
                                positive.setEnabled(true);
                                progressBar.setVisibility(View.GONE);
                                viewModel.isPrivate = false;
                                dialog.dismiss();
                                viewModel.linkUsername = username;
                                viewModel.setTextGroupLik();
                            }
                        });
                    }

                    @Override
                    public void onError(final int majorCode, int minorCode, final int time) {
                        G.handler.post(new Runnable() {

                            @Override
                            public void run() {
                                positive.setEnabled(true);
                                progressBar.setVisibility(View.GONE);
                                switch(majorCode) {
                                    case 5:
                                        HelperError.showSnackMessage(getString(R.string.wallet_error_server), false);
                                    case 368:
                                        if (dialog.isShowing())
                                            dialog.dismiss();
                                        dialogWaitTime(R.string.GROUP_UPDATE_USERNAME_UPDATE_LOCK, time, majorCode);
                                        break;
                                }
                            }
                        });
                    }
                });
            } else {
                progressBar.setVisibility(View.GONE);
                HelperError.showSnackMessage(getString(R.string.wallet_error_server), false);
            }
        }
    });
    edtUserName.setOnFocusChangeListener((view, b) -> {
        if (b) {
            viewUserName.setBackgroundColor(new Theme().getAccentColor(getContext()));
        } else {
            viewUserName.setBackgroundColor(getContext().getResources().getColor(R.color.line_edit_text));
        }
    });
    // check each word with server
    dialog.setOnDismissListener(dialog1 -> hideKeyboard());
    dialog.show();
}
Also used : RequestGroupUpdateUsername(net.iGap.request.RequestGroupUpdateUsername) InputMethodManager(android.view.inputmethod.InputMethodManager) HelperString(net.iGap.helper.HelperString) OnGroupUpdateUsername(net.iGap.observers.interfaces.OnGroupUpdateUsername) ProtoGroupCheckUsername(net.iGap.proto.ProtoGroupCheckUsername) OnGroupCheckUsername(net.iGap.observers.interfaces.OnGroupCheckUsername) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextInputLayout(com.google.android.material.textfield.TextInputLayout) ProgressBar(android.widget.ProgressBar) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) MEditText(net.iGap.module.MEditText) View(android.view.View) TextView(android.widget.TextView) CircleImageView(net.iGap.module.CircleImageView) RequestGroupCheckUsername(net.iGap.request.RequestGroupCheckUsername) Theme(net.iGap.module.Theme) LinearLayout(android.widget.LinearLayout)

Example 30 with Theme

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

the class FragmentIgapSearch method initComponent.

private void initComponent(View view) {
    // view.findViewById(R.id.sfl_ll_toolbar).setBackgroundColor(Color.parseColor(G.appBarColor));
    imvNothingFound = view.findViewById(R.id.sfl_imv_nothing_found);
    imvNothingFound.setImageResource(R.drawable.find1);
    txtEmptyListComment = view.findViewById(R.id.sfl_txt_empty_list_comment);
    // txtNothing = (TextView) view.findViewById(R.id.sfl_txt_empty_nothing);
    // txtNothing.setVisibility(View.VISIBLE);
    G.handler.postDelayed(new Runnable() {

        @Override
        public void run() {
            imvNothingFound.setVisibility(View.VISIBLE);
            txtEmptyListComment.setVisibility(View.VISIBLE);
        }
    }, 150);
    loadingProgressBar = view.findViewById(R.id.sfl_progress_loading);
    loadingProgressBar.getIndeterminateDrawable().setColorFilter(new Theme().getAccentColor(getContext()), PorterDuff.Mode.SRC_IN);
    // edtSearch = view.findViewById(R.id.sfl_edt_search);
    edtSearch.setInputType(InputType.TYPE_CLASS_TEXT);
    // edtSearch.setFilters(new InputFilter[] {
    // new InputFilter() {
    // public CharSequence filter(CharSequence src, int start, int end, Spanned dst, int dstart, int dend) {
    // 
    // Log.e("qqqqqq", src + "  " + start + "  " + end + "    " + dst + "   " + dstart + "    " + dend);
    // 
    // if (src.equals("") || (dst.length() == 0 && src.equals("@"))) {
    // return src;
    // }
    // if (src.toString().matches("\\w")) {
    // return src;
    // }
    // return "";
    // }
    // }
    // });
    edtSearch.setText("@");
    edtSearch.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            int strSize = edtSearch.getText().toString().length();
            // filter some character
            if (strSize > 1) {
                String _str = edtSearch.getText().toString().substring(strSize - 1);
                if (!_str.matches("\\w")) {
                    edtSearch.setText(edtSearch.getText().subSequence(0, strSize - 1));
                    edtSearch.setSelection(edtSearch.getText().length());
                }
            }
            if (strSize > 5) {
                if (getRequestManager().isUserLogin()) {
                    if ((!edtSearch.getText().toString().equals(preventRepeatSearch))) {
                        itemAdapter.clear();
                        new RequestClientSearchUsername().clientSearchUsername(edtSearch.getText().toString().substring(1));
                        loadingProgressBar.setVisibility(View.VISIBLE);
                        preventRepeatSearch = edtSearch.getText().toString();
                    }
                } else {
                    HelperError.showSnackMessage(G.context.getString(R.string.there_is_no_connection_to_server), false);
                }
            }
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (edtSearch.getText().length() == 0 || !edtSearch.getText().toString().substring(0, 1).equals("@")) {
                edtSearch.setText("@");
                edtSearch.setSelection(1);
            }
        }
    });
    edtSearch.requestFocus();
    InputMethodManager imm = (InputMethodManager) G.context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(edtSearch, InputMethodManager.SHOW_IMPLICIT);
    /*
        MaterialDesignTextView btnBack = (MaterialDesignTextView) view.findViewById(R.id.sfl_btn_back);
        final RippleView rippleBack = (RippleView) view.findViewById(R.id.sfl_ripple_back);
        rippleBack.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
            @Override
            public void onComplete(RippleView rippleView) {

                InputMethodManager imm = (InputMethodManager) G.fragmentActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(rippleBack.getWindowToken(), 0);
                //G.fragmentActivity.getSupportFragmentManager().beginTransaction().remove(FragmentIgapSearch.this).commit();
                G.fragmentActivity.onBackPressed();
            }
        });
        */
    // btnClose = (MaterialDesignTextView) view.findViewById(R.id.sfl_btn_close);
    btnClose.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            edtSearch.setText("@");
            edtSearch.setSelection(1);
        }
    });
    // rippleDown = view.findViewById(R.id.sfl_ripple_done);
    rippleDown.setEnabled(false);
    rippleDown.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {

        @Override
        public void onComplete(RippleView rippleView) {
        }
    });
    recyclerView = view.findViewById(R.id.sfl_recycleview);
}
Also used : RequestClientSearchUsername(net.iGap.request.RequestClientSearchUsername) InputMethodManager(android.view.inputmethod.InputMethodManager) RippleView(net.iGap.libs.rippleeffect.RippleView) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) MaterialDesignTextView(net.iGap.module.MaterialDesignTextView) TextView(android.widget.TextView) RippleView(net.iGap.libs.rippleeffect.RippleView) Theme(net.iGap.module.Theme) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

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