This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix unable to select items in a multi-picklist #953 * Create a constant for the listview item height
- Loading branch information
1 parent
9027410
commit f76a9d8
Showing
4 changed files
with
157 additions
and
94 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomListView.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,63 @@ | ||
package org.mozilla.vrbrowser.ui.views; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.util.Log; | ||
import android.view.MotionEvent; | ||
import android.view.View; | ||
import android.widget.ListView; | ||
|
||
import org.mozilla.vrbrowser.R; | ||
|
||
public class CustomListView extends ListView { | ||
public CustomListView(Context context) { | ||
super(context); | ||
initialize(); | ||
} | ||
|
||
public CustomListView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
initialize(); | ||
} | ||
|
||
public CustomListView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
initialize(); | ||
} | ||
|
||
public CustomListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
super(context, attrs, defStyleAttr, defStyleRes); | ||
initialize(); | ||
} | ||
|
||
void initialize() { | ||
setVerticalScrollBarEnabled(false); | ||
setFastScrollAlwaysVisible(false); | ||
} | ||
|
||
@Override | ||
public boolean isInTouchMode() { | ||
// Fixes unable to select items after scrolling. See https://github.com/MozillaReality/FirefoxReality/issues/953. | ||
return true; | ||
} | ||
|
||
@Override | ||
protected void onLayout(boolean changed, int l, int t, int r, int b) { | ||
super.onLayout(changed, l, t, r, b); | ||
|
||
boolean scrollVisible = false; | ||
|
||
if (getChildCount() > 0) { | ||
View first = getChildAt(0); | ||
View last = getChildAt(getChildCount() - 1); | ||
if (first.getTop() < 0 || last.getBottom() > getHeight()) { | ||
scrollVisible = true; | ||
} | ||
} | ||
|
||
setVerticalScrollBarEnabled(scrollVisible); | ||
setFastScrollAlwaysVisible(scrollVisible); | ||
} | ||
|
||
|
||
} |
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
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
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