Skip to content

Commit

Permalink
Added basic main fragment ui
Browse files Browse the repository at this point in the history
  • Loading branch information
nessup committed Oct 27, 2013
1 parent fa28b02 commit 0bbdbd5
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,65 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.joumaa.workouthome.temporary.Video;

/**
* Created by dany on 10/27/13.
*/
public class MainFragment extends Fragment {
private ListView listView;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.main_fragment, container, false);
View view = inflater.inflate(R.layout.main_fragment, container, false);

listView = (ListView) view.findViewById(R.id.listView);

View headerView = inflater.inflate(R.layout.list_view_header, listView, false);
listView.addHeaderView(headerView, null, false);

VideoListAdapter videoListAdapter = new VideoListAdapter(inflater);
listView.setAdapter(videoListAdapter);

return view;
}

private class VideoListAdapter extends BaseAdapter {
LayoutInflater inflater;

private VideoListAdapter(LayoutInflater inflater) {
this.inflater = inflater;
}

@Override
public int getCount() {
return 5;
}

@Override
public Video getItem(int i) {
return Video.buildTestVideo();
}

@Override
public long getItemId(int i) {
return 0;
}

@Override
public View getView(int i, View view, ViewGroup parentViewGroup) {
if (view == null) {
view = inflater.inflate(R.layout.video_row, parentViewGroup, false);
}

TextView titleView = (TextView) view.findViewById(R.id.title);
titleView.setText(getItem(i).getTitle());

return view;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.joumaa.workouthome.temporary;

/**
* Created by dany on 10/27/13.
*/
public class Video {
private String title;

public static Video buildTestVideo() {
Video video = new Video();
video.title = "The Most Awesome Ab Workout Ever";
return video;
}

public String getTitle() {
return title;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions Workoutathome/src/main/res/layout/list_view_header.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="20dp"
android:paddingBottom="20dp"
>

<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#808080"
android:layout_gravity="center_vertical"
android:text="Featured Workouts"
android:textSize="24sp"
/>

</FrameLayout>
2 changes: 1 addition & 1 deletion Workoutathome/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_toRightOf="@id/navigationContainer"
android:background="#e4e4e4"
android:background="@color/fragment_background"
tools:ignore="MergeRootFrame"
/>

Expand Down
7 changes: 7 additions & 0 deletions Workoutathome/src/main/res/layout/main_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
android:layout_height="match_parent"
tools:context=".MainFragment">

<ListView
android:id="@+id/listView"
android:layout_height="match_parent"
android:layout_width="600dp"
android:layout_centerHorizontal="true"
/>

</RelativeLayout>
55 changes: 55 additions & 0 deletions Workoutathome/src/main/res/layout/video_row.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:background="@color/fragment_background"
>

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@drawable/card_background"
android:orientation="vertical"
>

<ImageView
android:id="@+id/imageView"
android:layout_height="200dp"
android:layout_width="match_parent"
android:src="@drawable/test_image"
android:scaleType="centerCrop"
/>

<RelativeLayout
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_margin="10dp"
>

<TextView
android:id="@+id/title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="This is a test"
android:layout_centerVertical="true"
/>

<ImageView
android:id="@+id/playButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/play_icon"
/>

</RelativeLayout>

</LinearLayout>



</FrameLayout>
4 changes: 4 additions & 0 deletions Workoutathome/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="fragment_background">#e4e4e4</color>
</resources>
2 changes: 1 addition & 1 deletion Workoutathome/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.Base">
<item name="android:background">@android:color/white</item>

</style>

</resources>

0 comments on commit 0bbdbd5

Please sign in to comment.