-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Eddie Ringle <eddie@eringle.net>
- Loading branch information
1 parent
3a3090c
commit 35cfa02
Showing
6 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
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
74 changes: 74 additions & 0 deletions
74
src/net/idlesoft/android/apps/github/ui/activities/app/EventsActivity.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,74 @@ | ||
/* | ||
* Copyright (c) 2012 Eddie Ringle | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted | ||
* provided that the following conditions are met: | ||
* | ||
* Redistributions of source code must retain the above copyright notice, this list of conditions | ||
* and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
* and the following disclaimer in the documentation and/or other materials provided with the | ||
* distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY | ||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package net.idlesoft.android.apps.github.ui.activities.app; | ||
|
||
import com.actionbarsherlock.view.MenuItem; | ||
|
||
import net.idlesoft.android.apps.github.R; | ||
import net.idlesoft.android.apps.github.ui.activities.BaseDashboardActivity; | ||
import net.idlesoft.android.apps.github.ui.fragments.app.EventListFragment; | ||
import net.idlesoft.android.apps.github.ui.fragments.app.RepositoryListFragment; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
|
||
import static net.idlesoft.android.apps.github.HubroidConstants.ARG_TARGET_USER; | ||
|
||
public class EventsActivity extends BaseDashboardActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle icicle, int layout) { | ||
super.onCreate(icicle, R.layout.main); | ||
|
||
final FragmentManager fm = getSupportFragmentManager(); | ||
Fragment fragment = fm.findFragmentByTag(EventListFragment.class.getName()); | ||
|
||
if (fragment == null) { | ||
fragment = new EventListFragment(); | ||
fragment.setArguments(getIntent().getExtras()); | ||
|
||
getSupportFragmentManager() | ||
.beginTransaction() | ||
.replace(R.id.container_main, fragment, EventListFragment.class.getName()) | ||
.commit(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
if (item.getItemId() == android.R.id.home && !isFromDashboard()) { | ||
final String userJson = getIntent().getStringExtra(ARG_TARGET_USER); | ||
if (userJson != null) { | ||
final Intent toUser = new Intent(this, ProfileActivity.class); | ||
toUser.putExtra(ARG_TARGET_USER, userJson); | ||
startActivity(toUser); | ||
finish(); | ||
return true; | ||
} | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
src/net/idlesoft/android/apps/github/ui/adapters/EventListAdapter.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,81 @@ | ||
/* | ||
* Copyright (c) 2012 Eddie Ringle | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are permitted | ||
* provided that the following conditions are met: | ||
* | ||
* Redistributions of source code must retain the above copyright notice, this list of conditions | ||
* and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions | ||
* and the following disclaimer in the documentation and/or other materials provided with the | ||
* distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY | ||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package net.idlesoft.android.apps.github.ui.adapters; | ||
|
||
import com.androidquery.AQuery; | ||
|
||
import net.idlesoft.android.apps.github.R; | ||
import net.idlesoft.android.apps.github.ui.activities.BaseActivity; | ||
|
||
import org.eclipse.egit.github.core.Repository; | ||
import org.eclipse.egit.github.core.event.Event; | ||
|
||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
public class EventListAdapter extends BaseListAdapter<Event> { | ||
|
||
public static class ViewHolder { | ||
|
||
TextView title; | ||
|
||
ImageView gravatar; | ||
|
||
TextView extra; | ||
} | ||
|
||
public EventListAdapter(BaseActivity context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
ViewHolder holder; | ||
if (convertView == null) { | ||
convertView = mInflater.inflate(R.layout.event_list_item, null); | ||
holder = new ViewHolder(); | ||
|
||
holder.title = (TextView) convertView.findViewById(R.id.tv_event_title); | ||
holder.gravatar = (ImageView) convertView.findViewById(R.id.iv_event_gravatar); | ||
holder.extra = (TextView) convertView.findViewById(R.id.tv_event_extra); | ||
|
||
convertView.setTag(holder); | ||
} else { | ||
holder = (ViewHolder) convertView.getTag(); | ||
} | ||
|
||
final Event e = getItem(position); | ||
|
||
holder.title.setText(e.getActor().getLogin() + " did a(n) " + e.getType()); | ||
holder.extra.setText(e.getCreatedAt().toString()); | ||
|
||
final AQuery aq = new AQuery(getContext()); | ||
|
||
aq.id(holder.gravatar).image(e.getActor().getAvatarUrl(), true, true, 140, R.drawable.gravatar, null, AQuery.FADE_IN_NETWORK); | ||
|
||
return convertView; | ||
} | ||
} |
Oops, something went wrong.