use of com.squareup.picasso.Picasso in project kickmaterial by byoutline.
the class ProjectsAdapter method onBindViewHolder.
// Replace the contents of a view. This is invoked by the layout manager.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
int type = getItemViewType(position);
switch(type) {
case NORMAL_ITEM:
case BIG_ITEM:
Project project = getItem(position);
if (project != null) {
if (holder.projectId == project.id) {
// This view holder appears to already show correct project.
return;
} else {
holder.projectId = project.id;
}
ViewUtils.setTextForViewOrHideIt(holder.projectItemBigTitleTv, project.getProjectName());
holder.projectItemBigProgressSb.setProgress((int) project.getPercentProgress());
Picasso picasso = Picasso.with(context);
final RequestCreator picassoBuilder;
if (type == BIG_ITEM) {
setProjectDetailsInfo(null, holder.projectItemBigDescTv, holder.projectItemBigGatheredMoneyTv, holder.projectItemBigPledgedOfTv, holder.projectItemBigBackersTv, holder.projectItemBigTimeLeft, holder.projectItemBigTimeLeftType, project);
picassoBuilder = picasso.load(project.getBigPhotoUrl()).resize(bigItemWidth, bigItemHeight).placeholder(R.drawable.blank_project_wide);
} else {
picassoBuilder = picasso.load(project.getPhotoUrl()).resize(smallItemWidth, smallItemHeight).placeholder(R.drawable.blank_project_small);
}
picassoBuilder.onlyScaleDown().transform(new AplaTransformation()).centerCrop().into(holder.projectItemBigPhotoIv);
}
break;
}
}
use of com.squareup.picasso.Picasso in project Klyph by jonathangerbaud.
the class ImageLoader method display.
public static void display(ImageView imageView, String uri, boolean fadeIn, int stubImage, ImageLoaderListener listener) {
if (uri == null || uri.length() == 0)
uri = FAKE_URI;
/*uri = uri.replace("�", URLEncoder.encode("�"));
uri = uri.replace("�", URLEncoder.encode("�"));
uri = uri.replace("'", URLEncoder.encode("'"));
uri = uri.replace("�", URLEncoder.encode("�"));*/
uri = Uri.encode(uri, ALLOWED_URI_CHARS);
Picasso picasso = Picasso.with(imageView.getContext());
RequestCreator requestCreator = picasso.load(uri);
if (stubImage != 0) {
requestCreator.placeholder(stubImage);
requestCreator.error(stubImage);
}
if (!(fadeIn && FADE_ENABLED))
requestCreator.noFade();
LayoutParams params = imageView.getLayoutParams();
if (params.width > 0 && params.height > 0) {
requestCreator.resize(params.width, params.height, true);
}
requestCreator.inSampleSize(true);
requestCreator.into(imageView, listener);
}
use of com.squareup.picasso.Picasso in project cw-omnibus by commonsguy.
the class QuestionsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View result = super.onCreateView(inflater, container, savedInstanceState);
setRetainInstance(true);
OkHttpClient.Builder okb = new OkHttpClient.Builder();
TrustManagerBuilder tmb = new TrustManagerBuilder().withManifestConfig(getActivity());
try {
OkHttp3Integrator.applyTo(tmb, okb);
OkHttpClient ok = okb.build();
picasso = new Picasso.Builder(getActivity()).downloader(new OkHttp3Downloader(ok)).build();
Retrofit retrofit = new Retrofit.Builder().baseUrl("https://api.stackexchange.com").client(ok).addConverterFactory(GsonConverterFactory.create()).build();
StackOverflowInterface so = retrofit.create(StackOverflowInterface.class);
so.questions("android").enqueue(this);
} catch (Exception e) {
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
Log.e(getClass().getSimpleName(), "Exception from TrustManagerBuilder setup", e);
}
return (result);
}
use of com.squareup.picasso.Picasso in project UltimateAndroid by cymcsg.
the class SampleListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.shape_image_fragment_list_sample, container, false);
final Picasso picasso = Picasso.with(getActivity());
picasso.setLoggingEnabled(true);
picasso.setIndicatorsEnabled(false);
int listLayout = getArguments().getInt(ARG_LAYOUT);
final ListView listView = (ListView) view.findViewById(R.id.list);
Adapter adapter = new Adapter(getActivity(), picasso, listLayout);
listView.setAdapter(adapter);
return view;
}
use of com.squareup.picasso.Picasso in project iNGAGE by davis123123.
the class App method onCreate.
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
Picasso built = builder.build();
built.setIndicatorsEnabled(true);
// built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
}
Aggregations