Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
[library] Change TwoWayView to be less opinionated about scrollbars
Browse files Browse the repository at this point in the history
Fixes #24, #38, #46, #48, #70
  • Loading branch information
lucasr committed Jul 7, 2014
1 parent c42d5c0 commit 917e0f3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 84 deletions.
9 changes: 0 additions & 9 deletions library/src/main/java/org/lucasr/twowayview/TwoWayView.java
Expand Up @@ -388,7 +388,6 @@ public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
initializeScrollbars(a);

mDrawSelectorOnTop = a.getBoolean(
R.styleable.TwoWayView_android_drawSelectorOnTop, false);
Expand All @@ -409,8 +408,6 @@ public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
}

a.recycle();

updateScrollbarsDirection();
}

public void setOrientation(Orientation orientation) {
Expand All @@ -421,7 +418,6 @@ public void setOrientation(Orientation orientation) {

mIsVertical = isVertical;

updateScrollbarsDirection();
resetState();
mRecycler.clear();

Expand Down Expand Up @@ -2967,11 +2963,6 @@ private boolean contentFits() {
getChildEndEdge(last) <= getEndEdge());
}

private void updateScrollbarsDirection() {
setHorizontalScrollBarEnabled(!mIsVertical);
setVerticalScrollBarEnabled(mIsVertical);
}

private void triggerCheckForTap() {
if (mPendingCheckForTap == null) {
mPendingCheckForTap = new CheckForTap();
Expand Down
79 changes: 4 additions & 75 deletions library/src/main/res/values/attrs.xml
Expand Up @@ -16,83 +16,12 @@
-->

<resources>
<declare-styleable name="TwoWayView">

<!-- Imported from View -->
<attr name="android:id"/>
<attr name="android:tag"/>
<attr name="android:scrollX"/>
<attr name="android:scrollY"/>
<attr name="android:background"/>
<attr name="android:padding"/>
<attr name="android:paddingLeft"/>
<attr name="android:paddingTop"/>
<attr name="android:paddingRight"/>
<attr name="android:paddingBottom"/>
<attr name="android:paddingStart"/>
<attr name="android:paddingEnd"/>
<attr name="android:focusable"/>
<attr name="android:focusableInTouchMode"/>
<attr name="android:visibility"/>
<attr name="android:fitsSystemWindows"/>
<attr name="android:scrollbars"/>
<attr name="android:scrollbarStyle"/>
<attr name="android:isScrollContainer"/>
<attr name="android:fadeScrollbars"/>
<attr name="android:scrollbarFadeDuration"/>
<attr name="android:scrollbarDefaultDelayBeforeFade"/>
<attr name="android:scrollbarSize"/>
<attr name="android:scrollbarThumbHorizontal"/>
<attr name="android:scrollbarThumbVertical"/>
<attr name="android:scrollbarTrackHorizontal"/>
<attr name="android:scrollbarTrackVertical"/>
<attr name="android:scrollbarAlwaysDrawHorizontalTrack"/>
<attr name="android:scrollbarAlwaysDrawVerticalTrack"/>
<attr name="android:fadingEdge"/>
<attr name="android:requiresFadingEdge"/>
<attr name="android:fadingEdgeLength"/>
<attr name="android:nextFocusLeft"/>
<attr name="android:nextFocusRight"/>
<attr name="android:nextFocusUp"/>
<attr name="android:nextFocusDown"/>
<attr name="android:nextFocusForward"/>
<attr name="android:clickable"/>
<attr name="android:longClickable"/>
<attr name="android:saveEnabled"/>
<attr name="android:filterTouchesWhenObscured"/>
<attr name="android:drawingCacheQuality"/>
<attr name="android:keepScreenOn"/>
<attr name="android:duplicateParentState"/>
<attr name="android:minHeight"/>
<attr name="android:minWidth"/>
<attr name="android:soundEffectsEnabled"/>
<attr name="android:hapticFeedbackEnabled"/>
<attr name="android:contentDescription"/>
<attr name="android:onClick"/>
<attr name="android:overScrollMode"/>
<attr name="android:alpha"/>
<attr name="android:translationX"/>
<attr name="android:translationY"/>
<attr name="android:transformPivotX"/>
<attr name="android:transformPivotY"/>
<attr name="android:rotation"/>
<attr name="android:rotationX"/>
<attr name="android:rotationY"/>
<attr name="android:scaleX"/>
<attr name="android:scaleY"/>
<attr name="android:verticalScrollbarPosition"/>
<attr name="android:layerType"/>
<attr name="android:layoutDirection"/>
<attr name="android:textDirection"/>
<attr name="android:textAlignment"/>

<!-- Imported from Android -->
<declare-styleable name="TwoWayView">
<attr name="android:orientation"/>

<!-- Imported from AbsListView -->
<attr name="android:choiceMode"/>
<attr name="android:drawSelectorOnTop"/>
<attr name="android:listSelector"/>

<attr name="android:drawSelectorOnTop"/>
</declare-styleable>
</resources>

</resources>
1 change: 1 addition & 0 deletions sample/src/main/res/values-land/styles.xml
Expand Up @@ -19,6 +19,7 @@

<style name="TwoWayView">
<item name="android:orientation">horizontal</item>
<item name="android:scrollbars">horizontal</item>
</style>

</resources>
1 change: 1 addition & 0 deletions sample/src/main/res/values-port/styles.xml
Expand Up @@ -19,6 +19,7 @@

<style name="TwoWayView">
<item name="android:orientation">vertical</item>
<item name="android:scrollbars">vertical</item>
</style>

</resources>

0 comments on commit 917e0f3

Please sign in to comment.