├── filters
├── .gitignore
└── dev.properties
├── .gitignore
├── res
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── drawable
│ ├── twitter_logo.png
│ ├── gh_header_logo.png
│ ├── spring09_logo.png
│ ├── ic_tab_info_selected.png
│ ├── ic_tab_events_selected.png
│ ├── ic_tab_info_unselected.png
│ ├── ic_tab_events_unselected.png
│ ├── ic_tab_profile_selected.png
│ ├── ic_tab_profile_unselected.png
│ ├── ic_menu_close_clear_cancel.png
│ ├── ic_tab_events.xml
│ ├── ic_tab_info.xml
│ └── ic_tab_profile.xml
├── menu
│ ├── events_menu.xml
│ ├── tweets_menu.xml
│ └── profile_menu.xml
├── layout
│ ├── menu_list_item.xml
│ ├── web_oauth_activity_layout.xml
│ ├── event_description.xml
│ ├── event_session_description.xml
│ ├── tweet_list_item.xml
│ ├── events_list_item.xml
│ ├── event_sessions_list_item.xml
│ ├── profile.xml
│ ├── main.xml
│ ├── post_tweet.xml
│ ├── tweet_details.xml
│ ├── event_details.xml
│ ├── event_session_rating.xml
│ ├── authorize.xml
│ ├── info.xml
│ ├── event_session_details.xml
│ └── sign_in.xml
└── values
│ ├── env_settings.xml
│ ├── styles.xml
│ └── strings.xml
├── project.properties
├── NOTICE
├── src
├── org
│ └── springframework
│ │ └── social
│ │ └── greenhouse
│ │ ├── api
│ │ ├── TweetFeed.java
│ │ ├── impl
│ │ │ ├── GreenhouseErrorHandler.java
│ │ │ ├── GroupMixin.java
│ │ │ ├── TimeZoneMixin.java
│ │ │ ├── RoomMixin.java
│ │ │ ├── LeaderMixin.java
│ │ │ ├── GreenhouseProfileMixin.java
│ │ │ ├── VenueMixin.java
│ │ │ ├── TweetFeedMixin.java
│ │ │ ├── TweetMixin.java
│ │ │ ├── EventSessionMixin.java
│ │ │ ├── EventTemplate.java
│ │ │ ├── EventMixin.java
│ │ │ ├── UserTemplate.java
│ │ │ ├── AbstractGreenhouseOperations.java
│ │ │ ├── GreenhouseModule.java
│ │ │ ├── SessionTemplate.java
│ │ │ ├── GreenhouseTemplate.java
│ │ │ └── TweetTemplate.java
│ │ ├── TimeZone.java
│ │ ├── Group.java
│ │ ├── Room.java
│ │ ├── Leader.java
│ │ ├── EventOperations.java
│ │ ├── Venue.java
│ │ ├── UserOperations.java
│ │ ├── Greenhouse.java
│ │ ├── Tweet.java
│ │ ├── GreenhouseProfile.java
│ │ ├── SessionOperations.java
│ │ ├── TweetOperations.java
│ │ ├── EventSession.java
│ │ └── Event.java
│ │ └── connect
│ │ ├── GreenhouseOAuth2Template.java
│ │ ├── GreenhouseConnectionFactory.java
│ │ ├── GreenhouseAdapter.java
│ │ └── GreenhouseServiceProvider.java
└── com
│ └── springsource
│ └── greenhouse
│ ├── GreenhouseActivity.java
│ ├── events
│ ├── EventsListAdapter.java
│ ├── EventTweetsActivity.java
│ ├── EventDescriptionActivity.java
│ ├── sessions
│ │ ├── EventSessionsListAdapter.java
│ │ ├── EventSessionDescriptionActivity.java
│ │ ├── EventSessionsMyFavoritesActivity.java
│ │ ├── EventSessionsConferenceFavoritesActivity.java
│ │ ├── EventSessionsFilteredActivity.java
│ │ ├── EventSessionTweetsActivity.java
│ │ ├── EventSessionsCurrentActivity.java
│ │ ├── EventSessionsByDayActivity.java
│ │ ├── EventSessionsListActivity.java
│ │ ├── EventSessionsUpcomingActivity.java
│ │ ├── EventSessionsScheduleActivity.java
│ │ └── EventSessionDetailsActivity.java
│ ├── EventsActivityGroup.java
│ ├── EventDetailsActivity.java
│ └── EventsActivity.java
│ ├── authorization
│ └── AuthorizeActivity.java
│ ├── InfoActivity.java
│ ├── MainActivity.java
│ ├── twitter
│ ├── TweetsListAdapter.java
│ └── TweetsListActivity.java
│ ├── MainTabWidget.java
│ ├── ProgressAsyncTask.java
│ ├── AbstractGreenhouseActivity.java
│ ├── AbstractGreenhouseListActivity.java
│ ├── MainApplication.java
│ └── profile
│ └── ProfileActivity.java
├── AndroidManifest.xml
├── README
└── pom.xml
/filters/.gitignore:
--------------------------------------------------------------------------------
1 | prod.properties
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | bin
3 | gen
4 | target
5 | .project
6 | .classpath
7 | .settings
8 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable/twitter_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/twitter_logo.png
--------------------------------------------------------------------------------
/res/drawable/gh_header_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/gh_header_logo.png
--------------------------------------------------------------------------------
/res/drawable/spring09_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/spring09_logo.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_info_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_info_selected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_events_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_events_selected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_info_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_info_unselected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_events_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_events_unselected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_profile_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_profile_selected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_profile_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_tab_profile_unselected.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_close_clear_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-attic/greenhouse-android/master/res/drawable/ic_menu_close_clear_cancel.png
--------------------------------------------------------------------------------
/res/menu/events_menu.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/res/menu/tweets_menu.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/filters/dev.properties:
--------------------------------------------------------------------------------
1 | client.id=e9fbccdae98d5696
2 | client.secret=9fa283e1eca2d4e8
3 | connection.repository.encryption.password=password
4 | connection.repository.encryption.salt=5c0744940b5c369b
5 | base.url=https://10.0.2.2:8080/greenhouse/
--------------------------------------------------------------------------------
/res/layout/menu_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_events.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/ic_tab_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/menu/profile_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/res/layout/web_oauth_activity_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-16
12 |
--------------------------------------------------------------------------------
/res/values/env_settings.xml:
--------------------------------------------------------------------------------
1 |
2 | ${client.id}
3 | ${client.secret}
4 | ${connection.repository.encryption.password}
5 | ${connection.repository.encryption.salt}
6 | ${base.url}
7 |
--------------------------------------------------------------------------------
/res/layout/event_description.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
9 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/res/layout/event_session_description.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
9 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/res/layout/tweet_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/res/layout/events_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
11 |
12 |
14 |
15 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/res/layout/event_sessions_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
11 |
12 |
14 |
15 |
17 |
18 |
--------------------------------------------------------------------------------
/res/layout/profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
13 |
14 |
20 |
21 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Greenhouse for Android 1.0.0.BUILD-SNAPSHOT
2 | Copyright (c) 2010-2012 VMware, Inc. All Rights Reserved.
3 |
4 | This product is licensed to you under the Apache License, Version 2.0 (the "License").
5 | You may not use this product except in compliance with the License.
6 |
7 | This product may include a number of subcomponents with separate copyright notices
8 | and license terms. Your use of these subcomponents is subject to the terms and
9 | conditions of the subcomponent's license, as noted in the LICENSE file.
10 |
11 | This software downloads additional open source software components upon install
12 | that are distributed under separate terms and conditions. Please see the license
13 | information provided in the individual software components for more information.
14 |
15 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/TweetFeed.java:
--------------------------------------------------------------------------------
1 | package org.springframework.social.greenhouse.api;
2 |
3 | import java.util.List;
4 |
5 | public class TweetFeed {
6 |
7 | private boolean lastPage;
8 |
9 | private long maxId;
10 |
11 | private long sinceId;
12 |
13 | private List tweets;
14 |
15 | public TweetFeed(boolean lastPage, long maxId, long sinceId, List tweets) {
16 | this.lastPage = lastPage;
17 | this.maxId = maxId;
18 | this.sinceId = sinceId;
19 | this.tweets = tweets;
20 | }
21 |
22 | public boolean getLastPage() {
23 | return lastPage;
24 | }
25 |
26 | public long getMaxId() {
27 | return maxId;
28 | }
29 |
30 | public long getSinceId() {
31 | return sinceId;
32 | }
33 |
34 | public List getTweets() {
35 | return tweets;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
12 |
13 |
14 |
18 |
19 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/GreenhouseErrorHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.springframework.web.client.DefaultResponseErrorHandler;
19 |
20 | /**
21 | * @author Roy Clarkson
22 | */
23 | public class GreenhouseErrorHandler extends DefaultResponseErrorHandler {
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/GreenhouseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | /**
19 | * @author Roy Clarkson
20 | */
21 | public interface GreenhouseActivity {
22 |
23 | MainApplication getApplicationContext();
24 |
25 | void showProgressDialog();
26 |
27 | void showProgressDialog(String message);
28 |
29 | void dismissProgressDialog();
30 | }
31 |
--------------------------------------------------------------------------------
/res/layout/post_tweet.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
17 |
18 |
25 |
26 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/TimeZone.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * @author Roy Clarkson
21 | */
22 | public class TimeZone {
23 |
24 | private String id;
25 |
26 | @SuppressWarnings("unused")
27 | private boolean fixed;
28 |
29 | public TimeZone(String id, boolean fixed) {
30 | this.id = id;
31 | this.fixed = fixed;
32 | }
33 |
34 | public String getId() {
35 | return id;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/connect/GreenhouseOAuth2Template.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.connect;
17 |
18 | import org.springframework.social.oauth2.OAuth2Template;
19 |
20 | /**
21 | * Greenhouse-specific extension of OAuth2Template.
22 | * @author Roy Clarkson
23 | */
24 | public class GreenhouseOAuth2Template extends OAuth2Template {
25 |
26 | public GreenhouseOAuth2Template(String clientId, String clientSecret) {
27 | super(clientId, clientSecret, "https://greenhouse.springsource.org/signin", "https://greenhouse.springsource.org/oauth/token");
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Group.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * Model class representing a Greenhouse group.
21 | *
22 | * @author Craig Walls
23 | */
24 | public class Group {
25 |
26 | private String id;
27 |
28 | private String label;
29 |
30 | /**
31 | * The group ID.
32 | *
33 | * @return the group ID.
34 | */
35 | public String getId() {
36 | return id;
37 | }
38 |
39 | /**
40 | * The group's label.
41 | *
42 | * @return the group's label.
43 | */
44 | public String getLabel() {
45 | return label;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/GroupMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.annotate.JsonCreator;
19 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
20 | import org.codehaus.jackson.annotate.JsonProperty;
21 |
22 | /**
23 | * Mixin class for adding Jackson annotations to Event.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | @JsonIgnoreProperties(ignoreUnknown=true)
28 | abstract class GroupMixin {
29 | @JsonCreator
30 | GroupMixin(
31 | @JsonProperty("id") String id,
32 | @JsonProperty("label") String label) {}
33 | }
34 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Room.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * @author Roy Clarkson
21 | */
22 | public class Room {
23 |
24 | private long parentId;
25 |
26 | private long id;
27 |
28 | private String label;
29 |
30 | public Room(long parentId, long id, String label) {
31 | this.parentId = parentId;
32 | this.id = id;
33 | this.label = label;
34 | }
35 |
36 | public long getParentId() {
37 | return parentId;
38 | }
39 |
40 | public long getId() {
41 | return id;
42 | }
43 |
44 | public String getLabel() {
45 | return label;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/TimeZoneMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.annotate.JsonCreator;
19 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
20 | import org.codehaus.jackson.annotate.JsonProperty;
21 |
22 | /**
23 | * Mixin class for adding Jackson annotations to TimeZone.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | @JsonIgnoreProperties(ignoreUnknown=true)
28 | abstract class TimeZoneMixin {
29 | @JsonCreator
30 | TimeZoneMixin(
31 | @JsonProperty("id") String id,
32 | @JsonProperty("fixed") boolean fixed) {}
33 | }
34 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/RoomMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.annotate.JsonCreator;
19 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
20 | import org.codehaus.jackson.annotate.JsonProperty;
21 |
22 | /**
23 | * Mixin class for adding Jackson annotations to Room.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | @JsonIgnoreProperties(ignoreUnknown=true)
28 | abstract class RoomMixin {
29 | @JsonCreator
30 | RoomMixin(
31 | @JsonProperty("parentId") long parentId,
32 | @JsonProperty("id") long id,
33 | @JsonProperty("label") String label) {}
34 | }
35 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Leader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * @author Roy Clarkson
21 | */
22 | public class Leader {
23 |
24 | private String name;
25 |
26 | private String firstName;
27 |
28 | private String lastName;
29 |
30 | public Leader(String name, String firstName, String lastName) {
31 | this.name = name;
32 | this.firstName = firstName;
33 | this.lastName = lastName;
34 | }
35 |
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | public String getFirstName() {
41 | return firstName;
42 | }
43 |
44 | public String getLastName() {
45 | return lastName;
46 | }
47 | }
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/LeaderMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.annotate.JsonCreator;
19 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
20 | import org.codehaus.jackson.annotate.JsonProperty;
21 |
22 | /**
23 | * Mixin class for adding Jackson annotations to Leader.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | @JsonIgnoreProperties(ignoreUnknown=true)
28 | abstract class LeaderMixin {
29 | @JsonCreator
30 | LeaderMixin(
31 | @JsonProperty("name") String name,
32 | @JsonProperty("firstName") String firstName,
33 | @JsonProperty("lastName") String lastName) {}
34 | }
35 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/GreenhouseProfileMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.annotate.JsonCreator;
19 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
20 | import org.codehaus.jackson.annotate.JsonProperty;
21 |
22 | /**
23 | * Mixin class for adding Jackson annotations to GreenhouseProfile.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | @JsonIgnoreProperties(ignoreUnknown=true)
28 | abstract class GreenhouseProfileMixin {
29 | @JsonCreator
30 | GreenhouseProfileMixin(
31 | @JsonProperty("accountId") long id,
32 | @JsonProperty("displayName") String screenName,
33 | @JsonProperty("pictureUrl") String profileImageUrl) {}
34 | }
35 |
--------------------------------------------------------------------------------
/res/layout/tweet_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
11 |
12 |
17 |
18 |
20 |
21 |
23 |
24 |
29 |
30 |
33 |
34 |
37 |
38 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/VenueMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.Map;
19 |
20 | import org.codehaus.jackson.annotate.JsonCreator;
21 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
22 | import org.codehaus.jackson.annotate.JsonProperty;
23 |
24 | /**
25 | * Mixin class for adding Jackson annotations to Venue.
26 | *
27 | * @author Roy Clarkson
28 | */
29 | @JsonIgnoreProperties(ignoreUnknown=true)
30 | abstract class VenueMixin {
31 | @JsonCreator
32 | VenueMixin(
33 | @JsonProperty("id") long id,
34 | @JsonProperty("name") String name,
35 | @JsonProperty("postalAddress") String postalAddress,
36 | @JsonProperty("locationHint") String locationHint,
37 | @JsonProperty("location") Map location) {}
38 | }
39 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/TweetFeedMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.List;
19 |
20 | import org.codehaus.jackson.annotate.JsonCreator;
21 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
22 | import org.codehaus.jackson.annotate.JsonProperty;
23 | import org.springframework.social.greenhouse.api.Tweet;
24 |
25 | /**
26 | * Mixin class for adding Jackson annotations to Tweet.
27 | *
28 | * @author Roy Clarkson
29 | */
30 | @JsonIgnoreProperties(ignoreUnknown=true)
31 | abstract class TweetFeedMixin {
32 | @JsonCreator
33 | TweetFeedMixin(
34 | @JsonProperty("lastPage") boolean lastPage,
35 | @JsonProperty("maxId") long maxId,
36 | @JsonProperty("sinceId") long sinceId,
37 | @JsonProperty("tweets") List tweets) {}
38 | }
39 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/EventOperations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.util.Date;
19 | import java.util.List;
20 |
21 |
22 | /**
23 | * Interface defining the operations for retrieving {@link Event} information.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | public interface EventOperations {
28 |
29 | /**
30 | * Retrieves a list of events occurring in the future.
31 | *
32 | * @return a list of upcoming {@link Event} objects.
33 | */
34 | List getUpcomingEvents();
35 |
36 | /**
37 | * Retrieve a list of events that take place after a given time.
38 | *
39 | * @param date the starting point used to filter the list of events.
40 | * @return a list of {@link Event} objects that take place after the given time.
41 | */
42 | List getEventsAfter(Date date);
43 | }
44 |
--------------------------------------------------------------------------------
/res/layout/event_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
11 |
12 |
17 |
18 |
20 |
21 |
23 |
24 |
29 |
30 |
33 |
34 |
37 |
38 |
41 |
42 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/TweetMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.Date;
19 |
20 | import org.codehaus.jackson.annotate.JsonCreator;
21 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
22 | import org.codehaus.jackson.annotate.JsonProperty;
23 |
24 | /**
25 | * Mixin class for adding Jackson annotations to Tweet.
26 | *
27 | * @author Roy Clarkson
28 | */
29 | @JsonIgnoreProperties(ignoreUnknown=true)
30 | abstract class TweetMixin {
31 | @JsonCreator
32 | TweetMixin(
33 | @JsonProperty("id") long id,
34 | @JsonProperty("text") String text,
35 | @JsonProperty("createdAt") Date createdAt,
36 | @JsonProperty("fromUser") String fromUser,
37 | @JsonProperty("profileImageUrl") String profileImageUrl,
38 | @JsonProperty("userId") long userId,
39 | @JsonProperty("languageCode") String languageCode,
40 | @JsonProperty("source") String source) {}
41 | }
42 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventsListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.springsource.greenhouse.events;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.social.greenhouse.api.Event;
6 |
7 | import android.content.Context;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.BaseAdapter;
12 | import android.widget.TextView;
13 |
14 | import com.springsource.greenhouse.R;
15 |
16 | public class EventsListAdapter extends BaseAdapter {
17 |
18 | private List events;
19 | private final LayoutInflater layoutInflater;
20 |
21 | public EventsListAdapter(Context context, List events) {
22 | this.events = events;
23 | this.layoutInflater = LayoutInflater.from(context);
24 | }
25 |
26 | public int getCount() {
27 | if (events == null) {
28 | return 0;
29 | }
30 | return events.size();
31 | }
32 |
33 | public Event getItem(int position) {
34 | return events.get(position);
35 | }
36 |
37 | public long getItemId(int position) {
38 | return position;
39 | }
40 |
41 | public View getView(int position, View convertView, ViewGroup parent) {
42 | Event event = getItem(position);
43 | View view = convertView;
44 |
45 | if (view == null) {
46 | view = layoutInflater.inflate(R.layout.events_list_item, parent, false);
47 | }
48 |
49 | if (event != null) {
50 | TextView t = (TextView) view.findViewById(R.id.event_list_item_title);
51 | t.setText(event.getTitle());
52 |
53 | t = (TextView) view.findViewById(R.id.event_list_item_groupname);
54 | t.setText(event.getGroupName());
55 |
56 | t = (TextView) view.findViewById(R.id.event_list_item_date);
57 | t.setText(event.getFormattedTimeSpan());
58 | }
59 |
60 | return view;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/res/layout/event_session_rating.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
17 |
18 |
22 |
23 |
30 |
31 |
38 |
39 |
40 |
41 |
46 |
47 |
52 |
53 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Venue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.util.Map;
19 |
20 | /**
21 | * @author Roy Clarkson
22 | */
23 | public class Venue {
24 |
25 | private long id;
26 |
27 | private String name;
28 |
29 | private String postalAddress;
30 |
31 | private String locationHint;
32 |
33 | private Map location;
34 |
35 | public Venue(long id, String name, String postalAddress, String locationHint, Map location) {
36 | this.id = id;
37 | this.name = name;
38 | this.postalAddress = postalAddress;
39 | this.locationHint = locationHint;
40 | this.location = location;
41 | }
42 |
43 | public double getLatitude() {
44 | return location.get("latitude");
45 | }
46 |
47 | public double getLongitude() {
48 | return location.get("longitude");
49 | }
50 |
51 | public long getId() {
52 | return id;
53 | }
54 |
55 | public String getName() {
56 | return name;
57 | }
58 |
59 | public String getPostalAddress() {
60 | return postalAddress;
61 | }
62 |
63 | public String getLocationHint() {
64 | return locationHint;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/UserOperations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | /**
19 | * Interface defining the operations for retrieving information about Greenhouse users.
20 | *
21 | * @author Roy Clarkson
22 | */
23 | public interface UserOperations {
24 |
25 | /**
26 | * Retrieves the user's Greenhouse profile ID.
27 | *
28 | * @return the user's Greenhouse profile ID.
29 | */
30 | long getAccountId();
31 |
32 | /**
33 | * Retrieves the authenticated user's Greenhouse screen name
34 | *
35 | * @return the user's screen name
36 | */
37 | String getDisplayName();
38 |
39 | /**
40 | * Retrieves the authenticated user's Greenhouse profile details.
41 | *
42 | * @return a {@link GreenhouseProfile} object representing the user's profile.
43 | */
44 | GreenhouseProfile getUserProfile();
45 |
46 | /**
47 | * Retrieves a specific user's Greenhouse profile details.
48 | *
49 | * @param userId the user ID for the user whose details are to be retrieved.
50 | * @return a {@link GreenhouseProfile} object representing the user's profile.
51 | */
52 | GreenhouseProfile getUserProfile(long userId);
53 | }
54 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Greenhouse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import org.springframework.social.ApiBinding;
19 | import org.springframework.social.greenhouse.api.impl.GreenhouseTemplate;
20 |
21 | /**
22 | * Interface specifying a basic set of operations for interacting with Greenhouse.
23 | * Implemented by {@link GreenhouseTemplate}. Not often used directly, but a
24 | * useful option to enhance testability, as it can easily be mocked or stubbed.
25 | *
26 | * @author Roy Clarkson
27 | */
28 | public interface Greenhouse extends ApiBinding {
29 |
30 | /**
31 | * Returns the portion of the Greenhouse API containing the event operations.
32 | */
33 | EventOperations eventOperations();
34 |
35 | /**
36 | * Returns the portion of the Greenhouse API containing the session operations.
37 | */
38 | SessionOperations sessionOperations();
39 |
40 | /**
41 | * Returns the portion of the Greenhouse API containing the user operations.
42 | */
43 | UserOperations userOperations();
44 |
45 | /**
46 | * Returns the portion of the Greenhouse API containing the tweet operations.
47 | */
48 | TweetOperations tweetOperations();
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/EventSessionMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.Date;
19 | import java.util.List;
20 |
21 | import org.codehaus.jackson.annotate.JsonCreator;
22 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
23 | import org.codehaus.jackson.annotate.JsonProperty;
24 | import org.springframework.social.greenhouse.api.Leader;
25 | import org.springframework.social.greenhouse.api.Room;
26 |
27 | /**
28 | * Mixin class for adding Jackson annotations to EventSession.
29 | *
30 | * @author Roy Clarkson
31 | */
32 | @JsonIgnoreProperties(ignoreUnknown=true)
33 | abstract class EventSessionMixin {
34 | @JsonCreator
35 | EventSessionMixin(
36 | @JsonProperty("id") long id,
37 | @JsonProperty("title") String title,
38 | @JsonProperty("description") String description,
39 | @JsonProperty("startTime") Date startTime,
40 | @JsonProperty("endTime") Date endTime,
41 | @JsonProperty("hashtag") String hashtag,
42 | @JsonProperty("rating") float rating,
43 | @JsonProperty("favorite") boolean favorite,
44 | @JsonProperty("room") Room room,
45 | @JsonProperty("leaders") List leaders) {}
46 | }
47 |
--------------------------------------------------------------------------------
/res/layout/authorize.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
21 |
22 |
23 |
24 |
28 |
29 |
37 |
38 |
39 |
40 |
44 |
45 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/res/layout/info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
14 |
20 |
21 |
22 |
23 |
27 |
28 |
33 |
34 |
41 |
42 |
43 |
44 |
48 |
49 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/authorization/AuthorizeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.authorization;
17 |
18 | import android.app.Activity;
19 | import android.content.Intent;
20 | import android.os.Bundle;
21 | import android.view.View;
22 | import android.view.View.OnClickListener;
23 |
24 | import com.springsource.greenhouse.R;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class AuthorizeActivity extends Activity {
30 |
31 | //***************************************
32 | // Activity methods
33 | //***************************************
34 | @Override
35 | public void onCreate(final Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.authorize);
38 |
39 | findViewById(R.id.sign_in_button).setOnClickListener(new OnClickListener() {
40 | public void onClick(final View view) {
41 | startActivity(new Intent(AuthorizeActivity.this, SignInActivity.class));
42 | }
43 | });
44 | }
45 |
46 | @Override
47 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
48 | super.onActivityResult(requestCode, resultCode, data);
49 | if (resultCode == RESULT_OK) {
50 | finish();
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/InfoActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import android.content.ComponentName;
19 | import android.content.pm.PackageInfo;
20 | import android.content.pm.PackageManager.NameNotFoundException;
21 | import android.os.Bundle;
22 | import android.widget.TextView;
23 |
24 | import com.springsource.greenhouse.R;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class InfoActivity extends AbstractGreenhouseActivity {
30 |
31 | //***************************************
32 | // Activity methods
33 | //***************************************
34 | @Override
35 | public void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.info);
38 |
39 | final TextView textViewInfoVersion = (TextView) findViewById(R.id.info_textview_version);
40 |
41 | try {
42 | ComponentName componentName = new ComponentName(this, AbstractGreenhouseActivity.class);
43 | String packageName = componentName.getPackageName();
44 | PackageInfo packageInfo = getPackageManager().getPackageInfo(packageName, 0);
45 | textViewInfoVersion.setText("Version " + packageInfo.versionName);
46 | } catch (NameNotFoundException e) { }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventTweetsActivity.java:
--------------------------------------------------------------------------------
1 | package com.springsource.greenhouse.events;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.social.greenhouse.api.Event;
6 | import org.springframework.social.greenhouse.api.Tweet;
7 | import org.springframework.social.greenhouse.api.TweetFeed;
8 |
9 | import android.os.AsyncTask;
10 | import android.util.Log;
11 |
12 | import com.springsource.greenhouse.twitter.TweetsListActivity;
13 |
14 | public class EventTweetsActivity extends TweetsListActivity {
15 |
16 | private static final String TAG = EventTweetsActivity.class.getSimpleName();
17 |
18 |
19 | //***************************************
20 | // TweetsListActivity methods
21 | //***************************************
22 | @Override
23 | protected void downloadTweets() {
24 | new DownloadTweetsTask().execute();
25 | }
26 |
27 |
28 | //***************************************
29 | // Private classes
30 | //***************************************
31 | private class DownloadTweetsTask extends AsyncTask> {
32 |
33 | private Exception exception;
34 |
35 | @Override
36 | protected void onPreExecute() {
37 | showProgressDialog();
38 | }
39 |
40 | @Override
41 | protected List doInBackground(Void... params) {
42 | try {
43 | Event event = getSelectedEvent();
44 | if (event == null) {
45 | return null;
46 | }
47 | TweetFeed feed = getApplicationContext().getGreenhouseApi().tweetOperations().getTweetsForEvent(event.getId());
48 | return feed.getTweets();
49 | } catch(Exception e) {
50 | Log.e(TAG, e.getLocalizedMessage(), e);
51 | exception = e;
52 | }
53 |
54 | return null;
55 | }
56 |
57 | @Override
58 | protected void onPostExecute(List result) {
59 | dismissProgressDialog();
60 | processException(exception);
61 | setTweets(result);
62 | }
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/res/layout/event_session_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
11 |
12 |
17 |
18 |
20 |
21 |
23 |
24 |
29 |
30 |
33 |
34 |
37 |
38 |
41 |
42 |
45 |
46 |
49 |
50 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventDescriptionActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events;
17 |
18 | import org.springframework.social.greenhouse.api.Event;
19 |
20 | import android.os.Bundle;
21 | import android.widget.TextView;
22 |
23 | import com.springsource.greenhouse.AbstractGreenhouseActivity;
24 | import com.springsource.greenhouse.R;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class EventDescriptionActivity extends AbstractGreenhouseActivity {
30 |
31 | //***************************************
32 | // Activity methods
33 | //***************************************
34 | @Override
35 | public void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.event_description);
38 | }
39 |
40 | @Override
41 | public void onStart() {
42 | super.onStart();
43 | refreshEventDescription();
44 | }
45 |
46 |
47 | //***************************************
48 | // Private methods
49 | //***************************************
50 | private void refreshEventDescription() {
51 | final TextView textViewDescription = (TextView) findViewById(R.id.event_description_textview);
52 | Event event = getApplicationContext().getSelectedEvent();
53 | textViewDescription.setText(event.getDescription());
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/EventTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.ArrayList;
20 | import java.util.Date;
21 | import java.util.List;
22 |
23 | import org.springframework.social.greenhouse.api.Event;
24 | import org.springframework.social.greenhouse.api.EventOperations;
25 | import org.springframework.web.client.RestTemplate;
26 |
27 | /**
28 | * @author Roy Clarkson
29 | */
30 | public class EventTemplate extends AbstractGreenhouseOperations implements EventOperations {
31 |
32 | private final RestTemplate restTemplate;
33 |
34 | public EventTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, String apiUrlBase) {
35 | super(isAuthorizedForUser, apiUrlBase);
36 | this.restTemplate = restTemplate;
37 | }
38 |
39 | public List getUpcomingEvents() {
40 | requireAuthorization();
41 | return restTemplate.getForObject(buildUri("events"), EventList.class);
42 | }
43 |
44 | public List getEventsAfter(Date date) {
45 | String isoDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.000-00:00").format(date);
46 | return restTemplate.getForObject(buildUri("events", "after", isoDate), EventList.class);
47 | }
48 |
49 | @SuppressWarnings("serial")
50 | private static class EventList extends ArrayList {}
51 | }
52 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
44 |
45 |
48 |
49 |
52 |
53 |
54 |
55 |
56 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/EventMixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.Date;
19 | import java.util.List;
20 |
21 | import org.codehaus.jackson.annotate.JsonCreator;
22 | import org.codehaus.jackson.annotate.JsonIgnoreProperties;
23 | import org.codehaus.jackson.annotate.JsonProperty;
24 | import org.springframework.social.greenhouse.api.Group;
25 | import org.springframework.social.greenhouse.api.TimeZone;
26 | import org.springframework.social.greenhouse.api.Venue;
27 |
28 | /**
29 | * Mixin class for adding Jackson annotations to Event.
30 | *
31 | * @author Roy Clarkson
32 | */
33 | @JsonIgnoreProperties(ignoreUnknown=true)
34 | abstract class EventMixin {
35 | @JsonCreator
36 | EventMixin(
37 | @JsonProperty("id") long id,
38 | @JsonProperty("title") String title,
39 | @JsonProperty("location") String location,
40 | @JsonProperty("hashtag") String hashtag,
41 | @JsonProperty("description") String description,
42 | @JsonProperty("startTime") Date startTime,
43 | @JsonProperty("endTime") Date endTime,
44 | @JsonProperty("slug") String slug,
45 | @JsonProperty("groupName") String groupName,
46 | @JsonProperty("groupSlug") String groupSlug,
47 | @JsonProperty("group") Group group,
48 | @JsonProperty("timeZone") TimeZone timeZone,
49 | @JsonProperty("venues") List venues) {}
50 | }
51 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.springsource.greenhouse.events.sessions;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.social.greenhouse.api.EventSession;
6 | import org.springframework.social.greenhouse.api.Room;
7 |
8 | import android.content.Context;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.BaseAdapter;
13 | import android.widget.TextView;
14 |
15 | import com.springsource.greenhouse.R;
16 |
17 | public class EventSessionsListAdapter extends BaseAdapter {
18 |
19 | private List sessions;
20 | private final LayoutInflater layoutInflater;
21 |
22 | public EventSessionsListAdapter(Context context, List sessions) {
23 | this.sessions = sessions;
24 | this.layoutInflater = LayoutInflater.from(context);
25 | }
26 |
27 | public int getCount() {
28 | if (sessions == null) {
29 | return 0;
30 | }
31 | return sessions.size();
32 | }
33 |
34 | public EventSession getItem(int position) {
35 | return sessions.get(position);
36 | }
37 |
38 | public long getItemId(int position) {
39 | return position;
40 | }
41 |
42 | public View getView(int position, View convertView, ViewGroup parent) {
43 | EventSession session = getItem(position);
44 | View view = convertView;
45 |
46 | if (view == null) {
47 | view = layoutInflater.inflate(R.layout.event_sessions_list_item, parent, false);
48 | }
49 |
50 | TextView t = (TextView) view.findViewById(R.id.event_sessions_list_item_title);
51 | t.setText(session.getTitle());
52 |
53 | t = (TextView) view.findViewById(R.id.event_sessions_list_item_leaders);
54 | t.setText(session.getJoinedLeaders(", "));
55 |
56 | t = (TextView) view.findViewById(R.id.event_sessions_list_item_time_and_room);
57 | String s = session.getFormattedTimeSpan();
58 | Room room = session.getRoom();
59 | if (room != null) {
60 | s += " in " + room.getLabel();
61 | }
62 | t.setText(s);
63 |
64 | return view;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import org.springframework.social.connect.ConnectionRepository;
19 | import org.springframework.social.greenhouse.api.Greenhouse;
20 |
21 | import com.springsource.greenhouse.authorization.AuthorizeActivity;
22 |
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class MainActivity extends AbstractGreenhouseActivity {
30 |
31 | @SuppressWarnings("unused")
32 | private static final String TAG = MainActivity.class.getSimpleName();
33 |
34 | private ConnectionRepository connectionRepository;
35 |
36 | //***************************************
37 | // Activity methods
38 | //***************************************
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 |
43 | connectionRepository = getApplicationContext().getConnectionRepository();
44 |
45 | Intent intent;
46 | if (isConnected()) {
47 | intent = new Intent(this, MainTabWidget.class);
48 | } else {
49 | intent = new Intent(this, AuthorizeActivity.class);
50 | }
51 | startActivity(intent);
52 | finish();
53 | }
54 |
55 | //***************************************
56 | // Private methods
57 | //***************************************
58 | private boolean isConnected() {
59 | return connectionRepository.findPrimaryConnection(Greenhouse.class) != null;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/UserTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.springframework.social.greenhouse.api.GreenhouseProfile;
19 | import org.springframework.social.greenhouse.api.UserOperations;
20 | import org.springframework.web.client.RestTemplate;
21 |
22 | /**
23 | * Implementation of the {@link UserOperations} interface providing binding to Greenhouse's user-oriented REST resources.
24 | * @author Roy Clarkson
25 | */
26 | class UserTemplate extends AbstractGreenhouseOperations implements UserOperations {
27 |
28 | private final RestTemplate restTemplate;
29 |
30 | public UserTemplate(RestTemplate restTemplate, boolean isAuthorized, String apiUrlBase) {
31 | super(isAuthorized, apiUrlBase);
32 | this.restTemplate = restTemplate;
33 | }
34 |
35 | public long getAccountId() {
36 | requireAuthorization();
37 | return getUserProfile().getAccountId();
38 | }
39 |
40 | public String getDisplayName() {
41 | requireAuthorization();
42 | return getUserProfile().getDisplayName();
43 | }
44 |
45 | public GreenhouseProfile getUserProfile() {
46 | requireAuthorization();
47 | GreenhouseProfile profile = restTemplate.getForObject(buildUri("members/@self"), GreenhouseProfile.class);
48 | profile.setApiUrlBase(getApiUrlBase());
49 | return profile;
50 | }
51 |
52 | public GreenhouseProfile getUserProfile(long userId) {
53 | return restTemplate.getForObject(buildUri("members/" + userId), GreenhouseProfile.class);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Tweet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.util.Date;
19 |
20 | /**
21 | * @author Roy Clarkson
22 | */
23 | public class Tweet {
24 |
25 | private long id;
26 |
27 | private String text;
28 |
29 | private Date createdAt;
30 |
31 | private String fromUser;
32 |
33 | private String profileImageUrl;
34 |
35 | private long userId;
36 |
37 | private String languageCode;
38 |
39 | private String source;
40 |
41 | // private Bitmap profileImage;
42 |
43 | public Tweet(long id, String text, Date createdAt, String fromUser, String profileImageUrl, long userId, String languageCode, String source) {
44 | this.id = id;
45 | this.text = text;
46 | this.createdAt = createdAt;
47 | this.fromUser = fromUser;
48 | this.profileImageUrl = profileImageUrl;
49 | this.userId = userId;
50 | this.languageCode = languageCode;
51 | this.source = source;
52 | }
53 |
54 | public long getId() {
55 | return id;
56 | }
57 |
58 | public String getText() {
59 | return text;
60 | }
61 |
62 | public Date getCreatedAt() {
63 | return createdAt;
64 | }
65 |
66 | public String getFromUser() {
67 | return fromUser;
68 | }
69 |
70 | public String getProfileImageUrl() {
71 | return profileImageUrl;
72 | }
73 |
74 | public long getUserId() {
75 | return userId;
76 | }
77 |
78 | public String getLanguageCode() {
79 | return languageCode;
80 | }
81 |
82 | public String getSource() {
83 | return source;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/connect/GreenhouseConnectionFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.connect;
17 |
18 | import org.springframework.social.connect.support.OAuth2ConnectionFactory;
19 | import org.springframework.social.greenhouse.api.Greenhouse;
20 |
21 | /**
22 | * Greenhouse ConnectionFactory implementation.
23 | * @author Roy Clarkson
24 | */
25 | public class GreenhouseConnectionFactory extends OAuth2ConnectionFactory {
26 |
27 | /**
28 | * Creates a GreenhouseConnectionFactory for the given client ID and secret.
29 | * Using this constructor, no application namespace is set
30 | * @param clientId The application's Client ID as assigned by Greenhouse
31 | * @param clientSecret The application's Client Secret as assigned by Greenhouse
32 | */
33 | public GreenhouseConnectionFactory(String clientId, String clientSecret) {
34 | super("greenhouse", new GreenhouseServiceProvider(clientId, clientSecret), new GreenhouseAdapter());
35 | }
36 |
37 | /**
38 | * Creates a GreenhouseConnectionFactory for the given application ID, secret, and namespace.
39 | * @param clientId The application's Client ID as assigned by Greenhouse
40 | * @param clientSecret The application's Client Secret as assigned by Greenhouse
41 | * @param apiUrlBase The application's API base URL
42 | */
43 | public GreenhouseConnectionFactory(String clientId, String clientSecret, String apiUrlBase) {
44 | super("greenhouse", new GreenhouseServiceProvider(clientId, clientSecret, apiUrlBase), new GreenhouseAdapter());
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionDescriptionActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import org.springframework.social.greenhouse.api.EventSession;
19 |
20 | import android.os.Bundle;
21 | import android.widget.TextView;
22 |
23 | import com.springsource.greenhouse.AbstractGreenhouseActivity;
24 | import com.springsource.greenhouse.R;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class EventSessionDescriptionActivity extends AbstractGreenhouseActivity {
30 |
31 | @SuppressWarnings("unused")
32 | private static final String TAG = EventSessionDescriptionActivity.class.getSimpleName();
33 |
34 | private EventSession session;
35 |
36 |
37 | //***************************************
38 | // Activity methods
39 | //***************************************
40 | @Override
41 | public void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | setContentView(R.layout.event_session_description);
44 | }
45 |
46 | @Override
47 | public void onStart() {
48 | super.onStart();
49 | session = getApplicationContext().getSelectedSession();
50 | refreshSessionDescription();
51 | }
52 |
53 |
54 | //***************************************
55 | // Private methods
56 | //***************************************
57 | private void refreshSessionDescription() {
58 | if (session == null) {
59 | return;
60 | }
61 |
62 | final TextView textViewDescription = (TextView) findViewById(R.id.event_session_description_textview);
63 | textViewDescription.setText(session.getDescription());
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/connect/GreenhouseAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.connect;
17 |
18 | import org.springframework.social.ApiException;
19 | import org.springframework.social.connect.ApiAdapter;
20 | import org.springframework.social.connect.ConnectionValues;
21 | import org.springframework.social.connect.UserProfile;
22 | import org.springframework.social.connect.UserProfileBuilder;
23 | import org.springframework.social.greenhouse.api.Greenhouse;
24 | import org.springframework.social.greenhouse.api.GreenhouseProfile;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class GreenhouseAdapter implements ApiAdapter {
30 |
31 | public boolean test(Greenhouse greenhouse) {
32 | try {
33 | greenhouse.userOperations().getUserProfile();
34 | return true;
35 | } catch (ApiException e) {
36 | return false;
37 | }
38 | }
39 |
40 | public void setConnectionValues(Greenhouse api, ConnectionValues values) {
41 | GreenhouseProfile profile = api.userOperations().getUserProfile();
42 | values.setProviderUserId(Long.toString(profile.getAccountId()));
43 | values.setDisplayName(profile.getDisplayName());
44 | values.setProfileUrl(profile.getProfileUrl());
45 | values.setImageUrl(profile.getPictureUrl());
46 | }
47 |
48 | public UserProfile fetchUserProfile(Greenhouse api) {
49 | GreenhouseProfile profile = api.userOperations().getUserProfile();
50 | return new UserProfileBuilder().setName(profile.getDisplayName()).build();
51 | }
52 |
53 | public void updateStatus(Greenhouse api, String message) {
54 | // TODO: add update status functionality
55 | }
56 | }
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/twitter/TweetsListAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.twitter;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Tweet;
21 |
22 | import android.content.Context;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.widget.BaseAdapter;
27 | import android.widget.TextView;
28 |
29 | import com.springsource.greenhouse.R;
30 |
31 | /**
32 | * @author Roy Clarkson
33 | */
34 | public class TweetsListAdapter extends BaseAdapter {
35 |
36 | private List tweets;
37 |
38 | private final LayoutInflater layoutInflater;
39 |
40 | public TweetsListAdapter(Context context, List tweets) {
41 | this.tweets = tweets;
42 | this.layoutInflater = LayoutInflater.from(context);
43 | }
44 |
45 | public int getCount() {
46 | if (tweets == null) {
47 | return 0;
48 | }
49 | return tweets.size();
50 | }
51 |
52 | public Tweet getItem(int position) {
53 | return tweets.get(position);
54 | }
55 |
56 | public long getItemId(int position) {
57 | return position;
58 | }
59 |
60 | public View getView(int position, View convertView, ViewGroup parent) {
61 | Tweet tweet = getItem(position);
62 | View view = convertView;
63 |
64 | if (view == null) {
65 | view = layoutInflater.inflate(R.layout.tweet_list_item, parent, false);
66 | }
67 |
68 | TextView t = (TextView) view.findViewById(R.id.tweet_list_item_text);
69 | t.setText(tweet.getText());
70 |
71 | t = (TextView) view.findViewById(R.id.tweet_list_item_fromuser);
72 | t.setText(tweet.getFromUser());
73 |
74 | return view;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/AbstractGreenhouseOperations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.net.URI;
19 |
20 | import org.springframework.social.MissingAuthorizationException;
21 | import org.springframework.social.support.URIBuilder;
22 | import org.springframework.util.LinkedMultiValueMap;
23 | import org.springframework.util.MultiValueMap;
24 |
25 | /**
26 | * @author Roy Clarkson
27 | */
28 | class AbstractGreenhouseOperations {
29 |
30 | private final boolean isAuthorized;
31 |
32 | private final String apiUrlBase;
33 |
34 | public AbstractGreenhouseOperations(boolean isAuthorized, String apiUrlBase) {
35 | this.isAuthorized = isAuthorized;
36 | this.apiUrlBase = apiUrlBase;
37 | }
38 |
39 | protected void requireAuthorization() {
40 | if (!isAuthorized) {
41 | throw new MissingAuthorizationException();
42 | }
43 | }
44 |
45 | protected URI buildUri(String path) {
46 | return buildUri(path, EMPTY_PARAMETERS);
47 | }
48 |
49 | protected URI buildUri(String path, String parameterName, String parameterValue) {
50 | MultiValueMap parameters = new LinkedMultiValueMap();
51 | parameters.set(parameterName, parameterValue);
52 | return buildUri(path, parameters);
53 | }
54 |
55 | protected URI buildUri(String path, MultiValueMap parameters) {
56 | return URIBuilder.fromUri(getApiUrlBase() + path).queryParams(parameters).build();
57 | }
58 |
59 | protected String getApiUrlBase() {
60 | return apiUrlBase;
61 | }
62 |
63 | private static final LinkedMultiValueMap EMPTY_PARAMETERS = new LinkedMultiValueMap();
64 | }
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/connect/GreenhouseServiceProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.connect;
17 |
18 | import org.springframework.social.greenhouse.api.Greenhouse;
19 | import org.springframework.social.greenhouse.api.impl.GreenhouseTemplate;
20 | import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;
21 |
22 | /**
23 | * Greenhouse ServiceProvider implementation.
24 | * @author Roy Clarkson
25 | */
26 | public class GreenhouseServiceProvider extends AbstractOAuth2ServiceProvider {
27 |
28 | private final String apiUrlBase;
29 |
30 | /**
31 | * Creates a GreenhouseServiceProvider for the given client ID and secret.
32 | * @param clientId The application's Client ID as assigned by Greenhouse
33 | * @param clientSecret The application's Client Secret as assigned by Greenhouse
34 | */
35 | public GreenhouseServiceProvider(String clientId, String clientSecret) {
36 | super(new GreenhouseOAuth2Template(clientId, clientSecret));
37 | this.apiUrlBase = null;
38 | }
39 |
40 | /**
41 | * Creates a GreenhouseServiceProvider for the given client ID and secret.
42 | * @param clientId The application's Client ID as assigned by Greenhouse
43 | * @param clientSecret The application's Client Secret as assigned by Greenhouse
44 | * @param apiUrlBase The application's API base URL
45 | */
46 | public GreenhouseServiceProvider(String clientId, String clientSecret, String apiUrlBase) {
47 | super(new GreenhouseOAuth2Template(clientId, clientSecret));
48 | this.apiUrlBase = apiUrlBase;
49 | }
50 |
51 | public Greenhouse getApi(String accessToken) {
52 | return new GreenhouseTemplate(accessToken, getApiUrlBase());
53 | }
54 |
55 | private String getApiUrlBase() {
56 | return apiUrlBase;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/GreenhouseModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.codehaus.jackson.Version;
19 | import org.codehaus.jackson.map.module.SimpleModule;
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 | import org.springframework.social.greenhouse.api.GreenhouseProfile;
23 | import org.springframework.social.greenhouse.api.Group;
24 | import org.springframework.social.greenhouse.api.Leader;
25 | import org.springframework.social.greenhouse.api.Room;
26 | import org.springframework.social.greenhouse.api.TimeZone;
27 | import org.springframework.social.greenhouse.api.Tweet;
28 | import org.springframework.social.greenhouse.api.TweetFeed;
29 | import org.springframework.social.greenhouse.api.Venue;
30 |
31 | /**
32 | * @author Roy Clarkson
33 | */
34 | public class GreenhouseModule extends SimpleModule {
35 |
36 | public GreenhouseModule() {
37 | super("GreenhouseModule", new Version(1, 0, 0, null));
38 | }
39 |
40 | @Override
41 | public void setupModule(SetupContext context) {
42 | context.setMixInAnnotations(GreenhouseProfile.class, GreenhouseProfileMixin.class);
43 | context.setMixInAnnotations(Event.class, EventMixin.class);
44 | context.setMixInAnnotations(Group.class, GroupMixin.class);
45 | context.setMixInAnnotations(Venue.class, VenueMixin.class);
46 | context.setMixInAnnotations(TimeZone.class, TimeZoneMixin.class);
47 | context.setMixInAnnotations(EventSession.class, EventSessionMixin.class);
48 | context.setMixInAnnotations(Leader.class, LeaderMixin.class);
49 | context.setMixInAnnotations(Room.class, RoomMixin.class);
50 | context.setMixInAnnotations(TweetFeed.class, TweetFeedMixin.class);
51 | context.setMixInAnnotations(Tweet.class, TweetMixin.class);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/MainTabWidget.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import android.app.TabActivity;
19 | import android.content.Intent;
20 | import android.content.res.Resources;
21 | import android.os.Bundle;
22 | import android.widget.TabHost;
23 |
24 | import com.springsource.greenhouse.R;
25 | import com.springsource.greenhouse.events.EventsActivity;
26 | import com.springsource.greenhouse.profile.ProfileActivity;
27 |
28 | /**
29 | * @author Roy Clarkson
30 | */
31 | public class MainTabWidget extends TabActivity {
32 |
33 | //***************************************
34 | // Activity methods
35 | //***************************************
36 | @Override
37 | public void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.main);
40 |
41 | Resources res = getResources();
42 | TabHost tabHost = getTabHost();
43 | TabHost.TabSpec tabSpec;
44 | Intent intent;
45 |
46 | // add events tab
47 | intent = new Intent();
48 | intent.setClass(this, EventsActivity.class);
49 |
50 | tabSpec = tabHost.newTabSpec("events");
51 | tabSpec.setIndicator("Events", res.getDrawable(R.drawable.ic_tab_events));
52 | tabSpec.setContent(intent);
53 | tabHost.addTab(tabSpec);
54 |
55 | // add profile tab
56 | intent = new Intent();
57 | intent.setClass(this, ProfileActivity.class);
58 |
59 | tabSpec = tabHost.newTabSpec("profile");
60 | tabSpec.setIndicator("Profile", res.getDrawable(R.drawable.ic_tab_profile));
61 | tabSpec.setContent(intent);
62 | tabHost.addTab(tabSpec);
63 |
64 | // add info tab
65 | intent = new Intent();
66 | intent.setClass(this, InfoActivity.class);
67 |
68 | tabSpec = tabHost.newTabSpec("info");
69 | tabSpec.setIndicator("Info", res.getDrawable(R.drawable.ic_tab_info));
70 | tabSpec.setContent(intent);
71 | tabHost.addTab(tabSpec);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsMyFavoritesActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 |
23 | import android.os.AsyncTask;
24 | import android.util.Log;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class EventSessionsMyFavoritesActivity extends EventSessionsListActivity {
30 |
31 | private static final String TAG = EventSessionsMyFavoritesActivity.class.getSimpleName();
32 |
33 |
34 | //***************************************
35 | // Protected methods
36 | //***************************************
37 | @Override
38 | protected void downloadSessions() {
39 | new DownloadSessionsTask().execute();
40 | }
41 |
42 |
43 | //***************************************
44 | // Private classes
45 | //***************************************
46 | private class DownloadSessionsTask extends AsyncTask> {
47 |
48 | private Exception exception;
49 |
50 | @Override
51 | protected void onPreExecute() {
52 | showProgressDialog();
53 | }
54 |
55 | @Override
56 | protected List doInBackground(Void... params) {
57 | try {
58 | Event event = getSelectedEvent();
59 | if (event == null) {
60 | return null;
61 | }
62 | return getApplicationContext().getGreenhouseApi().sessionOperations().getFavoriteSessions(event.getId());
63 | }
64 | catch(Exception e) {
65 | Log.e(TAG, e.getLocalizedMessage(), e);
66 | exception = e;
67 | }
68 |
69 | return null;
70 | }
71 |
72 | @Override
73 | protected void onPostExecute(List result) {
74 | dismissProgressDialog();
75 | processException(exception);
76 | setSessions(result);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsConferenceFavoritesActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 |
23 | import android.os.AsyncTask;
24 | import android.util.Log;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class EventSessionsConferenceFavoritesActivity extends EventSessionsListActivity {
30 |
31 | private static final String TAG = EventSessionsConferenceFavoritesActivity.class.getSimpleName();
32 |
33 |
34 | //***************************************
35 | // Protected methods
36 | //***************************************
37 | @Override
38 | protected void downloadSessions() {
39 | new DownloadSessionsTask().execute();
40 | }
41 |
42 |
43 | //***************************************
44 | // Private classes
45 | //***************************************
46 | private class DownloadSessionsTask extends AsyncTask> {
47 |
48 | private Exception exception;
49 |
50 | @Override
51 | protected void onPreExecute() {
52 | showProgressDialog();
53 | }
54 |
55 | @Override
56 | protected List doInBackground(Void... params) {
57 | try {
58 | Event event = getSelectedEvent();
59 | if (event == null) {
60 | return null;
61 | }
62 | return getApplicationContext().getGreenhouseApi().sessionOperations().getConferenceFavoriteSessions(event.getId());
63 |
64 | } catch(Exception e) {
65 | Log.e(TAG, e.getLocalizedMessage(), e);
66 | exception = e;
67 | }
68 |
69 | return null;
70 | }
71 |
72 | @Override
73 | protected void onPostExecute(List result) {
74 | dismissProgressDialog();
75 | processException(exception);
76 | setSessions(result);
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/GreenhouseProfile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * A model class containing a Greenhouse user's profile information.
21 | *
22 | * @author Craig Walls
23 | * @author Roy Clarkson
24 | */
25 | public class GreenhouseProfile {
26 |
27 | private final long accountId;
28 |
29 | private final String displayName;
30 |
31 | private final String pictureUrl;
32 |
33 | private String apiUrlBase;
34 |
35 | public GreenhouseProfile(long accountId, String displayName, String pictureUrl) {
36 | this.accountId = accountId;
37 | this.displayName = displayName;
38 |
39 | /*
40 | * Android accesses localhost through a proxy, so the image url address is wrong
41 | * when running on the localhost server.
42 | */
43 | // TODO: figure out a better way to handle this hack
44 | this.pictureUrl = pictureUrl.replace("localhost", "10.0.2.2");
45 | }
46 |
47 | /**
48 | * The user's Greenhouse Account ID
49 | *
50 | * @return The user's Greenhouse Account ID
51 | */
52 | public long getAccountId() {
53 | return accountId;
54 | }
55 |
56 | /**
57 | * The user's Greenhouse screen name
58 | *
59 | * @return The user's Greenhouse screen name
60 | */
61 | public String getDisplayName() {
62 | return displayName;
63 | }
64 |
65 | /**
66 | * The URL of the user's profile image.
67 | *
68 | * @return The URL of the user's profile image.
69 | */
70 | public String getPictureUrl() {
71 | return pictureUrl;
72 | }
73 |
74 | /**
75 | * The URL of the user's profile.
76 | *
77 | * @return The URL of the user's profile.
78 | */
79 | public String getProfileUrl() {
80 | return apiUrlBase + "members/" + accountId;
81 | }
82 |
83 | /**
84 | * Sets the base URL for accessing the Greenhouse API
85 | *
86 | * @param apiUrlBase
87 | */
88 | public void setApiUrlBase(String apiUrlBase) {
89 | this.apiUrlBase = apiUrlBase;
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/ProgressAsyncTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import android.app.ProgressDialog;
19 | import android.content.Context;
20 | import android.os.AsyncTask;
21 |
22 | /**
23 | * @author Roy Clarkson
24 | */
25 | public abstract class ProgressAsyncTask extends AsyncTask {
26 |
27 | private Context context;
28 |
29 | private ProgressDialog progressDialog;
30 |
31 | private String message;
32 |
33 |
34 | //***************************************
35 | // Constructors methods
36 | //***************************************
37 | @SuppressWarnings("unused")
38 | private ProgressAsyncTask() {
39 | // context is required
40 | }
41 |
42 | public ProgressAsyncTask(Context context) {
43 | this(context, "Loading. Please wait...");
44 | }
45 |
46 | public ProgressAsyncTask(Context context, String message) {
47 | this.context = context;
48 | this.message = message;
49 | }
50 |
51 |
52 | //***************************************
53 | // AsyncTask methods
54 | //***************************************
55 | @Override
56 | protected void onPreExecute() {
57 | // before the network request begins, show a progress indicator
58 | showProgressDialog(message);
59 | }
60 |
61 | @Override
62 | protected void onPostExecute(Result result) {
63 | // after the network request completes, hide the progress indicator
64 | dismissProgressDialog();
65 | }
66 |
67 | @Override
68 | protected void onCancelled() {
69 | dismissProgressDialog();
70 | }
71 |
72 |
73 | //***************************************
74 | // Protected methods
75 | //***************************************
76 | protected void showProgressDialog(String message) {
77 | progressDialog = ProgressDialog.show(context, "", message, true);
78 | }
79 |
80 | protected void dismissProgressDialog() {
81 | if (progressDialog != null) {
82 | progressDialog.dismiss();
83 | }
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsFilteredActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import android.app.ListActivity;
19 | import android.content.Intent;
20 | import android.os.Bundle;
21 | import android.view.View;
22 | import android.widget.ArrayAdapter;
23 | import android.widget.ListView;
24 |
25 | import com.springsource.greenhouse.R;
26 |
27 | /**
28 | * @author Roy Clarkson
29 | */
30 | public class EventSessionsFilteredActivity extends ListActivity {
31 |
32 | @SuppressWarnings("unused")
33 | private static final String TAG = EventSessionsFilteredActivity.class.getSimpleName();
34 |
35 |
36 | //***************************************
37 | // Activity methods
38 | //***************************************
39 | @Override
40 | public void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | String[] menu_items = getResources().getStringArray(R.array.event_filtered_sessions_options_array);
43 | ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.menu_list_item, menu_items);
44 | setListAdapter(arrayAdapter);
45 | }
46 |
47 |
48 | //***************************************
49 | // ListActivity methods
50 | //***************************************
51 | @Override
52 | protected void onListItemClick(ListView l, View v, int position, long id) {
53 | super.onListItemClick(l, v, position, id);
54 |
55 | Intent intent = new Intent();
56 |
57 | switch(position) {
58 | case 0:
59 | intent.setClass(v.getContext(), EventSessionsCurrentActivity.class);
60 | break;
61 | case 1:
62 | intent.setClass(v.getContext(), EventSessionsUpcomingActivity.class);
63 | break;
64 | case 2:
65 | intent.setClass(v.getContext(), EventSessionsMyFavoritesActivity.class);
66 | break;
67 | case 3:
68 | intent.setClass(v.getContext(), EventSessionsConferenceFavoritesActivity.class);
69 | break;
70 | default:
71 | break;
72 | }
73 |
74 | startActivity(intent);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Greenhouse
5 | \u00A9 Copyright 2011–2012 SpringSource, a division of VMware
6 |
7 |
8 |
9 | Sign In
10 | Cancel
11 |
12 |
13 |
14 | Event Details
15 | Event Description
16 | Event Tweets
17 | Filtered Sessions
18 | Session Schedule
19 | Current Sessions
20 | Upcoming Sessions
21 | My Favorite Sessions
22 | Conference Favorite Sessions
23 | Sessions by Day
24 | Session Details
25 | Session Description
26 | Rate the Session
27 | Session Tweets
28 | Tweet Details
29 | Post Tweet
30 |
31 |
32 |
33 | Greenhouse Header
34 | SpringSource Logo
35 |
36 |
37 |
38 |
39 | - Filtered Sessions
40 | - Session Schedule
41 | - Post Tweet
42 | - Twitter Feed
43 |
44 |
45 | - Current
46 | - Upcoming
47 | - My Favorites
48 | - Conference Favorites
49 |
50 |
51 | - Favorite
52 | - Rate
53 | - Post Tweet
54 | - Twitter Feed
55 |
56 |
57 | - Reply
58 | - Retweet
59 | - Quote
60 |
61 |
62 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/SessionOperations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.util.Date;
19 | import java.util.List;
20 |
21 |
22 | /**
23 | * Interface defining the operations for retrieving {@link EventSession} information.
24 | *
25 | * @author Roy Clarkson
26 | */
27 | public interface SessionOperations {
28 |
29 | /**
30 | * Retrieves a list of sessions for an event that take place on a given day.
31 | *
32 | * @param eventId the ID of the {@link Event}
33 | * @param date the day for which to retrieve the {@link Event} objects
34 | * @return a list of sessions for the given {@link Event} and day
35 | */
36 | List getSessionsOnDay(long eventId, Date date);
37 |
38 | /**
39 | * Retrieves a list of sessions marked as favorites by the user
40 | *
41 | * @param eventId the ID of the {@link Event}
42 | * @return a list of {@link Session} objects marked as favorites
43 | */
44 | List getFavoriteSessions(long eventId);
45 |
46 | /**
47 | * Retrieves a list of sessions marked as favorites by all users.
48 | *
49 | * @param eventId the ID of the {@link Event}
50 | * @return a list of {@link Session} objects marked as favorites
51 | */
52 | List getConferenceFavoriteSessions(long eventId);
53 |
54 | /**
55 | * Updates the favorite status for a session. If the session is not a favorite
56 | * it is marked as a favorite.
57 | *
58 | * @param eventId the ID of the {@link Event}
59 | * @param sessionId the ID of the {@link Session}
60 | * @return true if the {@link Session} is a favorite, and false if it is not
61 | */
62 | boolean updateFavoriteSession(long eventId, long sessionId);
63 |
64 | /**
65 | * Rate a session.
66 | * @param eventId the ID of the {@link Event}
67 | * @param sessionId the ID of the {@link Session}
68 | * @param rating a rating value, 1 to 5 for the {@link Session}
69 | * @param comment feedback about the {@link Session}
70 | * @return the new average rating for the session
71 | */
72 | float rateSession(long eventId, long sessionId, int rating, String comment);
73 | }
74 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionTweetsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 | import org.springframework.social.greenhouse.api.Tweet;
23 | import org.springframework.social.greenhouse.api.TweetFeed;
24 |
25 | import android.os.AsyncTask;
26 | import android.util.Log;
27 |
28 | import com.springsource.greenhouse.twitter.TweetsListActivity;
29 |
30 | /**
31 | * @author Roy Clarkson
32 | */
33 | public class EventSessionTweetsActivity extends TweetsListActivity {
34 |
35 | private static final String TAG = EventSessionTweetsActivity.class.getSimpleName();
36 |
37 |
38 | //***************************************
39 | // TweetsListActivity methods
40 | //***************************************
41 | @Override
42 | protected void downloadTweets() {
43 | new DownloadTweetsTask().execute();
44 | }
45 |
46 |
47 | //***************************************
48 | // Private classes
49 | //***************************************
50 | private class DownloadTweetsTask extends AsyncTask> {
51 |
52 | private Exception exception;
53 |
54 | @Override
55 | protected void onPreExecute() {
56 | showProgressDialog();
57 | }
58 |
59 | @Override
60 | protected List doInBackground(Void... params) {
61 | try {
62 | Event event = getSelectedEvent();
63 | EventSession session = getSelectedSession();
64 | if (event == null && session == null) {
65 | return null;
66 | }
67 | TweetFeed feed = getApplicationContext().getGreenhouseApi().tweetOperations().getTweetsForEventSession(event.getId(), session.getId());
68 | return feed.getTweets();
69 | } catch(Exception e) {
70 | Log.e(TAG, e.getLocalizedMessage(), e);
71 | exception = e;
72 | }
73 |
74 | return null;
75 | }
76 |
77 | @Override
78 | protected void onPostExecute(List result) {
79 | dismissProgressDialog();
80 | processException(exception);
81 | setTweets(result);
82 | }
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventsActivityGroup.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events;
17 |
18 | import java.util.ArrayList;
19 |
20 | import android.app.ActivityGroup;
21 | import android.app.LocalActivityManager;
22 | import android.content.Intent;
23 | import android.os.Bundle;
24 | import android.view.View;
25 | import android.view.Window;
26 |
27 | /*
28 | * Good example from Henrik Larsen Toft on how to set up a Nested TabActivity
29 | * https://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/
30 | */
31 |
32 | public class EventsActivityGroup extends ActivityGroup {
33 |
34 | public static EventsActivityGroup group;
35 |
36 | // Need to keep track of the history so the back-button will work properly.
37 | private ArrayList history;
38 |
39 | //***************************************
40 | // Activity methods
41 | //***************************************
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | this.history = new ArrayList();
46 | group = this;
47 |
48 | // Start the root activity within the group and get its view
49 | Intent intent = new Intent();
50 | intent.setClass(this, EventsActivity.class);
51 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
52 |
53 | LocalActivityManager activityManager = getLocalActivityManager();
54 | Window window = activityManager.startActivity("EventsActivity", intent);
55 | View view = window.getDecorView();
56 |
57 | // Replace the view of this ActivityGroup
58 | replaceView(view);
59 | }
60 |
61 | @Override
62 | public void onBackPressed() {
63 | EventsActivityGroup.group.back();
64 | return;
65 | }
66 |
67 | //***************************************
68 | // Public methods
69 | //***************************************
70 | public void replaceView(View v) {
71 | // Adds the old one to history
72 | history.add(v);
73 |
74 | // Changes this Groups View to the new View.
75 | setContentView(v);
76 | }
77 |
78 | public void back() {
79 | if (history.size() > 0) {
80 | history.remove(history.size()-1);
81 | setContentView(history.get(history.size()-1));
82 | } else {
83 | finish();
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsCurrentActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Date;
20 | import java.util.List;
21 |
22 | import org.springframework.social.greenhouse.api.Event;
23 | import org.springframework.social.greenhouse.api.EventSession;
24 |
25 | import android.os.AsyncTask;
26 | import android.util.Log;
27 |
28 | /**
29 | * @author Roy Clarkson
30 | */
31 | public class EventSessionsCurrentActivity extends EventSessionsListActivity {
32 |
33 | private static final String TAG = EventSessionsCurrentActivity.class.getSimpleName();
34 |
35 |
36 | //***************************************
37 | // Protected methods
38 | //***************************************
39 | @Override
40 | protected void downloadSessions() {
41 | new DownloadSessionsTask().execute();
42 | }
43 |
44 |
45 | //***************************************
46 | // Private classes
47 | //***************************************
48 | private class DownloadSessionsTask extends AsyncTask> {
49 | private Exception exception;
50 |
51 | @Override
52 | protected void onPreExecute() {
53 | showProgressDialog();
54 | }
55 |
56 | @Override
57 | protected List doInBackground(Void... params) {
58 | try {
59 | Event event = getSelectedEvent();
60 | if (event == null) {
61 | return null;
62 | }
63 |
64 | Date now = new Date();
65 | List sessions = getApplicationContext().getGreenhouseApi().sessionOperations().getSessionsOnDay(event.getId(), now);
66 | List currentSessions = new ArrayList();
67 |
68 | for (EventSession session : sessions) {
69 | if (session.getStartTime().before(now) && session.getEndTime().after(now)) {
70 | currentSessions.add(session);
71 | }
72 | }
73 |
74 | return currentSessions;
75 | } catch(Exception e) {
76 | Log.e(TAG, e.getLocalizedMessage(), e);
77 | exception = e;
78 | }
79 |
80 | return null;
81 | }
82 |
83 | @Override
84 | protected void onPostExecute(List result) {
85 | dismissProgressDialog();
86 | processException(exception);
87 | setSessions(result);
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsByDayActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.Date;
20 | import java.util.List;
21 |
22 | import org.springframework.social.greenhouse.api.Event;
23 | import org.springframework.social.greenhouse.api.EventSession;
24 |
25 | import android.os.AsyncTask;
26 | import android.util.Log;
27 |
28 | /**
29 | * @author Roy Clarkson
30 | */
31 | public class EventSessionsByDayActivity extends EventSessionsListActivity {
32 |
33 | private static final String TAG = EventSessionsByDayActivity.class.getSimpleName();
34 |
35 | private Date day;
36 |
37 |
38 | //***************************************
39 | // Activity methods
40 | //***************************************
41 | @Override
42 | public void onStart() {
43 | day = getApplicationContext().getSelectedDay();
44 | super.onStart();
45 | if (day != null) {
46 | String title = new SimpleDateFormat("EEEE, MMM d").format(day);
47 | this.setTitle(title);
48 | }
49 | }
50 |
51 |
52 | //***************************************
53 | // Protected methods
54 | //***************************************
55 | @Override
56 | protected void downloadSessions() {
57 | new DownloadSessionsTask().execute();
58 | }
59 |
60 |
61 | //***************************************
62 | // Private classes
63 | //***************************************
64 | private class DownloadSessionsTask extends AsyncTask> {
65 |
66 | private Exception exception;
67 |
68 | @Override
69 | protected void onPreExecute() {
70 | showProgressDialog();
71 | }
72 |
73 | @Override
74 | protected List doInBackground(Void... params) {
75 | try {
76 | Event event = getSelectedEvent();
77 | if (event == null || day == null) {
78 | return null;
79 | }
80 | return getApplicationContext().getGreenhouseApi().sessionOperations().getSessionsOnDay(event.getId(), day);
81 | } catch(Exception e) {
82 | Log.e(TAG, e.getLocalizedMessage(), e);
83 | exception = e;
84 | }
85 |
86 | return null;
87 | }
88 |
89 | @Override
90 | protected void onPostExecute(List result) {
91 | dismissProgressDialog();
92 | processException(exception);
93 | setSessions(result);
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsListActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 |
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.ListView;
27 |
28 | import com.springsource.greenhouse.AbstractGreenhouseListActivity;
29 |
30 | /**
31 | * @author Roy Clarkson
32 | */
33 | public abstract class EventSessionsListActivity extends AbstractGreenhouseListActivity {
34 |
35 | private Event event;
36 |
37 | private List sessions;
38 |
39 |
40 | //***************************************
41 | // Activity methods
42 | //***************************************
43 | @Override
44 | public void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | }
47 |
48 | @Override
49 | public void onStart() {
50 | super.onStart();
51 | event = getApplicationContext().getSelectedEvent();
52 | downloadSessions();
53 | }
54 |
55 |
56 | //***************************************
57 | // ListActivity methods
58 | //***************************************
59 | @Override
60 | protected void onListItemClick(ListView l, View v, int position, long id) {
61 | super.onListItemClick(l, v, position, id);
62 | EventSession session = getSession(position);
63 | getApplicationContext().setSelectedSession(session);
64 | startActivity(new Intent(v.getContext(), EventSessionDetailsActivity.class));
65 | }
66 |
67 |
68 | //***************************************
69 | // Abstract methods
70 | //***************************************
71 | abstract void downloadSessions();
72 |
73 |
74 | //***************************************
75 | // Protected methods
76 | //***************************************
77 | protected Event getSelectedEvent() {
78 | return event;
79 | }
80 |
81 | protected void setSessions(List sessions) {
82 | this.sessions = sessions;
83 | getApplicationContext().setSelectedSession(null);
84 | setListAdapter(new EventSessionsListAdapter(this, sessions));
85 | }
86 |
87 | protected List getSessions() {
88 | return sessions;
89 | }
90 |
91 | protected EventSession getSession(int position) {
92 | return sessions.get(position);
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsUpcomingActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Date;
20 | import java.util.List;
21 |
22 | import org.springframework.social.greenhouse.api.Event;
23 | import org.springframework.social.greenhouse.api.EventSession;
24 |
25 | import android.os.AsyncTask;
26 | import android.util.Log;
27 |
28 | /**
29 | * @author Roy Clarkson
30 | */
31 | public class EventSessionsUpcomingActivity extends EventSessionsListActivity {
32 |
33 | private static final String TAG = EventSessionsUpcomingActivity.class.getSimpleName();
34 |
35 |
36 | //***************************************
37 | // Protected methods
38 | //***************************************
39 | @Override
40 | protected void downloadSessions() {
41 | new DownloadSessionsTask().execute();
42 | }
43 |
44 |
45 | //***************************************
46 | // Private classes
47 | //***************************************
48 | private class DownloadSessionsTask extends AsyncTask> {
49 |
50 | private Exception exception;
51 |
52 | @Override
53 | protected void onPreExecute() {
54 | showProgressDialog();
55 | }
56 |
57 | @Override
58 | protected List doInBackground(Void... params) {
59 | try {
60 | Event event = getSelectedEvent();
61 |
62 | if (event == null) {
63 | return null;
64 | }
65 |
66 | Date now = new Date();
67 | List sessions = getApplicationContext().getGreenhouseApi().sessionOperations().getSessionsOnDay(event.getId(), now);
68 | List upcomingSessions = new ArrayList();
69 |
70 | Date upcomingTime = null;
71 |
72 | for (EventSession session : sessions) {
73 | if (upcomingTime == null && session.getStartTime().after(now)) {
74 | upcomingTime = session.getStartTime();
75 | }
76 |
77 | if (upcomingTime != null && session.getStartTime().compareTo(upcomingTime) == 0) {
78 | upcomingSessions.add(session);
79 | }
80 | }
81 |
82 | return upcomingSessions;
83 | } catch(Exception e) {
84 | Log.e(TAG, e.getLocalizedMessage(), e);
85 | exception = e;
86 | }
87 |
88 | return null;
89 | }
90 |
91 | @Override
92 | protected void onPostExecute(List result) {
93 | dismissProgressDialog();
94 | processException(exception);
95 | setSessions(result);
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionsScheduleActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.ArrayList;
20 | import java.util.Date;
21 | import java.util.List;
22 |
23 | import org.springframework.social.greenhouse.api.Event;
24 |
25 | import android.content.Intent;
26 | import android.os.Bundle;
27 | import android.view.View;
28 | import android.widget.ArrayAdapter;
29 | import android.widget.ListView;
30 |
31 | import com.springsource.greenhouse.AbstractGreenhouseListActivity;
32 | import com.springsource.greenhouse.R;
33 |
34 | /**
35 | * @author Roy Clarkson
36 | */
37 | public class EventSessionsScheduleActivity extends AbstractGreenhouseListActivity {
38 |
39 | @SuppressWarnings("unused")
40 | private static final String TAG = EventSessionsScheduleActivity.class.getSimpleName();
41 |
42 | private Event event;
43 |
44 | private List conferenceDates;
45 |
46 |
47 | //***************************************
48 | // Activity methods
49 | //***************************************
50 | @Override
51 | public void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | }
54 |
55 | @Override
56 | public void onStart() {
57 | super.onStart();
58 | event = getApplicationContext().getSelectedEvent();
59 | getApplicationContext().setSelectedDay(null);
60 | refreshScheduleDays();
61 | }
62 |
63 | //***************************************
64 | // ListActivity methods
65 | //***************************************
66 | @Override
67 | protected void onListItemClick(ListView l, View v, int position, long id) {
68 | super.onListItemClick(l, v, position, id);
69 | Date day = conferenceDates.get(position);
70 | getApplicationContext().setSelectedDay(day);
71 | startActivity(new Intent(v.getContext(), EventSessionsByDayActivity.class));
72 | }
73 |
74 | //***************************************
75 | // Private methods
76 | //***************************************
77 | private void refreshScheduleDays() {
78 | if (event == null) {
79 | return;
80 | }
81 |
82 | conferenceDates = new ArrayList();
83 | List conferenceDays = new ArrayList();
84 | Date day = (Date) event.getStartTime().clone();
85 |
86 | while (day.before(event.getEndTime())) {
87 | conferenceDates.add((Date) day.clone());
88 | conferenceDays.add(new SimpleDateFormat("EEEE, MMM d").format(day));
89 | day.setDate(day.getDate() + 1);
90 | }
91 |
92 | setListAdapter(new ArrayAdapter(this, R.layout.menu_list_item, conferenceDays));
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/TweetOperations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 |
19 | /**
20 | * Interface defining the operations for retrieving and posting {@link Tweet} information.
21 | *
22 | * @author Roy Clarkson
23 | */
24 | public interface TweetOperations {
25 |
26 | /**
27 | * Retrieves a list of the most recent tweets for an Event.
28 | * @param eventId the ID of the event
29 | * @return a {@link TweetFeed} object that contains a list of {@link Tweet} objects.
30 | */
31 | TweetFeed getTweetsForEvent(long eventId);
32 |
33 | /**
34 | * Retrieves a list of tweets for an Event. Use the page parameter to retrieve older tweets.
35 | * @param eventId the ID of the event
36 | * @param page the page of tweets
37 | * @return a {@link TweetFeed} object that contains a list of {@link Tweet} objects.
38 | */
39 | TweetFeed getTweetsForEvent(long eventId, int page);
40 |
41 | /**
42 | * Retrieves a list of tweets for an Event Session.
43 | * @param eventId the ID of the event
44 | * @param sessionId the ID of the session
45 | * @return a {@link TweetFeed} object that contains a list of {@link Tweet} objects.
46 | */
47 | TweetFeed getTweetsForEventSession(long eventId, long sessionId);
48 |
49 | /**
50 | * Retrieves a list of tweets for an Event Session. Use the page parameter to retrieve older tweets.
51 | * @param eventId the ID of the event
52 | * @param sessionId the ID of the session
53 | * @param page the page of tweets
54 | * @return a {@link TweetFeed} object that contains a list of {@link Tweet} objects.
55 | */
56 | TweetFeed getTweetsForEventSession(long eventId, long sessionId, int page);
57 |
58 | /**
59 | * Posts a status update to twitter about an event.
60 | * @param eventId the ID of the event
61 | * @param status the status to post to twitter
62 | */
63 | void postTweetForEvent(long eventId, String status);
64 |
65 | /**
66 | * Posts a status update to twitter about a session.
67 | * @param eventId the ID of the event
68 | * @param sessionId the ID of the session
69 | * @param status the status to post to twitter
70 | */
71 | void postTweetForEventSession(long eventId, long sessionId, String status);
72 |
73 | /**
74 | * Posts a retweet of an existing tweet.
75 | * @param eventId the ID of the event
76 | * @param tweetId The ID of the tweet to be retweeted
77 | */
78 | void retweetForEvent(long eventId, long tweetId);
79 |
80 | /**
81 | * Posts a retweet of an existing tweet.
82 | * @param eventId the ID of the event
83 | * @param sessionid the ID of the session
84 | * @param tweetId The ID of the tweet to be retweeted
85 | */
86 | void retweetForEventSession(long eventId, long sessionId, long tweetId);
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/EventSession.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.Date;
20 | import java.util.List;
21 |
22 | /**
23 | * Model class that represents a Greenhouse event session.
24 | *
25 | * @author Craig Walls
26 | * @author Roy Clarkson
27 | */
28 | public class EventSession {
29 |
30 | private long id;
31 |
32 | private String title;
33 |
34 | private String description;
35 |
36 | private Date startTime;
37 |
38 | private Date endTime;
39 |
40 | private String hashtag;
41 |
42 | private float rating;
43 |
44 | private boolean favorite;
45 |
46 | private Room room;
47 |
48 | private List leaders;
49 |
50 | public EventSession(long id, String title, String description, Date startTime, Date endTime, String hashtag, float rating, boolean favorite, Room room, List leaders) {
51 | this.id = id;
52 | this.title = title;
53 | this.description = description;
54 | this.startTime = startTime;
55 | this.endTime = endTime;
56 | this.hashtag = hashtag;
57 | this.rating = rating;
58 | this.favorite = favorite;
59 | this.room = room;
60 | this.leaders = leaders;
61 | }
62 |
63 | public long getId() {
64 | return id;
65 | }
66 |
67 | public String getTitle() {
68 | return title;
69 | }
70 |
71 | public String getDescription() {
72 | return description;
73 | }
74 |
75 | public Date getStartTime() {
76 | return startTime;
77 | }
78 |
79 | public Date getEndTime() {
80 | return endTime;
81 | }
82 |
83 | public String getHashtag() {
84 | return hashtag;
85 | }
86 |
87 | public void setRating(float rating) {
88 | this.rating = rating;
89 | }
90 |
91 | public float getRating() {
92 | return rating;
93 | }
94 |
95 | public boolean isFavorite() {
96 | return favorite;
97 | }
98 |
99 | public Room getRoom() {
100 | return room;
101 | }
102 |
103 | public List getLeaders() {
104 | return leaders;
105 | }
106 |
107 | // public void setLeaders(List leaders)
108 | // {
109 | // this.leaders = leaders;
110 | // }
111 |
112 | public String getJoinedLeaders(String separator) {
113 | String s = "";
114 | int size = leaders.size();
115 |
116 | for (int i = 0; i < size; i++) {
117 | Leader leader = leaders.get(i);
118 | s += leader.getName();
119 |
120 | if (i < size-1) {
121 | s += separator;
122 | }
123 | }
124 |
125 | return s;
126 | }
127 |
128 | public String getFormattedTimeSpan() {
129 | String startTime = new SimpleDateFormat("h:mma").format(getStartTime());
130 | String endTime = new SimpleDateFormat("h:mma, EEE").format(getEndTime());
131 | return startTime + " - " + endTime;
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/res/layout/sign_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
24 |
35 |
36 |
37 |
38 |
39 |
48 |
49 |
58 |
59 |
65 |
66 |
72 |
73 |
74 |
79 |
80 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/SessionTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.ArrayList;
20 | import java.util.Date;
21 | import java.util.List;
22 |
23 | import org.springframework.http.HttpEntity;
24 | import org.springframework.http.HttpMethod;
25 | import org.springframework.social.greenhouse.api.EventSession;
26 | import org.springframework.social.greenhouse.api.SessionOperations;
27 | import org.springframework.util.LinkedMultiValueMap;
28 | import org.springframework.util.MultiValueMap;
29 | import org.springframework.web.client.RestTemplate;
30 |
31 | /**
32 | * @author Roy Clarkson
33 | */
34 | public class SessionTemplate extends AbstractGreenhouseOperations implements SessionOperations {
35 |
36 | private final RestTemplate restTemplate;
37 |
38 | public SessionTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, String apiUrlBase) {
39 | super(isAuthorizedForUser, apiUrlBase);
40 | this.restTemplate = restTemplate;
41 | }
42 |
43 | public List getSessionsOnDay(long eventId, Date date) {
44 | String isoDate = new SimpleDateFormat("yyyy-MM-dd").format(date);
45 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(isoDate).toString();
46 | return restTemplate.getForObject(buildUri(url), EventSessionList.class);
47 | }
48 |
49 | public List getFavoriteSessions(long eventId) {
50 | requireAuthorization();
51 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/favorites").toString();
52 | return restTemplate.getForObject(buildUri(url), EventSessionList.class);
53 | }
54 |
55 | public List getConferenceFavoriteSessions(long eventId) {
56 | String url = new StringBuilder().append("events/").append(eventId).append("/favorites").toString();
57 | return restTemplate.getForObject(buildUri(url), EventSessionList.class);
58 | }
59 |
60 | public boolean updateFavoriteSession(long eventId, long sessionId) {
61 | requireAuthorization();
62 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(sessionId).append("/favorite").toString();
63 | return restTemplate.exchange(buildUri(url), HttpMethod.PUT, null, Boolean.class).getBody();
64 | }
65 |
66 | public float rateSession(long eventId, long sessionId, int rating, String comment) {
67 | requireAuthorization();
68 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(sessionId).append("/rating").toString();
69 | MultiValueMap postData = new LinkedMultiValueMap();
70 | postData.add("value", String.valueOf(rating));
71 | postData.add("comment", comment);
72 | return restTemplate.exchange(buildUri(url), HttpMethod.POST, new HttpEntity>(postData, null), Float.class).getBody();
73 | }
74 |
75 | @SuppressWarnings("serial")
76 | private static class EventSessionList extends ArrayList {}
77 | }
78 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/GreenhouseTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import java.util.List;
19 |
20 | import org.codehaus.jackson.map.ObjectMapper;
21 | import org.springframework.http.converter.HttpMessageConverter;
22 | import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
23 | import org.springframework.social.greenhouse.api.EventOperations;
24 | import org.springframework.social.greenhouse.api.Greenhouse;
25 | import org.springframework.social.greenhouse.api.SessionOperations;
26 | import org.springframework.social.greenhouse.api.TweetOperations;
27 | import org.springframework.social.greenhouse.api.UserOperations;
28 | import org.springframework.social.oauth2.AbstractOAuth2ApiBinding;
29 |
30 | /**
31 | * This is the central class for interacting with Greenhouse.
32 | * @author Roy Clarkson
33 | */
34 | public class GreenhouseTemplate extends AbstractOAuth2ApiBinding implements Greenhouse {
35 |
36 | private final String apiUrlBase;
37 |
38 | private UserOperations userOperations;
39 |
40 | private EventOperations eventOperations;
41 |
42 | private SessionOperations sessionOperations;
43 |
44 | private TweetOperations tweetOperations;
45 |
46 | /**
47 | * Create a new instance of GreenhouseTemplate.
48 | * @param accessToken an access token acquired through OAuth 2 authentication with Greenhouse
49 | */
50 | public GreenhouseTemplate(String accessToken, String apiUrlBase) {
51 | super(accessToken);
52 | this.apiUrlBase = apiUrlBase;
53 | registerGreenhouseJsonModule();
54 | getRestTemplate().setErrorHandler(new GreenhouseErrorHandler());
55 | initSubApis();
56 | }
57 |
58 | public UserOperations userOperations() {
59 | return userOperations;
60 | }
61 |
62 | public EventOperations eventOperations() {
63 | return eventOperations;
64 | }
65 |
66 | public SessionOperations sessionOperations() {
67 | return sessionOperations;
68 | }
69 |
70 | public TweetOperations tweetOperations() {
71 | return tweetOperations;
72 | }
73 |
74 | // private helper
75 |
76 | private void registerGreenhouseJsonModule() {
77 | List> converters = getRestTemplate().getMessageConverters();
78 | for (HttpMessageConverter> converter : converters) {
79 | if(converter instanceof MappingJacksonHttpMessageConverter) {
80 | MappingJacksonHttpMessageConverter jsonConverter = (MappingJacksonHttpMessageConverter) converter;
81 | ObjectMapper objectMapper = new ObjectMapper();
82 | objectMapper.registerModule(new GreenhouseModule());
83 | jsonConverter.setObjectMapper(objectMapper);
84 | }
85 | }
86 | }
87 |
88 | private String getApiUrlBase() {
89 | return apiUrlBase;
90 | }
91 |
92 | private void initSubApis() {
93 | this.userOperations = new UserTemplate(getRestTemplate(), isAuthorized(), getApiUrlBase());
94 | this.eventOperations = new EventTemplate(getRestTemplate(), isAuthorized(), getApiUrlBase());
95 | this.sessionOperations = new SessionTemplate(getRestTemplate(), isAuthorized(), getApiUrlBase());
96 | this.tweetOperations = new TweetTemplate(getRestTemplate(), isAuthorized(), getApiUrlBase());
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/twitter/TweetsListActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.twitter;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 | import org.springframework.social.greenhouse.api.EventSession;
22 | import org.springframework.social.greenhouse.api.Tweet;
23 |
24 | import android.content.Intent;
25 | import android.os.Bundle;
26 | import android.view.Menu;
27 | import android.view.MenuInflater;
28 | import android.view.MenuItem;
29 | import android.view.View;
30 | import android.widget.ListView;
31 |
32 | import com.springsource.greenhouse.AbstractGreenhouseListActivity;
33 | import com.springsource.greenhouse.R;
34 |
35 | /**
36 | * @author Roy Clarkson
37 | */
38 | public abstract class TweetsListActivity extends AbstractGreenhouseListActivity {
39 |
40 | protected static final String TAG = TweetsListActivity.class.getSimpleName();
41 |
42 | private List tweets;
43 |
44 |
45 | //***************************************
46 | // Activity methods
47 | //***************************************
48 | @Override
49 | public void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 | }
52 |
53 | @Override
54 | public void onStart() {
55 | super.onStart();
56 | downloadTweets();
57 | }
58 |
59 | @Override
60 | public boolean onCreateOptionsMenu(Menu menu) {
61 | MenuInflater inflater = getMenuInflater();
62 | inflater.inflate(R.menu.tweets_menu, menu);
63 | return true;
64 | }
65 |
66 | @Override
67 | public boolean onOptionsItemSelected(MenuItem item) {
68 | // Handle item selection
69 | switch (item.getItemId()) {
70 | case R.id.tweets_menu_refresh:
71 | downloadTweets();
72 | return true;
73 | default:
74 | return super.onOptionsItemSelected(item);
75 | }
76 | }
77 |
78 |
79 | //***************************************
80 | // ListActivity methods
81 | //***************************************
82 | @Override
83 | protected void onListItemClick(ListView l, View v, int position, long id) {
84 | super.onListItemClick(l, v, position, id);
85 | Tweet tweet = getTweet(position);
86 | getApplicationContext().setSelectedTweet(tweet);
87 | startActivity(new Intent(v.getContext(), TweetDetailsActivity.class));
88 | }
89 |
90 |
91 | //***************************************
92 | // Abstract methods
93 | //***************************************
94 | protected abstract void downloadTweets();
95 |
96 |
97 | //***************************************
98 | // Protected methods
99 | //***************************************
100 | protected Event getSelectedEvent() {
101 | return getApplicationContext().getSelectedEvent();
102 | }
103 |
104 | protected EventSession getSelectedSession() {
105 | return getApplicationContext().getSelectedSession();
106 | }
107 |
108 | protected void setTweets(List tweets) {
109 | this.tweets = tweets;
110 | getApplicationContext().setSelectedTweet(null);
111 | setListAdapter(new TweetsListAdapter(this, tweets));
112 | }
113 |
114 | protected List getTweets() {
115 | return tweets;
116 | }
117 |
118 | protected Tweet getTweet(int position) {
119 | return tweets.get(position);
120 | }
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/AbstractGreenhouseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import org.springframework.http.HttpStatus;
19 | import org.springframework.web.client.HttpClientErrorException;
20 | import org.springframework.web.client.ResourceAccessException;
21 |
22 | import android.app.Activity;
23 | import android.app.AlertDialog;
24 | import android.app.ProgressDialog;
25 | import android.content.DialogInterface;
26 | import android.content.Intent;
27 | import android.view.Gravity;
28 | import android.widget.Toast;
29 |
30 | /**
31 | * @author Roy Clarkson
32 | */
33 | public abstract class AbstractGreenhouseActivity extends Activity implements GreenhouseActivity {
34 |
35 | protected static final String TAG = AbstractGreenhouseActivity.class.getSimpleName();
36 |
37 | private ProgressDialog progressDialog;
38 |
39 |
40 | //***************************************
41 | // GreenhouseActivity methods
42 | //***************************************
43 | public MainApplication getApplicationContext() {
44 | return (MainApplication) super.getApplicationContext();
45 | }
46 |
47 | public void showProgressDialog() {
48 | showProgressDialog("Loading. Please wait...");
49 | }
50 |
51 | public void showProgressDialog(String message) {
52 | if (progressDialog == null) {
53 | progressDialog = new ProgressDialog(this);
54 | progressDialog.setIndeterminate(true);
55 | }
56 |
57 | progressDialog.setMessage(message);
58 | progressDialog.show();
59 | }
60 |
61 | public void dismissProgressDialog() {
62 | if (progressDialog != null) {
63 | progressDialog.dismiss();
64 | }
65 | }
66 |
67 |
68 | //***************************************
69 | // Protected methods
70 | //***************************************
71 | protected void processException(Exception e) {
72 | if (e != null) {
73 | if (e instanceof ResourceAccessException) {
74 | displayNetworkError();
75 | } else if (e instanceof HttpClientErrorException) {
76 | HttpClientErrorException httpError = (HttpClientErrorException) e;
77 | if (httpError.getStatusCode() == HttpStatus.UNAUTHORIZED) {
78 | displayAuthorizationError();
79 | }
80 | }
81 | }
82 | }
83 |
84 | protected void displayNetworkError() {
85 | Toast toast = Toast.makeText(this, "A problem occurred with the network connection while attempting to communicate with Greenhouse.", Toast.LENGTH_LONG);
86 | toast.setGravity(Gravity.CENTER, 0, 0);
87 | toast.show();
88 | }
89 |
90 | protected void displayAuthorizationError() {
91 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
92 | builder.setMessage("You are not authorized to connect to Greenhouse. Please reauthorize the app.");
93 | builder.setCancelable(false);
94 | builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
95 | public void onClick(DialogInterface dialog, int id) {
96 | signOut();
97 | }
98 | });
99 | AlertDialog alert = builder.create();
100 | alert.show();
101 | }
102 |
103 | protected void signOut() {
104 | getApplicationContext().getConnectionRepository().removeConnections(getApplicationContext().getConnectionFactory().getProviderId());
105 | startActivity(new Intent(this, MainActivity.class));
106 | finish();
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/AbstractGreenhouseListActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import org.springframework.http.HttpStatus;
19 | import org.springframework.web.client.HttpClientErrorException;
20 | import org.springframework.web.client.ResourceAccessException;
21 |
22 | import android.app.AlertDialog;
23 | import android.app.ListActivity;
24 | import android.app.ProgressDialog;
25 | import android.content.DialogInterface;
26 | import android.content.Intent;
27 | import android.view.Gravity;
28 | import android.widget.Toast;
29 |
30 | /**
31 | * @author Roy Clarkson
32 | */
33 | public abstract class AbstractGreenhouseListActivity extends ListActivity implements GreenhouseActivity {
34 |
35 | protected static final String TAG = AbstractGreenhouseListActivity.class.getSimpleName();
36 |
37 | private ProgressDialog progressDialog;
38 |
39 |
40 | //***************************************
41 | // GreenhouseActivity methods
42 | //***************************************
43 | public MainApplication getApplicationContext() {
44 | return (MainApplication) super.getApplicationContext();
45 | }
46 |
47 | public void showProgressDialog() {
48 | showProgressDialog("Loading. Please wait...");
49 | }
50 |
51 | public void showProgressDialog(String message) {
52 | if (progressDialog == null) {
53 | progressDialog = new ProgressDialog(this);
54 | progressDialog.setIndeterminate(true);
55 | }
56 |
57 | progressDialog.setMessage(message);
58 | progressDialog.show();
59 | }
60 |
61 | public void dismissProgressDialog() {
62 | if (progressDialog != null) {
63 | progressDialog.dismiss();
64 | }
65 | }
66 |
67 |
68 | //***************************************
69 | // Protected methods
70 | //***************************************
71 | protected void processException(Exception e) {
72 | if (e != null) {
73 | if (e instanceof ResourceAccessException) {
74 | displayNetworkError();
75 | } else if (e instanceof HttpClientErrorException) {
76 | HttpClientErrorException httpError = (HttpClientErrorException) e;
77 | if (httpError.getStatusCode() == HttpStatus.UNAUTHORIZED) {
78 | displayAuthorizationError();
79 | }
80 | }
81 | }
82 | }
83 |
84 | protected void displayNetworkError() {
85 | Toast toast = Toast.makeText(this, "A problem occurred with the network connection while attempting to communicate with Greenhouse.", Toast.LENGTH_LONG);
86 | toast.setGravity(Gravity.CENTER, 0, 0);
87 | toast.show();
88 | }
89 |
90 | protected void displayAuthorizationError() {
91 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
92 | builder.setMessage("You are not authorized to connect to Greenhouse. Please reauthorize the app.");
93 | builder.setCancelable(false);
94 | builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
95 | public void onClick(DialogInterface dialog, int id) {
96 | signOut();
97 | }
98 | });
99 | AlertDialog alert = builder.create();
100 | alert.show();
101 | }
102 |
103 | protected void signOut() {
104 | getApplicationContext().getConnectionRepository().removeConnections(getApplicationContext().getConnectionFactory().getProviderId());
105 | startActivity(new Intent(this, MainActivity.class));
106 | finish();
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventDetailsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events;
17 |
18 | import org.springframework.social.greenhouse.api.Event;
19 |
20 | import android.content.Intent;
21 | import android.os.Bundle;
22 | import android.view.View;
23 | import android.widget.AdapterView;
24 | import android.widget.AdapterView.OnItemClickListener;
25 | import android.widget.ArrayAdapter;
26 | import android.widget.ListView;
27 | import android.widget.TextView;
28 |
29 | import com.springsource.greenhouse.AbstractGreenhouseActivity;
30 | import com.springsource.greenhouse.R;
31 | import com.springsource.greenhouse.events.sessions.EventSessionsFilteredActivity;
32 | import com.springsource.greenhouse.events.sessions.EventSessionsScheduleActivity;
33 | import com.springsource.greenhouse.twitter.PostTweetActivity;
34 |
35 | /**
36 | * @author Roy Clarkson
37 | */
38 | public class EventDetailsActivity extends AbstractGreenhouseActivity {
39 |
40 | @SuppressWarnings("unused")
41 | private static final String TAG = EventDetailsActivity.class.getSimpleName();
42 |
43 | private Event event;
44 |
45 |
46 | //***************************************
47 | // Activity methods
48 | //***************************************
49 | @Override
50 | public void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | setContentView(R.layout.event_details);
53 |
54 | final ListView listView = (ListView) findViewById(R.id.event_details_menu);
55 |
56 | String[] menu_items = getResources().getStringArray(R.array.event_details_options_array);
57 | ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.menu_list_item, menu_items);
58 | listView.setAdapter(arrayAdapter);
59 |
60 | listView.setOnItemClickListener(new OnItemClickListener() {
61 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
62 | Intent intent = new Intent();
63 |
64 | switch(position) {
65 | case 0:
66 | intent.setClass(view.getContext(), EventSessionsFilteredActivity.class);
67 | break;
68 | case 1:
69 | intent.setClass(view.getContext(), EventSessionsScheduleActivity.class);
70 | break;
71 | case 2:
72 | intent.setClass(view.getContext(), PostTweetActivity.class);
73 | break;
74 | case 3:
75 | intent.setClass(view.getContext(), EventTweetsActivity.class);
76 | break;
77 | default:
78 | break;
79 | }
80 |
81 | startActivity(intent);
82 | }
83 | });
84 | }
85 |
86 | @Override
87 | public void onStart() {
88 | super.onStart();
89 | event = getApplicationContext().getSelectedEvent();
90 | refreshEventDetails();
91 | }
92 |
93 |
94 | //***************************************
95 | // Private methods
96 | //***************************************
97 | private void refreshEventDetails() {
98 | if (event == null) {
99 | return;
100 | }
101 |
102 | TextView t = (TextView) findViewById(R.id.event_details_name);
103 | t.setText(event.getTitle());
104 |
105 | t = (TextView) findViewById(R.id.event_details_date);
106 | t.setText(event.getFormattedTimeSpan());
107 |
108 | t = (TextView) findViewById(R.id.event_details_location);
109 | t.setText(event.getLocation());
110 |
111 | t = (TextView) findViewById(R.id.event_details_description);
112 | t.setText(event.getDescription());
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/EventsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events;
17 |
18 | import java.util.List;
19 |
20 | import org.springframework.social.greenhouse.api.Event;
21 |
22 | import android.content.Intent;
23 | import android.os.AsyncTask;
24 | import android.os.Bundle;
25 | import android.util.Log;
26 | import android.view.Menu;
27 | import android.view.MenuInflater;
28 | import android.view.MenuItem;
29 | import android.view.View;
30 | import android.widget.ListView;
31 |
32 | import com.springsource.greenhouse.AbstractGreenhouseListActivity;
33 | import com.springsource.greenhouse.R;
34 |
35 | /**
36 | * @author Roy Clarkson
37 | */
38 | public class EventsActivity extends AbstractGreenhouseListActivity {
39 |
40 | protected static final String TAG = EventsActivity.class.getSimpleName();
41 |
42 | private List upcomingEvents;
43 |
44 |
45 | //***************************************
46 | // Activity methods
47 | //***************************************
48 | @Override
49 | public void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 | }
52 |
53 | @Override
54 | public void onStart() {
55 | super.onStart();
56 |
57 | if (upcomingEvents == null) {
58 | downloadEvents();
59 | }
60 | }
61 |
62 | @Override
63 | public boolean onCreateOptionsMenu(Menu menu) {
64 | MenuInflater inflater = getMenuInflater();
65 | inflater.inflate(R.menu.events_menu, menu);
66 | return true;
67 | }
68 |
69 | @Override
70 | public boolean onOptionsItemSelected(MenuItem item) {
71 | // Handle item selection
72 | switch (item.getItemId()) {
73 | case R.id.events_menu_refresh:
74 | downloadEvents();
75 | return true;
76 | default:
77 | return super.onOptionsItemSelected(item);
78 | }
79 | }
80 |
81 |
82 | //***************************************
83 | // ListActivity methods
84 | //***************************************
85 | @Override
86 | protected void onListItemClick(ListView l, View v, int position, long id) {
87 | super.onListItemClick(l, v, position, id);
88 |
89 | Event event = upcomingEvents.get(position);
90 | getApplicationContext().setSelectedEvent(event);
91 | startActivity(new Intent(this, EventDetailsActivity.class));
92 | }
93 |
94 |
95 | //***************************************
96 | // Private methods
97 | //***************************************
98 | private void refreshEvents(List upcomingEvents) {
99 | this.upcomingEvents = upcomingEvents;
100 |
101 | if (upcomingEvents == null) {
102 | return;
103 | }
104 |
105 | setListAdapter(new EventsListAdapter(this, upcomingEvents));
106 | }
107 |
108 | private void downloadEvents() {
109 | new DownloadEventsTask().execute();
110 | }
111 |
112 |
113 | //***************************************
114 | // Private classes
115 | //***************************************
116 | private class DownloadEventsTask extends AsyncTask> {
117 |
118 | private Exception exception;
119 |
120 | @Override
121 | protected void onPreExecute() {
122 | showProgressDialog();
123 | }
124 |
125 | @Override
126 | protected List doInBackground(Void... params) {
127 | try {
128 | return getApplicationContext().getGreenhouseApi().eventOperations().getUpcomingEvents();
129 | } catch(Exception e) {
130 | Log.e(TAG, e.getLocalizedMessage(), e);
131 | exception = e;
132 | }
133 |
134 | return null;
135 | }
136 |
137 | @Override
138 | protected void onPostExecute(List result) {
139 | dismissProgressDialog();
140 | processException(exception);
141 | refreshEvents(result);
142 | }
143 | }
144 | }
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api;
17 |
18 | import java.text.SimpleDateFormat;
19 | import java.util.Calendar;
20 | import java.util.Date;
21 | import java.util.List;
22 |
23 | /**
24 | * Model class that represents a Greenhouse event.
25 | *
26 | * @author Craig Walls
27 | * @author Roy Clarkson
28 | */
29 | public class Event {
30 |
31 | private long id;
32 |
33 | private String title;
34 |
35 | private String location;
36 |
37 | private String hashtag;
38 |
39 | private String description;
40 |
41 | private Date startTime;
42 |
43 | private Date endTime;
44 |
45 | private String slug;
46 |
47 | private String groupName;
48 |
49 | private String groupSlug;
50 |
51 | private Group group;
52 |
53 | private TimeZone timeZone;
54 |
55 | private List venues;
56 |
57 | private String formattedTimeSpan;
58 |
59 | public Event(long id, String title, String location, String hashtag, String description, Date startTime, Date endTime, String slug, String groupName, String groupSlug, Group group, TimeZone timeZone, List venues) {
60 | this.id = id;
61 | this.title = title;
62 | this.location = location;
63 | this.hashtag = hashtag;
64 | this.description = description;
65 | this.startTime = startTime;
66 | this.endTime = endTime;
67 | this.slug = slug;
68 | this.groupName = groupName;
69 | this.groupSlug = groupSlug;
70 | this.group = group;
71 | this.timeZone = timeZone;
72 | this.venues = venues;
73 | setFormattedTimeSpan(startTime, endTime);
74 | }
75 |
76 | public List getVenues() {
77 | return venues;
78 | }
79 |
80 | public void setVenues(List venues) {
81 | this.venues = venues;
82 | }
83 |
84 | public String getSlug() {
85 | return slug;
86 | }
87 |
88 | public Group getGroup() {
89 | return group;
90 | }
91 |
92 | public String getGroupName() {
93 | return groupName;
94 | }
95 |
96 | public String getGroupSlug() {
97 | return groupSlug;
98 | }
99 |
100 | public TimeZone getTimeZone() {
101 | return timeZone;
102 | }
103 |
104 | public long getId() {
105 | return id;
106 | }
107 |
108 | public String getTitle() {
109 | return title;
110 | }
111 |
112 | public String getLocation() {
113 | return location;
114 | }
115 |
116 | public String getHashtag() {
117 | return hashtag;
118 | }
119 |
120 | public String getDescription() {
121 | return description;
122 | }
123 |
124 | public Date getStartTime() {
125 | return startTime;
126 | }
127 |
128 | public Date getEndTime() {
129 | return endTime;
130 | }
131 |
132 | public String getFormattedTimeSpan() {
133 | return formattedTimeSpan;
134 | }
135 |
136 | // helpers
137 |
138 | private void setFormattedTimeSpan(Date start, Date end) {
139 | Calendar startCal = Calendar.getInstance();
140 | startCal.setTime(start);
141 | Calendar endCal = Calendar.getInstance();
142 | endCal.setTime(end);
143 |
144 | // if start and end time are exactly the same, just show the date
145 | if (startCal.compareTo(endCal) == 0) {
146 | this.formattedTimeSpan = new SimpleDateFormat("EEE, MMM d, yyyy").format(start);
147 | }
148 |
149 | // if start and end time are same day, show the times for the event
150 | if (startCal.get(Calendar.YEAR) == endCal.get(Calendar.YEAR) &&
151 | startCal.get(Calendar.DAY_OF_YEAR) == endCal.get(Calendar.DAY_OF_YEAR)) {
152 | String startFormatted = new SimpleDateFormat("EEE, MMM d, yyyy, h:mm a").format(getStartTime());
153 | String endFormatted = new SimpleDateFormat("h:mm a").format(getEndTime());
154 | this.formattedTimeSpan = startFormatted + " - " + endFormatted;
155 | }
156 |
157 | // if the times are days apart, display the date range for the event
158 | else {
159 | String startFormatted = new SimpleDateFormat("EEE, MMM d").format(start);
160 | String endFormatted = new SimpleDateFormat("EEE, MMM d, yyyy").format(end);
161 | this.formattedTimeSpan = startFormatted + " - " + endFormatted;
162 | }
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
32 |
36 |
37 |
38 |
41 |
44 |
47 |
50 |
53 |
56 |
59 |
62 |
65 |
68 |
71 |
74 |
77 |
80 |
83 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/org/springframework/social/greenhouse/api/impl/TweetTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.social.greenhouse.api.impl;
17 |
18 | import org.springframework.http.HttpEntity;
19 | import org.springframework.http.HttpMethod;
20 | import org.springframework.social.greenhouse.api.TweetFeed;
21 | import org.springframework.social.greenhouse.api.TweetOperations;
22 | import org.springframework.util.LinkedMultiValueMap;
23 | import org.springframework.util.MultiValueMap;
24 | import org.springframework.web.client.RestTemplate;
25 |
26 | /**
27 | * @author Roy Clarkson
28 | */
29 | public class TweetTemplate extends AbstractGreenhouseOperations implements TweetOperations {
30 |
31 | private static final String PAGE_SIZE = "40";
32 |
33 | private final RestTemplate restTemplate;
34 |
35 | public TweetTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, String apiBaseUrl) {
36 | super(isAuthorizedForUser, apiBaseUrl);
37 | this.restTemplate = restTemplate;
38 | }
39 |
40 | public TweetFeed getTweetsForEvent(long eventId) {
41 | return getTweetsForEvent(eventId, 1);
42 | }
43 |
44 | public TweetFeed getTweetsForEvent(long eventId, int page) {
45 | String url = new StringBuilder().append("events/").append(eventId).append("/tweets").append("?page=").append(page).append("&pageSize=").append(PAGE_SIZE).toString();
46 | MultiValueMap parameters = new LinkedMultiValueMap();
47 | // parameters.add("page", page));
48 | // parameters.add("pageSize", PAGE_SIZE);
49 | return restTemplate.getForObject(buildUri(url, parameters), TweetFeed.class);
50 | }
51 |
52 | public TweetFeed getTweetsForEventSession(long eventId, long sessionId) {
53 | return getTweetsForEventSession(eventId, sessionId, 1);
54 | }
55 |
56 | public TweetFeed getTweetsForEventSession(long eventId, long sessionId, int page) {
57 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(sessionId).append("/tweets").append("?page=").append(page).append("&pageSize=").append(PAGE_SIZE).toString();
58 | MultiValueMap parameters = new LinkedMultiValueMap();
59 | // parameters.add("page", page));
60 | // parameters.add("pageSize", PAGE_SIZE);
61 | return restTemplate.getForObject(buildUri(url, parameters), TweetFeed.class);
62 | }
63 |
64 | public void postTweetForEvent(long eventId, String status) {
65 | requireAuthorization();
66 | String url = new StringBuilder().append("events/").append(eventId).append("/tweets").toString();
67 | MultiValueMap postData = new LinkedMultiValueMap();
68 | postData.add("status", status);
69 | restTemplate.exchange(buildUri(url), HttpMethod.POST, new HttpEntity>(postData, null), null);
70 | }
71 |
72 | public void postTweetForEventSession(long eventId, long sessionId, String status) {
73 | requireAuthorization();
74 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(sessionId).append("/tweets").toString();
75 | MultiValueMap postData = new LinkedMultiValueMap();
76 | postData.add("status", status);
77 | restTemplate.exchange(buildUri(url), HttpMethod.POST, new HttpEntity>(postData, null), null);
78 | }
79 |
80 | public void retweetForEvent(long eventId, long tweetId) {
81 | requireAuthorization();
82 | String url = new StringBuilder().append("events/").append(eventId).append("/retweet").toString();
83 | MultiValueMap postData = new LinkedMultiValueMap();
84 | postData.add("tweetId", String.valueOf(tweetId));
85 | restTemplate.exchange(buildUri(url), HttpMethod.POST, new HttpEntity>(postData, null), null);
86 | }
87 |
88 | public void retweetForEventSession(long eventId, long sessionId, long tweetId) {
89 | requireAuthorization();
90 | String url = new StringBuilder().append("events/").append(eventId).append("/sessions/").append(sessionId).append("/retweet").toString();
91 | MultiValueMap postData = new LinkedMultiValueMap();
92 | postData.add("tweetId", String.valueOf(tweetId));
93 | restTemplate.exchange(buildUri(url), HttpMethod.POST, new HttpEntity>(postData, null), null);
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/MainApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011-2012 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse;
17 |
18 | import java.util.Date;
19 |
20 | import org.springframework.security.crypto.encrypt.AndroidEncryptors;
21 | import org.springframework.social.connect.Connection;
22 | import org.springframework.social.connect.ConnectionRepository;
23 | import org.springframework.social.connect.sqlite.SQLiteConnectionRepository;
24 | import org.springframework.social.connect.sqlite.support.SQLiteConnectionRepositoryHelper;
25 | import org.springframework.social.connect.support.ConnectionFactoryRegistry;
26 | import org.springframework.social.greenhouse.api.Event;
27 | import org.springframework.social.greenhouse.api.EventSession;
28 | import org.springframework.social.greenhouse.api.Greenhouse;
29 | import org.springframework.social.greenhouse.api.Tweet;
30 | import org.springframework.social.greenhouse.connect.GreenhouseConnectionFactory;
31 |
32 | import android.app.Application;
33 |
34 | /**
35 | * @author Roy Clarkson
36 | */
37 | public class MainApplication extends Application {
38 |
39 | @SuppressWarnings("unused")
40 | private static final String TAG = MainApplication.class.getSimpleName();
41 |
42 | private GreenhouseConnectionFactory connectionFactory;
43 |
44 | private ConnectionRepository connectionRepository;
45 |
46 | private Event selectedEvent;
47 |
48 | private EventSession selectedSession;
49 |
50 | private Date selectedDay;
51 |
52 | private Tweet selectedTweet;
53 |
54 | //***************************************
55 | // Application methods
56 | //***************************************
57 | @Override
58 | public void onCreate() {
59 | super.onCreate();
60 | connectionFactory = new GreenhouseConnectionFactory(getClientId(), getClientSecret(), getApiUrlBase());
61 | ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
62 | registry.addConnectionFactory(connectionFactory);
63 | connectionRepository = new SQLiteConnectionRepository(new SQLiteConnectionRepositoryHelper(this), registry,
64 | AndroidEncryptors.text(getEncryptionPassword(), getEncryptionSalt()));
65 | }
66 |
67 | //***************************************
68 | // Private methods
69 | //***************************************
70 | private String getEncryptionPassword() {
71 | return getString(R.string.connection_repository_encryption_password);
72 | }
73 |
74 | private String getEncryptionSalt() {
75 | return getString(R.string.connection_repository_encryption_salt);
76 | }
77 |
78 | public String getClientId() {
79 | return getString(R.string.client_id);
80 | }
81 |
82 | public String getClientSecret() {
83 | return getString(R.string.client_secret);
84 | }
85 |
86 | public String getApiUrlBase() {
87 | return getString(R.string.base_url);
88 | }
89 |
90 | //***************************************
91 | // Public methods
92 | //***************************************
93 | public ConnectionRepository getConnectionRepository() {
94 | return connectionRepository;
95 | }
96 |
97 | public GreenhouseConnectionFactory getConnectionFactory() {
98 | return connectionFactory;
99 | }
100 |
101 | public Connection getPrimaryConnection() {
102 | return getConnectionRepository().findPrimaryConnection(Greenhouse.class);
103 | }
104 |
105 | public Greenhouse getGreenhouseApi() {
106 | Connection connection = getPrimaryConnection();
107 | if (connection != null) {
108 | return connection.getApi();
109 | }
110 |
111 | return null;
112 | }
113 |
114 | public void setSelectedEvent(Event event) {
115 | this.selectedEvent = event;
116 | }
117 |
118 | public Event getSelectedEvent() {
119 | return selectedEvent;
120 | }
121 |
122 | public void setSelectedSession(EventSession session) {
123 | this.selectedSession = session;
124 | }
125 |
126 | public EventSession getSelectedSession() {
127 | return selectedSession;
128 | }
129 |
130 | public void setSelectedDay(Date selectedDay) {
131 | this.selectedDay = selectedDay;
132 | }
133 |
134 | public Date getSelectedDay() {
135 | return selectedDay;
136 | }
137 |
138 | public void setSelectedTweet(Tweet selectedTweet) {
139 | this.selectedTweet = selectedTweet;
140 | }
141 |
142 | public Tweet getSelectedTweet() {
143 | return selectedTweet;
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/profile/ProfileActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.profile;
17 |
18 | import java.io.BufferedInputStream;
19 | import java.io.IOException;
20 | import java.io.InputStream;
21 | import java.net.URL;
22 | import java.net.URLConnection;
23 |
24 | import org.springframework.social.greenhouse.api.GreenhouseProfile;
25 |
26 | import android.graphics.Bitmap;
27 | import android.graphics.BitmapFactory;
28 | import android.os.AsyncTask;
29 | import android.os.Bundle;
30 | import android.util.Log;
31 | import android.view.Menu;
32 | import android.view.MenuInflater;
33 | import android.view.MenuItem;
34 | import android.widget.ImageView;
35 | import android.widget.TextView;
36 |
37 | import com.springsource.greenhouse.AbstractGreenhouseActivity;
38 | import com.springsource.greenhouse.R;
39 |
40 | /**
41 | * @author Roy Clarkson
42 | */
43 | public class ProfileActivity extends AbstractGreenhouseActivity {
44 |
45 | protected static final String TAG = ProfileActivity.class.getSimpleName();
46 |
47 | private GreenhouseProfile profile;
48 |
49 |
50 | //***************************************
51 | // Activity methods
52 | //***************************************
53 | @Override
54 | public void onCreate(Bundle savedInstanceState) {
55 | super.onCreate(savedInstanceState);
56 | setContentView(R.layout.profile);
57 | }
58 |
59 | @Override
60 | public void onStart() {
61 | super.onStart();
62 |
63 | if (profile == null) {
64 | downloadProfile();
65 | }
66 | }
67 |
68 | @Override
69 | public boolean onCreateOptionsMenu(Menu menu) {
70 | MenuInflater inflater = getMenuInflater();
71 | inflater.inflate(R.menu.profile_menu, menu);
72 | return true;
73 | }
74 |
75 | @Override
76 | public boolean onOptionsItemSelected(MenuItem item) {
77 | // Handle item selection
78 | switch (item.getItemId()) {
79 | case R.id.profile_menu_refresh:
80 | downloadProfile();
81 | return true;
82 | case R.id.profile_menu_sign_out:
83 | signOut();
84 | return true;
85 | default:
86 | return super.onOptionsItemSelected(item);
87 | }
88 | }
89 |
90 | //***************************************
91 | // Private methods
92 | //***************************************
93 | private void refreshProfile(GreenhouseProfile profile) {
94 | if (profile == null) {
95 | return;
96 | }
97 |
98 | this.profile = profile;
99 |
100 | final TextView textViewMemberName = (TextView) findViewById(R.id.profile_textview_member_name);
101 | textViewMemberName.setText(profile.getDisplayName());
102 | new DownloadProfileImageTask().execute(profile.getPictureUrl());
103 | }
104 |
105 | private void downloadProfile() {
106 | new DownloadProfileTask().execute();
107 | }
108 |
109 |
110 | //***************************************
111 | // Private classes
112 | //***************************************
113 | private class DownloadProfileTask extends AsyncTask {
114 |
115 | private Exception exception;
116 |
117 | @Override
118 | protected void onPreExecute() {
119 | showProgressDialog();
120 | }
121 |
122 | @Override
123 | protected GreenhouseProfile doInBackground(Void... params) {
124 | try {
125 | return getApplicationContext().getPrimaryConnection().getApi().userOperations().getUserProfile();
126 | } catch(Exception e) {
127 | Log.e(TAG, e.getLocalizedMessage(), e);
128 | exception = e;
129 | }
130 |
131 | return null;
132 | }
133 |
134 | @Override
135 | protected void onPostExecute(GreenhouseProfile result) {
136 | dismissProgressDialog();
137 | processException(exception);
138 | refreshProfile(result);
139 | }
140 | }
141 |
142 | private class DownloadProfileImageTask extends AsyncTask {
143 |
144 | @Override
145 | protected Bitmap doInBackground(String... urls) {
146 | Bitmap bitmap = null;
147 | try {
148 | if (urls.length > 0) {
149 | URL url = new URL(urls[0]);
150 | URLConnection conn = url.openConnection();
151 | conn.connect();
152 | InputStream is = conn.getInputStream();
153 | BufferedInputStream bis = new BufferedInputStream(is);
154 | bitmap = BitmapFactory.decodeStream(bis);
155 | bis.close();
156 | is.close();
157 | }
158 | } catch (IOException e) {
159 | Log.e(TAG, "Error retrieving profile image", e);
160 | } catch(Exception e) {
161 | Log.e(TAG, e.getLocalizedMessage(), e);
162 | }
163 |
164 | return bitmap;
165 | }
166 |
167 | @Override
168 | protected void onPostExecute(Bitmap result) {
169 | final ImageView imageViewPicture = (ImageView) findViewById(R.id.profile_imageview_picture);
170 | imageViewPicture.setImageBitmap(result);
171 | }
172 | }
173 |
174 | }
175 |
--------------------------------------------------------------------------------
/src/com/springsource/greenhouse/events/sessions/EventSessionDetailsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.springsource.greenhouse.events.sessions;
17 |
18 | import org.springframework.social.greenhouse.api.Event;
19 | import org.springframework.social.greenhouse.api.EventSession;
20 |
21 | import android.content.Intent;
22 | import android.os.AsyncTask;
23 | import android.os.Bundle;
24 | import android.util.Log;
25 | import android.view.View;
26 | import android.widget.AdapterView;
27 | import android.widget.AdapterView.OnItemClickListener;
28 | import android.widget.ArrayAdapter;
29 | import android.widget.ListView;
30 | import android.widget.TextView;
31 |
32 | import com.springsource.greenhouse.AbstractGreenhouseActivity;
33 | import com.springsource.greenhouse.R;
34 | import com.springsource.greenhouse.twitter.PostTweetActivity;
35 |
36 | /**
37 | * @author Roy Clarkson
38 | */
39 | public class EventSessionDetailsActivity extends AbstractGreenhouseActivity {
40 |
41 | private static final String TAG = EventSessionDetailsActivity.class.getSimpleName();
42 |
43 | private Event event;
44 |
45 | private EventSession session;
46 |
47 |
48 | //***************************************
49 | // Activity methods
50 | //***************************************
51 | @Override
52 | public void onCreate(Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 | setContentView(R.layout.event_session_details);
55 |
56 | final ListView listView = (ListView) findViewById(R.id.event_session_details_menu);
57 |
58 | String[] menu_items = getResources().getStringArray(R.array.event_session_details_options_array);
59 | ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.menu_list_item, menu_items);
60 | listView.setAdapter(arrayAdapter);
61 |
62 | listView.setOnItemClickListener(new OnItemClickListener() {
63 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
64 | switch(position) {
65 | case 0:
66 | new UpdateFavoriteTask().execute();
67 | break;
68 | case 1:
69 | startActivity(new Intent(view.getContext(), EventSessionRatingActivity.class));
70 | break;
71 | case 2:
72 | startActivity(new Intent(view.getContext(), PostTweetActivity.class));
73 | break;
74 | case 3:
75 | startActivity(new Intent(view.getContext(), EventSessionTweetsActivity.class));
76 | break;
77 | default:
78 | break;
79 | }
80 | }
81 | });
82 | }
83 |
84 | @Override
85 | public void onStart() {
86 | super.onStart();
87 | event = getApplicationContext().getSelectedEvent();
88 | session = getApplicationContext().getSelectedSession();
89 | refreshEventDetails();
90 | }
91 |
92 |
93 | //***************************************
94 | // Private methods
95 | //***************************************
96 | private void refreshEventDetails() {
97 | if (session == null) {
98 | return;
99 | }
100 |
101 | TextView t = (TextView) findViewById(R.id.event_session_details_name);
102 | t.setText(session.getTitle());
103 |
104 | t = (TextView) findViewById(R.id.event_session_details_leaders);
105 | t.setText(session.getJoinedLeaders(", "));
106 |
107 | t = (TextView) findViewById(R.id.event_session_details_time_and_room);
108 | t.setText(session.getFormattedTimeSpan() + " in " + session.getRoom().getLabel());
109 |
110 | t = (TextView) findViewById(R.id.event_session_details_rating);
111 | if (session.getRating() == 0) {
112 | t.setText("No Ratings");
113 | } else {
114 | t.setText(session.getRating() + " Stars");
115 | }
116 |
117 | t = (TextView) findViewById(R.id.event_session_details_description);
118 | t.setText(session.getDescription());
119 |
120 | setFavoriteStatus(session.isFavorite());
121 | }
122 |
123 | private void setFavoriteStatus(Boolean status) {
124 | final TextView textViewSessionFavorite = (TextView) findViewById(R.id.event_session_details_favorite);
125 | String text = status ? "Favorite: \u2713" : "Not a Favorite";
126 | textViewSessionFavorite.setText(text);
127 | }
128 |
129 |
130 | //***************************************
131 | // Private classes
132 | //***************************************
133 | private class UpdateFavoriteTask extends AsyncTask {
134 |
135 | private Exception exception;
136 |
137 | @Override
138 | protected void onPreExecute() {
139 | showProgressDialog("Updating favorite ...");
140 | }
141 |
142 | @Override
143 | protected Boolean doInBackground(Void... params) {
144 | try {
145 | if (event == null || session == null) {
146 | return false;
147 | }
148 | return getApplicationContext().getGreenhouseApi().sessionOperations().updateFavoriteSession(event.getId(), session.getId());
149 | } catch(Exception e) {
150 | Log.e(TAG, e.getLocalizedMessage(), e);
151 | exception = e;
152 | }
153 |
154 | return false;
155 | }
156 |
157 | @Override
158 | protected void onPostExecute(Boolean result) {
159 | dismissProgressDialog();
160 | processException(exception);
161 | setFavoriteStatus(result);
162 | }
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | **********************************
2 | * Greenhouse for Android
3 | **********************************
4 |
5 | Introduction
6 | ------------
7 | This project requires set up of the Android SDK, command line tools, Maven, the Maven Android Plugin, and Android Maven artifacts such as Spring dependencies. This document walks step by step through that setup.
8 |
9 |
10 | Development Environment
11 | -----------------------
12 | The Android SDK is required for developing Android applications. Google provides command line tools, and an Eclipse plugin for building Android applications, however you are not restricted to only those options.
13 | The Maven Android Plugin makes use of the Android SDK command line tools to compile and deploy the app to the emulator, so there is no need for a separate IDE setup or configuration.
14 |
15 |
16 | Install the Android SDK
17 | -----------------------
18 | Download the correct version of the Android SDK for your operating system from the Android web site:
19 | https://developer.android.com/sdk/index.html
20 |
21 | Unzip the archive and place it in a location of your choosing. For example on a Mac, you may want to place it in the root of your user directory. See the download web site for additional installation details.
22 |
23 | Add Android to your Path
24 | Example: a .bash_profile on a Mac:
25 | $ export ANDROID_HOME=~/android-sdk-mac_x86
26 | $ export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
27 |
28 |
29 | Install Android SDK Platform
30 | ----------------------------
31 | The Android SDK download does not include any specific Android platform SDKs. In order to run the sample code you need to download and install an Android SDK Platform. The Greenhouse for Android client requires a minimum of Android 2.1, API Level 7. To install the SDK Platform, use the Android SDK and AVD Manager that was installed from the previous step.
32 |
33 | Open the Android SDK and AVD Manager window:
34 | $ android
35 | Note: if this command does not open the Android SDK and AVD Manager, then your path is not configured correctly.
36 | Select Available packages from the left hand column
37 | Select the checkbox for Android Repository in the main window
38 | Select the desired SDK Platform. You should install Android 2.1, API Level 7, or higher.
39 | Click the Install Selected button to complete the download and installation.
40 | Note: you may want to simply install all the available updates, but be aware it will take longer, as each SDK level is a sizable download.
41 |
42 |
43 | Configure an Android Virtual Device
44 | -----------------------------------
45 | https://developer.android.com/guide/developing/devices/index.html
46 | Open the Android SDK and AVD Manager window:
47 | $ android
48 | Select Virtual devices in the left hand column and click the New button
49 | Enter 7 in the Name field
50 | Select Android 2.1-update1, API Level 7 in the Target selector
51 | Click Create AVD to finish
52 | Note: The sample application is configured to look for an AVD with the name "7". Otherwise, you can name the AVD whatever you like. Using "7" for the name simply is a visual indicator of which API level it uses.
53 |
54 |
55 | Build and Run the Greenhouse Server app
56 | ---------------------------------------
57 | You need to clone the Greenhouse server repository so that you can run a local instance.
58 | $ git clone git://github.com/SpringSource/greenhouse.git
59 |
60 | To build, simply execute 'mvn install' and deploy the resulting .war to any Servlet 2.5 >, such as Tomcat.
61 | By default, the app will run in 'embedded' mode which does not require any external setup.
62 |
63 | You may also launch Tomcat from the command line by invoking the Tomcat 7 Maven plugin:
64 | mvn t7:run
65 |
66 | Access the deployed webapp at http://localhost:8080/greenhouse-1.0.0.BUILD-SNAPSHOT
67 |
68 | To build and run from a Maven/Java Dynamic Web-project-capable IDE, such as Eclipse/SpringSource Tool Suite, simply import the project into your IDE and deploy the project to your IDE's embedded servlet container.
69 |
70 | See the README on the Greenhouse project for more information.
71 | https://github.com/SpringSource/greenhouse
72 |
73 |
74 | Build and Run the Greenhouse for Android app
75 | --------------------------------------------
76 | $ cd greenhouse-android
77 | $ mvn clean install
78 | $ mvn android:emulator-start
79 | IMPORTANT: Ensure the emulator is fully initialized and ready or the deploy will fail.
80 | $ mvn android:deploy
81 |
82 |
83 | A Note about URLs
84 | -----------------
85 | Depending on where you deploy the server app, you may need to modify the Android client configuration to point to the correct URL. If you are running from an Android AVD (emulator) and connecting to a local Greenhouse instance, the client will access the localhost via the 10.0.2.2 proxy address. Localhost on an Android device refers to itself, and not the host computer where the emulator is running. If you deploy the Android client to an actual device, then you will need to modify the URL so the device can communicate to the server. To modify the URL, edit the 'filters/dev.properties' file in the greenhouse-android directory, and change the base.url property to reflect the location of the Greenhouse server.
86 |
87 | base.url=https://10.0.2.2:8080/greenhouse/
88 |
89 | Once the url is modified, simply repeat the steps to build and run the client app with the new settings.
90 |
91 |
92 | Emulator Performance
93 | --------------------
94 | The Android emulator often feels slow. You can try editing your AVD configuration with the following settings to improve performance:
95 | - To improve start up times, check Snapshot: Enabled
96 | - Set the 'Device ram size' property to 1024.
97 |
98 |
99 | Troubleshooting Failed Deployment
100 | ---------------------------------
101 | If 'mvn android:deploy' fails, try stopping and restarting the adb server:
102 | $ adb kill-server
103 | $ adb start-server
104 | $ mvn android:deploy
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.springsource
6 | greenhouse
7 | 1.0.0.BUILD-SNAPSHOT
8 | apk
9 | greenhouse-android
10 | https://www.springsource.org
11 | 2010
12 |
13 | SpringSource
14 | https://www.springsource.org
15 |
16 |
17 |
18 | prod
19 | 16
20 | 2.5
21 | 3.3.2
22 | 2.5.1
23 | 4.1.1.4
24 | 1.6
25 | 1.0.0.RELEASE
26 | 1.0.2.RELEASE
27 | 3.1.2.RELEASE
28 | 1.9.10
29 |
30 |
31 |
32 |
33 | spring-snapshot
34 | SpringSource Snapshot Repository
35 | https://repo.springsource.org/libs-snapshot
36 |
37 |
38 |
39 |
40 |
41 | com.google.android
42 | android
43 | ${android-version}
44 | provided
45 |
46 |
47 | org.springframework.android
48 | spring-android-auth
49 | ${spring-android-version}
50 |
51 |
52 | org.springframework.security
53 | spring-security-crypto
54 | ${spring-security-version}
55 |
56 |
57 |
58 | spring-core
59 | org.springframework
60 |
61 |
62 |
63 |
64 | org.springframework.social
65 | spring-social-core
66 | ${spring-social-version}
67 |
68 |
69 |
70 | spring-web
71 | org.springframework
72 |
73 |
74 |
75 |
76 | org.codehaus.jackson
77 | jackson-mapper-asl
78 | ${jackson-version}
79 |
80 |
81 |
82 |
83 | ${project.artifactId}
84 | src
85 |
86 | ${project.basedir}/filters/${env}.properties
87 |
88 |
89 |
90 |
91 | ${project.basedir}/res
92 | true
93 | ${project.build.directory}/filtered-res
94 |
95 | **/*.xml
96 |
97 |
98 |
99 |
100 | ${project.basedir}/res
101 | false
102 | ${project.build.directory}/filtered-res
103 |
104 | **/*.xml
105 |
106 |
107 |
108 |
109 | ${project.basedir}
110 | true
111 | ${project.build.directory}/filtered-manifest
112 |
113 | AndroidManifest.xml
114 |
115 |
116 |
117 |
118 |
119 | maven-resources-plugin
120 | ${maven-resources-plugin-version}
121 |
122 |
123 | initialize
124 |
125 | resources
126 |
127 |
128 |
129 |
130 |
131 | com.jayway.maven.plugins.android.generation2
132 | android-maven-plugin
133 | ${android-maven-plugin-version}
134 |
135 | ${project.build.directory}/filtered-manifest/AndroidManifest.xml
136 | ${project.basedir}/assets
137 | ${project.build.directory}/filtered-res
138 |
139 | ${android-platform}
140 |
141 | true
142 | true
143 |
144 | true
145 |
146 |
147 | maven-compiler-plugin
148 | ${maven-compiler-plugin-version}
149 |
150 | ${java-version}
151 | ${java-version}
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 | dev
160 |
161 | dev
162 |
163 |
164 |
165 | prod
166 |
167 | prod
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------