|
|
@@ -53,6 +53,8 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
|
|
|
private Handler handler = getHandler();
|
|
|
|
|
|
+ private Toast toast = null;
|
|
|
+ private long lastTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
public CircleOfFriendsFragment(){
|
|
|
@@ -99,6 +101,8 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
toolbar.init();
|
|
|
toolbar.setTitle("朋友圈");
|
|
|
toolbar.setRightText("发表");
|
|
|
+
|
|
|
+ //打开发布Activity
|
|
|
toolbar.getRightTV().setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
@@ -107,6 +111,24 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ //双击标题返回顶部
|
|
|
+ toolbar.getTitleTV().setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ long nowTime = System.currentTimeMillis();
|
|
|
+ long interval = lastTime - nowTime;
|
|
|
+ if (interval < 1000){
|
|
|
+ lastTime = nowTime;
|
|
|
+ if (recyclerView!=null){
|
|
|
+ recyclerView.smoothScrollToPosition(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ lastTime = nowTime;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -125,7 +147,12 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
handler.post(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- Toast.makeText(getActivity(),str,Toast.LENGTH_SHORT).show();
|
|
|
+ if (toast == null){
|
|
|
+ toast = Toast.makeText(getActivity(),str,Toast.LENGTH_SHORT);
|
|
|
+ }else {
|
|
|
+ toast.setText(str);
|
|
|
+ }
|
|
|
+ toast.show();
|
|
|
|
|
|
}
|
|
|
});
|
|
|
@@ -171,6 +198,7 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
* @param lastId
|
|
|
*/
|
|
|
public void loadCircleListMore(String lastId){
|
|
|
+ showToast("正在加载更多内容...");
|
|
|
presenter.loadCircleList(AccountCache.getAccount().getId(),lastId);
|
|
|
}
|
|
|
|
|
|
@@ -180,9 +208,10 @@ public class CircleOfFriendsFragment extends MainTabFragment{
|
|
|
*/
|
|
|
public void refreshCircle(){
|
|
|
if (adapter != null){
|
|
|
+ //防止Inconsistency detected
|
|
|
+ recyclerView.getRecycledViewPool().clear();
|
|
|
+
|
|
|
adapter.clearAll();
|
|
|
- //防止无网络时invalid viewholder
|
|
|
- recyclerView.smoothScrollToPosition(0);
|
|
|
loadCircleListMore("");
|
|
|
}
|
|
|
}
|