<commit_before>package todomore.android;

import org.metawidget.android.widget.AndroidMetawidget;

import com.darwinsys.todo.model.Task;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

public class DetailsActivity extends Activity {

	private Task mTask;

	public void onCreate(Bundle saved) {
		super.onCreate(saved);
		setContentView(R.layout.details_activity);

		long id = getIntent().getLongExtra("taskId", -1);

		if (id != -1) {
			mTask = ((TodoMoreApplication) getApplication()).getTaskDao().findById(id);
		} else {
			mTask = new AndroidTask();
		}

		final AndroidMetawidget metawidget = 
			(AndroidMetawidget) findViewById(R.id.metawidget);
        metawidget.setToInspect(mTask);
        if ( id == -1) {
            metawidget.setReadOnly(false);
        }

        if (!metawidget.isReadOnly()) {
            metawidget.buildWidgets();
            View view = metawidget.findViewWithTag("name");
            view.setFocusable(true);
            view.setFocusableInTouchMode(true);
            view.requestFocus();
        }
	}
}<commit_msg>Make metawidget object a field so enableEditing() can find it<commit_after>package todomore.android;

import org.metawidget.android.widget.AndroidMetawidget;

import com.darwinsys.todo.model.Task;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

/** 
 * An Activity that shows all the Details of one Task, using MetaWidget.
 * It starts in display mode, but an Edit button makes it editable.
 * @author <NAME>
 */
public class DetailsActivity extends Activity {

	private static final String TAG = DetailsActivity.class.getSimpleName();
	private Task mTask;
	private AndroidMetawidget mMetawidget;

	public void onCreate(Bundle saved) {
		super.onCreate(saved);
		setContentView(R.layout.details_activity);

		long id = getIntent().getLongExtra("taskId", -1);
		Log.d(TAG, "_id = " + id);
		if (id != -1) {
			mTask = ((TodoMoreApplication) getApplication()).getTaskDao().findById(id);
		} else {
			mTask = new AndroidTask();
		}

		mMetawidget = (AndroidMetawidget) findViewById(R.id.metawidget);
        mMetawidget.setToInspect(mTask);
        if (id == -1) {
            mMetawidget.setReadOnly(false);
        }

        if (!mMetawidget.isReadOnly()) {
            mMetawidget.buildWidgets();
            View view = mMetawidget.findViewWithTag("name");
            view.setFocusable(true);
            view.setFocusableInTouchMode(true);
            view.requestFocus();
        }
	}
	
	public void enableEditing(View v) {
		Log.d(TAG, "enableEditing");
		mMetawidget.setReadOnly(false);
	}
}
{'fraction_non_alphanumeric': 0.11882308562806489, 'fraction_numerical': 0.002263296869105998, 'mean_word_length': 3.3475409836065575, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3736194', 'n_tokens_mistral': 868, 'n_tokens_neox': 827, 'n_words': 172}