Search in sources :

Example 6 with RippleView

use of net.iGap.libs.rippleeffect.RippleView in project iGap-Android by KianIranian-STDG.

the class ShowMediaListener method initComponent.

private void initComponent(View view, List<RealmRoomMessage> roomMessages) {
    RippleView rippleBackBtn = view.findViewById(R.id.asi_ripple_back);
    rippleBackBtn.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {

        @Override
        public void onComplete(RippleView rippleView) {
            G.fragmentActivity.getSupportFragmentManager().popBackStackImmediate();
        }
    });
    RippleView rippleMenu = view.findViewById(R.id.asi_ripple_menu);
    rippleMenu.setOnRippleCompleteListener(rippleView -> popUpMenuTopSheet(roomMessages.get(selectedFile)));
    imgPlay = view.findViewById(R.id.imgPlay);
    viewPager = view.findViewById(R.id.asi_view_pager);
    contentNumberTv = view.findViewById(R.id.asi_txt_image_number);
    toolbarLl = view.findViewById(R.id.toolbarShowContent);
    room = DbManager.getInstance().doRealmTask(realm -> {
        return realm.where(RealmRoom.class).equalTo("id", roomMessages.get(selectedFile).roomId).findFirst();
    });
    imgPlay.setOnClickListener(v -> {
        if (exoPlayer.isPlaying()) {
            exoPlayer.pause();
        } else {
            exoPlayer.setPlayWhenReady(true);
        }
    });
    initViewPager(roomMessages);
}
Also used : ImageButton(android.widget.ImageButton) LinearLayout(android.widget.LinearLayout) Arrays(java.util.Arrays) Bundle(android.os.Bundle) AppUtils(net.iGap.module.AppUtils) NonNull(androidx.annotation.NonNull) ProtoFileDownload(net.iGap.proto.ProtoFileDownload) WindowManager(android.view.WindowManager) Player(com.google.android.exoplayer2.Player) SimpleExoPlayer(com.google.android.exoplayer2.SimpleExoPlayer) MessageProgress(net.iGap.messageprogress.MessageProgress) G(net.iGap.G) RealmUserInfo(net.iGap.realm.RealmUserInfo) LayoutTransition(android.animation.LayoutTransition) Fragment(androidx.fragment.app.Fragment) View(android.view.View) HelperError(net.iGap.helper.HelperError) RecyclerView(androidx.recyclerview.widget.RecyclerView) RealmConstants(net.iGap.realm.RealmConstants) DefaultDataSourceFactory(com.google.android.exoplayer2.upstream.DefaultDataSourceFactory) MediaItem(com.google.android.exoplayer2.MediaItem) HelperCalander(net.iGap.helper.HelperCalander) Status(net.iGap.module.downloader.Status) ScrollingMovementMethod(android.text.method.ScrollingMovementMethod) RealmRoom(net.iGap.realm.RealmRoom) Downloader(net.iGap.module.downloader.Downloader) ViewGroup(android.view.ViewGroup) HelperLog(net.iGap.helper.HelperLog) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) RealmRegisteredInfo(net.iGap.realm.RealmRegisteredInfo) ConstraintLayout(androidx.constraintlayout.widget.ConstraintLayout) MusicPlayer(net.iGap.module.MusicPlayer) HttpRequest(net.iGap.module.downloader.HttpRequest) IDownloader(net.iGap.module.downloader.IDownloader) Sort(io.realm.Sort) EventManager(net.iGap.observers.eventbus.EventManager) DownloadObject(net.iGap.module.downloader.DownloadObject) Typeface(android.graphics.Typeface) EmojiManager(net.iGap.libs.emojiKeyboard.emoji.EmojiManager) AttachmentObject(net.iGap.structs.AttachmentObject) RippleView(net.iGap.libs.rippleeffect.RippleView) AndroidUtils(net.iGap.module.AndroidUtils) ResourcesCompat(androidx.core.content.res.ResourcesCompat) ProgressiveMediaSource(com.google.android.exoplayer2.source.ProgressiveMediaSource) AccountManager(net.iGap.module.accountManager.AccountManager) Intent(android.content.Intent) ViewPager2(androidx.viewpager2.widget.ViewPager2) PlayerView(com.google.android.exoplayer2.ui.PlayerView) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Toast(android.widget.Toast) ImageLoadingServiceInjector(net.iGap.module.imageLoaderService.ImageLoadingServiceInjector) SparseArrayCompat(androidx.collection.SparseArrayCompat) RealmRoomMessage(net.iGap.realm.RealmRoomMessage) WeakReference(java.lang.ref.WeakReference) VerticalSwipeBackLayout(net.iGap.libs.swipeback.VerticalSwipeBackLayout) AbstractMessage(com.google.protobuf.AbstractMessage) HelperDownloadFile(net.iGap.helper.HelperDownloadFile) LayoutInflater(android.view.LayoutInflater) MessageObject(net.iGap.structs.MessageObject) PhotoView(com.github.chrisbanes.photoview.PhotoView) TextUtils(android.text.TextUtils) TopSheetDialog(net.iGap.module.dialog.topsheet.TopSheetDialog) File(java.io.File) RealmAvatar(net.iGap.realm.RealmAvatar) HelperSaveFile(net.iGap.helper.HelperSaveFile) Configuration(android.content.res.Configuration) ProtoGlobal(net.iGap.proto.ProtoGlobal) ViewTreeObserver(android.view.ViewTreeObserver) R(net.iGap.R) RoomObject(net.iGap.helper.RoomObject) DbManager(net.iGap.module.accountManager.DbManager) RealmRoom(net.iGap.realm.RealmRoom) RippleView(net.iGap.libs.rippleeffect.RippleView)

Example 7 with RippleView

use of net.iGap.libs.rippleeffect.RippleView 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

RippleView (net.iGap.libs.rippleeffect.RippleView)7 View (android.view.View)5 TextView (android.widget.TextView)5 LinearLayout (android.widget.LinearLayout)4 Bundle (android.os.Bundle)3 RecyclerView (androidx.recyclerview.widget.RecyclerView)3 File (java.io.File)3 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 LayoutInflater (android.view.LayoutInflater)2 ViewGroup (android.view.ViewGroup)2 ImageView (android.widget.ImageView)2 ProgressBar (android.widget.ProgressBar)2 Toast (android.widget.Toast)2 Nullable (androidx.annotation.Nullable)2 PhotoView (com.github.chrisbanes.photoview.PhotoView)2 Sort (io.realm.Sort)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 G (net.iGap.G)2