Skip to content

Instantly share code, notes, and snippets.

@thisandagain
Created May 5, 2015 23:57
Show Gist options
  • Save thisandagain/33c918dd9f7896d5a9d9 to your computer and use it in GitHub Desktop.
Save thisandagain/33c918dd9f7896d5a9d9 to your computer and use it in GitHub Desktop.
package mozilla.org.webmaker.activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RelativeLayout;
import mozilla.org.webmaker.R;
import mozilla.org.webmaker.WebmakerActivity;
import mozilla.org.webmaker.view.WebmakerWebView;
public class Map extends WebmakerActivity {
public Map() {
super("map", R.id.map_layout, R.layout.map_layout, R.menu.menu_map);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Extract route information from intent extras
Bundle intentExtras = getIntent().getExtras();
String projectId = intentExtras.get("id").toString();
Log.v("Route!", projectId);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(menuResId, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return item.getItemId() == R.id.action_settings;
}
}
package mozilla.org.webmaker;
import android.app.Application;
import android.util.Log;
import mozilla.org.webmaker.activity.Editor;
import mozilla.org.webmaker.activity.Map;
import mozilla.org.webmaker.activity.Project;
import mozilla.org.webmaker.activity.Tinker;
import mozilla.org.webmaker.router.Router;
public class WebmakerApplication extends Application {
// Singleton
private WebmakerApplication singleton;
public WebmakerApplication getInstance(){
return singleton;
}
@Override
public void onCreate() {
super.onCreate();
singleton = this;
Log.v("[Webmaker]", "Application created.");
// Router
Router.sharedRouter().setContext(getApplicationContext());
Router.sharedRouter().map("/main", MainActivity.class);
Router.sharedRouter().map("/main/:tab", MainActivity.class);
Router.sharedRouter().map("/map/:id", Map.class);
Router.sharedRouter().map("/projects/:projectId", Project.class);
Router.sharedRouter().map("/projects/:projectId/elements/:elementId", Editor.class);
Router.sharedRouter().map("/projects/:projectId/elements/:elementId/:attributeId", Tinker.class);
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
public void onTerminate() {
super.onTerminate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment