Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'

compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.google.code.gson:gson:1.7.2'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.loopj.android:android-async-http:1.4.8'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.aparna.wireframes;
package com.example.aparna.fit360;

import android.app.Application;
import android.test.ApplicationTestCase;
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aparna.wireframes">
package="com.example.aparna.fit360">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand All @@ -9,7 +11,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".HomeActivity"
android:name=".activities.HomeActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
Expand All @@ -19,18 +21,18 @@
</intent-filter>
</activity>
<activity
android:name=".activities.ProfileActivity"
android:name="com.example.aparna.fit360.activities.ProfileActivity"
android:label="@string/title_activity_profile"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activities.ChatActivity"
android:name="com.example.aparna.fit360.activities.ChatActivity"
android:label="@string/title_activity_chat"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activities.CommunityActivity"
android:name="com.example.aparna.fit360.activities.CommunityActivity"
android:label="@string/title_activity_community"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".activities.MapActivity"></activity>
<activity android:name="com.example.aparna.fit360.activities.MapActivity"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.aparna.fit360.Fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.aparna.fit360.R;

import butterknife.ButterKnife;

public class ProfileHeaderFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
// Defines the xml file for the fragment
return inflater.inflate(R.layout.fragment_profile_header, parent, false);
}

// This event is triggered soon after onCreateView().
// Any view setup should occur here. E.g., view lookups and attaching view listeners.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// Setup any handles to view objects here
// EditText etFoo = (EditText) view.findViewById(R.id.etFoo);
ButterKnife.bind(this, view);
}

}
118 changes: 118 additions & 0 deletions app/src/main/java/com/example/aparna/fit360/Fragments/Tracking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package com.example.aparna.fit360.Fragments;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.example.aparna.fit360.R;

import java.io.File;

import butterknife.Bind;
import butterknife.ButterKnife;


public class Tracking extends Fragment {
@Bind(R.id.etWeight) EditText etWeight;
@Bind(R.id.etWater) EditText etWater;

@Bind(R.id.ivCameraPicture)
ImageView ivCameraPicture;
@Bind(R.id.btnTakePicture)
Button btnTakePicture;

public final String APP_TAG = "MyCustomApp";
public final static int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 1034;
public String photoFileName = "photo.jpg";
// The onCreateView method is called when Fragment should create its View object hierarchy,
// either dynamically or via XML layout inflation.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
// Defines the xml file for the fragment
return inflater.inflate(R.layout.fragment_tracking, parent, false);
}

// This event is triggered soon after onCreateView().
// Any view setup should occur here. E.g., view lookups and attaching view listeners.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// Setup any handles to view objects here
// EditText etFoo = (EditText) view.findViewById(R.id.etFoo);
ButterKnife.bind(this, view);

btnTakePicture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLaunchCamera();
}
});

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
Uri takenPhotoUri = getPhotoFileUri(photoFileName);
// by this point we have the camera photo on disk
Bitmap takenImage = BitmapFactory.decodeFile(takenPhotoUri.getPath());
// Load the taken image into a preview
ivCameraPicture.setImageBitmap(takenImage);
} else { // Result was a failure
// Toast.makeText(this, "Picture wasn't taken!", Toast.LENGTH_SHORT).show();
Log.d("DEBUG", "Picture wasn't taken!");
}
}
}
public void onLaunchCamera() {
// create Intent to take a picture and return control to the calling application
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, getPhotoFileUri(photoFileName)); // set the image file name

// If you call startActivityForResult() using an intent that no app can handle, your app will crash.
// So as long as the result is not null, it's safe to use the intent.
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
// Start the image capture intent to take photo
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
}
// Returns the Uri for a photo stored on disk given the fileName
public Uri getPhotoFileUri(String fileName) {
// Only continue if the SD Card is mounted
if (isExternalStorageAvailable()) {
// Get safe storage directory for photos
// Use `getExternalFilesDir` on Context to access package-specific directories.
// This way, we don't need to request external read/write runtime permissions.
File mediaStorageDir = new File(
getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES), APP_TAG);

// Create the storage directory if it does not exist
if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()){
Log.d(APP_TAG, "failed to create directory");
}

// Return the file target for the photo based on filename
return Uri.fromFile(new File(mediaStorageDir.getPath() + File.separator + fileName));
}
return null;
}

// Returns true if external storage for photos is available
private boolean isExternalStorageAvailable() {
String state = Environment.getExternalStorageState();
return state.equals(Environment.MEDIA_MOUNTED);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.example.aparna.wireframes.activities;
package com.example.aparna.fit360.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

import com.example.aparna.wireframes.R;
import com.example.aparna.fit360.R;

public class ChatActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.example.aparna.wireframes.activities;
package com.example.aparna.fit360.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

import com.example.aparna.wireframes.R;
import com.example.aparna.fit360.R;

public class CommunityActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.aparna.wireframes;
package com.example.aparna.fit360.activities;

import android.content.Intent;
import android.os.Bundle;
Expand All @@ -7,13 +7,9 @@
import android.view.Menu;
import android.view.MenuItem;

import com.example.aparna.wireframes.activities.ChatActivity;
import com.example.aparna.wireframes.activities.CommunityActivity;
import com.example.aparna.wireframes.activities.MapActivity;
import com.example.aparna.wireframes.activities.ProfileActivity;
import com.example.aparna.fit360.R;

public class HomeActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.example.aparna.wireframes.activities;
package com.example.aparna.fit360.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.example.aparna.wireframes.R;
import com.example.aparna.fit360.R;

public class MapActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package com.example.aparna.wireframes.activities;
package com.example.aparna.fit360.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

import com.example.aparna.wireframes.R;
import com.example.aparna.fit360.R;

public class ProfileActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}

}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.aparna.wireframes.activities.ChatActivity">
tools:context="com.example.aparna.fit360.activities.ChatActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_community.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.aparna.wireframes.activities.CommunityActivity">
tools:context="com.example.aparna.fit360.activities.CommunityActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.aparna.wireframes.HomeActivity">
tools:context=".activities.HomeActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.aparna.wireframes.activities.MapActivity">
tools:context="com.example.aparna.fit360.activities.MapActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.aparna.wireframes.activities.ProfileActivity">
tools:context="com.example.aparna.fit360.activities.ProfileActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.aparna.wireframes.activities.ChatActivity"
tools:context="com.example.aparna.fit360.activities.ChatActivity"
tools:showIn="@layout/activity_chat">
<ImageView
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_community.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.aparna.wireframes.activities.CommunityActivity"
tools:context="com.example.aparna.fit360.activities.CommunityActivity"
tools:showIn="@layout/activity_community">
<ImageView
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.aparna.wireframes.HomeActivity"
tools:context="com.example.aparna.fit360.activities.HomeActivity"
tools:showIn="@layout/activity_home">

<ImageView
Expand Down
18 changes: 12 additions & 6 deletions app/src/main/res/layout/content_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.aparna.wireframes.activities.ProfileActivity"
tools:context="com.example.aparna.fit360.activities.ProfileActivity"
tools:showIn="@layout/activity_profile">

<ImageView
<fragment
android:name="com.example.aparna.fit360.Fragments.ProfileHeaderFragment"
android:id="@+id/fragProfileHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<fragment
android:name="com.example.aparna.fit360.Fragments.Tracking"
android:id="@+id/fragTracking"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ivProfileActivity"
android:layout_alignParentTop="true"
android:src="@drawable/profile_activity"
android:layout_alignParentStart="true" />
android:layout_below="@id/fragProfileHeader"
/>
</RelativeLayout>
Loading