
package com.uwetrottmann.shopr.ui;

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

import com.uwetrottmann.shopr.R;

public class ResultsActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_results);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.results, menu);
        return true;
    }

}

@@ -59,16 +59,48 @@
 tivity;%0A
+import android.database.Cursor;%0A
 import a
@@ -142,16 +142,48 @@
 ew.Menu;
+%0Aimport android.widget.TextView;
 %0A%0Aimport
@@ -213,223 +213,1681 @@
 .R;%0A
-%0Apublic class ResultsActivity extends Activity %7B%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.activity_results);
+import com.uwetrottmann.shopr.provider.ShoprContract.Stats;%0A%0A/**%0A * Displays the given stats and allows to start a new task.%0A */%0Apublic class ResultsActivity extends Activity %7B%0A%0A    public interface InitBundle %7B%0A        String STATS_ID = %22stats_id%22;%0A    %7D%0A%0A    private int mStatId;%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.activity_results);%0A%0A        // extract stat id%0A        Bundle extras = getIntent().getExtras();%0A        if (extras == null) %7B%0A            finish();%0A            return;%0A        %7D%0A        mStatId = extras.getInt(InitBundle.STATS_ID);%0A%0A        setupViews();%0A    %7D%0A%0A    private void setupViews() %7B%0A        TextView textViewUserName = (TextView) findViewById(R.id.textViewResultsUsername);%0A        TextView textViewTaskType = (TextView) findViewById(R.id.textViewResultsTaskType);%0A        TextView textViewDuration = (TextView) findViewById(R.id.textViewResultsDuration);%0A        TextView textViewCycles = (TextView) findViewById(R.id.textViewResultsCycles);%0A%0A        final Cursor query = getContentResolver().query(Stats.buildStatUri(mStatId), new String%5B%5D %7B%0A                Stats._ID, Stats.USERNAME, Stats.TASK_TYPE, Stats.DURATION, Stats.CYCLE_COUNT%0A        %7D, null, null, null);%0A        if (query != null) %7B%0A            if (query.moveToFirst()) %7B%0A                textViewUserName.setText(query.getString(1));%0A                textViewTaskType.setText(query.getString(2));%0A                textViewDuration.setText(query.getString(3));%0A                textViewCycles.setText(query.getString(4));%0A            %7D%0A            query.close();%0A        %7D
 %0A   

Load data when displaying results.