Search in sources :

Example 1 with StatsSnapshot

use of com.squareup.picasso.StatsSnapshot in project cw-omnibus by commonsguy.

the class PicassoDiagnosticService method getContextForPath.

@Override
protected Context getContextForPath(String relpath) {
    if ("picasso.hbs".equals(relpath)) {
        StatsSnapshot ss = Picasso.with(PicassoDiagnosticService.this).getSnapshot();
        String formattedTime = DateUtils.formatDateTime(PicassoDiagnosticService.this, ss.timeStamp, DateUtils.FORMAT_SHOW_TIME);
        return (Context.newBuilder(ss).combine("formattedTime", formattedTime).resolver(FieldValueResolver.INSTANCE).build());
    }
    throw new IllegalStateException("Did not recognize " + relpath);
}
Also used : StatsSnapshot(com.squareup.picasso.StatsSnapshot)

Example 2 with StatsSnapshot

use of com.squareup.picasso.StatsSnapshot in project sbt-android by scala-android.

the class DebugView method refreshPicassoStats.

private void refreshPicassoStats() {
    StatsSnapshot snapshot = picasso.getSnapshot();
    String size = getSizeString(snapshot.size);
    String total = getSizeString(snapshot.maxSize);
    int percentage = (int) ((1f * snapshot.size / snapshot.maxSize) * 100);
    picassoCacheSizeView.setText(size + " / " + total + " (" + percentage + "%)");
    picassoCacheHitView.setText(String.valueOf(snapshot.cacheHits));
    picassoCacheMissView.setText(String.valueOf(snapshot.cacheMisses));
    picassoDecodedView.setText(String.valueOf(snapshot.originalBitmapCount));
    picassoDecodedTotalView.setText(getSizeString(snapshot.totalOriginalBitmapSize));
    picassoDecodedAvgView.setText(getSizeString(snapshot.averageOriginalBitmapSize));
    picassoTransformedView.setText(String.valueOf(snapshot.transformedBitmapCount));
    picassoTransformedTotalView.setText(getSizeString(snapshot.totalTransformedBitmapSize));
    picassoTransformedAvgView.setText(getSizeString(snapshot.averageTransformedBitmapSize));
}
Also used : ApiEndpoint(com.jakewharton.u2020.data.ApiEndpoint) StatsSnapshot(com.squareup.picasso.StatsSnapshot)

Example 3 with StatsSnapshot

use of com.squareup.picasso.StatsSnapshot in project u2020 by JakeWharton.

the class DebugView method refreshPicassoStats.

private void refreshPicassoStats() {
    StatsSnapshot snapshot = picasso.getSnapshot();
    String size = getSizeString(snapshot.size);
    String total = getSizeString(snapshot.maxSize);
    int percentage = (int) ((1f * snapshot.size / snapshot.maxSize) * 100);
    picassoCacheSizeView.setText(size + " / " + total + " (" + percentage + "%)");
    picassoCacheHitView.setText(String.valueOf(snapshot.cacheHits));
    picassoCacheMissView.setText(String.valueOf(snapshot.cacheMisses));
    picassoDecodedView.setText(String.valueOf(snapshot.originalBitmapCount));
    picassoDecodedTotalView.setText(getSizeString(snapshot.totalOriginalBitmapSize));
    picassoDecodedAvgView.setText(getSizeString(snapshot.averageOriginalBitmapSize));
    picassoTransformedView.setText(String.valueOf(snapshot.transformedBitmapCount));
    picassoTransformedTotalView.setText(getSizeString(snapshot.totalTransformedBitmapSize));
    picassoTransformedAvgView.setText(getSizeString(snapshot.averageTransformedBitmapSize));
}
Also used : ApiEndpoint(com.jakewharton.u2020.data.ApiEndpoint) StatsSnapshot(com.squareup.picasso.StatsSnapshot)

Example 4 with StatsSnapshot

use of com.squareup.picasso.StatsSnapshot in project cw-omnibus by commonsguy.

the class PicassoDiagnosticActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    StatsSnapshot ss = Picasso.with(this).getSnapshot();
    TextView tv = (TextView) findViewById(R.id.last_updated_value);
    tv.setText(DateUtils.formatDateTime(this, ss.timeStamp, DateUtils.FORMAT_SHOW_TIME));
    tv = (TextView) findViewById(R.id.avg_download_size_value);
    tv.setText(Long.toString(ss.averageDownloadSize));
    tv = (TextView) findViewById(R.id.avg_orig_size_value);
    tv.setText(Long.toString(ss.averageOriginalBitmapSize));
    tv = (TextView) findViewById(R.id.avg_xform_size_value);
    tv.setText(Long.toString(ss.averageTransformedBitmapSize));
    tv = (TextView) findViewById(R.id.cache_hits_value);
    tv.setText(Long.toString(ss.cacheHits));
    tv = (TextView) findViewById(R.id.cache_misses_value);
    tv.setText(Long.toString(ss.cacheMisses));
    tv = (TextView) findViewById(R.id.download_count_value);
    tv.setText(Long.toString(ss.downloadCount));
    tv = (TextView) findViewById(R.id.max_size_value);
    tv.setText(Long.toString(ss.maxSize));
    tv = (TextView) findViewById(R.id.orig_bitmap_count_value);
    tv.setText(Long.toString(ss.originalBitmapCount));
    tv = (TextView) findViewById(R.id.size_value);
    tv.setText(Long.toString(ss.size));
    tv = (TextView) findViewById(R.id.total_dl_size_value);
    tv.setText(Long.toString(ss.totalDownloadSize));
    tv = (TextView) findViewById(R.id.total_orig_size_value);
    tv.setText(Long.toString(ss.totalOriginalBitmapSize));
    tv = (TextView) findViewById(R.id.total_xform_size_value);
    tv.setText(Long.toString(ss.totalTransformedBitmapSize));
    tv = (TextView) findViewById(R.id.xform_count_value);
    tv.setText(Long.toString(ss.transformedBitmapCount));
}
Also used : TextView(android.widget.TextView) StatsSnapshot(com.squareup.picasso.StatsSnapshot)

Aggregations

StatsSnapshot (com.squareup.picasso.StatsSnapshot)4 ApiEndpoint (com.jakewharton.u2020.data.ApiEndpoint)2 TextView (android.widget.TextView)1