From 8a2a5768ddda9393f467dfa1dda07fbc057baafa Mon Sep 17 00:00:00 2001 From: unknown <leo112071@gmail.com> Date: Thu, 22 Feb 2018 21:16:47 +0700 Subject: [PATCH] Jogging kemungkinan besar dah bisa --- .../Adapter/JogginHistoryAdapter.java | 75 ++++++++++++ .../Adapter/PlankHistoryAdapter.java | 68 +++++++++++ .../leo/fitnessdiy/HIstoryActivity.java | 108 ++++++++++++++++-- .../leo/fitnessdiy/JoggingActivity.java | 21 +++- .../fitnessdiy/Utilities/PositionUtils.java | 28 +++++ .../example/leo/fitnessdiy/routes/api.java | 2 + app/src/main/res/drawable/down_button.png | Bin 0 -> 957 bytes app/src/main/res/drawable/jogging_icon.png | Bin 0 -> 3049 bytes app/src/main/res/layout/activity_history.xml | 101 ++++++++++++++-- app/src/main/res/layout/activity_jogging.xml | 17 ++- app/src/main/res/layout/card.xml | 33 ------ app/src/main/res/layout/jogging_card.xml | 33 ++++++ app/src/main/res/layout/plank_card.xml | 27 +++++ app/src/main/res/values/strings.xml | 2 + 14 files changed, 452 insertions(+), 63 deletions(-) create mode 100644 app/src/main/java/com/example/leo/fitnessdiy/Adapter/JogginHistoryAdapter.java create mode 100644 app/src/main/java/com/example/leo/fitnessdiy/Adapter/PlankHistoryAdapter.java create mode 100644 app/src/main/java/com/example/leo/fitnessdiy/Utilities/PositionUtils.java create mode 100644 app/src/main/res/drawable/down_button.png create mode 100644 app/src/main/res/drawable/jogging_icon.png delete mode 100644 app/src/main/res/layout/card.xml create mode 100644 app/src/main/res/layout/jogging_card.xml create mode 100644 app/src/main/res/layout/plank_card.xml diff --git a/app/src/main/java/com/example/leo/fitnessdiy/Adapter/JogginHistoryAdapter.java b/app/src/main/java/com/example/leo/fitnessdiy/Adapter/JogginHistoryAdapter.java new file mode 100644 index 0000000..ec4b71f --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/Adapter/JogginHistoryAdapter.java @@ -0,0 +1,75 @@ +package com.example.leo.fitnessdiy.Adapter; + +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.example.leo.fitnessdiy.R; +import com.example.leo.fitnessdiy.model.Jogging; + +import java.util.List; + +/** + * Created by Leo on 22/02/2018. + */ + +public class JogginHistoryAdapter extends RecyclerView.Adapter<JogginHistoryAdapter.JoggingHistoryViewHolder> { + private List<Jogging> joggings; + + public JogginHistoryAdapter(List<Jogging> j) { + this.joggings = j; + } + + @Override + public JoggingHistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.jogging_card, parent, false); + + return new JoggingHistoryViewHolder(v); + } + + @Override + public void onBindViewHolder(JogginHistoryAdapter.JoggingHistoryViewHolder holder, int position) { + holder.Date.setText(joggings.get(position).getDate()); + holder.Time.setText( + String.format("%s - %s", joggings.get(position).getStart(), + joggings.get(position).getEnd()) + ); + holder.Distance.setText(String.format("Your Jogging Distance : %s m", + joggings.get(position).getDistance())); + + holder.Track.setText( + String.format("You have been running from %s to %s", + joggings.get(position).getStartingPoint(), + joggings.get(position).getEndPoint()) + ); + } + + @Override + public int getItemCount() { + return joggings.size(); + } + + @Override + public void onAttachedToRecyclerView(RecyclerView recyclerView) { + super.onAttachedToRecyclerView(recyclerView); + } + + public static class JoggingHistoryViewHolder extends RecyclerView.ViewHolder{ + TextView Date; + TextView Time; + TextView Distance; + TextView Track; + + public JoggingHistoryViewHolder(View itemView) { + super(itemView); + + Date = (TextView) itemView.findViewById(R.id.jogging_date); + Time = (TextView) itemView.findViewById(R.id.jogging_time); + Distance = (TextView) itemView.findViewById(R.id.jogging_distance); + Track = (TextView) itemView.findViewById(R.id.jogging_track); + } + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/Adapter/PlankHistoryAdapter.java b/app/src/main/java/com/example/leo/fitnessdiy/Adapter/PlankHistoryAdapter.java new file mode 100644 index 0000000..41b31d3 --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/Adapter/PlankHistoryAdapter.java @@ -0,0 +1,68 @@ +package com.example.leo.fitnessdiy.Adapter; + +import android.support.v7.widget.RecyclerView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.example.leo.fitnessdiy.R; +import com.example.leo.fitnessdiy.model.Jogging; +import com.example.leo.fitnessdiy.model.Plank; + +import java.util.List; + +/** + * Created by Leo on 22/02/2018. + */ + +public class PlankHistoryAdapter extends RecyclerView.Adapter<PlankHistoryAdapter.PlankHistoryViewHolder>{ + private List<Plank> planks; + + public PlankHistoryAdapter(List<Plank> p) { + this.planks = p; + } + + @Override + public PlankHistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.plank_card, parent, false); + + return new PlankHistoryViewHolder(v); + } + + @Override + public void onBindViewHolder(PlankHistoryViewHolder holder, int position) { + holder.Date.setText(planks.get(position).getDate()); + holder.Time.setText( + String.format("%s - %s", planks.get(position).getStart(), + planks.get(position).getEnd()) + ); + holder.Duration.setText(String.format("You last for : %s detik", + planks.get(position).getDuration())); + } + + @Override + public int getItemCount() { + return planks.size(); + } + + @Override + public void onAttachedToRecyclerView(RecyclerView recyclerView) { + super.onAttachedToRecyclerView(recyclerView); + } + + public static class PlankHistoryViewHolder extends RecyclerView.ViewHolder{ + TextView Date; + TextView Time; + TextView Duration; + + public PlankHistoryViewHolder(View itemView) { + super(itemView); + + Date = (TextView) itemView.findViewById(R.id.plank_date); + Time = (TextView) itemView.findViewById(R.id.plank_time); + Duration = (TextView) itemView.findViewById(R.id.plank_duration); + } + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/HIstoryActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/HIstoryActivity.java index cfb5b6f..bed6a4b 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/HIstoryActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/HIstoryActivity.java @@ -1,18 +1,28 @@ package com.example.leo.fitnessdiy; +import android.content.Context; +import android.hardware.Sensor; +import android.hardware.SensorManager; import android.os.AsyncTask; import android.os.StrictMode; +import android.support.design.widget.TabLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.view.View; import android.widget.TextView; +import com.example.leo.fitnessdiy.Adapter.JogginHistoryAdapter; +import com.example.leo.fitnessdiy.Adapter.PlankHistoryAdapter; import com.example.leo.fitnessdiy.Utilities.NetworkUtils; import com.example.leo.fitnessdiy.model.History; import com.example.leo.fitnessdiy.model.Jogging; +import com.example.leo.fitnessdiy.model.Plank; import com.example.leo.fitnessdiy.model.PushUp; import com.example.leo.fitnessdiy.model.SitUp; import com.example.leo.fitnessdiy.routes.api; @@ -30,25 +40,76 @@ import java.util.List; public class HIstoryActivity extends AppCompatActivity { - public static final String TAG = HIstoryActivity.class.getSimpleName(); private RecyclerView mRecyclerView; - private List<Jogging> joggingHistory; + private RecyclerView plankRecyclerView; + private List<Jogging> joggingHistory = new ArrayList<>(); + private CardView jogging; + private CardView plank; private List<PushUp> pushupHistory; + private List<Plank> plankHistory = new ArrayList<>(); private List<SitUp> situpHistory; + public static final String TAG = HIstoryActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); -// mRecyclerView = (RecyclerView) findViewById(R.id.rv_history); -// -// LinearLayoutManager layoutManager = new LinearLayoutManager(this); -// -// mRecyclerView.setLayoutManager(layoutManager); -// mRecyclerView.setHasFixedSize(true); -// RecyclerViewAdapter rv = new RecyclerViewAdapter(histories); -// mRecyclerView.setAdapter(rv); + mRecyclerView = (RecyclerView) findViewById(R.id.jogging_history); + mRecyclerView.setVisibility(View.GONE); + + plankRecyclerView = (RecyclerView) findViewById(R.id.plank_history); + plankRecyclerView.setVisibility(View.GONE); + + getJoggingData(); + getPlankData(); + + jogging = (CardView) findViewById(R.id.jogging); + jogging.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d(TAG, "Jogging Title Clicked"); + if (mRecyclerView.getVisibility() == View.GONE) { + Log.d(TAG, "Jogging View Gone"); + LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext()); + +// Set Jogging Adapter + mRecyclerView.setLayoutManager(layoutManager); + mRecyclerView.setHasFixedSize(true); + JogginHistoryAdapter adapter = new JogginHistoryAdapter(joggingHistory); + mRecyclerView.setAdapter(adapter); + mRecyclerView.setVisibility(View.VISIBLE); + } else { + Log.d(TAG, "Jogging View Visible"); + mRecyclerView.setVisibility(View.GONE); + mRecyclerView.removeAllViewsInLayout(); + } + } + }); + + plank = (CardView) findViewById(R.id.plank); + plank.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d(TAG, "Plank Title Clicked"); + if (plankRecyclerView.getVisibility() == View.GONE) { + LinearLayoutManager layoutManager2 = new LinearLayoutManager(getApplicationContext()); + //Set Plank Adapter + plankRecyclerView.setLayoutManager(layoutManager2); + plankRecyclerView.setHasFixedSize(true); + PlankHistoryAdapter pa = new PlankHistoryAdapter(plankHistory); + plankRecyclerView.setAdapter(pa); + plankRecyclerView.setVisibility(View.VISIBLE); + Log.d(TAG, "Plank View Now Visible"); + } else { + plankRecyclerView.setVisibility(View.GONE); + plankRecyclerView.removeAllViewsInLayout(); + Log.d(TAG, "Plank View Now Gone"); + + } + } + }); + } public void getJoggingData() { @@ -56,6 +117,7 @@ public class HIstoryActivity extends AppCompatActivity { String response = NetworkUtils.getResponseFromHttpUrl( new URL(api.JOGGING_HISTORY_URL + "1") ); + Log.d(TAG, response); JSONArray jsonArray = new JSONArray(response); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -67,6 +129,32 @@ public class HIstoryActivity extends AppCompatActivity { jsonObject.getString("starting_point"), jsonObject.getString("end_point") )); + Log.d(TAG, i + jsonObject.getString("jogging_date")); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (JSONException e) { + e.printStackTrace(); + } + } + + public void getPlankData() { + try { + String response = NetworkUtils.getResponseFromHttpUrl( + new URL(api.PLANK_HISTORY_URL + "1") + ); + Log.d(TAG, response); + JSONArray jsonArray = new JSONArray(response); + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + plankHistory.add(new Plank( + jsonObject.getString("plank_date"), + jsonObject.getString("plank_time_start"), + jsonObject.getString("plank_time_end"), + jsonObject.getInt("plank_duration") + )); } } catch (MalformedURLException e) { e.printStackTrace(); diff --git a/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java index 5ade481..a2141dd 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java @@ -6,6 +6,10 @@ import android.content.Context; import android.content.DialogInterface; import android.content.pm.PackageManager; import android.graphics.Color; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; import android.location.Address; import android.location.Geocoder; import android.location.Location; @@ -15,6 +19,7 @@ import android.os.Build; import android.os.StrictMode; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.os.Bundle; @@ -29,6 +34,7 @@ import android.widget.TextView; import android.widget.Toast; import com.example.leo.fitnessdiy.Utilities.NetworkUtils; +import com.example.leo.fitnessdiy.Utilities.PositionUtils; import com.example.leo.fitnessdiy.model.Jogging; import com.example.leo.fitnessdiy.routes.api; import com.google.android.gms.common.ConnectionResult; @@ -68,6 +74,7 @@ import java.util.Calendar; import java.util.List; import java.util.Locale; +@RequiresApi(api = Build.VERSION_CODES.KITKAT) public class JoggingActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, @@ -108,6 +115,9 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb private TextView infoJoggingEnd; private Button mButton; private String startTime; + SensorManager sensorManager; + Sensor stepSensor; + private double distance = 0; @Override protected void onCreate(Bundle savedInstanceState) { @@ -251,6 +261,10 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb public void onLocationChanged(Location location) { mMap.clear(); + distance += PositionUtils.distance(mLastKnownLocation.getLatitude(), + mLastKnownLocation.getLongitude(), + location.getLatitude(), + location.getLongitude()); MarkerOptions mp = new MarkerOptions(); mp.position(new LatLng(location.getLatitude(), location.getLongitude())); @@ -260,6 +274,7 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb mMap.animateCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(location.getLatitude(), location.getLongitude()), 16 )); + mLastKnownLocation = location; } @Override @@ -449,6 +464,7 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb mButton.setBackgroundColor(Color.parseColor("#FF0000")); startTime = new SimpleDateFormat("HH:mm:ss") .format(Calendar.getInstance().getTime()); + distance = 0; } public void stopJogging(View view) { @@ -463,13 +479,12 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb mButton.setBackgroundColor(Color.parseColor("#4CFF00")); // TODO : Distance itung berapa langkah - float distance = 1000; Calendar c = Calendar.getInstance(); Jogging jogging = new Jogging( new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()), startTime, new SimpleDateFormat("HH:mm:ss").format(c.getTime()), - distance, + (float) distance, infoJoggingStart.getText().toString(), infoJoggingEnd.getText().toString() ); @@ -483,7 +498,7 @@ public class JoggingActivity extends FragmentActivity implements OnMapReadyCallb jogging.getDistance(), jogging.getStartingPoint(), jogging.getEndPoint() - ); + ).replaceAll(" ", "%20"); Log.d(TAG, url); try { String response = NetworkUtils.getResponseFromHttpUrl( diff --git a/app/src/main/java/com/example/leo/fitnessdiy/Utilities/PositionUtils.java b/app/src/main/java/com/example/leo/fitnessdiy/Utilities/PositionUtils.java new file mode 100644 index 0000000..731313f --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/Utilities/PositionUtils.java @@ -0,0 +1,28 @@ +package com.example.leo.fitnessdiy.Utilities; + +/** + * Created by Leo on 22/02/2018. + */ + +public class PositionUtils { + public static double distance(double lat1, double lon1, double lat2, double lon2) { + double theta = lon1 - lon2; + double dist = Math.sin(deg2rad(lat1)) + * Math.sin(deg2rad(lat2)) + + Math.cos(deg2rad(lat1)) + * Math.cos(deg2rad(lat2)) + * Math.cos(deg2rad(theta)); + dist = Math.acos(dist); + dist = rad2deg(dist); + dist = dist * 60 * 1.1515; + return (dist); + } + + public static double deg2rad(double deg) { + return (deg * Math.PI / 180.0); + } + + public static double rad2deg(double rad) { + return (rad * 180.0 / Math.PI); + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java b/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java index 8da80de..c2cc686 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/routes/api.java @@ -23,6 +23,8 @@ public class api { public static final String JOGGING_HISTORY_URL = BASE_URL + "jogging_history.php?user="; + public static final String PLANK_HISTORY_URL = BASE_URL + "plank_history.php?user="; + public static final String PUSHUP_HISTORY_URL = BASE_URL + "pushup_history.php?user="; public static final String SITUP_HISTORY_URL = BASE_URL + "situp_history.php?user="; diff --git a/app/src/main/res/drawable/down_button.png b/app/src/main/res/drawable/down_button.png new file mode 100644 index 0000000000000000000000000000000000000000..7dba95c6cad6af9f720d4f1096ac93299856014d GIT binary patch literal 957 zcmV;u148_XP)<h;3K|Lk000e1NJLTq007|t007|#0{{R332h=s0000gP)t-s|Ns90 z004V?d)C(0czAf--QC#O*nNF{)YQ~;baZufb+faxtE;Q9u&}eEx$6J`15QaqK~#90 z?b+>eqc9AG;kqGd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vXXu0mjfAfL=# literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/jogging_icon.png b/app/src/main/res/drawable/jogging_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8497feb4c7200a17b4ae93a8db6f685eb28ab0a3 GIT binary patch literal 3049 zcmZ`*c{r47AAa6<hA}h7FqXvFw}com)@o!wp-EB-jqJ;4EQxHd$d)oujgW@wBq3Xt zgPOG2j#FeQ(l{YSD3K4<H|Jd6Kj-_d@4BAnzVF|2{qBFB>w13Aoke%CC*b68004rc zgN-Wyut359jS`Tsdsml$(1BLYRshuI;x~MR1T_@pYQGy)_mMvciY?K$hoYlm0?m*4 zMEUEThzte+!D0U9`uh6OOqM>=CotGIR4*)UyJP5{XhTVa^Or~CFOQ#3w7)s?xL<HU z956JXQ1vK=dK6<fim^Gx$lQ>sV_;xzV6fqsmGuvUZ=}D#_x}y&q$tJ$1D56B5hY-U zzqegi=uUx<r#rdX+OwRf#>OU8s$l(>;CdZs6SRp$ySnTLZqr@T@iz=O4QWgOa8-^r zR&KGcKVAL(q@;<|6Z_8zVO|}j^`cB%y{OU|4|8kBdZYBHf}5q}0{<XfY^eORwR(9N zO3n#T&pqXG;_kSi#rI=xPQD$;*Az)uU7UE7K~&oLPw^~SaU!GX__ah;@1G7yS@!xK z!$-T1N4(D=@me+%mo}x%ZhA!ok#-Ksm+nyH>#BBj4S`OxA~DMg@)Qjeoe8r&i)dk0 zN4GVf1fzSol@RX+?BkANQ2CI!V^=%o)ID&ylFBw9y4?e@He7d<e(F=Pvun#s<%~*T zFzo`nD%OC4Er48yTJ44T7ZrGqQOd(eKS~+H)&VsaQ!88%VOrUtUC#S;k72~?Q8RI1 z60E4l$<Sd_Ka4@ZFrs1x3LBfdG0(|4HgnECPilEWJ!=P^h&!7oix{p9e9m6?qeqzc zsX<nBhc6PP1)iwcC4PYjjd`$PFPgi;;OAgz=Wu=HKxCfMby&wnn2&7{M*H+#6*|q2 z4V5HEKqK?nx}6}bsPv>Cy72&i93d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KTz39r*3RrOhZiq>bmgY($TwLhnoc?DN z4P3Iy_0{t)1DymM*#;cZ@ZO)Vg--BRqugF3@xD>dIC6BL4WY-Hx%L_e2Xji(<q#Mz z({ak-g5u(91*^)?YOi}p|9dHfGxJNnjtacEH6lE6NDYiaSGt%WWmrt)+%^ZirILEi z`FNocLS~MlgmkQj0kv>dJa(aKCC9}=$eXm~FB*>`-LkuN6>it~?WHh?O0F}KixrO@ z*3!8iS_?1OUg-_utE9BrT`SljCDri>>154O?Bku(sg{fSFG{3!MD?F;3c8zpGyV9P zL}%0jW9UJN(1{;+*Ij?C!GYgHF{!7v?^;M!<X0xQD|CEu-0V*>RY%jslU%H?pby>O zvOje0kcP5PoT<kh(u^cLv(Hkt;&w_7sU{$8vlp#%9#)On^xT(&T=ay8jM)2NQVce8 zM1#xVAbFm!d#F!mQ{*TdG4sL!Uf7=G?_CON-V%bgrWt+-aCp3$6>$m6ZLrc_zu;h7 zoiaO&7Gbg(!#uahbzW}HwSuD*t65@N-#EMK=j!sBo{AyXay&u3;I=sK_>NexrdvL~ zX5YL}7V?BpM+^?P(`|vu?{BW>j{{49o(h~gSf-8<cZ>wu7DzFfR!}SW>+V83@$7X( zFf;`ZEm$ZRWaf~OkE2;OTG!vtfzuKe$m{AYgDrFgs5-S)4)&8gHj18kYE9jBHI^r= z+<a#Bq3QKQKTB2$h%{Dl{##i>p2Tw6%S+;Zy$1vCrYXO_dhur?p=7|N`{=WbVk2y2 vh{{xA%b?Oj{Ku(`l>bSPe`m@K;-5!r)0VZ0?0OFi!YpvKb+M`5%{cvUP0<TS literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_history.xml b/app/src/main/res/layout/activity_history.xml index 609d703..1a29c7f 100644 --- a/app/src/main/res/layout/activity_history.xml +++ b/app/src/main/res/layout/activity_history.xml @@ -1,22 +1,101 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:card_view="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:card_view="http://schemas.android.com/tools" - tools:context="com.example.leo.fitnessdiy.HIstoryActivity" + android:orientation="vertical" android:padding="16dp" - android:orientation="vertical"> + tools:context="com.example.leo.fitnessdiy.HIstoryActivity"> + <android.support.v7.widget.CardView + android:id="@+id/jogging" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <RelativeLayout + android:id="@+id/layout_jogging" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="8dp"> + + <ImageView + android:id="@+id/jogging_icon" + android:layout_width="48dp" + android:layout_height="40dp" + android:layout_marginRight="8dp" + android:contentDescription="TODO" + android:src="@drawable/jogging_icon"/> + + <TextView + android:id="@+id/jogging_title" + style="@style/TextAppearance.AppCompat.Headline" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:layout_toRightOf="@id/jogging_icon" + android:text="@string/jogging_history" /> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_marginTop="10dp" + android:src="@drawable/down_button"/> + + </RelativeLayout> + + </android.support.v7.widget.CardView> + + <android.support.v7.widget.RecyclerView + android:id="@+id/jogging_history" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <android.support.v7.widget.CardView + android:id="@+id/plank" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <RelativeLayout + android:id="@+id/layout_plank" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="8dp"> + + <ImageView + android:id="@+id/plank_icon" + android:layout_width="48dp" + android:layout_height="40dp" + android:layout_marginRight="8dp" + android:contentDescription="TODO" + android:src="@drawable/jogging_icon"/> + + <TextView + android:id="@+id/plank_title" + style="@style/TextAppearance.AppCompat.Headline" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:layout_toEndOf="@id/plank_icon" + android:layout_toRightOf="@id/plank_icon" + android:text="@string/plank_history" /> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_marginTop="10dp" + android:src="@drawable/down_button"/> - <android.support.v7.widget.CardView - android:layout_width="match_parent" - android:layout_height="wrap_content"> + </RelativeLayout> - </android.support.v7.widget.CardView> - <android.support.v7.widget.RecyclerView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/rv_history"/> + </android.support.v7.widget.CardView> + <android.support.v7.widget.RecyclerView + android:id="@+id/plank_history" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_jogging.xml b/app/src/main/res/layout/activity_jogging.xml index 8e64945..9c9f270 100644 --- a/app/src/main/res/layout/activity_jogging.xml +++ b/app/src/main/res/layout/activity_jogging.xml @@ -39,14 +39,19 @@ android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_marginTop="16dp"> - <TextView + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/tv_info_start"/> - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/tv_info_end"/> + android:orientation="vertical"> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/tv_info_start"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/tv_info_end"/> + </LinearLayout> </android.support.v7.widget.CardView> </FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/card.xml b/app/src/main/res/layout/card.xml deleted file mode 100644 index b2f4f92..0000000 --- a/app/src/main/res/layout/card.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:card_view="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/sport_name"/> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/sport_date" - android:layout_below="@id/sport_name"/> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/sport_start" - android:layout_below="@id/sport_date"/> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/sport_end" - android:layout_below="@id/sport_start"/> - - -</RelativeLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/jogging_card.xml b/app/src/main/res/layout/jogging_card.xml new file mode 100644 index 0000000..b23e2e4 --- /dev/null +++ b/app/src/main/res/layout/jogging_card.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="8dp" + android:orientation="vertical"> + + <TextView + android:id="@+id/jogging_date" + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="@style/TextAppearance.AppCompat.Title" /> + + <TextView + android:id="@+id/jogging_time" + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="@style/TextAppearance.AppCompat" /> + + <TextView + android:id="@+id/jogging_distance" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="#000000" + android:textSize="12dp" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="#000000" + android:textSize="14dp" + android:id="@+id/jogging_track"/> +</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/plank_card.xml b/app/src/main/res/layout/plank_card.xml new file mode 100644 index 0000000..1bd41b6 --- /dev/null +++ b/app/src/main/res/layout/plank_card.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="8dp" + android:orientation="vertical"> + + <TextView + android:id="@+id/plank_date" + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="@style/TextAppearance.AppCompat.Title" /> + + <TextView + android:id="@+id/plank_time" + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="@style/TextAppearance.AppCompat" /> + + <TextView + android:id="@+id/plank_duration" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="#000000" + android:textSize="12dp" /> + +</LinearLayout> \ 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 b631752..7ec71d6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,4 +28,6 @@ <string name="motivation_situp">Sit Up Challenge : Before and After</string> <string name="situp_demo">How to do sit up properly</string> <string name="situp_video">Sit Up Video</string> + <string name="jogging_history">Jogging History</string> + <string name="plank_history">Plank History</string> </resources> -- GitLab