|
|
@@ -1,6 +1,7 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.screen.my.bucketlist;
|
|
|
|
|
|
import android.content.Context;
|
|
|
+import android.graphics.Bitmap;
|
|
|
import android.graphics.Rect;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
@@ -19,7 +20,10 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.bumptech.glide.Glide;
|
|
|
-import com.bumptech.glide.request.RequestOptions;
|
|
|
+import com.bumptech.glide.load.DataSource;
|
|
|
+import com.bumptech.glide.load.engine.GlideException;
|
|
|
+import com.bumptech.glide.request.RequestListener;
|
|
|
+import com.bumptech.glide.request.target.Target;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -48,6 +52,8 @@ public class AddMyBucketListFragment extends FragmentBase<AddMyBucketListPresent
|
|
|
private TextView textViewMyBucketDetail;
|
|
|
private Button buttonAddMyBucket;
|
|
|
private ImageView imageViewBackground;
|
|
|
+ private ImageView imageViewBackground2;
|
|
|
+ private ImageView targetImageView;
|
|
|
private AddMyBucketListAdapter addMyBucketListAdapter;
|
|
|
|
|
|
@Nullable
|
|
|
@@ -63,7 +69,8 @@ public class AddMyBucketListFragment extends FragmentBase<AddMyBucketListPresent
|
|
|
textViewMyBucketDetail = findViewById(R.id.text_view_my_bucket_detail);
|
|
|
buttonAddMyBucket = findViewById(R.id.button_add_my_bucket);
|
|
|
imageViewBackground = findViewById(R.id.image_background);
|
|
|
-
|
|
|
+ imageViewBackground2 = findViewById(R.id.image_background2);
|
|
|
+ targetImageView = imageViewBackground2;
|
|
|
editTextMyBucketTitle.requestFocus();
|
|
|
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
inputMethodManager.showSoftInput(editTextMyBucketTitle, InputMethodManager.SHOW_IMPLICIT);
|
|
|
@@ -166,10 +173,26 @@ public class AddMyBucketListFragment extends FragmentBase<AddMyBucketListPresent
|
|
|
|
|
|
@Override
|
|
|
public void changeBackground(String imageUrl) {
|
|
|
- Glide.with(imageViewBackground)
|
|
|
+
|
|
|
+ Glide.with(targetImageView)
|
|
|
.asBitmap().load(imageUrl)
|
|
|
- .apply(new RequestOptions().placeholder(ResourceUtil.getDrawable(imageViewBackground.getContext(), R.drawable.image_loading_full)))
|
|
|
- .into(imageViewBackground);
|
|
|
+ //.apply(new RequestOptions().placeholder(ResourceUtil.getDrawable(imageViewBackground.getContext(), R.drawable.image_loading_full)))
|
|
|
+ .addListener(new RequestListener<Bitmap>() {
|
|
|
+ @Override
|
|
|
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
|
|
|
+ targetImageView.bringToFront();
|
|
|
+ changeImageViewTarget();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .into(targetImageView);
|
|
|
+
|
|
|
+
|
|
|
// imageViewBackground.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
|
}
|
|
|
|
|
|
@@ -233,4 +256,13 @@ public class AddMyBucketListFragment extends FragmentBase<AddMyBucketListPresent
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void changeImageViewTarget() {
|
|
|
+ if (targetImageView == imageViewBackground2) {
|
|
|
+ targetImageView = imageViewBackground;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ targetImageView = imageViewBackground2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|