Skip to content

Commit

Permalink
夜间模式配色调整
Browse files Browse the repository at this point in the history
  • Loading branch information
郭文明 committed Aug 31, 2016
1 parent 6b31365 commit 0c1623f
Show file tree
Hide file tree
Showing 20 changed files with 172 additions and 186 deletions.
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
142 changes: 26 additions & 116 deletions weiSwift/src/main/java/com/wenming/weiswift/ui/common/FillContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,126 +483,36 @@ public static boolean isLongImg(File file, Bitmap bitmap) {
* @param norImg
* @param gifImg
* @param imageLabel
* @param mSingleImageSize
* @param mDoubleImgSize
* @param mThreeImgSize
*/
public static void fillImageList(final Context context, final Status status, DisplayImageOptions options, final int position, final SubsamplingScaleImageView longImg, final ImageView norImg, final GifImageView gifImg, final ImageView imageLabel, ImageSize mSingleImageSize, ImageSize mDoubleImgSize, ImageSize mThreeImgSize) {
public static void fillImageList(final Context context, final Status status, DisplayImageOptions options, final int position, final SubsamplingScaleImageView longImg, final ImageView norImg, final GifImageView gifImg, final ImageView imageLabel) {
final ArrayList<String> urllist = status.bmiddle_pic_urls;
if (urllist.size() == 1) {
ImageLoader.getInstance().loadImage(urllist.get(position), mSingleImageSize, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
setLabelForGif(urllist.get(position), imageLabel);
}

@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayGif(file, gifImg, imageLabel);
} else if (isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayLongPic(file, bitmap, longImg, imageLabel);
} else {
norImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.INVISIBLE);
displayNorImg(file, bitmap, norImg, imageLabel);
}
}
});
}else if (urllist.size() == 2 || urllist.size() == 4){
ImageLoader.getInstance().loadImage(urllist.get(position), mDoubleImgSize, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
setLabelForGif(urllist.get(position), imageLabel);
}

@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayGif(file, gifImg, imageLabel);
} else if (isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayLongPic(file, bitmap, longImg, imageLabel);
} else {
norImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.INVISIBLE);
displayNorImg(file, bitmap, norImg, imageLabel);
}
}
});
}else if (urllist.size()== 3 || urllist.size() >= 5){
ImageLoader.getInstance().loadImage(urllist.get(position), mThreeImgSize, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
setLabelForGif(urllist.get(position), imageLabel);
}

@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayGif(file, gifImg, imageLabel);
} else if (isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayLongPic(file, bitmap, longImg, imageLabel);
} else {
norImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.INVISIBLE);
displayNorImg(file, bitmap, norImg, imageLabel);
}
}
});
}else {
ImageLoader.getInstance().loadImage(urllist.get(position), options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
setLabelForGif(urllist.get(position), imageLabel);
}
ImageLoader.getInstance().loadImage(urllist.get(position), options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
setLabelForGif(urllist.get(position), imageLabel);
}

@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayGif(file, gifImg, imageLabel);
} else if (isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayLongPic(file, bitmap, longImg, imageLabel);
} else {
norImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.INVISIBLE);
displayNorImg(file, bitmap, norImg, imageLabel);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayGif(file, gifImg, imageLabel);
} else if (isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImg.setVisibility(View.INVISIBLE);
displayLongPic(file, bitmap, longImg, imageLabel);
} else {
norImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.INVISIBLE);
displayNorImg(file, bitmap, norImg, imageLabel);
}
});
}

}
});
longImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
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 @@ -63,7 +63,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
FillContent.fillImageList(mContext, mStatus, options, position, holder.longImg, holder.norImg, holder.gifImg, holder.imageLabel,mSingleImageSize,mDoubleImgSize,mThreeImgSize);
FillContent.fillImageList(mContext, mStatus, options, position, holder.longImg, holder.norImg, holder.gifImg, holder.imageLabel);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,22 @@ public void highlightIndicator(String group) {
userInfoIndicator.setVisibility(View.INVISIBLE);
weiboIndicator.setVisibility(View.INVISIBLE);
photoIndicator.setVisibility(View.INVISIBLE);
homepageTextview.setTextColor(Color.parseColor("#929292"));
weiboTextview.setTextColor(Color.parseColor("#929292"));
photoTextview.setTextColor(Color.parseColor("#929292"));

homepageTextview.setTextColor(getResources().getColor(R.color.user_topbar_text));
weiboTextview.setTextColor(getResources().getColor(R.color.user_topbar_text));
photoTextview.setTextColor(getResources().getColor(R.color.user_topbar_text));

switch (group) {
case UserActivity.USER_ACTIVITY_USER_INFO:
homepageTextview.setTextColor(Color.parseColor("#2f2f2f"));
homepageTextview.setTextColor(getResources().getColor(R.color.user_topbar_text_highlight));
userInfoIndicator.setVisibility(View.VISIBLE);
break;
case UserActivity.USER_ACTIVITY_USER_STATUS:
weiboTextview.setTextColor(Color.parseColor("#2f2f2f"));
weiboTextview.setTextColor(getResources().getColor(R.color.user_topbar_text_highlight));
weiboIndicator.setVisibility(View.VISIBLE);
break;
case UserActivity.USER_ACTIVITY__USER_PHOTO:
photoTextview.setTextColor(Color.parseColor("#2f2f2f"));
photoTextview.setTextColor(getResources().getColor(R.color.user_topbar_text_highlight));
photoIndicator.setVisibility(View.VISIBLE);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,18 @@ private void changeSendButtonBg() {

private void pressSendButton() {
mSendButton.setBackgroundResource(R.drawable.compose_send_corners_highlight_press_bg);
mSendButton.setTextColor(Color.parseColor("#ebeef3"));
mSendButton.setTextColor(getResources().getColor(R.color.press_send_button_text));
}

private void highlightSendButton() {
mSendButton.setBackgroundResource(R.drawable.compose_send_corners_highlight_bg);
mSendButton.setTextColor(Color.parseColor("#fbffff"));
mSendButton.setTextColor(getResources().getColor(R.color.enable_send_button_text));
mSendButton.setEnabled(true);
}

private void sendNormal() {
mSendButton.setBackgroundResource(R.drawable.compose_send_corners_bg);
mSendButton.setTextColor(Color.parseColor("#b3b3b3"));
mSendButton.setTextColor(getResources().getColor(R.color.unable_send_button_text));
mSendButton.setEnabled(false);
}

Expand Down Expand Up @@ -422,14 +422,14 @@ public void setLimitTextColor(TextView limitTextView, String content) {
long length = calculateWeiboLength(content);
if (length > TEXT_LIMIT) {
long outOfNum = length - TEXT_LIMIT;
limitTextView.setTextColor(Color.parseColor("#e03f22"));
limitTextView.setTextColor(getResources().getColor(R.color.limittext_text_outofrange));
limitTextView.setText("-" + outOfNum + "");
} else if (length == TEXT_LIMIT) {
limitTextView.setText(0 + "");
limitTextView.setTextColor(Color.parseColor("#929292"));
limitTextView.setTextColor(getResources().getColor(R.color.limittext_text_warning));
} else if (TEXT_LIMIT - length <= TEXT_REMIND) {
limitTextView.setText(TEXT_LIMIT - length + "");
limitTextView.setTextColor(Color.parseColor("#929292"));
limitTextView.setTextColor(getResources().getColor(R.color.limittext_text_warning));
} else {
limitTextView.setText("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 设置填充颜色 为白色 -->
<solid android:color="#FFFFFF" />
<solid android:color="@color/night_send_button_bg" />

<!-- 设置几何图形四个角的弧度 -->
<corners android:radius="2dp" />

<!-- 设置几何形状绘制边框 红色边框 -->
<stroke
android:width="1dp"
android:color="#cbcbcb" />
android:color="@color/night_send_button_stoke" />

</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/enable_send_button_bg" />

<corners android:radius="2dp" />

<stroke
android:width="1dp"
android:color="@color/enable_send_button_bg" />

</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/press_send_button_bg" />

<corners android:radius="2dp" />

<stroke
android:width="1dp"
android:color="@color/press_send_button_bg" />

</shape>
Loading

0 comments on commit 0c1623f

Please sign in to comment.