diff --git a/Apps/Motion/AndroidManifest.xml b/Apps/Motion/AndroidManifest.xml
index 8a93f455..9ed0861b 100644
--- a/Apps/Motion/AndroidManifest.xml
+++ b/Apps/Motion/AndroidManifest.xml
@@ -52,7 +52,7 @@
@@ -102,10 +102,9 @@
android:theme="@style/AppThemeDialog"
tools:ignore="MissingRegistered" />
+ android:name="edu.uml.cs.isense.motion.dialogs.EnterName"
+ android:label="Enter Data Set Name"
+ android:theme="@style/AppThemeDialog"/>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Apps/Motion/res/layout-v11/main.xml b/Apps/Motion/res/layout-v11/main.xml
index 9e474f5d..0367ec87 100644
--- a/Apps/Motion/res/layout-v11/main.xml
+++ b/Apps/Motion/res/layout-v11/main.xml
@@ -117,7 +117,7 @@
android:layout_height="40dp"
android:layout_toRightOf="@id/tv_name"
android:background="@drawable/button_rsense"
- android:text="@string/john_smith"
+ android:text="@string/data_name"
android:textColor="#0066FF"
android:textSize="14sp"
android:textStyle="bold" />
diff --git a/Apps/Motion/res/layout-v11/presets.xml b/Apps/Motion/res/layout-v11/presets.xml
index dba9e426..6bb0d2f0 100644
--- a/Apps/Motion/res/layout-v11/presets.xml
+++ b/Apps/Motion/res/layout-v11/presets.xml
@@ -10,13 +10,6 @@
android:layout_width="match_parent"
android:layout_height="1dp"/>
-
-
-
-
-
-
diff --git a/Apps/Motion/res/layout/enter_name.xml b/Apps/Motion/res/layout/enter_name.xml
new file mode 100644
index 00000000..0f3a0120
--- /dev/null
+++ b/Apps/Motion/res/layout/enter_name.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Apps/Motion/res/layout/main.xml b/Apps/Motion/res/layout/main.xml
index 9d282f1e..f7c740e3 100644
--- a/Apps/Motion/res/layout/main.xml
+++ b/Apps/Motion/res/layout/main.xml
@@ -112,7 +112,7 @@
android:layout_height="40dp"
android:layout_toRightOf="@id/tv_name"
android:background="@drawable/button_rsense"
- android:text="@string/john_smith"
+ android:text="@string/data_name"
android:textColor="#0066FF"
android:textSize="14sp"
android:textStyle="bold" />
diff --git a/Apps/Motion/res/values/strings.xml b/Apps/Motion/res/values/strings.xml
index 6dc75655..ef316ef0 100644
--- a/Apps/Motion/res/values/strings.xml
+++ b/Apps/Motion/res/values/strings.xml
@@ -3,6 +3,7 @@
iSENSE MotionsHelp
+ Name:iS MotionAbout:\n\nThis app enables you to record your accel/magn in all directions and it allows you to share that data online. When the app is activated, your data is collected for ten seconds and then saved so that it can later be shared on the iSENSE web system (isenseproject.org), where it can be viewed publicly. The recording length can be changed via the Menu. In order to allow you to find your contributed data easily, the app asks you to enter your first name and last initial. If you are not comfortable with this information being posted on the web, please refrain from using this application.\n\nInstructions:\n\n In order to begin recording and sharing data, first enter your first name and last initial. Next, choose the sample length in which you would like data to be recorded, this can be done via the \"Recording Length\" menu option. Choose the project you would like the data to be uploaded to by going to the \"Select Project\" menu option. Finally, when you are ready to begin recording data press and hold the button that says \"Hold to Start.\" This allows data to be recorded and saved. When you are ready to upload your data, click on the Upload option in the menu. While data is being recorded, you will not be able to exit the app by pressing the Back button. Pressing the Home button will interrupt the recording. \nHow to Create a Project for this App:\n\n1. Go to isenseproject.org\n\n2. Login or Register for an Account.\n\n3. Click on Projects.\n\n4. Click on Create Project.\n\n5. Enter a name for your project, then click finish. \n\n6. Enter a Description.\n\n7. When formatting the project, the app is capable of recording the following fields:\n\n
@@ -84,7 +85,7 @@ Light\n\n
Create New ProjectForce Values:Name:
- John S.
+ Data Set NameAcceleration PresetGPS Preset
diff --git a/Apps/Motion/src/edu/uml/cs/isense/motion/Motion.java b/Apps/Motion/src/edu/uml/cs/isense/motion/Motion.java
index d4134fb1..de347dbf 100644
--- a/Apps/Motion/src/edu/uml/cs/isense/motion/Motion.java
+++ b/Apps/Motion/src/edu/uml/cs/isense/motion/Motion.java
@@ -18,7 +18,6 @@
/***************************************************************************************************/
package edu.uml.cs.isense.motion;
-import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -48,7 +47,7 @@
import edu.uml.cs.isense.comm.API;
import edu.uml.cs.isense.credentials.ClassroomMode;
import edu.uml.cs.isense.credentials.CredentialManager;
-import edu.uml.cs.isense.credentials.EnterName;
+import edu.uml.cs.isense.motion.dialogs.EnterName;
import edu.uml.cs.isense.motion.dialogs.DurationDialog;
import edu.uml.cs.isense.motion.dialogs.Help;
import edu.uml.cs.isense.motion.dialogs.MessageDialogTemplate;
@@ -63,7 +62,6 @@
import edu.uml.cs.isense.motion.fields.MagFragment;
import edu.uml.cs.isense.motion.fields.PressureFragment;
import edu.uml.cs.isense.motion.fields.TempFragment;
-import edu.uml.cs.isense.objects.RPerson;
import edu.uml.cs.isense.proj.ProjectManager;
import edu.uml.cs.isense.queue.QueueLayout;
import edu.uml.cs.isense.queue.UploadQueue;
@@ -97,9 +95,6 @@ public class Motion extends ActionBarActivity {
public API api;
- static String firstName = "";
- static String lastInitial = "";
-
public static final int RESULT_GOT_NAME = 1000;
public static final int LOGIN_STATUS_REQUESTED = 1002;
public static final int RECORDING_LENGTH_REQUESTED = 1003;
@@ -125,6 +120,8 @@ public class Motion extends ActionBarActivity {
public static Menu menu;
+ public static String dataSetName;
+
Intent service;
//Receives info from library to update ui
@@ -225,23 +222,13 @@ public void run() {
startStop.setText("Hold to Start");
}
- SharedPreferences namePrefs = getSharedPreferences(
- EnterName.PREFERENCES_KEY_USER_INFO, MODE_PRIVATE);
- firstName = namePrefs.getString(
- EnterName.PREFERENCES_USER_INFO_SUBKEY_FIRST_NAME,
- "");
- lastInitial = namePrefs
- .getString(
- EnterName.PREFERENCES_USER_INFO_SUBKEY_LAST_INITIAL,
- "");
-
- if (firstName.length() == 0) {
+ dataSetName = settings.getString(EnterName.Name_Key, "");
+
+ if (dataSetName.length() == 0) {
Intent iEnterName = new Intent(this, EnterName.class);
- iEnterName.putExtra(EnterName.PREFERENCES_CLASSROOM_MODE,
- true);
startActivityForResult(iEnterName, RESULT_GOT_NAME);
} else {
- nameB.setText(firstName + " " + lastInitial);
+ nameB.setText(dataSetName);
}
String projId = ProjectManager.getProject(mContext);
@@ -399,16 +386,9 @@ public void onClick(View v) {
@Override
public void onClick(View v) {
- // Launch the dialog that allows users to enter his/her
- // firstname
- // and last initial
Intent iEnterName = new Intent(mContext, EnterName.class);
SharedPreferences classPrefs = getSharedPreferences(
ClassroomMode.PREFS_KEY_CLASSROOM_MODE, 0);
- iEnterName.putExtra(EnterName.PREFERENCES_CLASSROOM_MODE,
- classPrefs.getBoolean(
- ClassroomMode.PREFS_BOOLEAN_CLASSROOM_MODE,
- true));
startActivityForResult(iEnterName, RESULT_GOT_NAME);
}
@@ -508,7 +488,6 @@ public void onStart() {
inPausedState = false;
}
- @SuppressLint("NewApi")
@Override
public void onResume() {
super.onResume();
@@ -641,33 +620,9 @@ public void onActivityResult(int reqCode, int resultCode, Intent data) {
}
} else if (reqCode == RESULT_GOT_NAME) {
if (resultCode == RESULT_OK) {
- SharedPreferences namePrefs = getSharedPreferences(
- EnterName.PREFERENCES_KEY_USER_INFO, MODE_PRIVATE);
-
- if (namePrefs
- .getBoolean(
- EnterName.PREFERENCES_USER_INFO_SUBKEY_USE_ACCOUNT_NAME,
- true)) {
- RPerson user = api.getCurrentUser();
-
- firstName = user.name;
- lastInitial = "";
-
- nameB.setText(firstName + " " + lastInitial);
-
-
- } else {
- firstName = namePrefs.getString(
- EnterName.PREFERENCES_USER_INFO_SUBKEY_FIRST_NAME,
- "");
- lastInitial = namePrefs
- .getString(
- EnterName.PREFERENCES_USER_INFO_SUBKEY_LAST_INITIAL,
- "");
-
- nameB.setText(firstName + " " + lastInitial);
-
- }
+ SharedPreferences settings = getSharedPreferences(MY_SAVED_PREFERENCES, 0);
+ dataSetName = settings.getString(EnterName.Name_Key, "");
+ nameB.setText(dataSetName);
}
} else if (reqCode == RESET_REQUESTED) {
@@ -701,11 +656,6 @@ public void onActivityResult(int reqCode, int resultCode, Intent data) {
/*reset name*/
Intent iEnterName = new Intent(mContext, EnterName.class);
- SharedPreferences classPrefs = getSharedPreferences(
- ClassroomMode.PREFS_KEY_CLASSROOM_MODE, 0);
- iEnterName.putExtra(EnterName.PREFERENCES_CLASSROOM_MODE,
- classPrefs.getBoolean(
- ClassroomMode.PREFS_BOOLEAN_CLASSROOM_MODE, true));
startActivityForResult(iEnterName, RESULT_GOT_NAME);
}
diff --git a/Apps/Motion/src/edu/uml/cs/isense/motion/PresetScreen.java b/Apps/Motion/src/edu/uml/cs/isense/motion/PresetScreen.java
index 3fe7fdd8..083df484 100644
--- a/Apps/Motion/src/edu/uml/cs/isense/motion/PresetScreen.java
+++ b/Apps/Motion/src/edu/uml/cs/isense/motion/PresetScreen.java
@@ -6,7 +6,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
@@ -14,7 +14,7 @@
import edu.uml.cs.isense.motion.dialogs.Presets;
import edu.uml.cs.isense.proj.ProjectManager;
-public class PresetScreen extends ActionBarActivity {
+public class PresetScreen extends AppCompatActivity {
CheckBox showScreen;
@Override
diff --git a/Apps/Motion/src/edu/uml/cs/isense/motion/RecordingService.java b/Apps/Motion/src/edu/uml/cs/isense/motion/RecordingService.java
index c5d83810..8a3a8509 100644
--- a/Apps/Motion/src/edu/uml/cs/isense/motion/RecordingService.java
+++ b/Apps/Motion/src/edu/uml/cs/isense/motion/RecordingService.java
@@ -26,6 +26,7 @@
import edu.uml.cs.isense.comm.API;
import edu.uml.cs.isense.dfm.DataFieldManager;
+import edu.uml.cs.isense.motion.dialogs.EnterName;
import edu.uml.cs.isense.proj.ProjectManager;
import edu.uml.cs.isense.queue.QDataSet.Type;
@@ -38,24 +39,12 @@ public class RecordingService extends Service {
public static boolean running = false;
- /* Distance and Velocity */
- float distance = 0;
- float velocity = 0;
- float deltaTime = 0;
- boolean bFirstPoint = true;
- float totalDistance = 0;
- long startTime;
-
private MediaPlayer mMediaPlayer;
private Vibrator vibrator;
- Intent intent;
Context serviceContext;
- Timer recordLength;
-
- private String dataSetName = "";
CountDownTimer mTimer;
LocalBroadcastManager broadcaster;
@@ -214,14 +203,14 @@ public void onDestroy() {
updateButtonStop("Stop");
+
// Create the name of the session using the entered name
- dataSetName = Motion.firstName + " " + Motion.lastInitial;
String description = "Number of Data Points: " + dataSet.length();
Type type = Type.DATA;
//add new dataset to queue
Motion.uq.buildQueueFromFile();
- Motion.uq.addToQueue(dataSetName, description, type, dataSet, null, ProjectManager.getProject(this), null, false);
+ Motion.uq.addToQueue(Motion.dataSetName, description, type, dataSet, null, ProjectManager.getProject(this), null, false);
}
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
diff --git a/Apps/Motion/src/edu/uml/cs/isense/motion/dialogs/EnterName.java b/Apps/Motion/src/edu/uml/cs/isense/motion/dialogs/EnterName.java
new file mode 100644
index 00000000..a21f4ba1
--- /dev/null
+++ b/Apps/Motion/src/edu/uml/cs/isense/motion/dialogs/EnterName.java
@@ -0,0 +1,74 @@
+package edu.uml.cs.isense.motion.dialogs;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+
+import edu.uml.cs.isense.R;
+import edu.uml.cs.isense.motion.Motion;
+
+/**
+ * Allows the user to identify his/her data sets with their chosen name. This
+ * can allow for students to use a teacher's iSENSE Account, because each
+ * student will have a unique identity. The Login activity should be called
+ * before this activity.
+ *
+ * @author iSENSE Android Dev Team
+ */
+public class EnterName extends AppCompatActivity {
+ public static final String Name_Key = "NAME";
+ private static final String blankName = "Do not leave name blank.";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.enter_name);
+
+ final EditText nameInput = (EditText) findViewById(R.id.edittext_name);
+ final Button okButton = (Button) findViewById(R.id.button_ok);
+
+ SharedPreferences settings = getSharedPreferences(Motion.MY_SAVED_PREFERENCES, 0);
+ String dataSetName = settings.getString(Name_Key, "");
+ nameInput.setText(dataSetName);
+
+ /*
+ * Write the user's information into memory.
+ */
+ okButton.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View v) {
+ if (nameInput.length() == 0) {
+ nameInput.setError(blankName);
+ } else {
+ SharedPreferences settings = getSharedPreferences(Motion.MY_SAVED_PREFERENCES, 0);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(Name_Key, nameInput.getText().toString());
+ editor.commit();
+
+ Intent resultIntent = new Intent();
+ setResult(Activity.RESULT_OK, resultIntent);
+ finish();
+ }
+ }
+
+ });
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ }
+
+ @Override
+ public void onBackPressed() {
+ setResult(RESULT_CANCELED, null);
+ super.onBackPressed();
+ }
+
+}
diff --git a/Apps/Pictures/AndroidManifest.xml b/Apps/Pictures/AndroidManifest.xml
index 5a26c4ce..30890f8a 100644
--- a/Apps/Pictures/AndroidManifest.xml
+++ b/Apps/Pictures/AndroidManifest.xml
@@ -87,6 +87,7 @@
android:theme="@style/AppThemeDialog" />
@@ -126,6 +127,7 @@
-
-
-
-
-
-