Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:wenmingvs/WeiBo into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wenmingvs committed Sep 1, 2016
2 parents 927daf4 + b70cf05 commit 59a978b
Show file tree
Hide file tree
Showing 58 changed files with 423 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,31 @@ public void onError(String error) {
}

@Override
public void user_destroy(final User user, Context context, final ImageView follwerIcon, final TextView follwerText) {
public void user_destroy(final User user, final Context context, final ImageView follwerIcon, final TextView follwerText) {
friendShipModel.user_destroy(user, context, new FriendShipModel.OnRequestListener() {
@Override
public void onSuccess() {
mFollowActivityView.updateRealtionShip(user, follwerIcon, follwerText);
mFollowActivityView.updateRealtionShip(context,user, follwerIcon, follwerText);
}

@Override
public void onError(String error) {
mFollowActivityView.updateRealtionShip(user, follwerIcon, follwerText);
mFollowActivityView.updateRealtionShip(context,user, follwerIcon, follwerText);
}
}, true);
}

@Override
public void user_create(final User user, Context context, final ImageView follwerIcon, final TextView follwerText) {
public void user_create(final User user, final Context context, final ImageView follwerIcon, final TextView follwerText) {
friendShipModel.user_create(user, context, new FriendShipModel.OnRequestListener() {
@Override
public void onSuccess() {
mFollowActivityView.updateRealtionShip(user, follwerIcon, follwerText);
mFollowActivityView.updateRealtionShip(context,user, follwerIcon, follwerText);
}

@Override
public void onError(String error) {
mFollowActivityView.updateRealtionShip(user, follwerIcon, follwerText);
mFollowActivityView.updateRealtionShip(context,user, follwerIcon, follwerText);
}
}, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,32 @@ public void onError(String error) {
}

@Override
public void user_destroy(final User user, Context context, final ImageView friendIcon, final TextView friendText) {
public void user_destroy(final User user, final Context context, final ImageView friendIcon, final TextView friendText) {
friendShipModel.user_destroy(user, context, new FriendShipModel.OnRequestListener() {
@Override
public void onSuccess() {
mFriendActivityView.updateRealtionShip(user, friendIcon, friendText);
mFriendActivityView.updateRealtionShip(context,user, friendIcon, friendText);
//mFriendActivityView.disFocusSuccess(friendIcon, friendText);
}

@Override
public void onError(String error) {
mFriendActivityView.updateRealtionShip(user, friendIcon, friendText);
mFriendActivityView.updateRealtionShip(context,user, friendIcon, friendText);
}
}, false);
}

@Override
public void user_create(final User user, Context context, final ImageView friendIcon, final TextView friendText) {
public void user_create(final User user, final Context context, final ImageView friendIcon, final TextView friendText) {
friendShipModel.user_create(user, context, new FriendShipModel.OnRequestListener() {
@Override
public void onSuccess() {
mFriendActivityView.updateRealtionShip(user, friendIcon, friendText);
mFriendActivityView.updateRealtionShip(context,user, friendIcon, friendText);
}

@Override
public void onError(String error) {
mFriendActivityView.updateRealtionShip(user, friendIcon, friendText);
mFriendActivityView.updateRealtionShip(context,user, friendIcon, friendText);
}
}, false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.wenming.weiswift.mvp.view;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

Expand Down Expand Up @@ -44,6 +45,6 @@ public interface FollowActivityView {
public void showErrorFooterView();


public void updateRealtionShip(User user, ImageView icon, TextView text);
public void updateRealtionShip(Context context, User user, ImageView icon, TextView text);

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.wenming.weiswift.mvp.view;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

Expand Down Expand Up @@ -43,5 +44,5 @@ public interface FriendActivityView {
*/
public void showErrorFooterView();

public void updateRealtionShip(User user, ImageView icon, TextView text);
public void updateRealtionShip(Context context, User user, ImageView icon, TextView text);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ protected void onCreate(Bundle savedInstanceState) {
getSwipeBackLayout().setSwipeMode(SwipeBackLayout.FULL_SCREEN_LEFT);
getSwipeBackLayout().setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);
getSwipeBackLayout().setSensitivity(BaseActivity.this, 0.3f);
boolean setNightMode = (boolean) SharedPreferencesUtil.get(this, "setNightMode", false);
if (!setNightMode) {
boolean isNightMode = (boolean) SharedPreferencesUtil.get(this, "setNightMode", false);
if (!isNightMode) {
StatusBarUtils.from(this)
.setTransparentStatusbar(true)
.setStatusBarColor(Color.parseColor("#FFFFFF"))
.setStatusBarColor(getResources().getColor(R.color.home_status_bg))
.setLightStatusBar(true)
.process(this);
}else {
} else {
StatusBarUtils.from(this)
.setTransparentStatusbar(true)
.setStatusBarColor(Color.parseColor("#262626"))
.setLightStatusBar(true)
.setStatusBarColor(getResources().getColor(R.color.home_status_bg))
.process(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.assist.ImageSize;
import com.nostra13.universalimageloader.core.display.CircleBitmapDisplayer;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
Expand All @@ -43,6 +44,7 @@
import com.wenming.weiswift.ui.login.fragment.post.idea.IdeaActivity;
import com.wenming.weiswift.utils.DateUtils;
import com.wenming.weiswift.utils.NetUtil;
import com.wenming.weiswift.utils.SharedPreferencesUtil;
import com.wenming.weiswift.utils.TimeUtils;
import com.wenming.weiswift.widget.emojitextview.EmojiTextView;
import com.wenming.weiswift.widget.emojitextview.WeiBoContentTextUtil;
Expand Down Expand Up @@ -179,21 +181,39 @@ public static void setFollowerComeFrom(TextView textView, Status status) {
}
}

public static void updateRealtionShip(User user, ImageView icon, TextView text) {
if (user.follow_me && user.following) {
icon.setImageResource(R.drawable.card_icon_arrow);
text.setText("互相关注");
text.setTextColor(Color.parseColor("#5788BF"));
} else if (user.following) {
icon.setImageResource(R.drawable.card_icon_attention);
text.setText("已关注");
text.setTextColor(Color.parseColor("#000000"));
public static void updateRealtionShip(Context context, User user, ImageView icon, TextView text) {
boolean isNightMode = (boolean) SharedPreferencesUtil.get(context, "setNightMode", false);
if (!isNightMode) {
if (user.follow_me && user.following) {
icon.setImageResource(R.drawable.card_icon_arrow);
text.setText("互相关注");
text.setTextColor(context.getResources().getColor(R.color.friend_item_button_follow_each_other));
} else if (user.following) {
icon.setImageResource(R.drawable.card_icon_attention);
text.setText("已关注");
text.setTextColor(context.getResources().getColor(R.color.friend_item_button_follow_alreay));
} else {
icon.setImageResource(R.drawable.card_icon_addattention);
text.setText("加关注");
text.setTextColor(context.getResources().getColor(R.color.friend_item_button_follow_none));
}
} else {
icon.setImageResource(R.drawable.card_icon_addattention);
text.setText("加关注");
text.setTextColor(Color.parseColor("#e98219"));
if (user.follow_me && user.following) {
icon.setImageResource(R.drawable.card_icon_arrow);
text.setText("互相关注");
text.setTextColor(context.getResources().getColor(R.color.night_friend_item_button_follow_each_other));
} else if (user.following) {
icon.setImageResource(R.drawable.card_icon_attention);
text.setText("已关注");
text.setTextColor(context.getResources().getColor(R.color.night_friend_item_button_follow_alreay));
} else {
icon.setImageResource(R.drawable.card_icon_addattention);
text.setText("加关注");
text.setTextColor(context.getResources().getColor(R.color.night_friend_item_button_follow_none));
}
}


}


Expand Down Expand Up @@ -671,11 +691,35 @@ public static void fillMentionCenterContent(Status retweetstatus, ImageView prof
profile_name.setVisibility(View.GONE);
content.setText(retweetstatus.text);
}
}

/**
* 设置评论页的回复评论区域的Bg
*
* @param context
* @param layout
*/
public static void setReplyAreaBg(Context context, View layout) {
boolean isNightMode = (boolean) SharedPreferencesUtil.get(context, "setNightMode", false);
if (isNightMode) {

} else {

}

}

/**
* 设置评论页的评论内容的center Bg
*
* @param layout
*/
public static void setReplyContentAreaBg(View layout) {

}

public static void fillCommentCenterContent(final Context context, Comment comment, LinearLayout bg_layout, LinearLayout comment_weibolayout, EmojiTextView mycomment, final CropImageView mentionitem_img, TextView profile_name, TextView content) {
//填充我回复的评论
//如果存在回复,则需要填充我回复的评论
if (comment.reply_comment != null) {
mycomment.setVisibility(View.VISIBLE);
bg_layout.setBackgroundResource(R.drawable.home_commentcenter_grey_bg_auto);
Expand All @@ -684,8 +728,8 @@ public static void fillCommentCenterContent(final Context context, Comment comme
fillWeiBoContent(mycommenttext, context, mycomment);
} else {
mycomment.setVisibility(View.GONE);
bg_layout.setBackgroundColor(Color.parseColor("#fefefe"));
comment_weibolayout.setBackgroundResource(R.drawable.home_commentcenter_grey_bg_auto);
bg_layout.setBackgroundColor(Color.TRANSPARENT);
comment_weibolayout.setBackgroundResource(R.drawable.home_commentcenter_white_noreply_bg_auto);
}

//填充我所评论的微博的内容,包括微博的主人名,微博图片,微博文本内容
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
Expand Down Expand Up @@ -132,17 +131,17 @@ protected void onCreate(Bundle savedInstanceState) {
setTabFragment(HOME_FRAGMENT);
}
setUpListener();
boolean setNightMode = (boolean) SharedPreferencesUtil.get(this, "setNightMode", false);
if (!setNightMode) {
boolean isNightMode = (boolean) SharedPreferencesUtil.get(this, "setNightMode", false);
if (!isNightMode) {
StatusBarUtils.from(this)
.setTransparentStatusbar(true)
.setStatusBarColor(Color.parseColor("#FFFFFF"))
.setStatusBarColor(getResources().getColor(R.color.home_status_bg))
.setLightStatusBar(true)
.process(this);
}else {
} else {
StatusBarUtils.from(this)
.setTransparentStatusbar(true)
.setStatusBarColor(Color.parseColor("#262626"))
.setStatusBarColor(getResources().getColor(R.color.home_status_bg))
.process(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class HomeFragment extends Fragment implements HomeFragmentView, ArrowDia
/**
* 手指滑动距离多少个像素点的距离,才隐藏bar
*/
private static final int HIDE_THRESHOLD = 80;
private static int sHideThreshold ;
/**
* 记录手指滑动的距离
*/
Expand All @@ -91,7 +91,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
mContext = getContext();
mHomePresent = new HomeFragmentPresentImp(this);
mComeFromAccoutActivity = getArguments().getBoolean("comeFromAccoutActivity");

sHideThreshold = DensityUtil.dp2px(mContext,20);
mView = inflater.inflate(R.layout.mainfragment_layout, container, false);
mRecyclerView = (RecyclerView) mView.findViewById(R.id.weiboRecyclerView);
mTopBar = (RelativeLayout) mView.findViewById(R.id.toolbar_home);
Expand Down Expand Up @@ -336,6 +336,8 @@ public void setUserName(String userName) {
}


private static final int SHOW_THRESHOLD = 80;

public EndlessRecyclerOnScrollListener mOnScrollListener = new EndlessRecyclerOnScrollListener() {
@Override
public void onLoadNextPage(View view) {
Expand All @@ -350,7 +352,7 @@ public void onLoadNextPage(View view) {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
//手指向上滑动
if (mScrolledDistance > HIDE_THRESHOLD && mControlsVisible) {
if (mScrolledDistance > sHideThreshold && mControlsVisible) {
if (mOnBottonBarListener != null) {
hideTopBar();
mOnBottonBarListener.hideButtonBar();
Expand All @@ -359,7 +361,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
mScrolledDistance = 0;
}
//手指向下滑动
else if (mScrolledDistance < -HIDE_THRESHOLD && !mControlsVisible) {
else if (mScrolledDistance < -SHOW_THRESHOLD && !mControlsVisible) {
if (mOnBottonBarListener != null) {
showTopBar();
mOnBottonBarListener.showButtonBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import android.view.Window;

import com.wenming.weiswift.R;
import com.wenming.weiswift.ui.common.StatusBarUtils;
import com.wenming.weiswift.utils.SharedPreferencesUtil;

import java.util.ArrayList;

Expand Down Expand Up @@ -93,6 +95,11 @@ public void onClick(View view) {
}
});

StatusBarUtils.from(this)
.setTransparentStatusbar(true)
.setStatusBarColor(getResources().getColor(R.color.black))
.process(this);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.assist.ImageSize;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.wenming.weiswift.R;
import com.wenming.weiswift.entity.Status;
import com.wenming.weiswift.ui.common.FillContent;
Expand All @@ -37,13 +39,17 @@ public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ViewHolder>
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
;
private final ImageSize mSingleImageSize;
private final ImageSize mDoubleImgSize;
private final ImageSize mThreeImgSize;

public ImageAdapter(Status status, Context context) {
this.mStatus = status;
this.mData = status.bmiddle_pic_urls;
this.mContext = context;

mSingleImageSize = new ImageSize(ScreenUtil.getScreenWidth(context), (int) (ScreenUtil.getScreenWidth(context) * 0.7));
mDoubleImgSize = new ImageSize(ScreenUtil.getScreenWidth(context) / 2, ScreenUtil.getScreenWidth(context) / 2);
mThreeImgSize = new ImageSize(ScreenUtil.getScreenWidth(context) / 3,ScreenUtil.getScreenWidth(context) / 3);
}

@Override
Expand Down
Loading

0 comments on commit 59a978b

Please sign in to comment.