Skip to content

Commit

Permalink
1、fix some bugs 2、Modify Loads more view displays
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklygaj committed Jan 16, 2017
1 parent 29ea8ae commit 0eeccbf
Show file tree
Hide file tree
Showing 13 changed files with 642 additions and 402 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

818 changes: 490 additions & 328 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.bigkoo/convenientbanner/2.0.5/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.CymChad/BaseRecyclerViewAdapterHelper/2.1.6/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.ybq/Android-SpinKit/1.0.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
Expand Down Expand Up @@ -131,6 +132,7 @@
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="library" exported="" name="convenientbanner-2.0.5" level="project" />
<orderEntry type="library" exported="" name="Android-SpinKit-1.0.2" level="project" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="BaseRecyclerViewAdapterHelper-2.1.6" level="project" />
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ dependencies {
compile 'com.github.ybq:Android-SpinKit:1.0.2'
// compile 'com.github.anzaizai:EasyRefreshLayout:1.0.8'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.bigkoo:convenientbanner:2.0.5'


compile project(':library')
}
29 changes: 15 additions & 14 deletions app/src/main/java/zaizai/com/View/OnlyLoadingActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package zaizai.com.View;

import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
Expand All @@ -13,6 +14,7 @@
import java.util.Date;
import java.util.List;

import zaizai.com.MyAnimation;
import zaizai.com.SimpleAdapter;

public class OnlyLoadingActivity extends AppCompatActivity {
Expand All @@ -30,7 +32,6 @@ protected void onCreate(Bundle savedInstanceState) {
initListener();
initData();
}

private void initData() {
List<String> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
Expand All @@ -45,25 +46,23 @@ private void initListener() {
easyRefreshLayout.addEasyEvent(new EasyRefreshLayout.EasyEvent() {
@Override
public void onLoadMore() {

final List<String> list = new ArrayList<>();
for (int i = 0; i < 5; i++) {
list.add("this is new load data >>>>" + new Date().toLocaleString());
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
final List<String> list = new ArrayList<>();
for (int i = 0; i < 5; i++) {
list.add("this is new load data >>>>"+new Date().toLocaleString());
}
easyRefreshLayout.loadMoreComplete(new EasyRefreshLayout.Event() {
@Override
public void complete() {
adapter.getData().addAll(list);
adapter.notifyDataSetChanged();
}
}, 1000);

easyRefreshLayout.closeLoadView();
adapter.getData().addAll(list);
adapter.notifyDataSetChanged();
}
}, 2000);
},500);


}

@Override
public void onRefreshing() {

Expand All @@ -78,6 +77,8 @@ private void initView() {
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
adapter = new SimpleAdapter();
// adapter.setDuration(1000);
// adapter.openLoadAnimation(new MyAnimation());
recyclerView.setAdapter(adapter);
}
}
55 changes: 55 additions & 0 deletions app/src/main/java/zaizai/com/View/OnlyRefreshActivity.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
package zaizai.com.View;

import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.ajguan.R;
import com.ajguan.library.EasyRefreshLayout;
import com.bigkoo.convenientbanner.ConvenientBanner;
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator;
import com.bigkoo.convenientbanner.holder.Holder;

import java.util.ArrayList;
import java.util.Date;
Expand All @@ -25,6 +34,9 @@ public class OnlyRefreshActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
private SimpleAdapter adapter;
private ConvenientBanner banner;
private List localImages = new ArrayList();


@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -40,9 +52,50 @@ private void initData() {
for (int i = 0; i < 20; i++) {
list.add("EasyRefreshLayout index :" + i);
}
// adapter.addHeaderView(banner);
adapter.setNewData(list);
for (int i = 0; i < 6; i++) {
localImages.add(R.drawable.arrow);
}

//自定义你的Holder,实现更多复杂的界面,不一定是图片翻页,其他任何控件翻页亦可。

// banner.setPages(
// new CBViewHolderCreator<LocalImageHolderView>() {
// @Override
// public LocalImageHolderView createHolder() {
// final OnlyRefreshActivity.LocalImageHolderView localImageHolderView = new LocalImageHolderView();
//
// return localImageHolderView;
// }
// }, localImages)
// //设置两个点图片作为翻页指示器,不设置则没有指示器,可以根据自己需求自行配合自己的指示器,不需要圆点指示器可用不设
// .setPageIndicator(new int[]{R.drawable.cpmplete_icon, R.drawable.arrow})
// //设置指示器的方向
// .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT);
//设置翻页的效果,不需要翻页效果可用不设
//.setPageTransformer(Transformer.DefaultTransformer); 集成特效之后会有白屏现象,新版已经分离,如果要集成特效的例子可以看Demo的点击响应。
// convenientBanner.setManualPageable(false);//设置不能手动影响
}

public class LocalImageHolderView implements Holder<Integer> {
private ImageView imageView;

@Override
public View createView(Context context) {
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);

return imageView;
}

@Override
public void UpdateUI(Context context, final int position, Integer data) {
imageView.setImageResource(data);
}
}


