Giter VIP home page Giter VIP logo

twoway-view's Introduction

TwoWayView

RecyclerView made simple.

Features

  • A LayoutManager base class that greatly simplifies the development of custom layouts for RecyclerView
  • A collection of feature-complete stock layouts including:
    • List
    • Grid
    • Staggered Grid
    • Spannable Grid
  • A collection of stock item decorations including:
    • Item spacing
    • Horizontal/vertical dividers.
  • ListView-style pluggable APIs for:
    • Item click and long click support e.g. OnItemClickListener and OnItemLongClickListener.
    • Item selection (single and multiple) support e.g. setChoiceMode(), setItemChecked(int, boolean), etc.

Snapshot

The new API is still under heavy development but you can try it now via Maven Central snapshots.

Gradle:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile 'org.lucasr.twowayview:core:1.0.0-SNAPSHOT@aar'
    compile 'org.lucasr.twowayview:layouts:1.0.0-SNAPSHOT@aar'
}

Stable Release

TwoWayView used to be a standalone AdapterView implementation. You can grab it here from Maven Central as follows.

Grab via Maven:

<dependency>
  <groupId>org.lucasr.twowayview</groupId>
  <artifactId>twowayview</artifactId>
  <version>0.1.4</version>
</dependency>

Gradle:

compile 'org.lucasr.twowayview:twowayview:0.1.4'

If you are using ProGuard add the following line to the rules:

-keep class org.lucasr.twowayview.** { *; }

Want to help?

File new issues to discuss specific aspects of the API and to propose new features.

License

Copyright (C) 2013 Lucas Rocha

TwoWayView's code is based on bits and pieces of Android's
AbsListView, Listview, and StaggeredGridView.

Copyright (C) 2012 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

twoway-view's People

Contributors

codebutler avatar eveliotc avatar frogermcs avatar jacek-marchwicki avatar josh-burton avatar lucasr avatar oxc avatar paulsowden avatar wabbawabbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twoway-view's Issues

How to add stackFromBottom attribute in twoway-view?

I see the stackFromBottom method in AbsListView which extends AdapterView. Also, the twoway-view extends AdapterView. But there's no stackFromBottom method it.

So there's the question:

How to add stackFromBottom attribute in it? Or there's another method to use?

Implement Endless list

Can you please implement functionality of Endless list with this Twoway- view so for huge data loading its good to use.

Thanks
Nkpatel

NullPointerException while flinging in horizontal mode

Hi,
I was playing with the sample in the emulator with android 4.2.
I changed the list_item width to 50dp and changed the orientation of the TwoWayView to horizontal.
While flinging the view, I rapidly get a NullPointerException with the following stacktrace :

03-17 21:30:14.939: ERROR/AndroidRuntime(2108): FATAL EXCEPTION: main
        java.lang.NullPointerException
        at org.lucasr.twowayview.TwoWayView.fillGap(TwoWayView.java:3456)
        at org.lucasr.twowayview.TwoWayView.trackMotionScroll(TwoWayView.java:1924)
        at org.lucasr.twowayview.TwoWayView.computeScroll(TwoWayView.java:1982)
        at android.view.View.getDisplayList(View.java:12633)
        at android.view.View.getDisplayList(View.java:12689)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
        at android.view.View.getDisplayList(View.java:12583)
        at android.view.View.getDisplayList(View.java:12689)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
        at android.view.View.getDisplayList(View.java:12583)
        at android.view.View.getDisplayList(View.java:12689)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
        at android.view.View.getDisplayList(View.java:12583)
        at android.view.View.getDisplayList(View.java:12689)
        at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1198)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2173)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
        at android.view.Choreographer.doCallbacks(Choreographer.java:562)
        at android.view.Choreographer.doFrame(Choreographer.java:532)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
        at android.os.Handler.handleCallback(Handler.java:725)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5039)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
        at dalvik.system.NativeStart.main(Native Method)

Cheers

padding head and tail with android:clipToPadding="false"

