diff --git a/app/build.gradle b/app/build.gradle index de5568d23fa6e1c3876752fa38d93e2a29181822..1c45e7ed4898d16fa4e7d43fdfc7be5cdec2db45 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 26 defaultConfig { applicationId "com.example.leo.fitnessdiy" - minSdkVersion 15 + minSdkVersion 16 targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -29,10 +29,16 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' compile 'com.squareup.okhttp3:okhttp:3.8.1' compile 'com.android.support:cardview-v7:26.1.0' + compile 'com.android.support:design:26.1.0' compile 'com.android.support:recyclerview-v7:26.1.0' compile 'com.github.bumptech.glide:glide:4.2.0' compile 'com.google.android.gms:play-services:11.8.0' compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1' compile 'com.google.code.gson:gson:2.8.1' compile 'com.mcxiaoke.volley:library:1.0.19' + + compile 'com.android.support:design:26.1.0' + compile 'com.firebaseui:firebase-ui:0.6.0' } + +apply plugin: 'com.google.gms.google-services' diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000000000000000000000000000000000000..b82dd4404638156cd5daec4df7d9dde44ddf37f2 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,143 @@ +{ + "project_info": { + "project_number": "145946844862", + "firebase_url": "https://chatroom-ca444.firebaseio.com", + "project_id": "chatroom-ca444", + "storage_bucket": "chatroom-ca444.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:145946844862:android:d6ce396209c6cfd3", + "android_client_info": { + "package_name": "com.example.heil.chatroom" + } + }, + "oauth_client": [ + { + "client_id": "145946844862-k70e5blk1gvu645eb455umqnnfb9kp0o.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.example.heil.chatroom", + "certificate_hash": "115e06ed0d4d6219898c05cef50eb935401113dc" + } + }, + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBlESSrC8NqbRvIHRn4DSCfps5TctNLGjE" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:145946844862:android:5626d847803be314", + "android_client_info": { + "package_name": "com.example.heil.bismillah" + } + }, + "oauth_client": [ + { + "client_id": "145946844862-n22r33mdmtvpi5230r9druv5qvn425g4.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.example.heil.bismillah", + "certificate_hash": "115e06ed0d4d6219898c05cef50eb935401113dc" + } + }, + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBlESSrC8NqbRvIHRn4DSCfps5TctNLGjE" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:145946844862:android:35ec7a00c3481d94", + "android_client_info": { + "package_name": "com.example.leo.fitnessdiy" + } + }, + "oauth_client": [ + { + "client_id": "145946844862-oshjav6a4mq4760hnt0m1940gkhdnrri.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.example.leo.fitnessdiy", + "certificate_hash": "115e06ed0d4d6219898c05cef50eb935401113dc" + } + }, + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBlESSrC8NqbRvIHRn4DSCfps5TctNLGjE" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "145946844862-jbf75ke4cnv8t0a7dgriq7tr2dos6n60.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/src/main/java/com/example/leo/fitnessdiy/BlankFragment.java b/app/src/main/java/com/example/leo/fitnessdiy/BlankFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..5a047ea49daa72384157ec82c36e18ac296f9b8e --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/BlankFragment.java @@ -0,0 +1,108 @@ +package com.example.leo.fitnessdiy; + +import android.content.Context; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + +/** + * A simple {@link Fragment} subclass. + * Activities that contain this fragment must implement the + * {@link BlankFragment.OnFragmentInteractionListener} interface + * to handle interaction events. + * Use the {@link BlankFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class BlankFragment extends Fragment { + // TODO: Rename parameter arguments, choose names that match + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER + private static final String ARG_PARAM1 = "param1"; + private static final String ARG_PARAM2 = "param2"; + + // TODO: Rename and change types of parameters + private String mParam1; + private String mParam2; + + private OnFragmentInteractionListener mListener; + + public BlankFragment() { + // Required empty public constructor + } + + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment BlankFragment. + */ + // TODO: Rename and change types and number of parameters + public static BlankFragment newInstance(String param1, String param2) { + BlankFragment fragment = new BlankFragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mParam1 = getArguments().getString(ARG_PARAM1); + mParam2 = getArguments().getString(ARG_PARAM2); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_blank, container, false); + } + + // TODO: Rename method, update argument and hook method into UI event + public void onButtonPressed(Uri uri) { + if (mListener != null) { + mListener.onFragmentInteraction(uri); + } + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof OnFragmentInteractionListener) { + mListener = (OnFragmentInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnFragmentInteractionListener"); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + } + + /** + * This interface must be implemented by activities that contain this + * fragment to allow an interaction in this fragment to be communicated + * to the activity and potentially other fragments contained in that + * activity. + * <p> + * See the Android Training lesson <a href= + * "http://developer.android.com/training/basics/fragments/communicating.html" + * >Communicating with Other Fragments</a> for more information. + */ + public interface OnFragmentInteractionListener { + // TODO: Update argument type and name + void onFragmentInteraction(Uri uri); + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/ChatActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/ChatActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..9e44e286aea62659e46839c29b8d4bdf6ba79903 --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/ChatActivity.java @@ -0,0 +1,152 @@ +package com.example.leo.fitnessdiy; + +import android.content.Intent; +import android.support.annotation.NonNull; +import android.support.design.widget.FloatingActionButton; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.text.format.DateFormat; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.firebase.ui.auth.AuthUI; +import com.firebase.ui.database.FirebaseListAdapter; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.FirebaseDatabase; + +import java.util.Date; + +/** + * Created by Heil on 2/18/2018. + */ + +public class ChatActivity extends AppCompatActivity { + + private static final int SIGN_IN_REQUEST_CODE = 1; + private FirebaseListAdapter<ChatMessage> adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_chat); + + if(FirebaseAuth.getInstance().getCurrentUser() == null) { + // Start sign in/sign up activity + startActivityForResult( + AuthUI.getInstance().createSignInIntentBuilder().build(), + SIGN_IN_REQUEST_CODE + ); + } else { + // User is already signed in. Therefore, display + // a welcome Toast + Toast.makeText(this, + "Welcome " + FirebaseAuth.getInstance() + .getCurrentUser() + .getDisplayName(), + Toast.LENGTH_LONG) + .show(); + + displayChatMessages(); + } + + FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + EditText input = (EditText)findViewById(R.id.input); + + // Read the input field and push a new instance + // of ChatMessage to the Firebase database + FirebaseDatabase.getInstance() + .getReference() + .push() + .setValue(new ChatMessage(input.getText().toString(), + FirebaseAuth.getInstance() + .getCurrentUser() + .getDisplayName()) + ); + + // Clear the input + input.setText(""); + } + }); + + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode == SIGN_IN_REQUEST_CODE) { + if(resultCode == RESULT_OK) { + Toast.makeText(this, + "Successfully signed in. Welcome!", + Toast.LENGTH_LONG) + .show(); + + displayChatMessages(); + } else { + Toast.makeText(this, + "We couldn't sign you in. Please try again later.", + Toast.LENGTH_LONG) + .show(); + finish(); + } + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if(item.getItemId() == R.id.menu_sign_out) { + AuthUI.getInstance().signOut(this) + .addOnCompleteListener(new OnCompleteListener<Void>() { + @Override + public void onComplete(@NonNull Task<Void> task) { + Toast.makeText(ChatActivity.this, + "You have been signed out.", + Toast.LENGTH_LONG) + .show(); + + // Close activity + finish(); + } + }); + } + return true; + } + + private void displayChatMessages() { + ListView listOfMessages = (ListView)findViewById(R.id.list_of_messages); + + adapter = new FirebaseListAdapter<ChatMessage>(this, ChatMessage.class, + R.layout.message, FirebaseDatabase.getInstance().getReference()) { + @Override + protected void populateView(View v, ChatMessage model, int position) { + // Get references to the views of message.xml + TextView messageText = (TextView)v.findViewById(R.id.message_text); + TextView messageUser = (TextView)v.findViewById(R.id.message_user); + TextView messageTime = (TextView)v.findViewById(R.id.message_time); + + // Set their text + messageText.setText(model.getMessageText()); + messageUser.setText(model.getMessageUser()); + messageTime.setText(DateFormat.format("dd-MM-yyyy (HH:mm:ss)", + model.getMessageTime())); + } + }; + + listOfMessages.setAdapter(adapter); + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/ChatMessage.java b/app/src/main/java/com/example/leo/fitnessdiy/ChatMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..5225c8bf6a44f88efe75e04b543dcd9697389e77 --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/ChatMessage.java @@ -0,0 +1,67 @@ +package com.example.leo.fitnessdiy; + +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.design.widget.FloatingActionButton; +import android.support.v7.app.AppCompatActivity; +import android.text.format.DateFormat; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import com.firebase.ui.auth.AuthUI; +import com.firebase.ui.database.FirebaseListAdapter; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.FirebaseDatabase; + +import java.util.Date; +/** + * Created by Heil on 2/18/2018. + */ +public class ChatMessage { + + private String messageText; + private String messageUser; + private long messageTime; + + public ChatMessage(String messageText, String messageUser) { + this.messageText = messageText; + this.messageUser = messageUser; + messageTime = new Date().getTime(); + } + + public ChatMessage(){ + + } + + public String getMessageText() { + return messageText; + } + + public void setMessageText(String messageText) { + this.messageText = messageText; + } + + public String getMessageUser() { + return messageUser; + } + + public void setMessageUser(String messageUser) { + this.messageUser = messageUser; + } + + public long getMessageTime() { + return messageTime; + } + + public void setMessageTime(long messageTime) { + this.messageTime = messageTime; + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/ExerciseFragment.java b/app/src/main/java/com/example/leo/fitnessdiy/ExerciseFragment.java index 41f289e5f3fc6a8d51a006d08df760d32338c62c..ec8becc82eb7128d60c7efcd4f1786aa34cc03aa 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/ExerciseFragment.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/ExerciseFragment.java @@ -1,12 +1,14 @@ package com.example.leo.fitnessdiy; import android.content.Context; +import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; /** @@ -64,7 +66,16 @@ public class ExerciseFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_exercise, container, false); + View view = inflater.inflate(R.layout.fragment_exercise, container, false); + Button plankButton = (Button)view.findViewById(R.id.plank_button); + plankButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent i = new Intent(getActivity(), PlankActivity.class); + startActivity(i); + } + }); + return view; } // TODO: Rename method, update argument and hook method into UI event @@ -105,4 +116,10 @@ public class ExerciseFragment extends Fragment { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } + + + + + + } diff --git a/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java index aa7674eaa492968ce114787c19398fa74ab3da62..7c9d1fb657584d7ae0fad4bf3f36643eba07c719 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java @@ -2,6 +2,7 @@ package com.example.leo.fitnessdiy; import android.content.Intent; import android.net.Uri; +import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -11,8 +12,10 @@ import android.support.v4.app.FragmentTransaction; public class HomeActivity extends AppCompatActivity implements ExerciseFragment.OnFragmentInteractionListener, - HistoryFragment.OnFragmentInteractionListener{ + HistoryFragment.OnFragmentInteractionListener, + BlankFragment.OnFragmentInteractionListener{ + private FloatingActionButton chatButton; @Override public void onFragmentInteraction(Uri uri) { @@ -23,6 +26,8 @@ public class HomeActivity extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); + chatButton = findViewById(R.id.chat_button); + chatButton.setImageResource(R.drawable.chat_icon); } public void openHistory(View view) { @@ -30,26 +35,32 @@ public class HomeActivity extends AppCompatActivity startActivity(i); } - public void startExcercise(View view) { - Intent i = new Intent(getApplicationContext(), ExerciseActivity.class); - startActivity(i); - } + public void changeFragment(View view){ Fragment fragment; +// fragment = getSupportFragmentManager().findFragmentById(R.id.home_fragment); +// FragmentManager manager = getSupportFragmentManager(); +// if (fragment != null) { +// getSupportFragmentManager().beginTransaction().remove(fragment).commit(); +// manager.popBackStack(); +// } if(view == findViewById(R.id.history_button)){ fragment = new HistoryFragment(); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.home_fragment, fragment); + ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } - if(view == findViewById(R.id.exercise_button)){ + else if(view == findViewById(R.id.exercise_button)){ fragment = new ExerciseFragment(); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.home_fragment, fragment); + ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); + ft.commit(); } } @@ -58,4 +69,7 @@ public class HomeActivity extends AppCompatActivity Intent i = new Intent(getApplicationContext(), JoggingActivity.class); startActivity(i); } + public void goToChat(View view) { + + } } diff --git a/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java index d7fc235b742bdbbf7258277e26b080af8ed783fb..c6fdfb270d99e562b2c5b5779b339eb9fd847d74 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/PlankActivity.java @@ -1,5 +1,7 @@ package com.example.leo.fitnessdiy; +import android.content.Intent; +import android.net.Uri; import android.os.CountDownTimer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; @@ -14,12 +16,21 @@ public class PlankActivity extends AppCompatActivity { setContentView(R.layout.activity_plank); } + public String milisecondToMinutes(long l){ + long minutes = (l/1000)/60; + long seconds = (l/1000)%60; + if (seconds >= 10) + return minutes+" : "+seconds; + else + return minutes+" : 0"+seconds; + } + public void countDownPlank(View view) { final TextView countText = findViewById(R.id.count_timer); - new CountDownTimer(60000, 1000){ + new CountDownTimer(120000, 1000){ @Override public void onTick(long l) { - String waktu = Long.toString(l/1000); + String waktu = milisecondToMinutes(l); countText.setText(waktu); } @@ -29,4 +40,15 @@ public class PlankActivity extends AppCompatActivity { } }.start(); } + + public void openVideo(View view) { + String url = (String)view.getTag(); + + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_VIEW); + intent.addCategory(Intent.CATEGORY_BROWSABLE); + + intent.setData(Uri.parse(url)); + startActivity(intent); + } } diff --git a/app/src/main/res/drawable/chat_icon.png b/app/src/main/res/drawable/chat_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3f8679dc97ac5fe57e9b22b6ba79c76e2c8792db Binary files /dev/null and b/app/src/main/res/drawable/chat_icon.png differ diff --git a/app/src/main/res/drawable/ic_send_black_24dp.xml b/app/src/main/res/drawable/ic_send_black_24dp.xml new file mode 100644 index 0000000000000000000000000000000000000000..e145ca83cc46a3c041851602eed8499451da12de --- /dev/null +++ b/app/src/main/res/drawable/ic_send_black_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> +</vector> diff --git a/app/src/main/res/drawable/plank_video_1.PNG b/app/src/main/res/drawable/plank_video_1.PNG new file mode 100644 index 0000000000000000000000000000000000000000..f0a8e23b8452dd87593021d4179a450fa409aa1a Binary files /dev/null and b/app/src/main/res/drawable/plank_video_1.PNG differ diff --git a/app/src/main/res/drawable/plank_video_2.PNG b/app/src/main/res/drawable/plank_video_2.PNG new file mode 100644 index 0000000000000000000000000000000000000000..647a0a8372c82077f14d73d982e1eee420ad7b05 Binary files /dev/null and b/app/src/main/res/drawable/plank_video_2.PNG differ diff --git a/app/src/main/res/layout/activity_chat.xml b/app/src/main/res/layout/activity_chat.xml new file mode 100644 index 0000000000000000000000000000000000000000..cd23aa97715a7a46594eca0b993cf4bffd3214b9 --- /dev/null +++ b/app/src/main/res/layout/activity_chat.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/activity_chat" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingBottom="@dimen/activity_vertical_margin" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + tools:context="com.example.leo.fitnessdiy.ChatActivity"> + + <android.support.design.widget.FloatingActionButton + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + android:src="@drawable/ic_send_black_24dp" + android:id="@+id/fab" + android:tint="@android:color/white" + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + app:fabSize="mini" /> + + <android.support.design.widget.TextInputLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/fab" + android:layout_alignParentBottom="true" + android:layout_alignParentStart="true"> + + <EditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="Input" + android:id="@+id/input" + /> + </android.support.design.widget.TextInputLayout> + + <ListView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_alignParentTop="true" + android:layout_alignParentStart="true" + android:layout_above="@id/fab" + android:dividerHeight="16dp" + android:divider="@android:color/transparent" + android:id="@+id/list_of_messages" + android:layout_marginBottom="16dp"/> +</RelativeLayout> diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 50777db35b453185b559dcfe3b825a432302ae45..cb97e984eb4945d7f0d54dff861b54cc68a97f04 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -29,12 +29,19 @@ android:text="Jogging" android:onClick="openJogging"/> </LinearLayout> + <fragment - android:name="com.example.leo.fitnessdiy.ExerciseFragment" android:id="@+id/home_fragment" + android:name="com.example.leo.fitnessdiy.BlankFragment" android:layout_width="match_parent" - android:layout_height="match_parent" - /> + android:layout_height="471dp" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/chat_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:onClick="goToChat"/> diff --git a/app/src/main/res/layout/activity_plank.xml b/app/src/main/res/layout/activity_plank.xml index 1424f0db93c95d215df0f673304fa5514be36dee..b4941ba5686e7365bc8a362dfdf3050d674059fe 100644 --- a/app/src/main/res/layout/activity_plank.xml +++ b/app/src/main/res/layout/activity_plank.xml @@ -12,19 +12,73 @@ android:layout_height="wrap_content" android:layout_marginBottom="100dp" android:text="@string/plank" /> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="30dp" + android:onClick="countDownPlank" + android:text="start" /> <TextView android:id="@+id/count_timer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:text="1:00" /> + android:textSize="32sp" + android:text="2 : 00" /> - <Button + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:onClick="countDownPlank" - android:text="start" /> + android:layout_marginBottom="30dp" + android:text="@string/plank_video" /> + + + + <!--<ScrollView--> + <!--android:layout_width="wrap_content"--> + <!--android:layout_height="wrap_content">--> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:tag="https://www.youtube.com/watch?v=TvxNkmjdhMM" + android:clickable="true" + android:focusable="true" + android:onClick="openVideo" + android:layout_margin="4dp" + > + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/plank_video_1"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="How to Plank"/> + </LinearLayout> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:tag="https://www.youtube.com/watch?v=_nZgpZLf7ZA" + android:clickable="true" + android:focusable="true" + android:onClick="openVideo" + android:layout_margin="4dp"> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/plank_video_2"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Benefits of Plank"/> + </LinearLayout> + + <!--</ScrollView>--> + </LinearLayout> diff --git a/app/src/main/res/layout/activity_pushup.xml b/app/src/main/res/layout/activity_pushup.xml new file mode 100644 index 0000000000000000000000000000000000000000..d8fb3247f0f6c95a88a47fc12ddc3d2cf5f75980 --- /dev/null +++ b/app/src/main/res/layout/activity_pushup.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<android.support.constraint.ConstraintLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="match_parent"> + +</android.support.constraint.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_blank.xml b/app/src/main/res/layout/fragment_blank.xml new file mode 100644 index 0000000000000000000000000000000000000000..13773b2e564b6b6310c013a23e9354c1fb69a6a3 --- /dev/null +++ b/app/src/main/res/layout/fragment_blank.xml @@ -0,0 +1,7 @@ +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.example.leo.fitnessdiy.BlankFragment"> + +</FrameLayout> diff --git a/app/src/main/res/layout/fragment_exercise.xml b/app/src/main/res/layout/fragment_exercise.xml index 83fbd4042372fea4a797d9d2c8b08814da1dbb1b..c28ca5dda596664c6ae265ce6576e3dc626c7533 100644 --- a/app/src/main/res/layout/fragment_exercise.xml +++ b/app/src/main/res/layout/fragment_exercise.xml @@ -4,10 +4,11 @@ android:layout_height="match_parent" tools:context="com.example.leo.fitnessdiy.ExerciseFragment"> - <!-- TODO: Update blank fragment layout --> - <TextView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:text="EXERCISE" /> + <Button + android:id="@+id/plank_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Plank" + /> </FrameLayout> diff --git a/app/src/main/res/layout/message.xml b/app/src/main/res/layout/message.xml new file mode 100644 index 0000000000000000000000000000000000000000..df41a562b8badc308514e2e8a908ecf99376f48c --- /dev/null +++ b/app/src/main/res/layout/message.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_alignParentStart="true" + android:id="@+id/message_user" + android:textStyle="normal|bold" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBottom="@+id/message_user" + android:layout_alignParentEnd="true" + android:id="@+id/message_time" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/message_user" + android:layout_alignParentStart="true" + android:layout_marginTop="5dp" + android:id="@+id/message_text" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" + android:textSize="18sp" /> +</RelativeLayout> \ No newline at end of file diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..33cfebd4854303bb18e5f500d6293b75ea7b3665 --- /dev/null +++ b/app/src/main/res/menu/main_menu.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <item android:title="Sign out" app:showAsAction="never" + android:id="@+id/menu_sign_out"/> + +</menu> \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..70eeb8a7ff8484d644b9dec689a048f0c6f105a3 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> +</resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 65e280cc7851616b323694a21bd7866b0ef5c482..88128abbbb4673020b48b232fa46cccf71ec0555 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,8 +15,9 @@ <string name="plank">Plank</string> <string name="exercise">Start Exercise</string> - <!-- TODO: Remove or change this placeholder text --> + <string name="hello_blank_fragment">Hello blank fragment</string> <string name="title_activity_jogging">Map</string> <string name="start">START</string> + <string name="plank_video">Plank Video</string> </resources> diff --git a/build.gradle b/build.gradle index e6b32bc7884bb98a5024981d37fec787514b56c8..b44fb33d715edce702b0d8b45fa98e54bba1bb40 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' - + classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index c3e97349da2e190824bac094c8dc3dcea37a9495..587d5bd674e12e88a7a0bda235f1603b6fc681a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,5 +12,12 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -#Mon Feb 12 14:53:51 ICT 2018 - +#Mon Feb 19 17:06:30 GMT+07:00 2018 +systemProp.http.proxyPassword=02414056 +systemProp.https.proxyUser=leo16515325 +systemProp.https.proxyPort=8080 +systemProp.http.proxyHost=cache.itb.ac.id +systemProp.https.proxyPassword=02414056 +systemProp.https.proxyHost=cache.itb.ac.id +systemProp.http.proxyPort=8080 +systemProp.http.proxyUser=leo16515325