/*
 * Copyright 2012 GitHub Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.mobile.issue;

import static com.github.mobile.util.GitHubIntents.EXTRA_ISSUE;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;

import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.github.mobile.R.id;
import com.github.mobile.R.layout;
import com.github.mobile.R.menu;
import com.github.mobile.R.string;
import com.github.mobile.util.GitHubIntents.Builder;
import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity;

import org.eclipse.egit.github.core.Issue;

import roboguice.inject.InjectExtra;
import roboguice.inject.InjectView;

/**
 * Activity to edit the title and description for an issue
 */
public class EditIssueActivity extends RoboSherlockFragmentActivity {

    @InjectView(id.et_issue_title)
    private EditText titleText;

    @InjectView(id.et_issue_body)
    private EditText bodyText;

    @InjectExtra(EXTRA_ISSUE)
    private Issue issue;

    /**
     * Create intent to edit an issue
     *
     * @param issue
     * @return intent
     */
    public static Intent createIntent(final Issue issue) {
        return new Builder("repo.issues.edit.VIEW").issue(issue).toIntent();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(layout.issue_edit);
        setTitle(getString(string.issue_title) + issue.getNumber());

        titleText.setText(issue.getTitle());
        bodyText.setText(issue.getBody());
    }

    public boolean onCreateOptionsMenu(Menu options) {
        getSupportMenuInflater().inflate(menu.issue_edit, options);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case id.issue_edit:
            Intent intent = new Intent();
            Issue edited = new Issue();
            edited.setTitle(titleText.getText().toString());
            edited.setBody(bodyText.getText().toString());
            intent.putExtra(EXTRA_ISSUE, edited);
            setResult(RESULT_OK, intent);
            finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
}

@@ -1396,206 +1396,16 @@
  %7B%0A%0A
-    @InjectView(id.et_issue_title)%0A    private EditText titleText;%0A%0A    @InjectView(id.et_issue_body)%0A    private EditText bodyText;%0A%0A    @InjectExtra(EXTRA_ISSUE)%0A    private Issue issue;%0A%0A
     /**%0A
     
@@ -1400,16 +1400,16 @@
     /**%0A
+
      * C
@@ -1634,24 +1634,214 @@
 t();%0A    %7D%0A%0A
+    @InjectView(id.et_issue_title)%0A    private EditText titleText;%0A%0A    @InjectView(id.et_issue_body)%0A    private EditText bodyText;%0A%0A    @InjectExtra(EXTRA_ISSUE)%0A    private Issue issue;%0A%0A
     @Overrid
@@ -1943,16 +1943,17 @@
 State);%0A
+%0A
         
@@ -2144,32 +2144,46 @@
 Body());%0A    %7D%0A%0A
+    @Override%0A
     public boole
@@ -2313,24 +2313,38 @@
 rue;%0A    %7D%0A%0A
+    @Override%0A
     public b

Put static methods above instance variables