I need to leave static empty space at the two ends of the list view, for a vertical list view, I'd do:

    android:paddingTop="100dp"
    android:paddingBottom="100dp"
    android:clipToPadding="false"

(Detail: http://stackoverflow.com/questions/13366281/how-can-i-add-blank-space-to-the-end-of-a-listview/21842756#21842756)

But this doesn't work with TwoWay-view, the list items get rendered weird, can you please look into this?

BTW, I also tried out sephiroth74/HorizontalVariableListView, his implementation is more feature complete, but the his HListView is not extended from AdapterView/AbaListView. And your implementation can specify orientation, so that I could use horizontal for portrait screen, and vertical for landscape screen. Good stuff, thanks!

Extensive logging

What about some debug flag that enables/disables the logging?
Default value could be BuildConfig.DEBUG.

Implement smoothScrollBy, smoothScrollToPosition

Thanks for this excellent library, the Android development world needs a good horizontal listview implementation.

Any chance that the smoothScrollBy/smoothScrollToPosition methods will be implemented in this library?

As far as I can see, this is one of the few remaining features needed to make the twoway-view match the functionality of the standard Android listview.

NoClassDefFoundError while trying to run demo project

I am getting an exception while trying to run demo project

Caused by: java.lang.NoClassDefFoundError: android.support.v4.widget.EdgeEffectCompat
at org.lucasr.twowayview.TwoWayView.setOverScrollMode(TwoWayView.java:936)
at android.view.View.(View.java:3237)
at android.view.View.(View.java:3295)
at android.view.ViewGroup.(ViewGroup.java:427)
at android.widget.AdapterView.(AdapterView.java:235)
at org.lucasr.twowayview.TwoWayView.(TwoWayView.java:287)
at org.lucasr.twowayview.TwoWayView.(TwoWayView.java:283)

Fatal exception: The observer is null

I have implemented sample adapter with 2 types of entries.
The twowayview is looking something like this:
twowayview

Everything works fine for now, but sometimes suddenly this exception is thrown:
ERROR/AndroidRuntime(25175): FATAL EXCEPTION: main
java.lang.IllegalArgumentException: The observer is null.
at android.database.Observable.unregisterObserver(Observable.java:64)
at android.widget.BaseAdapter.unregisterDataSetObserver(BaseAdapter.java:42)
at com.dudu.android.views.TwoWayView.setAdapter(TwoWayView.java:706)

What could be the reason for this?

Can't set the currently selected item

I'm trying to set the currently selected item when I do a rotation, so I'm using the method .setSelection but do nothing ... It's a bug?

UPDATE: Please close... my fault! sorry :(

Programmatically scroll

What I would like to achieve is to "synch" the horizontal scrolling of the TwoWayView with an horizontal SeekBar displayed at the bottom of the activity screen. Here's what I've done so far:

  1. Set the maximum of the seekbar to listview.computedTotalWidth - listview.getWidth
  2. Handle the seekbar.onProgress event to set listview.scrollX to seekbar.progress
  3. Handle listview.onScroll event to set seekbar.progress to listview.scrollX

Unfortunately, this method does not work well since the TwoWayView does not override the getScrollX and setScrollX method.

I then tried to replace the getScrollX and setScrollX methods my own custom methods that uses TwoWayView internal mScroller instance. Here is the code:

public int getScroll() {

    final int pos;

    mScroller.computeScrollOffset();

    if (mIsVertical) {

        pos = mScroller.getCurrY();

    } else {

        pos = mScroller.getCurrX();

    }

    return pos;

}



public void scrollTo(int value) {

    if (mIsVertical) {

        mScroller.setFinalY(value);

    } else {

        mScroller.setFinalX(value);

    }

    computeScroll();

}

But for some reason, my getScroll method return positive and negative values, from -2000 to +2000...

That said, I really need your help. I'm sure there is an easy way to implement the method I need to sync the listview scroll offset to the seekbar. I just don't know the internal workings of your component well enough to do it myself.

Thanks a lot for your help and have a nice day.

Maven does not compile

Using Maven won't work as the support library requested does not have all of the functions.

I fixed this myself by changingg the android support library dependency to this:

<dependency>
  <groupId>android.support</groupId>
  <artifactId>compatibility-v4</artifactId>
  <version>11</version>
</dependency>

Please note that you need to deploy it yourself using https://github.com/mosabua/maven-android-sdk-deployer

All items are visible

Hi,

Methods getFirstVisiblePosition() and getLastVisiblePosition() returns 0 and list.size(). So my Adapter downloading all images, even if they are not visible.

Feature?

Inflated view layout params are not taking effect

I am inflating the TwoWayView with ImageViews.
Layout looks like this (I am using SmartImageView):
<com.loopj.android.image.SmartImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="80dp"
android:layout_height="80dp"
/>

And here is the inflating code in getView() method of the adapter:
if (convertView == null) {
switch (getItemViewType(position)) {
case 0:
convertView = mInflater.inflate(R.layout.photo_stream_counter, null);
break;
case 1:
convertView = mInflater.inflate(R.layout.photo_stream_photo, null);
break;
default:
convertView = mInflater.inflate(R.layout.photo_stream_photo, null);
break;
}
}

But the size that I set up in xml is not taken in consideration when drawing the contents of TwoWayView. You can see it on screenshot:
twowayview

And if I set the layout params programmatically, like this:
case 1:
convertView = mInflater.inflate(R.layout.photo_stream_photo, null);
convertView.setLayoutParams(new TwoWayView.LayoutParams(imageSize, imageSize));
break;

first it looks fine:
twoway2

But when I try to scroll the view, it fails with exception:
ERROR/AndroidRuntime(703): FATAL EXCEPTION: main
java.lang.ClassCastException: com.dudu.android.views.CounterButton cannot be cast to com.loopj.android.image.SmartImageView
at com.dudu.android.main.profile.photostream.PhotoStreamAdapter.getView(PhotoStreamAdapter.java:53)
at com.dudu.android.views.TwoWayView.obtainView(TwoWayView.java:3880)

The first item in my TwoWayView is the CounterButton, showing the actual amount of photos. But somehow getView() receives it in convertView instead of SmartImageView.
If I don't resize the images, the scrolling works fine.

Remove the scrollbar

I am testing your two-way listview, really great :) is there a way to remove the scrollbar please ? thanks in advance

Allow scrolling from outside

I want to keep the views moving, e.g. images that slide through slowly without user interaction. If the user does touch events, that should be stopped.

Any thoughts how this could be achieved? I made a quick hack and made trackMotionScroll public, and periodically called it (like one pixel every 10ms).

Also, it would be nice to be notified when the user interacts with the view (e.g. touch). Like this, I'd be able to pause the automatic scrolling.

Item order is getting messed up

Check out the numbers in the screenshot: after 22 comes 33:
2way

Steps to preproduce: Scroll down some items; and scroll up again. Scrolling up seems to skip items.

Canvas: trying to use a recycled bitmap

Are there any ways to check the bitmap for being recycled?
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@40a1fd38, 109x87
at android.graphics.Canvas.throwIfRecycled(Canvas.java:973)
at android.graphics.Canvas.drawBitmap(Canvas.java:1062)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:332)
at android.widget.ImageView.onDraw(ImageView.java:943)
at android.view.View.draw(View.java:7014)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at org.lucasr.twowayview.TwoWayView.dispatchDraw(TwoWayView.java:3605)
at android.view.View.draw(View.java:7017)
at org.lucasr.twowayview.TwoWayView.draw(TwoWayView.java:3614)