private void initListener() {
easyRefreshLayout.autoRefresh();
easyRefreshLayout.addEasyEvent(new EasyRefreshLayout.EasyEvent() {
Expand Down Expand Up @@ -80,5 +133,7 @@ private void initView() {
recyclerView.setHasFixedSize(true);
adapter = new SimpleAdapter();
recyclerView.setAdapter(adapter);
banner = (ConvenientBanner) View.inflate(this, R.layout.convenientbanner_view, null);

}
}
43 changes: 22 additions & 21 deletions app/src/main/java/zaizai/com/View/RefreshLoadingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@

import com.ajguan.R;
import com.ajguan.library.EasyRefreshLayout;
import com.chad.library.adapter.base.animation.BaseAnimation;
import com.chad.library.adapter.base.animation.SlideInBottomAnimation;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import zaizai.com.MyAnimation;
import zaizai.com.SimpleAdapter;

public class RefreshLoadingActivity extends AppCompatActivity {
Expand All @@ -34,40 +37,38 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initData() {
List<String> list = new ArrayList<>();
List<String> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
list.add("EasyRefreshLayout index :" + i);
}
adapter.setNewData(list);

adapter.getData().addAll(list);
adapter.notifyDataSetChanged();
}




}

private void initListener() {
easyRefreshLayout.addEasyEvent(new EasyRefreshLayout.EasyEvent() {
@Override
public void onLoadMore() {

final List<String> list = new ArrayList<>();
for (int i = 0; i < 5; i++) {
list.add("this is new load data >>>>" + new Date().toLocaleString());
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
final List<String> list = new ArrayList<>();
for (int j = 0; j < 5; j++) {
list.add("this is new load data >>>>" + new Date().toLocaleString());
}

//adapter.addData(list);

easyRefreshLayout.loadMoreComplete(new EasyRefreshLayout.Event() {
@Override
public void complete() {
adapter.getData().addAll(list);
adapter.notifyDataSetChanged();

}
}, 500);

easyRefreshLayout.closeLoadView();
int postion = adapter.getData().size();
adapter.getData().addAll(list);
adapter.notifyDataSetChanged();
recyclerView.scrollToPosition(postion);
}
}, 2000);

},500);

}

Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/items_recyclerview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="1dp"
android:focusable="true"
android:clickable="true"
android:focusableInTouchMode="true"
android:background="@drawable/select"
android:gravity="center"
android:background="#1e777777"
android:orientation="vertical">

<TextView
Expand All @@ -13,4 +16,6 @@
android:layout_height="wrap_content"
android:text="hello" />



</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#FFFFFF</color>
<color name="gray_CCCCCC">#CCCCCC</color>
</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions library/library.iml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-core-2.2.2" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="runner-0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="exposed-instrumentation-api-publish-0.5" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-2.2.2" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-2.2.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="rules-0.5" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.annotation-api-1.2" level="project" />
Expand Down
Loading

0 comments on commit 0eeccbf

Please sign in to comment.