Skip to content

Commit

Permalink
Merge pull request #43 from gdg-x/pulse
Browse files Browse the repository at this point in the history
Pulse
  • Loading branch information
mauimauer committed Aug 21, 2013
2 parents 560a89f + 430b6d3 commit 7cf54ab
Show file tree
Hide file tree
Showing 16 changed files with 1,548 additions and 779 deletions.
2 changes: 2 additions & 0 deletions app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.PulseActivity">
</activity>
<receiver android:name=".widget.UpcomingEventWidgetProvider" android:label="@string/upcoming_widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand Down
Binary file added app/res/drawable-xxhdpi/drw_ic_pulse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/res/drawable-xxhdpi/ic_logo_pulse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions app/res/layout/activity_pulse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/titles"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<android.support.v4.view.ViewPager android:id="@+id/pager"
android:layout_height="wrap_content"
android:layout_width="fill_parent"></android.support.v4.view.ViewPager>
</LinearLayout>
42 changes: 42 additions & 0 deletions app/res/layout/fragment_pulse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright 2013 The GDG Frisbee Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/list"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/loading" android:gravity="center_vertical|center_horizontal">
<org.gdg.frisbee.android.view.AnimationImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView" android:src="@drawable/gdg_load"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/empty" android:gravity="center_vertical|center_horizontal">
</LinearLayout>
</LinearLayout>
23 changes: 23 additions & 0 deletions app/res/layout/list_pulse_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:padding="8dip">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1."
android:id="@+id/position" android:layout_gravity="center_horizontal|top" android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GDG Sampletown"
android:id="@+id/key" android:layout_gravity="center_horizontal|top" android:layout_marginLeft="5dip"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="(00)"
android:id="@+id/value" android:layout_gravity="center_horizontal|top" android:gravity="right"/>
</LinearLayout>
5 changes: 5 additions & 0 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@
<string name="about_license">(c) 2013 The GDG Frisbee Project\nAll Rights reserved.\n\nLicensed under the terms\nof the Apache 2.0 License</string>
<string name="past_event">PAST</string>
<string name="upcoming_widget">GDG - Upcoming Event</string>
<string name="global">Global</string>
<string name="pulse">GDG Pulse</string>
<string name="pulse_events">Events</string>
<string name="pulse_attendees">Attendees</string>
<string name="pulse_circlers">Chapter Circlers</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ public void onPageScrollStateChanged(int i) {
}
});



mDrawerAdapter = new DrawerAdapter(this);
mDrawerContent.setAdapter(mDrawerAdapter);
mDrawerContent.setOnItemClickListener(new AdapterView.OnItemClickListener() {
Expand All @@ -161,6 +159,9 @@ public void onGotGamesClient(GamesClient c) {
case R.string.gdl:
startActivity(new Intent(MainActivity.this, GdlActivity.class));
break;
case R.string.pulse:
startActivity(new Intent(MainActivity.this, PulseActivity.class));
break;
case R.string.settings:
startActivity(new Intent(MainActivity.this, SettingsActivity.class));
break;
Expand Down Expand Up @@ -204,12 +205,8 @@ public void onResponse(final Directory directory) {
@Override
public void onPutIntoCache() {
ArrayList<Chapter> chapters = directory.getGroups();
addChapters(chapters);

mViewPagerAdapter.setSelectedChapter(chapters.get(0));

mViewPager.setAdapter(mViewPagerAdapter);
mIndicator.setViewPager(mViewPager);
initChapters(chapters);
}
});
}
Expand All @@ -228,11 +225,7 @@ public void onErrorResponse(VolleyError volleyError) {
@Override
public void onGet(Object item) {
Directory directory = (Directory)item;

addChapters(directory.getGroups());
mViewPagerAdapter.setSelectedChapter(directory.getGroups().get(0));
mViewPager.setAdapter(mViewPagerAdapter);
mIndicator.setViewPager(mViewPager);
initChapters(directory.getGroups());
}

@Override
Expand All @@ -246,10 +239,7 @@ public void onNotFound(String key) {
@Override
public void onGet(Object item) {
Directory directory = (Directory)item;
addChapters(directory.getGroups());
mViewPagerAdapter.setSelectedChapter(directory.getGroups().get(0));
mViewPager.setAdapter(mViewPagerAdapter);
mIndicator.setViewPager(mViewPager);
initChapters(directory.getGroups());
}

@Override
Expand Down Expand Up @@ -294,6 +284,29 @@ public void onNotFound(String key) {
}
}

private void initChapters(ArrayList<Chapter> chapters) {
addChapters(chapters);
Chapter chapter = null;

if(getIntent().hasExtra("org.gdg.frisbee.CHAPTER")) {
String chapterId = getIntent().getStringExtra("org.gdg.frisbee.CHAPTER");
for(Chapter c : chapters) {
if(c.getGplusId().equals(chapterId)) {
chapter = c;
break;
}
}
if(chapter == null)
chapter = chapters.get(0);
} else {
chapter = chapters.get(0);
}

getSupportActionBar().setSelectedNavigationItem(mSpinnerAdapter.getPosition(chapter));
mViewPager.setAdapter(mViewPagerAdapter);
mIndicator.setViewPager(mViewPager);
}

private void trackViewPagerPage(int position) {
if(mViewPager == null || mViewPagerAdapter.getSelectedChapter() == null)
return;
Expand Down Expand Up @@ -446,7 +459,7 @@ protected void onSaveInstanceState(Bundle outState) {
public boolean onNavigationItemSelected(int position, long l) {
Chapter previous = mViewPagerAdapter.getSelectedChapter();
mViewPagerAdapter.setSelectedChapter(mSpinnerAdapter.getItem(position));
if(!previous.equals(mSpinnerAdapter.getItem(position))) {
if(previous == null || !previous.equals(mSpinnerAdapter.getItem(position))) {
Log.d(LOG_TAG, "Switching chapter!");
mViewPagerAdapter.notifyDataSetChanged();
}
Expand Down

0 comments on commit 7cf54ab

Please sign in to comment.