EnhancedListView SwipeRefreshLayout

Я использую SwipeRefreshLayout и EnhancedListView, чтобы объединить их, как GMAIL-App. Когда я начинаю проводить по горизонтали, я все еще могу проводить по вертикали. В этом случае анимация из EnhancedListView зависла и не сбрасывается и не прокручивается до конца, если я не завершаю вертикальный (SwipeRefreshLayout) пролистывание.

Я вижу, что сначала потянуть, чтобы обновить, а затем swipeToDismiss не работает. Только сначала проведите пальцем, а затем обновите. Так что я предполагаю, что речь идет о том, чтобы быть родительским элементом.

Возможное решение, о котором я думал: проверьте горизонтальную прокрутку и отключите SwipeRefreshLayout с помощью swipeL.setEnabled(false); По окончании swipeL.setEnabled(true); Но не могу найти где его отключить и включить.

Мой макет:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:background="#0A756E"
    android:gravity="center" >

    <LinearLayout
        android:id="@+id/ll_archiv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/greenbox" >

        <TextView
            android:id="@+id/tv_archiv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="10dp"
            android:paddingTop="10dp"
            android:text="@string/archiv"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#fff" />
    </LinearLayout>
</RelativeLayout>

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipe_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <de.android.voucheroo.utils.EnhancedListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/footer"
        android:layout_alignParentTop="true"
        android:descendantFocusability="blocksDescendants" >
    </de.android.voucheroo.utils.EnhancedListView>
</android.support.v4.widget.SwipeRefreshLayout>

My Code:

    swipeL = (SwipeRefreshLayout) getActivity().findViewById(
            R.id.swipe_container);
    ll_archiv = (LinearLayout) getActivity().findViewById(R.id.ll_archiv);
    tv_archiv = (TextView) getActivity().findViewById(R.id.tv_archiv);
    elv = (EnhancedListView) getActivity().findViewById(android.R.id.list);
    elv.setDismissCallback(new OnDismissCallback() {

        @Override
        public Undoable onDismiss(EnhancedListView listView,
                final int position) {
            try {
                final Object vouch = voucher.get(position);
                voucher.remove(position);
                adapter.notifyDataSetChanged();
                return new EnhancedListView.Undoable() {

                    @Override
                    public void undo() {
                        voucher.add(position, vouch);
                        adapter.notifyDataSetChanged();
                    }

                    // Return a string for your item
                    @Override
                    public String getTitle() {
                        return "foo";
                    }

                    // Delete item completely from your persistent storage
                    @Override
                    public void discard() {
                        [...];
                    }
                };
            } catch (Exception e) {
                Log.w("ELV_EXCEPTION", e.getMessage());
                e.getStackTrace();
                return null;
            }
        }
    });
    swipeL.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            [...]
            swipeL.setRefreshing(false);
        }
    });

    // Handler
    elv.enableSwipeToDismiss();
    elv.setSwipingLayout(R.id.ll_parent);
    elv.setUndoStyle(UndoStyle.MULTILEVEL_POPUP);

person Friedolino    schedule 28.07.2014    source источник


Ответы (1)


Сегодня я знаю ответ на свой вопрос. Это не проблема моего кода, это проблема SwipeRefreshView.

Есть аналогичный вопрос с той же проблемой, которую я нашел здесь: SO-Answer

person Friedolino    schedule 21.08.2014