change line 1395, for null adapter

change line 1395 to check if adapter is null using this

} else if (mMotionPosition >= 0 && mAdapter!=null && mAdapter.isEnabled(mMotionPosition)) {

otherwise this view detects touch events and crashes if the adapter was not set yet

measurement size is not reported correctly

I have implemented view like so

  <RelativeLayout android:layout_width="match_parent"
     android:layout_height="270dp">
     <org.lucasr.twowayview.TwoWayView
        android:id="@+id/twowayview_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:drawSelectorOnTop="false"
        android:orientation="horizontal"
        android:scrollbars="none"
        />
  </RelativeLayout>

what i tried to do is to make a fix height on the horizontal list view but the parent view does not seems detect it at it stated.
Please kindly fix it, many thanks!

Overscroll

Hey so I was hoping to override the overscroll mechanism to get a bounce effect.
Normally on ScrollViews I can just override overScrollBy and give it a custom max overscroll distance.
I've tried doing that with the overScrollByInternal call in this view, but it doesn't seem to do it.
Any ideas how this functionality can be achieved?

setChoiceMode(TwoWayView.ChoiceMode.SINGLE) doesn't work

I try to set ChoiceMode to ChoiceMode.SINGLE. I want to change background for custom item view when it selected and I wrote selector that checks android:state_activated="true". It doesn't work. The item gets default background every time.

The part of the custom item:

<TextView
            android:id="@+id/text1"
            android:layout_width="60dp"
            android:layout_height="50dp"
            android:layout_marginRight="15dp"
            android:background="@drawable/item_section_background_selector"
            android:textSize="12sp"
            android:gravity="center_horizontal|center_vertical"
            android:textColor="@android:color/black"
            android:text="Example"/>

Selector:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:drawable="@android:color/transparent"/>
    <item android:drawable="@drawable/section_background"/>
</selector>

CursorAdapter bindView method called constantly when only 10 items in the list.

I use LoaderCallbacks to populate a CursorAdaptor with the loaded cursor when it has finished loading and pass it to the TwoWay-View.

The TwoWay-View component is displaying correctly, but what I am seeing is that the CursorAdapter bindView method is being called constantly. It is called continuously even though there are only 10 items in the list and I am not moving/scrolling the list (actually I am not touching the screen at all).

This is a problem for me, because I download images (1 for each item in the list) and I am generating too many requests for http client calls. Even though the results for these calls are cached, this is not ideal. I didn't have this issue when using a GridView or a ListView for the exact same scenario.

Nullpointer Exception

While trying to inflate a custom layout, i'm getting a NullPointerException.

11-22 15:55:48.318: E/AndroidRuntime(20366): FATAL EXCEPTION: main
11-22 15:55:48.318: E/AndroidRuntime(20366): java.lang.NullPointerException
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.support.v4.view.ViewCompatJB.getImportantForAccessibility(ViewCompatJB.java:54)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.support.v4.view.ViewCompat$JBViewCompatImpl.getImportantForAccessibility(ViewCompat.java:481)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.support.v4.view.ViewCompat.getImportantForAccessibility(ViewCompat.java:837)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at org.lucasr.twowayview.TwoWayView.obtainView(TwoWayView.java:5344)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at org.lucasr.twowayview.TwoWayView.measureWidthOfChildren(TwoWayView.java:4710)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at org.lucasr.twowayview.TwoWayView.onMeasure(TwoWayView.java:3763)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1217)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.ScrollView.onMeasure(ScrollView.java:321)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5008)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2189)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.View.measure(View.java:15848)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1905)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1104)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1284)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.Choreographer.doFrame(Choreographer.java:532)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.os.Handler.handleCallback(Handler.java:730)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.os.Looper.loop(Looper.java:137)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at android.app.ActivityThread.main(ActivityThread.java:5103)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at java.lang.reflect.Method.invokeNative(Native Method)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at java.lang.reflect.Method.invoke(Method.java:525)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-22 15:55:48.318: E/AndroidRuntime(20366):    at dalvik.system.NativeStart.main(Native Method)

