gdg-korea / pinterestlikeadapterview Goto Github PK
View Code? Open in Web Editor NEW[Deprecated] An Android multi column list view like Pinterest.
[Deprecated] An Android multi column list view like Pinterest.
The sample show how to display a random text in each card, but how to assign the images to each card?.
I am a beginner in Android.
In How to use, I find this:
To use pull-to-refresh features.
check this project as library project.
MultiColumnPullToRefreshListView class in extra folder is what you need.
But, I couldn't find the MultiColumnPullToRefreshListView class.
When list has one item count then being hide on scroll up down . Why it is happening ,Please help.
I download the latest lib. when i import the lib into eclipse, it always appear such error:
cannot nest '/src/main/java' inside '/src' error.
i don't know why.
thanks.
Since I use this library to show images from the internet, it's crucial that when calling notifyDatasetChanged won't cause a mess on the views.
For some reason, calling this function would call the getView with different positions for the views. for example, for position 0 it will take what was the view of position 8, for position 1 it will take the view of position 7 , and so on...
This makes the whole grid to refresh its images, and so it ruins the UX.
Usually, in both gridView and listView, the way to overcome refreshing is to put the position that was used for the view inside the viewHolder, and if they are equal, it means that they still match.
for example:
... getView(...)
{
//<=inflate a new view if needed
//avoid refreshing view in case it's still the same position:
if(position==holder.position)
return rootView;
holder.position=position;
//<=update the view according to its data
...
}
However, here they re-use other views in a different order so this trick won't work here.
What can I do?
Is this a known bug?
Could it be related to the fact that I use a header view?
I am trying to implement pull up to load more in this library, creating new file base on MultiColumnPullToRefreshListView.java, it took me a lot of time. I am new in android and my experience is also very limited. Please help me to implement BOTH pull down to refresh and pull up to loadmore in your PLA library. Thank you very much.
How to set space for each item in xml or programmatically ?
If the last picture is very long, Swiping from the top to bottom will lead to the other columns of the picture scroll down to the bottom, and align bottom with the long picture. I don't want it to roll down, have any good solutions?thanks.
onitemclick look like is not function. is it?
it there possible to add the margin/padding around the item?
I try put it into a scrollview, but after I run apk, I saw only one raw on the screen ! So I try to change the code, I rewrite
onMeasure()
Method, like this:
super.Measure(originWidth,MesureSpec.make(Integer.MAX>>2,MeasureSpec.AT_MOST))
but at last, I saw too much blank space on my Screen! Can u tell my how I can put it into a scrollView?
Thank U,My English Is poor....
i want to use this as a waterfall,but when i run https://github.com/dodola/PinterestLikeAdapterView. i found that when i have lots item and i scroll back to top fastly,all view disappeared.What can i do for this.Thx.
Could you modify "import com.huewu.pla.smaple.R"?
I think that is com.huewu.pla.sample.R;
i got this problem,anyone can help me? thx!
Fatal Exception: java.lang.AbstractMethodError: abstract method not implemented at android.widget.AbsListView.fillGap(AbsListView.java) at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5136) at android.widget.AbsListView.onGenericMotionEvent(AbsListView.java:3804) at android.view.View.dispatchGenericMotionEventInternal(View.java:7801) at android.view.View.dispatchGenericMotionEvent(View.java:7782) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824) at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777) at android.view.View.dispatchGenericMotionEvent(View.java:7775) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchGenericMotionEvent(PhoneWindow.java:2076) at com.android.internal.policy.impl.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1525) at android.app.Activity.dispatchGenericMotionEvent(Activity.java:2494) at android.support.v7.view.WindowCallbackWrapper.dispatchGenericMotionEvent(WindowCallbackWrapper.java:73) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchGenericMotionEvent(PhoneWindow.java:2030) at android.view.View.dispatchPointerEvent(View.java:7888) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3978) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3857) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3423) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3473) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3442) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3549) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3450) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3606) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3423) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3473) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3442) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3450) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3423) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5626) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5606) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5577) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5706) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:138) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:5045) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:133) at dalvik.system.NativeStart.main(NativeStart.java)
I add a header in MultiColumnListView, then the list turns to be black.
The code below is what I add in SampleActivity.java:
View headerView = View.inflate(context, R.layout.listview_header, null);
listView.addHeaderView(headerView);
mAdapter = new PLAAdapter(getActivity());
When I remove a FooterView,throw an exception :
java.lang.ClassCastException: com.xlaner.duidui.view.home.HomeFragment$3 cannot be cast to com.huewu.pla.lib.internal.PLA_HeaderViewListAdapter
I like use it like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.zhy:okhttputils:2.3.8'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
If it can like this,it will more better.
안녕하세요 ^^
개인적으로 PLA_AbsListView 클래스를 살펴 보았을때,
아래와 같은 메소드가 있더라고요
setVerticalScrollBarEnabled(true);
ㄴ 세로 스크롤바를 사용할수있게한다.
위내용으로 봐서는 분명 스크롤바가 나와야되는데 나오질않아요.
혹시, 만드시다가 바쁘셔서 중단하신내용인가요 ?!
즉 원래 기능자체에 스크롤바 기능이 없는건가요 ?!
그렇다면, 자체적으로 스크롤바를 넣을수있는 방법은 없을까요 ?!
소중한 답변 기다리겠습니다~^^
오늘도 좋은 하루되세용~!!
The left line roll down when Pull to refresh demo
The grow heap is accumulating, and eventually the app goes OOM , after 6 or more orientation change. How do I prevent the memory leak? Thanks
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
gView = inflater.inflate(R.layout.ac_image_grid, container, false);
listView = (MultiColumnListView ) gView.findViewById(R.id.list);
}
From Memory Analyzing Tool of Eclipse:
One instance of "com.huewu.pla.lib.MultiColumnListView" loaded by "dalvik.system.PathClassLoader @ 0x4123d2f8" occupies 4,195,712 (27.91%) bytes. The memory is accumulated in one instance of "android.view.View[]" loaded by "<system class loader>".
Keywords:
dalvik.system.PathClassLoader @ 0x4123d2f8
android.view.View[]
com.huewu.pla.lib.MultiColumnListView
I've set the following drawable to pinterestlikeadapterView, but it keep show me the
orange outline around item view once I've pressed the item view. Do you have any idea about this issue?
Your help will be much more appreciated. Many thanks.
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@color/active_background" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@color/active_background" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@color/active_background" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@color/active_background" />
<item android:state_focused="true" android:drawable="@color/active_background" />
<item android:drawable="@drawable/shape_gridview_round" />
헤더가 추가된 상태에서
데이터가 없으면 기본적으로 검은색이 뜨고요.
xml자체 리스트뷰에 background 색상값울 주어도 블랙으로 뜨고요.
혹시나싶어서 리스트뷰 안의 아이템자체에도 색상값을 주어도 블랙이에요~!
어떻게하면 해결할수있나요 ?
Universal Image Loader has this feature that makes sure to avoid lag during scrolling, but the problem is PauseOnScrollListener can't be casted to MultiColumnListView or the .PLA_AbsListView.setOnScrollListener. Is there many way to have a work around on this?
Universal_Image-Loader
PauseOnScrollListener.java
/**
* Constructor
*
* @param imageLoader {@linkplain ImageLoader} instance for controlling
* @param pauseOnScroll Whether {@linkplain ImageLoader#pause() pause ImageLoader} during touch scrolling
* @param pauseOnFling Whether {@linkplain ImageLoader#pause() pause ImageLoader} during fling
*/
public PauseOnScrollListener(ImageLoader imageLoader, boolean pauseOnScroll, boolean pauseOnFling) {
this(imageLoader, pauseOnScroll, pauseOnFling, null);
}
/**
* Constructor
*
* @param imageLoader {@linkplain ImageLoader} instance for controlling
* @param pauseOnScroll Whether {@linkplain ImageLoader#pause() pause ImageLoader} during touch scrolling
* @param pauseOnFling Whether {@linkplain ImageLoader#pause() pause ImageLoader} during fling
* @param customListener Your custom {@link OnScrollListener} for {@linkplain AbsListView list view} which also will
* be get scroll events
*/
public PauseOnScrollListener(ImageLoader imageLoader, boolean pauseOnScroll, boolean pauseOnFling, OnScrollListener customListener) {
this.imageLoader = imageLoader;
this.pauseOnScroll = pauseOnScroll;
this.pauseOnFling = pauseOnFling;
externalListener = customListener;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
imageLoader.resume();
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
if (pauseOnScroll) {
imageLoader.pause();
}
break;
case OnScrollListener.SCROLL_STATE_FLING:
if (pauseOnFling) {
imageLoader.pause();
}
break;
}
if (externalListener != null) {
externalListener.onScrollStateChanged(view, scrollState);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (externalListener != null) {
externalListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
}
}
}
i copy the sample to my workspaces and add the code : MultiColumnListView listView = (MultiColumnListView) view.findViewById(R.id.list);
mAdapter = new PLAAdapter(getActivity());
fillAdapter(mAdapter, 30);
TextView tv = new TextView(this.getActivity());
tv.setText("bottom"+index);
listView.addFooterView( tv);
listView.setAdapter(mAdapter);
so: the result on phone : item is align bottom, i want to keep different heights, so how can i do ?
Hey all, first of all this is a great library !
Since I'm loading images with different sizes, I've been left with a blank area/gap when one of my shorter lists has ended.
Do we have something we can do with this problem or is it impossible ?
As a function of listview, we must have a way to set divider for this kind of listview.
I wanted to add an effect like on this library:
https://github.com/ManuelPeinado/FadingActionBar
or this one:
https://github.com/ManuelPeinado/GlassActionBar
I've found out they just needs the scrolling changes , as the user scrolls, so I've made a class that extends MultiColumnListView and adds this functionality.
Sadly, when I use this class, it seems the onScrollChanged doesn't get called , so it won't work.
Here's the code:
public class PinterestListView extends MultiColumnListView {
private OnScrollChangedListener mOnScrollChangedListener;
public interface OnScrollChangedListener {
void onScrollChanged(PinterestListView who, int l, int t, int oldl, int oldt);
}
public PinterestListView(final Context context) {
super(context);
}
public PinterestListView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public PinterestListView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onScrollChanged(final int l, final int t, final int oldl, final int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollChangedListener != null) {
mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
public void setOnScrollChangedListener(final OnScrollChangedListener listener) {
mOnScrollChangedListener = listener;
}
}
ButtonFlat has not method setTextColor
The function "initializeScrollbars" seems to be removed from View.java :
http://developer.android.com/reference/android/view/View.html
This means that "PLA_AbsListView.java" cannot use it anymore.
I've made a post about it on StackOverflow and also reported the missing information of it to Google:
http://stackoverflow.com/q/26448771
https://code.google.com/p/android/issues/detail?id=77745
Please fix this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.