Skip to content

Commit 68ea657

Browse files
author
Fady Benattayallah
committed
initial commit
0 parents  commit 68ea657

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+956
-0
lines changed

.gitignore

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
.gradle/
22+
build/
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Proguard folder generated by Eclipse
28+
proguard/
29+
30+
# Log Files
31+
*.log
32+
33+
# Android Studio Navigation editor temp files
34+
.navigation/
35+
36+
# Android Studio captures folder
37+
captures/
38+
39+
# IntelliJ
40+
*.iml
41+
.idea/workspace.xml
42+
.idea/tasks.xml
43+
.idea/gradle.xml
44+
.idea/assetWizardSettings.xml
45+
.idea/dictionaries
46+
.idea/libraries
47+
# Android Studio 3 in .gitignore file.
48+
.idea/caches
49+
.idea/modules.xml
50+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51+
.idea/navEditor.xml
52+
53+
# Keystore files
54+
# Uncomment the following lines if you do not want to check your keystore files in.
55+
#*.jks
56+
#*.keystore
57+
58+
# External native build folder generated in Android Studio 2.2 and later
59+
.externalNativeBuild
60+
.cxx/
61+
62+
# Google Services (e.g. APIs or Firebase)
63+
# google-services.json
64+
65+
# Freeline
66+
freeline.py
67+
freeline/
68+
freeline_project_description.json
69+
70+
# fastlane
71+
fastlane/report.xml
72+
fastlane/Preview.html
73+
fastlane/screenshots
74+
fastlane/test_output
75+
fastlane/readme.md
76+
77+
# Version control
78+
vcs.xml
79+
80+
# lint
81+
lint/intermediates/
82+
lint/generated/
83+
lint/outputs/
84+
lint/tmp/
85+
# lint/reports/

.idea/encodings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
defaultConfig {
6+
applicationId "com.example.runnertracker"
7+
minSdkVersion 15
8+
targetSdkVersion 29
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'androidx.appcompat:appcompat:1.1.0'
24+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'androidx.test:runner:1.2.0'
27+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
28+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.example.runnertracker;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.InstrumentationRegistry;
6+
import androidx.test.runner.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getTargetContext();
24+
25+
assertEquals("com.example.runnertracker", appContext.getPackageName());
26+
}
27+
}

app/src/main/AndroidManifest.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.runnertracker">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".RecordJourney"></activity>
13+
<activity android:name=".MainActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>

app/src/main/ic_launcher-web.png

102 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
package com.example.runnertracker;
2+
3+
import android.content.Context;
4+
import android.graphics.Canvas;
5+
import android.graphics.Movie;
6+
import android.net.Uri;
7+
import android.os.SystemClock;
8+
import android.util.AttributeSet;
9+
import android.util.Log;
10+
import android.view.View;
11+
import java.io.FileNotFoundException;
12+
import java.io.InputStream;
13+
14+
public class GifPlayer extends View {
15+
private Movie animation;
16+
private int w, height;
17+
private Context content;
18+
private boolean paused;
19+
private int time;
20+
private InputStream stream;
21+
private long begin;
22+
23+
public GifPlayer(Context context, AttributeSet attrs, int defStyleAttr) {
24+
super(context, attrs, defStyleAttr);
25+
this.content = context;
26+
if (attrs.getAttributeName(1).equals("background")) {
27+
int id = Integer.parseInt(attrs.getAttributeValue(1).substring(1));
28+
setGifImageResource(id);
29+
}
30+
paused = false;
31+
time = 0;
32+
}
33+
34+
public GifPlayer(Context context) {
35+
super(context);
36+
this.content = context;
37+
}
38+
39+
public GifPlayer(Context context, AttributeSet attrs) {
40+
this(context, attrs, 0);
41+
}
42+
43+
44+
public void pause() {
45+
paused = true;
46+
}
47+
48+
public void play() {
49+
paused = false;
50+
}
51+
52+
private void init() {
53+
setFocusable(true);
54+
animation = Movie.decodeStream(stream);
55+
w = animation.width();
56+
height = animation.height();
57+
58+
requestLayout();
59+
}
60+
61+
@Override
62+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
63+
setMeasuredDimension(w, height);
64+
}
65+
66+
@Override
67+
protected void onDraw(Canvas canvas) {
68+
// play the animation
69+
long now = SystemClock.uptimeMillis();
70+
71+
if (begin == 0) {
72+
begin = now;
73+
}
74+
75+
if (animation != null) {
76+
77+
// if paused then dont update the time
78+
if(!paused) {
79+
int duration = animation.duration();
80+
if (duration == 0) {
81+
duration = 1000;
82+
}
83+
84+
time = (int) ((now - begin) % duration);
85+
}
86+
87+
animation.setTime(time);
88+
89+
animation.draw(canvas, 0, 0);
90+
invalidate();
91+
}
92+
}
93+
94+
public void setGifImageResource(int id) {
95+
stream = content.getResources().openRawResource(id);
96+
init();
97+
}
98+
99+
public void setGifImageUri(Uri uri) {
100+
try {
101+
stream = content.getContentResolver().openInputStream(uri);
102+
init();
103+
} catch (FileNotFoundException e) {
104+
Log.e("mdp", "Couldn't find gif file");
105+
}
106+
}
107+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.example.runnertracker;
2+
3+
import androidx.appcompat.app.AppCompatActivity;
4+
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.view.View;
8+
9+
10+
/*
11+
TO DO
12+
1. Allow user to record a journey which is saved to a database. The path, time, distance, date via gps
13+
2. Allow user to stop, start or pause a journey. Stopping a journey causes it to be saved
14+
3. Allow user to attach image to a saved journey
15+
4. Allow user to rate a journey out of 5
16+
5. Allow user to add comments about a certain journey
17+
6. Allow user to see a list of recorded journeys
18+
7. Clicking on a recorded journey displays more information (rating, comments, picture, time, distance, average distance, path on google maps)
19+
8. Allow user to delete a journey
20+
9. Allow use to see stastics page which shows how far ran today, this week, this month, all time and could graph these
21+
10. Allow user to set a goal for km to run every week, display whether the goal has been reached or not in the app.
22+
11. Allow user to track not only running but also cycling
23+
24+
Need
25+
- Service (for GPS tracking)
26+
- Activities (to display stats, journeys, single journeys, recording a journey, home page)
27+
- Database (to store journey information)
28+
- Content Provider (in order to access the database)
29+
- Broadcast Receiver to register callbacks
30+
*/
31+
public class MainActivity extends AppCompatActivity {
32+
33+
@Override
34+
protected void onCreate(Bundle savedInstanceState) {
35+
super.onCreate(savedInstanceState);
36+
setContentView(R.layout.activity_main);
37+
38+
39+
}
40+
41+
public void onClickRecord(View v) {
42+
// go to the record journey activity
43+
Intent journey = new Intent(MainActivity.this, RecordJourney.class);
44+
startActivity(journey);
45+
}
46+
47+
public void onClickView(View v) {
48+
// go to the activity for displaying journeys
49+
50+
}
51+
52+
public void onClickStatistics(View v) {
53+
// go to the activity for displaying statistics
54+
}
55+
}

0 commit comments

Comments
 (0)