change highlight color on press

Hi.
Right now when I click on an item, I get green color highlight. Is there a way to disable that?
I know how to add selector, but the current green color gets mixed with my colors and turns ugly.
Thank you in advance.

Set divider

can i add android support divider on twowayview ? Did you add ?

Hide Scrollbars

I want to say thanks for this great lib, How can I hide scrollbars in this view?
Unfortunately android:scrollbars="none" not working!

Feature

Do you want to add OnScrollOnBottom and OnScrollOnTop function?
I think it will be useful,
because I start to wrote right now.

Horizontal programmatic scroll issues

Using the inherited method call scrollTo(int x,int y) DOES scroll the view, but any items in the list that were offscreen do not get drawn (invalidating, notifying change on adapter, nothing tried gets them drawn). So this list does scroll to where it is told, but the elements are undrawn and blank.

Using method defined in TwoWayView, scrollBy(int delta) does not appear to work on my horizontal scrolling TwoWayView. Does not appear to change the view at all. Looking at the source code I'm not seeing any obvious reason nothing happens, the list is populated (getChildCount() returns non-zero) and it does scroll with gestures and draws the items appropriately, etc.

Has anyone has accomplished programmatic scrolling with horizontal scroll direction successfully?

Keyboard focus & navigation

Hi,

We have started using this widget a few weeks ago. It works well in terms of performance, but we would need to have keyboard navigation and proper focus handling.

