-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b1664e
commit e6c89e8
Showing
11 changed files
with
294 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/com/sms/partyview/activities/EventDetailActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.sms.partyview.activities; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.widget.TextView; | ||
|
||
import com.sms.partyview.R; | ||
import com.sms.partyview.models.Event; | ||
|
||
public class EventDetailActivity extends Activity { | ||
Event mEvent; | ||
TextView tvEventName; | ||
TextView tvEventOrganizer; | ||
TextView tvEventDescription; | ||
TextView tvEventTime; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_event_detail); | ||
mEvent = (Event) getIntent().getSerializableExtra("event"); | ||
setupViews(); | ||
populateEventInfo(); | ||
} | ||
|
||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.event_detail, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
public void setupViews() { | ||
tvEventName = (TextView) findViewById(R.id.tvEventNameTitle); | ||
tvEventOrganizer = (TextView) findViewById(R.id.tvEventOrganizerTitle); | ||
tvEventDescription = (TextView) findViewById(R.id.tvEventDescTitle); | ||
tvEventTime = (TextView) findViewById(R.id.tvEventTimeTitle); | ||
} | ||
|
||
public void populateEventInfo() { | ||
tvEventName.setText(tvEventName.getText() + ": " + mEvent.getTitle()); | ||
tvEventOrganizer.setText(tvEventOrganizer.getText() + ": " + mEvent.getHost().getUserName()); | ||
tvEventDescription.setText(tvEventDescription.getText() + ": " + mEvent.getDescription()); | ||
tvEventTime.setText(tvEventTime.getText() + ": " + mEvent.getTime()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
app/src/main/java/com/sms/partyview/activities/HomeActivity.java.orig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package com.sms.partyview.activities; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentActivity; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.app.FragmentTransaction; | ||
import android.support.v4.view.ViewPager; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.widget.AdapterView; | ||
import android.widget.TextView; | ||
|
||
import com.astuetz.PagerSlidingTabStrip; | ||
import com.sms.partyview.R; | ||
import com.sms.partyview.adapters.MyPagerAdapter; | ||
import com.sms.partyview.fragments.AcceptedEventsFragment; | ||
import com.sms.partyview.fragments.EventListFragment; | ||
import com.sms.partyview.fragments.PendingEventsFragment; | ||
import com.sms.partyview.models.Event; | ||
import com.sms.partyview.models.User; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class HomeActivity | ||
extends FragmentActivity | ||
implements EventListFragment.DummyEventProvider { | ||
|
||
private FragmentPagerAdapter mAdapterViewPager; | ||
private PagerSlidingTabStrip mTabs; | ||
|
||
User currentUser; | ||
|
||
// Keys for passing in data in an intent. | ||
public static final String INTENT_USER_NAME = "user_name"; | ||
public static final String INTENT_EMAIL = "email"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_home); | ||
|
||
setupViews(); | ||
|
||
setupTabs(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.home, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
@Override | ||
public ArrayList<Event> getEvents() { | ||
Event e1 = new Event(); | ||
e1.setTitle("Independence Day BBQ"); | ||
e1.setHost(currentUser); | ||
e1.setTime("4 July 2014, 4pm"); | ||
Event e2 = new Event(); | ||
e2.setTitle("End of CodePath Android Bootcamp"); | ||
e2.setHost(currentUser); | ||
e2.setTime("24 July 2014, 7pm"); | ||
|
||
// Add the events to the event list. | ||
ArrayList<Event> events = new ArrayList<Event>(); | ||
events.add(e1); | ||
events.add(e2); | ||
|
||
return events; | ||
} | ||
|
||
private void setupViews() { | ||
retrieveUserInfo(); | ||
} | ||
|
||
private void retrieveUserInfo() { | ||
// Store user information. | ||
currentUser = new User(); | ||
// Default user info fields. | ||
currentUser.setEmail("foo@example.com"); | ||
currentUser.setUserName("AnonymousUser"); | ||
// Display the username and email. | ||
String userName = getIntent().getStringExtra(INTENT_USER_NAME); | ||
if (userName != null) { | ||
currentUser.setUserName(userName); | ||
} | ||
String email = getIntent().getStringExtra(INTENT_EMAIL); | ||
if (email != null) { | ||
currentUser.setEmail(email); | ||
} | ||
} | ||
|
||
private void setupTabs() { | ||
// Initialize the ViewPager and set an adapter | ||
ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager); | ||
mAdapterViewPager = new MyPagerAdapter(getSupportFragmentManager(), getFragments()); | ||
vpPager.setAdapter(mAdapterViewPager); | ||
|
||
mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); | ||
mTabs.setViewPager(vpPager); | ||
} | ||
|
||
private List<Fragment> getFragments() { | ||
List<Fragment> fragments = new ArrayList<Fragment>(); | ||
|
||
fragments.add(AcceptedEventsFragment.newInstance()); | ||
fragments.add(PendingEventsFragment.newInstance()); | ||
|
||
return fragments; | ||
} | ||
|
||
public void onEventClick(Event event) { | ||
Intent i = new Intent(this, EventDetailActivity.class); | ||
i.putExtra("event", event); | ||
startActivity(i); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
tools:context="com.sms.partyview.activities.EventDetailActivity"> | ||
|
||
<LinearLayout | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:id="@+id/linearLayout"> | ||
<TextView | ||
android:id="@+id/tvEventDetailsTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:text="@string/event_details_title" | ||
android:padding="2dp"/> | ||
<TextView | ||
android:id="@+id/tvEventNameTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/event_name_title" | ||
android:padding="2dp"/> | ||
<TextView | ||
android:id="@+id/tvEventTimeTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/event_time_title" | ||
android:padding="2dp"/> | ||
<TextView | ||
android:id="@+id/tvEventOrganizerTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/event_organizer_title" | ||
android:padding="2dp"/> | ||
<TextView | ||
android:id="@+id/tvEventDescTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/event_desc_title" | ||
android:padding="2dp"/> | ||
</LinearLayout> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:context="com.sms.partyview.activities.EventDetailActivity" > | ||
<item android:id="@+id/action_settings" | ||
android:title="@string/action_settings" | ||
android:orderInCategory="100" | ||
android:showAsAction="never" /> | ||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters