-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from CSGHackathon/android
Finished the app
- Loading branch information
Showing
39 changed files
with
1,047 additions
and
56 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
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
32 changes: 32 additions & 0 deletions
32
.../AndroidClient/app/src/main/java/com/swagoverflow/androidclient/ViewFavoriteActivity.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,32 @@ | ||
package com.swagoverflow.androidclient; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.app.Activity; | ||
import android.widget.Switch; | ||
|
||
public class ViewFavoriteActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_view_favorite); | ||
|
||
handleIntent(getIntent()); | ||
} | ||
|
||
private void handleIntent(Intent intent) { | ||
boolean isTeam = intent.getBooleanExtra(Constants.IS_TEAM, false); | ||
boolean notifications = intent.getBooleanExtra(Constants.NOTIFICATIONS, true); | ||
|
||
Switch notificationsEnabled = (Switch) findViewById(R.id.notificationEnabled); | ||
notificationsEnabled.setChecked(notifications); | ||
|
||
if (isTeam) { | ||
// TODO get team info | ||
} else { | ||
// TODO get show info | ||
} | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
.../AndroidClient/app/src/main/java/com/swagoverflow/androidclient/WatchContentActivity.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,27 @@ | ||
package com.swagoverflow.androidclient; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.app.Activity; | ||
import android.widget.MediaController; | ||
import android.widget.VideoView; | ||
|
||
public class WatchContentActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_watch_content); | ||
|
||
Intent intent = getIntent(); | ||
String uri = intent.getStringExtra(Constants.URI); | ||
|
||
VideoView videoView = (VideoView) findViewById(R.id.videoView); | ||
videoView.setMediaController(new MediaController(this)); | ||
videoView.setVideoURI(Uri.parse(uri)); | ||
videoView.requestFocus(); | ||
videoView.start(); | ||
} | ||
|
||
} |
147 changes: 147 additions & 0 deletions
147
...oidClient/app/src/main/java/com/swagoverflow/androidclient/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,147 @@ | ||
package com.swagoverflow.androidclient.adapters; | ||
|
||
import android.app.Activity; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.ImageView; | ||
import android.widget.SectionIndexer; | ||
import android.widget.TextView; | ||
|
||
import com.squareup.picasso.Picasso; | ||
import com.swagoverflow.androidclient.R; | ||
import com.swagoverflow.androidclient.models.Episode; | ||
import com.swagoverflow.androidclient.models.Game; | ||
import com.swagoverflow.androidclient.utilities.Utility; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.List; | ||
|
||
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter; | ||
|
||
/** | ||
* Created by Mike on 2/27/2016. | ||
*/ | ||
public class EventListAdapter extends BaseAdapter implements StickyListHeadersAdapter, SectionIndexer { | ||
|
||
private Activity context; | ||
private List<Game> games; | ||
private List<Episode> episodes; | ||
private String[] mSections = new String[] { "Games", "Episodes" }; | ||
|
||
public EventListAdapter(Activity context, List<Game> games, List<Episode> episodes) { | ||
this.context = context; | ||
this.games = games; | ||
this.episodes = episodes; | ||
} | ||
|
||
@Override | ||
public View getHeaderView(int position, View convertView, ViewGroup parent) { | ||
HeaderViewHolder holder; | ||
|
||
if (convertView == null) { | ||
holder = new HeaderViewHolder(); | ||
convertView = LayoutInflater.from(context).inflate(R.layout.header, parent, false); | ||
holder.textView = (TextView) convertView.findViewById(R.id.title); | ||
convertView.setTag(holder); | ||
} else { | ||
holder = (HeaderViewHolder) convertView.getTag(); | ||
} | ||
|
||
if (position < games.size()) { | ||
holder.textView.setText(mSections[0]); | ||
} else { | ||
holder.textView.setText(mSections[1]); | ||
} | ||
|
||
return convertView; | ||
} | ||
|
||
@Override | ||
public long getHeaderId(int position) { | ||
if (position < games.size()) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return games.size() + episodes.size() + 1; | ||
} | ||
|
||
@Override | ||
public Object getItem(int i) { | ||
if (i < games.size()) { | ||
return games.get(i); | ||
} else if (i < episodes.size() + games.size()) { | ||
return episodes.get(i - games.size()); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Override | ||
public long getItemId(int i) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View v, ViewGroup parent) { | ||
View view = LayoutInflater.from(context).inflate(R.layout.layout_event, parent, false); | ||
|
||
ImageView thumbnail = (ImageView) view.findViewById(R.id.thumbnail); | ||
TextView name = (TextView) view.findViewById(R.id.name); | ||
TextView date = (TextView) view.findViewById(R.id.date); | ||
TextView channel = (TextView) view.findViewById(R.id.channel); | ||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d 'at' h:mm a"); | ||
|
||
if (position < games.size()) { | ||
Game game = games.get(position); | ||
Picasso.with(context).load(game.getThumbnailUrl()).into(thumbnail); | ||
name.setText(game.getDescription()); | ||
date.setText(sdf.format(game.getDate())); | ||
channel.setText(game.getChannel()); | ||
} else if (position < games.size() + episodes.size()) { | ||
Episode episode = episodes.get(position - games.size()); | ||
Picasso.with(context).load(episode.getThumbnailUrl()).into(thumbnail); | ||
name.setText(episode.getShow().getName()); | ||
date.setText(sdf.format(episode.getDate())); | ||
channel.setText(episode.getChannel()); | ||
} else { | ||
view.setMinimumHeight(Utility.convertDpToPx(context.getWindowManager().getDefaultDisplay(), 10)); | ||
} | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public Object[] getSections() { | ||
return mSections; | ||
} | ||
|
||
@Override | ||
public int getPositionForSection(int i) { | ||
if (games.size() == 0 && episodes.size() == 0) { | ||
return 0; | ||
} | ||
|
||
if (i <= 0) { | ||
return 0; | ||
} else { | ||
return games.size(); | ||
} | ||
} | ||
|
||
@Override | ||
public int getSectionForPosition(int i) { | ||
return 0; | ||
} | ||
|
||
class HeaderViewHolder { | ||
TextView textView; | ||
} | ||
} |
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
Oops, something went wrong.