package mozilla.org.webmaker.activity;

import android.view.Menu;
import android.view.MenuItem;

import org.json.JSONException;

import mozilla.org.webmaker.R;
import mozilla.org.webmaker.WebmakerActivity;
import mozilla.org.webmaker.router.Router;

public class Project extends WebmakerActivity {
    public Project() {
        super("project", R.id.project_layout, R.layout.project_layout, R.menu.menu_project);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(menuResId, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Fetch project ID
        String id;
        try {
            id = routeParams.get("project").toString();
        } catch (JSONException e) {
            return super.onOptionsItemSelected(item);
        }

        // Handle button press
        switch (item.getItemId()) {
            case R.id.action_play:
                Router.sharedRouter().open("/projects/" + id + "/play");
                return true;
            case R.id.action_settings:
                Router.sharedRouter().open("/projects/" + id + "/settings");
                return true;
            case R.id.action_share:
                // @todo
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}

@@ -33,16 +33,42 @@
 ivity;%0A%0A
+import android.os.Bundle;%0A
 import a
@@ -432,32 +432,294 @@
 roject);%0A    %7D%0A%0A
+    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        %0A        try %7B%0A            routeParams.put(%22mode%22, %22edit%22);%0A        %7D catch (JSONException e) %7B%0A            // do nothing%0A        %7D%0A    %7D%0A%0A
     @Override%0A  

Set mode = edit in project activity