-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionNestedScrollView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.schabi.newpipe.fragments.detail; | ||
|
||
import android.content.Context; | ||
import android.graphics.Rect; | ||
import android.util.AttributeSet; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.core.widget.NestedScrollView; | ||
|
||
/** | ||
* The behaviour of this scroll view is exactly equal to that of {@link NestedScrollView} except | ||
* that it does not scroll automatically to give focus to views (unwanted since everything would | ||
* move around when clicking on links, see #5453). | ||
*/ | ||
public class DescriptionNestedScrollView extends NestedScrollView { | ||
|
||
public DescriptionNestedScrollView(@NonNull final Context context) { | ||
super(context); | ||
} | ||
|
||
public DescriptionNestedScrollView(@NonNull final Context context, | ||
@Nullable final AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public DescriptionNestedScrollView(@NonNull final Context context, | ||
@Nullable final AttributeSet attrs, | ||
final int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
@Override | ||
protected int computeScrollDeltaToGetChildRectOnScreen(final Rect rect) { | ||
// Override this to return always 0 so that the description scroll view is not scrolled | ||
// around when the user presses on a link | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void scrollTo(final int x, final int y) { | ||
// Override this to prevent any scrolling | ||
} | ||
|
||
@Override | ||
public void scrollBy(final int x, final int y) { | ||
// Override this to prevent any scrolling | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters