I'm trying to add Pull To Refresh feature to the Activity which already is using Merge Adapter made by Mark Myrphy aka @commonsware.
Here is our code:
//get container PTR listview
PullToRefreshListView ptrLvContainer = (PullToRefreshListView) findViewById(R.id.lv_merge_fragment);
//create adapter for bottom list view
lvAdapter = new ListViewAdapter(this, R.layout.adapter_row, alResults);
mMergeAdapter = new MergeAdapter();
//Create 2 rows of custom views, that will be set above the lvAdapter
LinearLayout llRow1 = new LinearLayout(this);
//here we add picture to llRow1
LinearLayout llRow2 = new LinearLayout(this);
//here we add 2 pictures to llRow2
//Add everything to mergeAdapter
mergeAdapter.addView(llRow1);
mergeAdapter.addView(llRow2);
mergeAdapter.addAdapter(lvAdapter);
//set mergeAdapter to Pull To Refresh ListView
ptrLvContainer.setAdapter(mergeAdapter);
And here is lv_merge_fragment.xml.
<?xml version="1.0" encoding="utf-8"?>
<com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:ptr="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
ptr:ptrMode="pullDownFromTop"
ptr:ptrDrawable="@drawable/cell_home_top"
android:id="@+id/lv__merge_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:scrollbars="none"
android:fadingEdge="none"
android:divider="@android:color/transparent"
android:listSelector="@android:color/transparent" >
</com.handmark.pulltorefresh.library.PullToRefreshListView>
I'm trying to get working together https://github.com/chrisbanes/Android-PullToRefresh and https://github.com/commonsguy/cwac-merge .
Unfortunately, there's a problem. MergeAdapter treats whole PullToRefresh listview as something to display from bottom to top, which makes the header (which is used as a PTR indicator), being visible all the time (not only after drag). There's no way I can make it to work, and rewriting one of the libs is a hard-way to get across this issue. Did anyone succesfully used CommonsWare MergeAdapter with Pull to Refresh libs in android? Screenshot attached for better understanding of what I'm trying to achieve. Basically the PTR action should reload all the view.
and here is what I want it to look/work like:
Thanks in advance for the help.