Skip to content

Commit

Permalink
夜间模式改善
Browse files Browse the repository at this point in the history
  • Loading branch information
wenmingvs committed Sep 2, 2016
1 parent 2bbc3c6 commit 279ead7
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
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 Down Expand Up @@ -495,6 +494,9 @@ public void onLoadingStarted(String s, View view) {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
File file = DiskCacheUtils.findInCache(urllist.get(position), ImageLoader.getInstance().getDiskCache());
if (file == null){
return;
}
if (imageUri.endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.INVISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ public void arrowClick(Status status, int position) {
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);

TimelineArrowWindow arrowDialog = new TimelineArrowWindow(mContext, mDatas.get(position), mAdapter, position, "");
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ public void arrowClick(Status status, int position) {
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);

TimelineArrowWindow arrowDialog = new TimelineArrowWindow(mContext, mDatas.get(position), mAdapter, position, mUserNameTextView.getText().toString());
arrowDialog.create();
arrowDialog.show();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.setOnDialogButtonClick(HomeFragment.this);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.cesards.cropimageview.CropImageView;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.ImageViewState;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
Expand Down Expand Up @@ -85,7 +84,7 @@ public Object instantiateItem(ViewGroup container, final int position) {
final PhotoView preImageView = (PhotoView) mView.findViewById(R.id.previewImg);
final SubsamplingScaleImageView longImg = (SubsamplingScaleImageView) mView.findViewById(R.id.longImg);
final GifImageView gifImageView = (GifImageView) mView.findViewById(R.id.gifView);
final PhotoView norImgView = (uk.co.senab.photoview.PhotoView) mView.findViewById(R.id.norImg);
final PhotoView norImgView = (PhotoView) mView.findViewById(R.id.norImg);


setOnClickListener(preImageView,bgLayout, longImg, gifImageView, norImgView);
Expand Down Expand Up @@ -119,12 +118,18 @@ public void onLoadingComplete(String s, final View view, Bitmap bitmap) {
longImg.setVisibility(View.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);
File file = DiskCacheUtils.findInCache(mDatas.get(position), ImageLoader.getInstance().getDiskCache());
if (file == null){
return;
}
displayGif(file, gifImageView);
} else if (bitmap.getHeight() > bitmap.getWidth() * 3) {
longImg.setVisibility(View.VISIBLE);
gifImageView.setVisibility(View.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);
File file = DiskCacheUtils.findInCache(mDatas.get(position), ImageLoader.getInstance().getDiskCache());
if (file == null){
return;
}
displayLongPic(file, bitmap, longImg);
} else {
norImgView.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -177,7 +182,7 @@ public boolean onLongClick(View v) {
});
}

private void setOnClickListener(PhotoView preImageView, RelativeLayout relativeLayout, SubsamplingScaleImageView longImg, GifImageView gifImageView, PhotoView photoView) {
private void setOnClickListener(PhotoView preImageView, RelativeLayout relativeLayout, SubsamplingScaleImageView longImg, GifImageView gifImageView, PhotoView normalImg) {
relativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -207,7 +212,7 @@ public void onClick(View v) {
onSingleTagListener.onTag();
}
});
photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
normalImg.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float v, float v1) {
onSingleTagListener.onTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public void arrowClick(Status status, int position) {
// TimelineArrowWindow popupWindow = new TimelineArrowWindow(mContext, statuselist.get(position), mMyWeiBoAdapter, position, "我的微博");
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);
TimelineArrowWindow arrowDialog = new TimelineArrowWindow(mContext, statuselist.get(position), mMyWeiBoAdapter, position, "我的微博");
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.wenming.weiswift.entity.Status;
import com.wenming.weiswift.mvp.model.imp.StatusDetailModelImp;
import com.wenming.weiswift.ui.common.FillContent;
import com.wenming.weiswift.ui.common.dialog.ArrowDialog;
import com.wenming.weiswift.ui.login.fragment.home.weiboitem.TimelineArrowWindow;
import com.wenming.weiswift.utils.DensityUtil;
import com.wenming.weiswift.utils.ScreenUtil;
Expand Down Expand Up @@ -110,7 +109,6 @@ public void onClick(View v) {
// detailWeiBoArrowWindow.showAtLocation(mView, Gravity.CENTER, 0, 0);

TimelineArrowWindow arrowDialog = new TimelineArrowWindow(mContext, status);
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private void initWeiBoContent(Context context, final Status status) {
@Override
public void onClick(View v) {
TimelineArrowWindow arrowDialog = new TimelineArrowWindow(mContext, status);
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.wenming.weiswift.mvp.presenter.imp.MentionActivityPresentImp;
import com.wenming.weiswift.mvp.view.MentionActivityView;
import com.wenming.weiswift.ui.common.BaseActivity;
import com.wenming.weiswift.ui.common.dialog.ArrowDialog;
import com.wenming.weiswift.ui.common.login.Constants;
import com.wenming.weiswift.ui.login.fragment.message.IGroupItemClick;
import com.wenming.weiswift.ui.login.fragment.message.comment.CommentAdapter;
Expand Down Expand Up @@ -122,7 +121,6 @@ public void arrowClick(Status status, int position) {
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);

MentionArrowWindow arrowDialog = new MentionArrowWindow(mContext, status);
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down Expand Up @@ -169,7 +167,6 @@ public void arrowClick(Status status, int position) {
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);

MentionArrowWindow arrowDialog = new MentionArrowWindow(mContext, status);
arrowDialog .create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;

Expand All @@ -16,7 +15,6 @@
import com.wenming.weiswift.mvp.view.FavoritiesActivityView;
import com.wenming.weiswift.ui.common.BaseActivity;
import com.wenming.weiswift.ui.login.fragment.home.weiboitem.SeachHeadView;
import com.wenming.weiswift.ui.login.fragment.home.weiboitem.TimelineArrowWindow;
import com.wenming.weiswift.ui.login.fragment.home.weiboitem.WeiboAdapter;
import com.wenming.weiswift.utils.DensityUtil;
import com.wenming.weiswift.utils.ScreenUtil;
Expand Down Expand Up @@ -81,7 +79,6 @@ public void arrowClick(Status status, int position) {
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);

FavoritiesArrowWindow arrowDialog = new FavoritiesArrowWindow(mContext, mDatas.get(position), mAdapter, position, "");
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void arrowClick(Status status, int position) {
// MyWeiBoArrowWindow popupWindow = new MyWeiBoArrowWindow(mContext, mDatas.get(position), mAdapter, position, "我的" + mGroupName.getText().toString());
// popupWindow.showAtLocation(mRecyclerView, Gravity.CENTER, 0, 0);
MyWeiBoArrowWindow arrowDialog = new MyWeiBoArrowWindow(mContext, mDatas.get(position), mAdapter, position, "我的" + mGroupName.getText().toString());
arrowDialog.create();
int width = ScreenUtil.getScreenWidth(mContext) - DensityUtil.dp2px(mContext, 80);
arrowDialog.show();
arrowDialog.getWindow().setLayout(width, (ViewGroup.LayoutParams.WRAP_CONTENT));
Expand Down

0 comments on commit 279ead7

Please sign in to comment.