Are there plans to implement those? Is there any way that we could help?

ask a stupid question.

In Eclipse:
after I import the library and sample,
I found that your code is write on "java/org/lucar" not in "src//org/lucar",
then I always get ClassNotFoundException.
How do I change the default setting about that?

Imcompatible with Android 2.3.7 ?

Hi!

Is the library compatible with GINGERBREAD (API 10) ?

I've used it over a map, inside an viewpager, but it doesn't seems that it is compatible. Does anyone has information about it ?

Ps: Is there any news on the development of smoothScrollToPosition/By ?

Thanks.

android 2.3 animation of items works bad

There is a bug on one of my devices (LG gt540, android 2.3). I have horizontal list of images, that fetched from the server and when the image is loaded, fade_in animation is started.
On this device if list is not scrolling at the current moment, but image loaded and animation is started, list doesn't redraw this child view, so animation like "paused" on it's first frame. After that if we will scroll list(draw methods of list was called), than animation will play. I cant figure out why so that? For some reasons drawing methods of TwoWayView not called (I've checked with logcat), when animation is playing and when the list is not scrolling.
P.S. With default android listview and same adapter everything works good.

Scroll problems

On devices with small screen size and android 2.3, like Galaxy Gio GT-S5660, Galaxy Ace Duos GT-S6802 scroll dosen't work.

There is following code in the method private boolean maybeStartScrolling(int delta) every time return true:

if (Math.abs(delta) <= mTouchSlop && !isOverScroll)

Because mTouchSlop equal 12 (Galaxy Ace), or 16 (Galaxy Gio), and I can't do any gesture to increase delta bigger, then mTouchSlop.

P.S. Sorry for my terrible English.

Centering a specific item on screen

Didn't manage to create a pull request for this but I'm trying to center an item in the middle of the screen, similar to setSelection, but for centering on the screen.

public void centerOnPosition(int position)
{   
    if (getChildCount()>0)
    {
        View child=getChildAt(0);
        int childmeasuredwidth=child.getMeasuredWidth();

        if (childmeasuredwidth>0)
        {
            int whereShouldIScrollTo = (childmeasuredwidth * (2 * position + 1) - getWidth()) / 2;

            int targetposition=whereShouldIScrollTo/childmeasuredwidth;
            int offset=whereShouldIScrollTo%childmeasuredwidth;

            //Log.e("a","centerOnPosition="+position+" whereShouldIScrollTo="+whereShouldIScrollTo+" target="+targetposition+" offset="+offset);

            setSelectionFromOffset(targetposition, offset);
        }
        else
        {
            setSelectionFromOffset(position, 0);
        }
    }
    else
    {
        setSelectionFromOffset(position, 0);
    }
}

It works correctly, but the problem is when i notifydatasetchanged, it makes a jump. From what I saw, it seems that the handleDataChanged() has a different mSyncPosition than the target setselection.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.