Android Open Source - picasso Picasso Sample Activity






From Project

Back to project page picasso.

License

The source code is released under:

Apache License

If you think the Android project picasso listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.picasso;
/*from www  .j a  va 2 s.c o  m*/
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.ToggleButton;

import com.squareup.picasso.Picasso;

import static android.view.View.GONE;
import static android.view.View.VISIBLE;

abstract class PicassoSampleActivity extends FragmentActivity {
  private ToggleButton showHide;
  private FrameLayout sampleContent;

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.picasso_sample_activity);
    sampleContent = (FrameLayout) findViewById(R.id.sample_content);

    final ListView activityList = (ListView) findViewById(R.id.activity_list);
    final PicassoSampleAdapter adapter = new PicassoSampleAdapter(this);
    activityList.setAdapter(adapter);
    activityList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
        adapter.getItem(position).launch(PicassoSampleActivity.this);
      }
    });

    showHide = (ToggleButton) findViewById(R.id.faux_action_bar_control);
    showHide.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
      @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
        activityList.setVisibility(checked ? VISIBLE : GONE);
      }
    });
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    Picasso.with(this).cancelTag(this);
  }

  @Override public void onBackPressed() {
    if (showHide.isChecked()) {
      showHide.setChecked(false);
    } else {
      super.onBackPressed();
    }
  }

  @Override public void setContentView(int layoutResID) {
    getLayoutInflater().inflate(layoutResID, sampleContent);
  }

  @Override public void setContentView(View view) {
    sampleContent.addView(view);
  }

  @Override public void setContentView(View view, ViewGroup.LayoutParams params) {
    sampleContent.addView(view, params);
  }
}




Java Source Code List

com.example.picasso.Data.java
com.example.picasso.GrayscaleTransformation.java
com.example.picasso.PicassoSampleActivity.java
com.example.picasso.PicassoSampleAdapter.java
com.example.picasso.SampleContactsActivity.java
com.example.picasso.SampleContactsAdapter.java
com.example.picasso.SampleGalleryActivity.java
com.example.picasso.SampleGridViewActivity.java
com.example.picasso.SampleGridViewAdapter.java
com.example.picasso.SampleListDetailActivity.java
com.example.picasso.SampleListDetailAdapter.java
com.example.picasso.SampleScrollListener.java
com.example.picasso.SampleWidgetProvider.java
com.example.picasso.SquaredImageView.java
com.squareup.picasso.Action.java
com.squareup.picasso.AssetRequestHandler.java
com.squareup.picasso.BitmapHunter.java
com.squareup.picasso.Cache.java
com.squareup.picasso.Callback.java
com.squareup.picasso.ContactsPhotoRequestHandler.java
com.squareup.picasso.ContentStreamRequestHandler.java
com.squareup.picasso.DeferredRequestCreator.java
com.squareup.picasso.Dispatcher.java
com.squareup.picasso.Downloader.java
com.squareup.picasso.FetchAction.java
com.squareup.picasso.FileRequestHandler.java
com.squareup.picasso.GetAction.java
com.squareup.picasso.ImageViewAction.java
com.squareup.picasso.LruCache.java
com.squareup.picasso.MarkableInputStream.java
com.squareup.picasso.MediaStoreRequestHandler.java
com.squareup.picasso.MemoryPolicy.java
com.squareup.picasso.NetworkPolicy.java
com.squareup.picasso.NetworkRequestHandler.java
com.squareup.picasso.OkHttpDownloader.java
com.squareup.picasso.PicassoDrawable.java
com.squareup.picasso.PicassoExecutorService.java
com.squareup.picasso.Picasso.java
com.squareup.picasso.RemoteViewsAction.java
com.squareup.picasso.RequestCreator.java
com.squareup.picasso.RequestHandler.java
com.squareup.picasso.Request.java
com.squareup.picasso.ResourceRequestHandler.java
com.squareup.picasso.StatsSnapshot.java
com.squareup.picasso.Stats.java
com.squareup.picasso.TargetAction.java
com.squareup.picasso.Target.java
com.squareup.picasso.Transformation.java
com.squareup.picasso.UrlConnectionDownloader.java
com.squareup.picasso.Utils.java
com.squareup.picasso.pollexor.PollexorRequestTransformer.java