package com.squareup.picasso.sample;

import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import com.squareup.picasso.Picasso;

public class SampleActivity extends Activity {
  private SampleAdapter adapter;

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());

    adapter = new SampleAdapter(this);

    ListView lv = new ListView(this);
    lv.setAdapter(adapter);

    setContentView(lv);
  }

  @Override public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == 0) {
      item.setChecked(!item.isChecked());

      Picasso.with(this).setDebugging(item.isChecked());
      adapter.notifyDataSetChanged();
      return true;
    }
    return super.onOptionsItemSelected(item);
  }

  @Override public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem debugItem = menu.add(0, 0, 0, "Debugging");
    debugItem.setCheckable(true);
    debugItem.setChecked(Picasso.with(this).isDebugging());
    return super.onCreateOptionsMenu(menu);
  }
}

@@ -712,88 +712,73 @@
 n on
+Create
 Options
-ItemSelected(MenuItem item) %7B%0A    if (item.getItemId() == 0) %7B%0A
+Menu(Menu menu) %7B%0A    menu.add(%22Debugging%22)%0A  
       
-item
 .set
@@ -786,38 +786,39 @@
 heck
-ed(!item.isChecked());%0A%0A      
+able(true)%0A        .setChecked(
 Pica
@@ -832,19 +832,18 @@
 h(this).
+i
 s
-et
 Debuggin
@@ -848,317 +848,200 @@
 ing(
-item.isChecked(
 ))
-;
 %0A      
-adapter.notifyDataSetChanged();%0A      return true;%0A    %7D%0A    return super.onOptionsItemSelected(item);%0A  %7D%0A%0A  @Override public boolean onCreateOptionsMenu(Menu menu) %7B%0A    MenuItem debugItem = menu.add(0, 0, 0, %22Debugging%22);%0A    debugItem.setCheckable(true);%0A    debugI
+  .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() %7B%0A          @Override public boolean onMenuItemClick(MenuItem item) %7B%0A            item.setChecked(!i
 tem.
+i
 s
-et
 Checked(
 Pica
@@ -1036,37 +1036,69 @@
 Checked(
-Picasso.with(
+));%0A            Picasso.with(SampleActivity.
 this).
-i
 s
+et
 Debuggin
@@ -1103,54 +1103,135 @@
 ing(
-));%0A    return super.onCreateOptionsMenu(menu)
+item.isChecked());%0A            adapter.notifyDataSetChanged();%0A            return true;%0A          %7D%0A        %7D);%0A    return true
 ;%0A  

Simplify menu debugging logic a bit.