Commit fa8b625a authored by Kristin Muterspaw's avatar Kristin Muterspaw
Browse files

If the user had never uploaded, downloaded, or cleared in the database actions...

If the user had never uploaded, downloaded, or cleared in the database actions activity, field day displays 'Never' instead of nothing.
parent b987e500
<component name="ProjectDictionaryState">
<dictionary name="buzzlightyear" />
</component>
\ No newline at end of file
......@@ -27,22 +27,6 @@
</value>
</option>
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Android</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
......@@ -59,20 +43,4 @@
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -86,13 +86,13 @@
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="postgresql" level="project" />
<orderEntry type="library" exported="" name="play-services-base-8.4.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-8.4.0" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.9.2" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-8.4.0" level="project" />
<orderEntry type="library" exported="" name="play-services-drive-8.4.0" level="project" />
<orderEntry type="library" exported="" name="postgresql" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-8.4.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-8.4.0" level="project" />
<orderEntry type="library" exported="" name="play-services-drive-8.4.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -88,11 +88,11 @@ public class DatabaseActionsActivity extends Activity {
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), ""));
getDatabaseStatus(db.getStatus());
cleanTV = (TextView) findViewById(R.id.lastClean);
cleanTV.setText(String.format(res.getString(R.string.lastClean), settings.getString("lastClean", "")));
cleanTV.setText(String.format(res.getString(R.string.lastClean), settings.getString("lastClean", "Never")));
uploadTV = (TextView) findViewById(R.id.lastUpload);
uploadTV.setText(String.format(res.getString(R.string.lastUpload), settings.getString("lastUpload", "")));
uploadTV.setText(String.format(res.getString(R.string.lastUpload), settings.getString("lastUpload", "Never")));
downloadTV = (TextView) findViewById(R.id.lastDownload);
downloadTV.setText(String.format(res.getString(R.string.lastDownload), settings.getString("lastDownload", "")));
downloadTV.setText(String.format(res.getString(R.string.lastDownload), settings.getString("lastDownload", "Never")));
dbName = (EditText) findViewById(R.id.database);
database = settings.getString("database_name", null);
......@@ -262,6 +262,7 @@ public class DatabaseActionsActivity extends Activity {
db.cleanDatabase();
editor.putString("lastClean", getTimestamp());
cleanTV.setText(String.format(res.getString(R.string.lastClean), getTimestamp()));
getDatabaseStatus(0);
editor.apply();
}
}
......@@ -438,6 +439,8 @@ public class DatabaseActionsActivity extends Activity {
if (result) {
editor.putString("lastDownload", getTimestamp());
downloadTV.setText(String.format(res.getString(R.string.lastDownload), getTimestamp()));
getDatabaseStatus(3);
dbSizeTV.setText(String.format(res.getString(R.string.databaseSize), Formatter.formatFileSize(getApplicationContext(), db.getSize())));
editor.apply();
}
progressDialog.dismiss();
......@@ -612,24 +615,26 @@ public class DatabaseActionsActivity extends Activity {
}
public void getDatabaseStatus(int status){
String message = "";
switch(status){
case 0:
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), "Empty"));
message = "Empty";
break;
case 1:
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), "Initialized, readings table populated."));
message = "Initialized, readings table populated.";
break;
case 2:
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), "Initialized, readings and streamings table populated."));
message = "Initialized, readings and streamings table populated.";
break;
case 3:
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), "Initialized, no readings or streaming data."));
message = "Initialized, no readings or streaming data.";
break;
case 4:
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), "Initialized, streamings table populated."));
message = "Initialized, streamings table populated.";
break;
default:
break;
}
dbStatusTV.setText(String.format(res.getString(R.string.databaseStatus), message));
}
}
......@@ -10,6 +10,7 @@
android:text=""
android:hint="@string/server_ip"
android:layout_alignParentTop="true"
android:singleLine="true"
android:textColorHint="@color/dark_gray_blue"
android:textColor="@color/dark_gray_blue"
android:textCursorDrawable="@null"
......@@ -19,12 +20,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/database"
android:singleLine="true"
android:text=""
android:hint="@string/database_name"
android:textColorHint="@color/dark_gray_blue"
android:textColor="@color/dark_gray_blue"
android:textCursorDrawable="@null"
android:layout_below="@+id/serverIp"
android:layout_alignStart="@id/serverIp"
android:layout_alignEnd="@id/serverIp"
android:layout_centerHorizontal="true" />
<EditText
......@@ -35,8 +39,11 @@
android:hint="@string/username"
android:textColorHint="@color/dark_gray_blue"
android:textColor="@color/dark_gray_blue"
android:singleLine="true"
android:textCursorDrawable="@null"
android:layout_below="@+id/database"
android:layout_alignStart="@id/serverIp"
android:layout_alignEnd="@id/serverIp"
android:layout_centerHorizontal="true" />
<EditText
......@@ -47,10 +54,12 @@
android:inputType="textPassword"
android:hint="@string/password"
android:textColorHint="@color/dark_gray_blue"
android:singleLine="true"
android:textColor="@color/dark_gray_blue"
android:textCursorDrawable="@null"
android:layout_below="@+id/username"
android:layout_alignEnd="@+id/database" />
android:layout_alignStart="@id/serverIp"
android:layout_alignEnd="@id/serverIp" />
<EditText
android:layout_width="wrap_content"
......@@ -58,11 +67,14 @@
android:id="@+id/port"
android:text="@string/default_port"
android:hint="@string/port_of_db"
android:singleLine="true"
android:layout_below="@+id/password"
android:textColorHint="@color/dark_gray_blue"
android:textColor="@color/dark_gray_blue"
android:textCursorDrawable="@null"
android:fontFamily="sans-serif"
android:layout_alignStart="@id/serverIp"
android:layout_alignEnd="@id/serverIp"
android:layout_centerHorizontal="true" />
<Button
......@@ -79,16 +91,48 @@
android:layout_height="wrap_content"
android:text="@string/upload"
android:id="@+id/uploadButton"
android:layout_above="@+id/wipeDatabase"
android:layout_toEndOf="@+id/username" />
android:layout_alignTop="@+id/wipeDatabase"
android:layout_toEndOf="@+id/wipeDatabase"
android:layout_marginStart="88dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/wipeDB"
android:id="@+id/wipeDatabase"
android:layout_below="@+id/setupDbButton"
android:layout_toEndOf="@+id/setupDbButton"
android:layout_marginTop="50dp" />
android:layout_alignTop="@+id/setupDbButton"
android:layout_toEndOf="@+id/lastUpload" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lastUpload"
android:id="@+id/lastUpload"
android:layout_alignStart="@id/setupDbButton"
android:textColor="@color/dark_gray_blue"
android:textAppearance="@android:style/TextAppearance.Medium"
android:layout_below="@id/wipeDatabase"
android:layout_marginTop="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lastDownload"
android:id="@+id/lastDownload"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="@color/dark_gray_blue"
android:layout_above="@+id/lastClean"
android:layout_alignStart="@+id/lastUpload" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lastClean"
android:id="@+id/lastClean"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="@color/dark_gray_blue"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/lastDownload"
android:layout_marginBottom="47dp" />
</RelativeLayout>
\ No newline at end of file
......@@ -14,10 +14,9 @@
android:contentDescription="@string/builtinSensors"
android:background="@null"
android:onClick="startSampleActivity"
android:layout_marginTop="75dp"
android:layout_marginStart="83dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
android:adjustViewBounds="false"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="wrap_content"
......@@ -27,19 +26,18 @@
android:contentDescription="@string/bluetoothSensor"
android:background="@null"
android:onClick="startSampleActivity"
android:layout_marginStart="64dp"
android:layout_alignTop="@+id/imageButtonBuiltIn"
android:layout_toEndOf="@+id/imageButtonBuiltIn" />
android:layout_alignBottom="@+id/imageButtonDbActions"
android:layout_toStartOf="@+id/imageButtonBuiltIn" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButtonDbActions"
android:src="@drawable/database_actions_icon"
android:contentDescription="Database Actions"
android:contentDescription="@string/databaseActions"
android:background="@null"
android:onClick="startSampleActivity"
android:layout_below="@+id/imageButtonBuiltIn"
android:layout_above="@+id/imageButtonBuiltIn"
android:layout_toEndOf="@+id/imageButtonBuiltIn"
android:layout_marginTop="73dp" />
android:layout_marginBottom="84dp" />
</RelativeLayout>
\ No newline at end of file
......@@ -61,6 +61,7 @@
<!-- fragment_sensorscreen.xml strings -->
<string name="bluetoothSensor">Take a sample with Bluetooth Sensors</string>
<string name="builtinSensors">Take a sample with built in sensors</string>
<string name="databaseActions">Work with database</string>
<!--Bluetooth Sensor String -->
<string name="reread">Re-read connected sensor</string>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment