Java Code Examples for com.squareup.picasso.Picasso#setIndicatorsEnabled()

The following examples show how to use com.squareup.picasso.Picasso#setIndicatorsEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleBlog.java    From Simple-Blog-App with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (!FirebaseApp.getApps(this).isEmpty()) {
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);//offlinecapability
    }
    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
    Picasso built = builder.build();
    built.setIndicatorsEnabled(false);
    built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);
}
 
Example 2
Source File: Global.java    From Simple-Blog-App with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Picasso.Builder builder = new Picasso.Builder(this);
    builder.downloader(new OkHttp3Downloader(this,Integer.MAX_VALUE));
    Picasso built = builder.build();
    built.setIndicatorsEnabled(true);
    built.setLoggingEnabled(true);
    Picasso.setSingletonInstance(built);

}
 
Example 3
Source File: ModuleRest.java    From AndroidStarter with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
public Picasso providePicasso(@NonNull final Context poContext) {
    final Picasso loPicasso = Picasso.with(poContext);
    loPicasso.setIndicatorsEnabled(true);
    loPicasso.setLoggingEnabled(true);
    return loPicasso;
}
 
Example 4
Source File: ModuleRest.java    From AndroidStarterAlt with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
public Picasso providePicasso(@NonNull final Context poContext) {
    final Picasso loPicasso = Picasso.with(poContext);
    loPicasso.setIndicatorsEnabled(true);
    loPicasso.setLoggingEnabled(true);
    return loPicasso;
}
 
Example 5
Source File: SampleListFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 6
Source File: SampleBubbleFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.shape_image_fragment_chat_sample, container, false);
    final Picasso picasso = Picasso.with(getActivity());
    picasso.setLoggingEnabled(true);
    picasso.setIndicatorsEnabled(false);

    int listLayout1 = getArguments().getInt(ARG_LAYOUT_1);
    int listLayout2 = getArguments().getInt(ARG_LAYOUT_2);
    final ListView listView = (ListView) view.findViewById(R.id.list);
    Adapter adapter = new Adapter(getActivity(), picasso, listLayout1, listLayout2);
    listView.setAdapter(adapter);

    return view;
}
 
Example 7
Source File: SampleListFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 8
Source File: SampleBubbleFragment.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.shape_image_fragment_chat_sample, container, false);
    final Picasso picasso = Picasso.with(getActivity());
    picasso.setLoggingEnabled(true);
    picasso.setIndicatorsEnabled(false);

    int listLayout1 = getArguments().getInt(ARG_LAYOUT_1);
    int listLayout2 = getArguments().getInt(ARG_LAYOUT_2);
    final ListView listView = (ListView) view.findViewById(R.id.list);
    Adapter adapter = new Adapter(getActivity(), picasso, listLayout1, listLayout2);
    listView.setAdapter(adapter);

    return view;
}
 
Example 9
Source File: PicturePresenter.java    From AndroidDemo with MIT License 4 votes vote down vote up
public void loadImageView() {

        iPictureView.clearImageView();

        boolean cache = iPictureView.getCache();
        boolean disk = iPictureView.getDisk();
        boolean transformation = iPictureView.getTransformation();

        Picasso picasso = Picasso.with(context.get());
        picasso.setIndicatorsEnabled(true);
        picasso.setLoggingEnabled(true);

        String path = "https://avatars2.githubusercontent.com/u/9563634?s=400&u=6c9844a5ee91e0385888cbd5708af59f4062d651&v=4";
        RequestCreator requestCreator = picasso.load(path)
                .config(Bitmap.Config.RGB_565)
                .placeholder(R.drawable.ic_empty_zhihu)
                .error(R.drawable.ic_failed)
                .fit();

        if (!cache) {
            requestCreator.memoryPolicy(MemoryPolicy.NO_CACHE);
        }
        if (!disk) {
            requestCreator.networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE);
        }

        if (transformation) {
            final Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setColor(0xffcccccc);
            paint.setStyle(Paint.Style.FILL);
            final float round = Tools.dip2pxf(context.get(), 8);
            requestCreator.transform(new Transformation() {
                @Override
                public Bitmap transform(Bitmap source) {

                    Bitmap src = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight());
                    Canvas canvas = new Canvas(src);
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                        float r = source.getWidth() / 4 * 3;
                        canvas.drawCircle(source.getWidth() / 2, source.getHeight() / 2, r, paint);
                    } else {
                        canvas.drawRoundRect(round, round, source.getWidth() - round, source.getHeight() - round,
                                round, round, paint);
                    }
                    canvas.drawBitmap(source, 0, 0, paint);
                    if (!source.isRecycled()) {
                        source.recycle();
                    }
                    return src;
                }

                @Override
                public String key() {
                    return "PicassoTransformation";
                }
            });
        }
        requestCreator.into(iPictureView.getTarget(), new Callback() {
            @Override
            public void onSuccess() {
                iPictureView.showToast("success");
            }

            @Override
            public void onError() {
                iPictureView.showToast("error");
            }
        });
    }