Skip to content

Commit

Permalink
feat (fishbun): update picasso, glide, gradle version (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
sangcomz committed Mar 6, 2019
1 parent 177b7dd commit c3b0427
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sangcomz.fishbun.adapter.image;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

Expand All @@ -9,6 +8,6 @@
*/

public interface ImageAdapter {
void loadImage(Context context, ImageView target, Uri loadUrl);
void loadDetailImage(Context context, ImageView target, Uri loadUrl);
void loadImage(ImageView target, Uri loadUrl);
void loadDetailImage(ImageView target, Uri loadUrl);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sangcomz.fishbun.adapter.image.impl;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

Expand All @@ -14,24 +13,20 @@

public class GlideAdapter implements ImageAdapter {
@Override
public void loadImage(Context context,
ImageView target,
Uri loadUrl) {
RequestOptions options = new RequestOptions();
options.centerCrop();
public void loadImage(ImageView target, Uri loadUrl) {
RequestOptions options = new RequestOptions().centerCrop();
Glide
.with(context)
.with(target.getContext())
.load(loadUrl)
.apply(options)
.into(target);
}

@Override
public void loadDetailImage(Context context, ImageView target, Uri loadUrl) {
RequestOptions options = new RequestOptions();
options.centerInside();
public void loadDetailImage(ImageView target, Uri loadUrl) {
RequestOptions options = new RequestOptions().centerInside();
Glide
.with(context)
.with(target.getContext())
.load(loadUrl)
.apply(options)
.into(target);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sangcomz.fishbun.adapter.image.impl;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

Expand All @@ -13,19 +12,18 @@

public class PicassoAdapter implements ImageAdapter {
@Override
public void loadImage(Context context, ImageView target, Uri loadUrl) {
public void loadImage(ImageView target, Uri loadUrl) {
Picasso
.with(context)
.get()
.load(loadUrl)
.fit()
.centerCrop()
.into(target);
}

@Override
public void loadDetailImage(Context context, ImageView target, Uri loadUrl) {
Picasso
.with(context)
public void loadDetailImage(ImageView target, Uri loadUrl) {
Picasso.get()
.load(loadUrl)
.fit()
.centerInside()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public void onBindViewHolder(final ViewHolder holder, final int position) {
holder.imgAlbumThumb.setImageDrawable(null);
Fishton.getInstance().imageAdapter
.loadImage(holder.imgAlbumThumb.getContext(),
holder.imgAlbumThumb,
Uri.parse(albumList.get(position).thumbnailPath));
.loadImage(holder.imgAlbumThumb, Uri.parse(albumList.get(position).thumbnailPath));

holder.view.setTag(albumList.get(position));
Album a = (Album) holder.view.getTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public Object instantiateItem(ViewGroup container, int position) {

fishton
.imageAdapter
.loadDetailImage(itemView.getContext(),
imageView,
images[position]);
.loadDetailImage(imageView, images[position]);

return itemView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ public void onClick(View v) {
initState(fishton.selectedImages.indexOf(image), vh);
if (image != null)
Fishton.getInstance().imageAdapter
.loadImage(vh.imgThumbImage.getContext(),
vh.imgThumbImage,
image);
.loadImage(vh.imgThumbImage, image);


vh.btnThumbCount.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -257,7 +255,7 @@ public ViewHolderImage(View view) {
super(view);
item = view;
imgThumbImage = view.findViewById(R.id.img_thumb_image);
btnThumbCount = view.findViewById(R.id.btn_thumb_count);
btnThumbCount = view.findViewById(R.id.btn_thumb_count);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public void onBindViewHolder(final ViewHolder holder, final int position) {
final Uri imagePath = imagePaths.get(position);
Picasso
.with(context)
.get()
.load(imagePath)
.fit()
.centerCrop()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sangcomz.fishbundemo;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

Expand All @@ -10,17 +9,15 @@
* Created by sangc on 2015-11-06.
*/
class ImageController {
Context context;
ImageView imgMain;

ImageController(Context context, ImageView imgMain) {
this.context = context;
ImageController(ImageView imgMain) {
this.imgMain = imgMain;
}

void setImgMain(Uri path) {
Picasso
.with(context)
.get()
.load(path)
.fit()
.centerCrop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
btnAddImages = (Button) rootView.findViewById(R.id.btn_add_images);
linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
withActivityController = new ImageController(getActivity(), imgMain);
withActivityController = new ImageController(imgMain);
imageAdapter = new ImageAdapter(getActivity(), withActivityController, path);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(imageAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.widget.ImageView;

import com.sangcomz.fishbun.FishBun;
import com.sangcomz.fishbun.FishBunCreator;
import com.sangcomz.fishbun.adapter.image.impl.GlideAdapter;
import com.sangcomz.fishbun.adapter.image.impl.PicassoAdapter;
import com.sangcomz.fishbun.define.Define;
Expand All @@ -38,7 +39,7 @@ protected void onCreate(Bundle savedInstanceState) {
imgMain = findViewById(R.id.img_main);
recyclerView = findViewById(R.id.recyclerview);
linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
mainController = new ImageController(this, imgMain);
mainController = new ImageController(imgMain);
imageAdapter = new ImageAdapter(this, mainController, path);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(imageAdapter);
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
buildscript {
ext {
support_version = '28.0.0'
picasso_version = '2.5.2'
glide_version = '4.8.0'
fresco_version = '1.3.0'
picasso_version = '2.71828'
glide_version = '4.9.0'
constraint_version = '1.1.3'
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 29 18:30:33 KST 2018
#Wed Mar 06 22:49:29 KST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 comments on commit c3b0427

Please sign in to comment.