Search in sources :

Example 11 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project nmid-headline by miao1007.

the class SlideInOutBottomItemAnimator method animateRemoveImpl.

protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    ViewCompat.animate(view).setDuration(getRemoveDuration()).translationY(+mDeltaY).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationEnd(View view) {
            ViewCompat.setTranslationY(view, +mDeltaY);
            dispatchRemoveFinished(holder);
            mRemoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
    mRemoveAnimations.add(holder);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 12 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project nmid-headline by miao1007.

the class SlideInOutBottomItemAnimator method animateAddImpl.

protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    ViewCompat.animate(view).cancel();
    ViewCompat.animate(view).translationY(0).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationCancel(View view) {
            ViewCompat.setTranslationY(view, 0);
        }

        @Override
        public void onAnimationEnd(View view) {
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
    mAddAnimations.add(holder);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 13 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project nmid-headline by miao1007.

the class BaseItemAnimator method animateMoveImpl.

protected void animateMoveImpl(final RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    final View view = holder.itemView;
    final int deltaX = toX - fromX;
    final int deltaY = toY - fromY;
    ViewCompat.animate(view).cancel();
    if (deltaX != 0) {
        ViewCompat.animate(view).translationX(0);
    }
    if (deltaY != 0) {
        ViewCompat.animate(view).translationY(0);
    }
    // TODO: make EndActions end listeners instead, since end actions aren't called when
    // vpas are canceled (and can't end them. why?)
    // need listener functionality in VPACompat for this. Ick.
    ViewCompat.animate(view).setDuration(getMoveDuration()).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationCancel(View view) {
            if (deltaX != 0) {
                ViewCompat.setTranslationX(view, 0);
            }
            if (deltaY != 0) {
                ViewCompat.setTranslationY(view, 0);
            }
        }

        @Override
        public void onAnimationEnd(View view) {
            dispatchMoveFinished(holder);
            mMoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
    mMoveAnimations.add(holder);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 14 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project Signal-Android by WhisperSystems.

the class RecyclerViewPositionHelper method findOneVisibleChild.

View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) {
    OrientationHelper helper;
    if (layoutManager.canScrollVertically()) {
        helper = OrientationHelper.createVerticalHelper(layoutManager);
    } else {
        helper = OrientationHelper.createHorizontalHelper(layoutManager);
    }
    final int start = helper.getStartAfterPadding();
    final int end = helper.getEndAfterPadding();
    final int next = toIndex > fromIndex ? 1 : -1;
    View partiallyVisible = null;
    for (int i = fromIndex; i != toIndex; i += next) {
        final View child = layoutManager.getChildAt(i);
        final int childStart = helper.getDecoratedStart(child);
        final int childEnd = helper.getDecoratedEnd(child);
        if (childStart < end && childEnd > start) {
            if (completelyVisible) {
                if (childStart >= start && childEnd <= end) {
                    return child;
                } else if (acceptPartiallyVisible && partiallyVisible == null) {
                    partiallyVisible = child;
                }
            } else {
                return child;
            }
        }
    }
    return partiallyVisible;
}
Also used : OrientationHelper(android.support.v7.widget.OrientationHelper) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 15 with START

use of android.support.v7.widget.helper.ItemTouchHelper.START in project NewPipe by TeamNewPipe.

the class ChannelActivity method requestData.

private void requestData(final boolean onlyVideos) {
    // start processing
    isLoading = true;
    if (!onlyVideos) {
        //delete already displayed content
        progressBar.setVisibility(View.VISIBLE);
        infoListAdapter.clearSteamItemList();
        pageNumber = 0;
        subscriberLayout.setVisibility(View.GONE);
        titleView.setText("");
        getSupportActionBar().setTitle("");
        if (SDK_INT >= 21) {
            channelBanner.setImageDrawable(getDrawable(R.drawable.channel_banner));
            avatarView.setImageDrawable(getDrawable(R.drawable.buddy));
        }
        infoListAdapter.showFooter(false);
    }
    Thread channelExtractorThread = new Thread(new Runnable() {

        Handler h = new Handler();

        @Override
        public void run() {
            StreamingService service = null;
            try {
                service = NewPipe.getService(serviceId);
                ChannelExtractor extractor = service.getChannelExtractorInstance(channelUrl, pageNumber);
                final ChannelInfo info = ChannelInfo.getInfo(extractor);
                h.post(new Runnable() {

                    @Override
                    public void run() {
                        isLoading = false;
                        if (!onlyVideos) {
                            updateUi(info);
                            infoListAdapter.showFooter(true);
                        }
                        hasNextPage = info.hasNextPage;
                        if (!hasNextPage) {
                            infoListAdapter.showFooter(false);
                        }
                        addVideos(info);
                    }
                });
                // look for non critical errors during extraction
                if (info != null && !info.errors.isEmpty()) {
                    Log.e(TAG, "OCCURRED ERRORS DURING EXTRACTION:");
                    for (Throwable e : info.errors) {
                        e.printStackTrace();
                        Log.e(TAG, "------");
                    }
                    View rootView = findViewById(android.R.id.content);
                    ErrorActivity.reportError(h, ChannelActivity.this, info.errors, null, rootView, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, 0));
                }
            } catch (IOException ioe) {
                postNewErrorToast(h, R.string.network_error);
                ioe.printStackTrace();
            } catch (ParsingException pe) {
                ErrorActivity.reportError(h, ChannelActivity.this, pe, VideoItemDetailFragment.class, null, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, R.string.parsing_error));
                h.post(new Runnable() {

                    @Override
                    public void run() {
                        ChannelActivity.this.finish();
                    }
                });
                pe.printStackTrace();
            } catch (ExtractionException ex) {
                String name = "none";
                if (service != null) {
                    name = service.getServiceInfo().name;
                }
                ErrorActivity.reportError(h, ChannelActivity.this, ex, VideoItemDetailFragment.class, null, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, name, channelUrl, R.string.parsing_error));
                h.post(new Runnable() {

                    @Override
                    public void run() {
                        ChannelActivity.this.finish();
                    }
                });
                ex.printStackTrace();
            } catch (Exception e) {
                ErrorActivity.reportError(h, ChannelActivity.this, e, VideoItemDetailFragment.class, null, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, R.string.general_error));
                h.post(new Runnable() {

                    @Override
                    public void run() {
                        ChannelActivity.this.finish();
                    }
                });
                e.printStackTrace();
            }
        }
    });
    channelExtractorThread.start();
}
Also used : Handler(android.os.Handler) ChannelInfo(org.schabi.newpipe.extractor.channel.ChannelInfo) StreamingService(org.schabi.newpipe.extractor.StreamingService) IOException(java.io.IOException) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ParsingException(org.schabi.newpipe.extractor.exceptions.ParsingException) ExtractionException(org.schabi.newpipe.extractor.exceptions.ExtractionException) IOException(java.io.IOException) ChannelExtractor(org.schabi.newpipe.extractor.channel.ChannelExtractor) ExtractionException(org.schabi.newpipe.extractor.exceptions.ExtractionException) ParsingException(org.schabi.newpipe.extractor.exceptions.ParsingException)

Aggregations

View (android.view.View)367 RecyclerView (android.support.v7.widget.RecyclerView)271 TextView (android.widget.TextView)175 Intent (android.content.Intent)109 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)84 Toolbar (android.support.v7.widget.Toolbar)77 TextWatcher (android.text.TextWatcher)77 Editable (android.text.Editable)76 ImageView (android.widget.ImageView)76 ArrayList (java.util.ArrayList)68 Bundle (android.os.Bundle)48 DialogInterface (android.content.DialogInterface)47 AlertDialog (android.support.v7.app.AlertDialog)47 AdapterView (android.widget.AdapterView)46 EditText (android.widget.EditText)42 SuppressLint (android.annotation.SuppressLint)39 Button (android.widget.Button)39 ActionBar (android.support.v7.app.ActionBar)34 List (java.util.List)34 ViewPropertyAnimatorCompat (android.support.v4.view.ViewPropertyAnimatorCompat)33