mirror of
https://github.com/oliexdev/openScale.git
synced 2025-03-14 04:29:43 +01:00
add AndroidStudio project structure.
This commit is contained in:
parent
f416f4d064
commit
978498fb32
92
android_app/app/app.iml
Normal file
92
android_app/app/app.iml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-20.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="hellocharts-library-1.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
25
android_app/app/build.gradle
Normal file
25
android_app/app/build.gradle
Normal file
@ -0,0 +1,25 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.health.openscale"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
compile 'com.android.support:appcompat-v7:20.0.0'
|
||||
compile files('libs/hellocharts-library-1.2.jar')
|
||||
}
|
BIN
android_app/app/libs/hellocharts-library-1.2.jar
Normal file
BIN
android_app/app/libs/hellocharts-library-1.2.jar
Normal file
Binary file not shown.
32
android_app/app/src/main/AndroidManifest.xml
Normal file
32
android_app/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.health.openscale"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="21" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="com.health.openscale.gui.MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.health.openscale.gui.SettingsActivity"></activity>
|
||||
<activity android:name="com.health.openscale.gui.NewEntryActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="New Scale Data Entry"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,105 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.SyncStateContract.Constants;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
|
||||
public class BluetoothCommunication extends Thread {
|
||||
public static final int BT_MESSAGE_READ = 0;
|
||||
public static final int BT_SOCKET_CLOSED = 1;
|
||||
public static final int BT_NO_ADAPTER = 2;
|
||||
private final UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); // Standard SerialPortService ID
|
||||
|
||||
private BluetoothSocket btSocket;
|
||||
private BluetoothDevice btDevice;
|
||||
private BluetoothAdapter btAdapter;
|
||||
private Handler btHandler;
|
||||
private volatile boolean isCancel;
|
||||
|
||||
public BluetoothCommunication(Handler handler) {
|
||||
btHandler = handler;
|
||||
isCancel = false;
|
||||
}
|
||||
|
||||
void findBT(String deviceName) throws IOException {
|
||||
btAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
|
||||
if (btAdapter == null) {
|
||||
btHandler.obtainMessage(BluetoothCommunication.BT_NO_ADAPTER).sendToTarget();
|
||||
return;
|
||||
}
|
||||
|
||||
Set<BluetoothDevice> pairedDevices = btAdapter.getBondedDevices();
|
||||
|
||||
for (BluetoothDevice device : pairedDevices) {
|
||||
// check if we can found bluetooth device name in the pairing list
|
||||
if (device.getName().equals(deviceName)) {
|
||||
btDevice = device;
|
||||
|
||||
// Get a BluetoothSocket to connect with the given BluetoothDevice
|
||||
btSocket = btDevice.createRfcommSocketToServiceRecord(uuid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IOException("Bluetooth device not found");
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (!isCancel) {
|
||||
try {
|
||||
if (!btSocket.isConnected()) {
|
||||
// Connect the device through the socket. This will block
|
||||
// until it succeeds or throws an exception
|
||||
btSocket.connect();
|
||||
}
|
||||
|
||||
// Bluetooth connection was successful
|
||||
Log.d("BluetoothCommunication", "Bluetooth connection successful established!");
|
||||
BluetoothConnectedThread btConnectThread = new BluetoothConnectedThread(btSocket, btHandler);
|
||||
btConnectThread.start();
|
||||
return;
|
||||
|
||||
} catch (IOException connectException) {
|
||||
try {
|
||||
sleep(4000);
|
||||
} catch (InterruptedException e) {
|
||||
Log.e("BluetoothCommuncation", "Sleep error " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
try {
|
||||
btSocket.close();
|
||||
isCancel = true;
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
public class BluetoothConnectedThread extends Thread {
|
||||
private BluetoothSocket btSocket;
|
||||
private InputStream btInStream;
|
||||
private OutputStream btOutStream;
|
||||
private Handler btHandler;
|
||||
|
||||
public BluetoothConnectedThread(BluetoothSocket socket, Handler handler) {
|
||||
btSocket = socket;
|
||||
btHandler = handler;
|
||||
|
||||
// Get the input and output bluetooth streams
|
||||
try {
|
||||
btInStream = socket.getInputStream();
|
||||
btOutStream = socket.getOutputStream();
|
||||
} catch (IOException e) {
|
||||
Log.e("BluetoothConnectedThread", "Can't get bluetooth input or output stream " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
final StringBuilder btLine = new StringBuilder();
|
||||
|
||||
// Keep listening to the InputStream until an exception occurs (e.g. device partner goes offline)
|
||||
while (true) {
|
||||
try {
|
||||
// stream read is a blocking method
|
||||
char btChar = (char)btInStream.read();
|
||||
|
||||
btLine.append(btChar);
|
||||
|
||||
if (btLine.charAt(btLine.length()-1) == '\n'){
|
||||
btHandler.obtainMessage(BluetoothCommunication.BT_MESSAGE_READ, btLine.toString()).sendToTarget();
|
||||
|
||||
btLine.setLength(0);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
cancel();
|
||||
btHandler.obtainMessage(BluetoothCommunication.BT_SOCKET_CLOSED).sendToTarget();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void write(byte[] bytes) {
|
||||
try {
|
||||
btOutStream.write(bytes);
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
try {
|
||||
btSocket.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("BluetoothConnectedThread", "Error while closing bluetooth socket " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
public class OpenScale {
|
||||
|
||||
private static OpenScale instance;
|
||||
|
||||
private ScaleDatabase scaleDB;
|
||||
private ArrayList<ScaleData> scaleDBEntries;
|
||||
|
||||
private BluetoothCommunication btCom;
|
||||
private String btDeviceName;
|
||||
|
||||
private SimpleDateFormat dateTimeFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
|
||||
|
||||
private OpenScale(Context con) {
|
||||
scaleDB = new ScaleDatabase(con);
|
||||
scaleDBEntries = scaleDB.getAllDBEntries();
|
||||
}
|
||||
|
||||
public static OpenScale getInstance(Context con) {
|
||||
if (instance == null) {
|
||||
instance = new OpenScale(con);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public ArrayList<ScaleData> getScaleDBEntries() {
|
||||
return scaleDBEntries;
|
||||
}
|
||||
|
||||
public void addScaleData(String date_time, float weight, float fat,
|
||||
float water, float muscle) {
|
||||
ScaleData scaleData = new ScaleData();
|
||||
|
||||
try {
|
||||
scaleData.date_time = dateTimeFormat.parse(date_time);
|
||||
scaleData.weight = weight;
|
||||
scaleData.fat = fat;
|
||||
scaleData.water = water;
|
||||
scaleData.muscle = muscle;
|
||||
} catch (ParseException e) {
|
||||
Log.e("OpenScale", "Can't parse date time string while adding to the database");
|
||||
}
|
||||
|
||||
scaleDB.insertEntry(scaleData);
|
||||
|
||||
scaleDBEntries = scaleDB.getAllDBEntries();
|
||||
}
|
||||
|
||||
public void importData(String filename) throws IOException {
|
||||
File file = new File(filename);
|
||||
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
|
||||
InputStreamReader inputReader = new InputStreamReader(inputStream);
|
||||
BufferedReader csvReader = new BufferedReader(inputReader);
|
||||
|
||||
String line = csvReader.readLine();
|
||||
|
||||
try {
|
||||
while (line != null) {
|
||||
String csvField[] = line.split(",");
|
||||
|
||||
ScaleData newScaleData = new ScaleData();
|
||||
|
||||
newScaleData.date_time = dateTimeFormat.parse(csvField[0]);
|
||||
newScaleData.weight = Float.parseFloat(csvField[1]);
|
||||
newScaleData.fat = Float.parseFloat(csvField[2]);
|
||||
newScaleData.water = Float.parseFloat(csvField[3]);
|
||||
newScaleData.muscle = Float.parseFloat(csvField[4]);
|
||||
|
||||
scaleDB.insertEntry(newScaleData);
|
||||
|
||||
line = csvReader.readLine();
|
||||
}
|
||||
|
||||
} catch (ParseException e) {
|
||||
throw new IOException("Can't parse date format. Please set the date time format as <dd.MM.yyyy HH:mm> (e.g. 31.10.2014 05:23)");
|
||||
}
|
||||
|
||||
scaleDBEntries = scaleDB.getAllDBEntries();
|
||||
|
||||
csvReader.close();
|
||||
inputReader.close();
|
||||
}
|
||||
|
||||
public void exportData(String filename) throws IOException {
|
||||
File file = new File(filename);
|
||||
file.createNewFile();
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
|
||||
OutputStreamWriter csvWriter = new OutputStreamWriter(outputStream);
|
||||
|
||||
for (ScaleData scaleData : scaleDBEntries) {
|
||||
csvWriter.append(dateTimeFormat.format(scaleData.date_time) + ",");
|
||||
csvWriter.append(Float.toString(scaleData.weight) + ",");
|
||||
csvWriter.append(Float.toString(scaleData.fat) + ",");
|
||||
csvWriter.append(Float.toString(scaleData.water) + ",");
|
||||
csvWriter.append(Float.toString(scaleData.muscle));
|
||||
csvWriter.append("\n");
|
||||
}
|
||||
|
||||
csvWriter.close();
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
public void deleteAllDBEntries() {
|
||||
scaleDB.deleteAllEntries();
|
||||
|
||||
scaleDBEntries = scaleDB.getAllDBEntries();
|
||||
}
|
||||
|
||||
public void startBluetoothServer(String deviceName) {
|
||||
Log.d("OpenScale", "Bluetooth Server started! I am searching for device ...");
|
||||
|
||||
btCom = new BluetoothCommunication(btHandler);
|
||||
btDeviceName = deviceName;
|
||||
|
||||
try {
|
||||
btCom.findBT(btDeviceName);
|
||||
btCom.start();
|
||||
} catch (IOException e) {
|
||||
Log.e("OpenScale", "Error " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void stopBluetoothServer() {
|
||||
Log.d("OpenScale", "Bluetooth Server stopped!");
|
||||
|
||||
if (btCom != null) {
|
||||
btCom.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Handler that gets information back from the BluetoothChatService
|
||||
*/
|
||||
private final Handler btHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
|
||||
switch (msg.what) {
|
||||
case BluetoothCommunication.BT_MESSAGE_READ:
|
||||
String line = (String) msg.obj;
|
||||
|
||||
parseBtString(line);
|
||||
break;
|
||||
case BluetoothCommunication.BT_SOCKET_CLOSED:
|
||||
scaleDBEntries = scaleDB.getAllDBEntries();
|
||||
|
||||
Log.i("OpenScale", "Socket closed! Restarting socket ");
|
||||
|
||||
startBluetoothServer(btDeviceName);
|
||||
break;
|
||||
case BluetoothCommunication.BT_NO_ADAPTER:
|
||||
Log.e("OpenScale", "No bluetooth adapter found!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void parseBtString(String btString) {
|
||||
btString = btString.substring(0, btString.length() - 1); // delete newline '\n' of the string
|
||||
|
||||
if (btString.charAt(0) != '$' && btString.charAt(2) != '$') {
|
||||
Log.e("OpenScale", "Parse error of bluetooth string. String has not a valid format");
|
||||
return;
|
||||
}
|
||||
|
||||
String btMsg = btString.substring(3, btString.length()); // message string
|
||||
|
||||
switch (btString.charAt(1)) {
|
||||
case 'I':
|
||||
Log.i("OpenScale", "MCU Information: " + btMsg);
|
||||
break;
|
||||
case 'E':
|
||||
Log.e("OpenScale", "MCU Error: " + btMsg);
|
||||
break;
|
||||
case 'S':
|
||||
Log.i("OpenScale", "MCU stored data size: " + btMsg);
|
||||
break;
|
||||
case 'D':
|
||||
ScaleData scaleBtData = new ScaleData();
|
||||
|
||||
String[] csvField = btMsg.split(",");
|
||||
|
||||
try {
|
||||
int checksum = 0;
|
||||
|
||||
checksum ^= Integer.parseInt(csvField[1]);
|
||||
checksum ^= Integer.parseInt(csvField[2]);
|
||||
checksum ^= Integer.parseInt(csvField[3]);
|
||||
checksum ^= Integer.parseInt(csvField[4]);
|
||||
checksum ^= Integer.parseInt(csvField[5]);
|
||||
checksum ^= (int)Float.parseFloat(csvField[6]);
|
||||
checksum ^= (int)Float.parseFloat(csvField[7]);
|
||||
checksum ^= (int)Float.parseFloat(csvField[8]);
|
||||
checksum ^= (int)Float.parseFloat(csvField[9]);
|
||||
|
||||
int btChecksum = Integer.parseInt(csvField[10]);
|
||||
|
||||
if (checksum == btChecksum) {
|
||||
scaleBtData.id = Long.parseLong(csvField[0]);
|
||||
String date_string = csvField[1] + "/" + csvField[2] + "/" + csvField[3] + "/" + csvField[4] + "/" + csvField[5];
|
||||
scaleBtData.date_time = new SimpleDateFormat("yyyy/MM/dd/HH/mm").parse(date_string);
|
||||
|
||||
scaleBtData.weight = Float.parseFloat(csvField[6]);
|
||||
scaleBtData.fat = Float.parseFloat(csvField[7]);
|
||||
scaleBtData.water = Float.parseFloat(csvField[8]);
|
||||
scaleBtData.muscle = Float.parseFloat(csvField[9]);
|
||||
|
||||
Log.i("OpenScale", "MCU Data: " + scaleBtData);
|
||||
scaleDB.insertEntry(scaleBtData);
|
||||
} else {
|
||||
Log.e("OpenScale", "Error calculated checksum (" + checksum + ") and received checksum (" + btChecksum + ") is different");
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
Log.e("OpenScale", "Error while decoding bluetooth date string (" + e.getMessage() + ")");
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e("OpenScale", "Error while decoding a number of bluetooth string (" + e.getMessage() + ")");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.e("OpenScale", "Error unknown MCU command");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class ScaleData {
|
||||
public long id;
|
||||
public Date date_time;
|
||||
public float weight;
|
||||
public float fat;
|
||||
public float water;
|
||||
public float muscle;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ID : " + id + " DATE_TIME: " + date_time.toString() + " WEIGHT: " + weight + " FAT: " + fat + " WATER: " + water + " MUSCLE: " + muscle;
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.util.Log;
|
||||
|
||||
public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
private static final String DATABASE_NAME = "openScaleDatabase.db";
|
||||
|
||||
private static final String TABLE_NAME = "scaledata";
|
||||
private static final String COLUMN_NAME_ID = "id";
|
||||
private static final String COLUMN_NAME_DATE_TIME = "date_time";
|
||||
private static final String COLUMN_NAME_WEIGHT = "weight";
|
||||
private static final String COLUMN_NAME_FAT = "fat";
|
||||
private static final String COLUMN_NAME_WATER = "water";
|
||||
private static final String COLUMN_NAME_MUSCLE = "muscle";
|
||||
|
||||
private static final String SQL_CREATE_ENTRIES =
|
||||
"CREATE TABLE " + TABLE_NAME + " (" +
|
||||
COLUMN_NAME_ID + " INTEGER PRIMARY KEY," +
|
||||
COLUMN_NAME_DATE_TIME + " TEXT UNIQUE," +
|
||||
COLUMN_NAME_WEIGHT + " REAL," +
|
||||
COLUMN_NAME_FAT + " REAL," +
|
||||
COLUMN_NAME_WATER + " REAL," +
|
||||
COLUMN_NAME_MUSCLE + " REAL" +
|
||||
")";
|
||||
|
||||
private static final String SQL_DELETE_ENTRIES =
|
||||
"DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
private SimpleDateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
public ScaleDatabase(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL(SQL_CREATE_ENTRIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
db.execSQL(SQL_DELETE_ENTRIES);
|
||||
onCreate(db);
|
||||
}
|
||||
|
||||
public void deleteAllEntries() {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
|
||||
db.delete(TABLE_NAME, null, null);
|
||||
}
|
||||
|
||||
public void insertEntry(ScaleData scaleData) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
|
||||
// Create a new map of values, where column names are the keys
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(COLUMN_NAME_DATE_TIME, formatDateTime.format(scaleData.date_time));
|
||||
values.put(COLUMN_NAME_WEIGHT, scaleData.weight);
|
||||
values.put(COLUMN_NAME_FAT, scaleData.fat);
|
||||
values.put(COLUMN_NAME_WATER, scaleData.water);
|
||||
values.put(COLUMN_NAME_MUSCLE, scaleData.muscle);
|
||||
|
||||
// Insert the new row, returning the primary key value of the new row
|
||||
long newRowId = db.insert(TABLE_NAME, null, values);
|
||||
|
||||
if (newRowId == -1) {
|
||||
Log.e("ScaleDatabase", "An error occured while inserting a new entry into the scale database");
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<ScaleData> getAllDBEntries() {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleData> scaleDBEntries = new ArrayList<ScaleData>();
|
||||
|
||||
// Define a projection that specifies which columns from the database
|
||||
// you will actually use after this query.
|
||||
String[] projection = {
|
||||
COLUMN_NAME_ID,
|
||||
COLUMN_NAME_DATE_TIME,
|
||||
COLUMN_NAME_WEIGHT,
|
||||
COLUMN_NAME_FAT,
|
||||
COLUMN_NAME_WATER,
|
||||
COLUMN_NAME_MUSCLE
|
||||
};
|
||||
|
||||
// How you want the results sorted in the resulting Cursor
|
||||
String sortOrder = COLUMN_NAME_DATE_TIME + " DESC";
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
TABLE_NAME, // The table to query
|
||||
projection, // The columns to return
|
||||
null, // The columns for the WHERE clause
|
||||
null, // The values for the WHERE clause
|
||||
null, // don't group the rows
|
||||
null, // don't filter by row groups
|
||||
sortOrder // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
while (!cursorScaleDB.isAfterLast()) {
|
||||
ScaleData dataEntry = new ScaleData();
|
||||
|
||||
dataEntry.id = cursorScaleDB.getLong(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||
String date_time = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_DATE_TIME));
|
||||
dataEntry.weight = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_WEIGHT));
|
||||
dataEntry.fat = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_FAT));
|
||||
dataEntry.water = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_WATER));
|
||||
dataEntry.muscle = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_MUSCLE));
|
||||
|
||||
Date date = formatDateTime.parse(date_time);
|
||||
|
||||
dataEntry.date_time = date;
|
||||
|
||||
scaleDBEntries.add(dataEntry);
|
||||
//Log.d("ScaleDatabase", dataEntry.toString());
|
||||
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
} catch (ParseException ex) {
|
||||
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
||||
}
|
||||
catch ( IllegalArgumentException ex) {
|
||||
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return scaleDBEntries;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
public interface FragmentUpdateListener {
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDBEntries);
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lecho.lib.hellocharts.model.Axis;
|
||||
import lecho.lib.hellocharts.model.AxisValue;
|
||||
import lecho.lib.hellocharts.model.Line;
|
||||
import lecho.lib.hellocharts.model.LineChartData;
|
||||
import lecho.lib.hellocharts.model.PointValue;
|
||||
import lecho.lib.hellocharts.view.LineChartView;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View graphView;
|
||||
private LineChartView chartView;
|
||||
|
||||
public GraphFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
graphView = inflater.inflate(R.layout.fragment_graph, container, false);
|
||||
|
||||
chartView = (LineChartView) graphView.findViewById(R.id.data_chart);
|
||||
|
||||
return graphView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDBEntries)
|
||||
{
|
||||
if (scaleDBEntries.isEmpty()) {
|
||||
LineChartData data = new LineChartData();
|
||||
chartView.setLineChartData(data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
List<AxisValue> axisValues = new ArrayList<AxisValue>();
|
||||
List<PointValue> valuesWeight = new ArrayList<PointValue>();
|
||||
List<PointValue> valuesFat = new ArrayList<PointValue>();
|
||||
List<PointValue> valuesWater = new ArrayList<PointValue>();
|
||||
List<PointValue> valuesMuscle = new ArrayList<PointValue>();
|
||||
List<Line> lines = new ArrayList<Line>();
|
||||
|
||||
|
||||
for(ScaleData scaleEntry: scaleDBEntries)
|
||||
{
|
||||
valuesWeight.add(new PointValue(scaleEntry.date_time.getTime(), scaleEntry.weight));
|
||||
valuesFat.add(new PointValue(scaleEntry.date_time.getTime(), scaleEntry.fat));
|
||||
valuesWater.add(new PointValue(scaleEntry.date_time.getTime(), scaleEntry.water));
|
||||
valuesMuscle.add(new PointValue(scaleEntry.date_time.getTime(), scaleEntry.muscle));
|
||||
|
||||
axisValues.add(new AxisValue(scaleEntry.date_time.getTime(), DateFormat.getDateInstance(DateFormat.SHORT).format(scaleEntry.date_time).toCharArray()));
|
||||
}
|
||||
|
||||
Line lineWeight = new Line(valuesWeight).setColor(Color.GREEN);
|
||||
Line lineFat = new Line(valuesFat).setColor(Color.RED);
|
||||
Line lineWater = new Line(valuesWater).setColor(Color.BLUE);
|
||||
Line lineMuscle = new Line(valuesMuscle).setColor(Color.GRAY);
|
||||
|
||||
lines.add(lineWeight);
|
||||
lines.add(lineFat);
|
||||
lines.add(lineWater);
|
||||
lines.add(lineMuscle);
|
||||
|
||||
lineWeight.setHasLabels(true);
|
||||
lineWeight.setHasLabelsOnlyForSelected(true);
|
||||
lineFat.setHasLabelsOnlyForSelected(true);
|
||||
|
||||
LineChartData data = new LineChartData();
|
||||
|
||||
Axis axisX = new Axis(axisValues);
|
||||
Axis axisY = new Axis();
|
||||
|
||||
axisY.setHasLines(true);
|
||||
|
||||
axisX.setName("Zeit");
|
||||
axisY.setName("Wert");
|
||||
|
||||
axisX.setTextColor(Color.BLACK);
|
||||
axisY.setTextColor(Color.BLACK);
|
||||
|
||||
data.setAxisXBottom(axisX);
|
||||
data.setAxisYLeft(axisY);
|
||||
|
||||
data.setLines(lines);
|
||||
|
||||
chartView.setLineChartData(data);
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
|
||||
|
||||
public class MainActivity extends ActionBarActivity implements
|
||||
ActionBar.TabListener {
|
||||
|
||||
/**
|
||||
* The {@link android.support.v4.view.PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a {@link FragmentPagerAdapter}
|
||||
* derivative, which will keep every loaded fragment in memory. If this
|
||||
* becomes too memory intensive, it may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
private ViewPager mViewPager;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(prefs.getBoolean("btEnable", true)) {
|
||||
Log.i("ASD", "BT TRZE");
|
||||
String deviceName = prefs.getString("btDeviceName", "openScale");
|
||||
OpenScale.getInstance(getApplicationContext()).startBluetoothServer(deviceName);
|
||||
}
|
||||
|
||||
// Set up the action bar.
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
// primary sections of the activity.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(
|
||||
getSupportFragmentManager(), this);
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
// When swiping between different sections, select the corresponding
|
||||
// tab. We can also use ActionBar.Tab#select() to do this if we have
|
||||
// a reference to the Tab.
|
||||
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
actionBar.setSelectedNavigationItem(position);
|
||||
|
||||
FragmentUpdateListener fragment = (FragmentUpdateListener) mSectionsPagerAdapter.instantiateItem(mViewPager, position);
|
||||
if (fragment != null) {
|
||||
fragment.updateOnView(OpenScale.getInstance(mViewPager.getContext()).getScaleDBEntries());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// For each of the sections in the app, add a tab to the action bar.
|
||||
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
|
||||
// Create a tab with text corresponding to the page title defined by
|
||||
// the adapter. Also specify this Activity object, which implements
|
||||
// the TabListener interface, as the callback (listener) for when
|
||||
// this tab is selected.
|
||||
actionBar.addTab(actionBar.newTab()
|
||||
.setText(mSectionsPagerAdapter.getPageTitle(i))
|
||||
.setTabListener(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_settings) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelected(ActionBar.Tab tab,
|
||||
FragmentTransaction fragmentTransaction) {
|
||||
// When the given tab is selected, switch to the corresponding page in
|
||||
// the ViewPager.
|
||||
mViewPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(ActionBar.Tab tab,
|
||||
FragmentTransaction fragmentTransaction) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(ActionBar.Tab tab,
|
||||
FragmentTransaction fragmentTransaction) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private OverviewFragment overviewFrag;
|
||||
private GraphFragment graphFrag;
|
||||
private TableFragment tableFrag;
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm, Context con) {
|
||||
super(fm);
|
||||
|
||||
overviewFrag = new OverviewFragment();
|
||||
graphFrag = new GraphFragment();
|
||||
tableFrag = new TableFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// getItem is called to instantiate the fragment for the given page.
|
||||
// Return a PlaceholderFragment (defined as a static inner class
|
||||
// below).
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
return overviewFrag;
|
||||
case 1:
|
||||
return graphFrag;
|
||||
case 2:
|
||||
return tableFrag;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
Locale l = Locale.getDefault();
|
||||
switch (position) {
|
||||
case 0:
|
||||
return getString(R.string.title_overview).toUpperCase(l);
|
||||
case 1:
|
||||
return getString(R.string.title_graph).toUpperCase(l);
|
||||
case 2:
|
||||
return getString(R.string.title_frag).toUpperCase(l);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
|
||||
public class NewEntryActivity extends Activity {
|
||||
|
||||
private EditText txtWeight;
|
||||
private EditText txtFat;
|
||||
private EditText txtWater;
|
||||
private EditText txtMuscle;
|
||||
private EditText txtDate;
|
||||
private EditText txtTime;
|
||||
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
|
||||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_newentry);
|
||||
context = this;
|
||||
|
||||
txtWeight = (EditText) findViewById(R.id.txtWeight);
|
||||
txtFat = (EditText) findViewById(R.id.txtFat);
|
||||
txtWater = (EditText) findViewById(R.id.txtWater);
|
||||
txtMuscle = (EditText) findViewById(R.id.txtMuscle);
|
||||
txtDate = (EditText) findViewById(R.id.txtDate);
|
||||
txtTime = (EditText) findViewById(R.id.txtTime);
|
||||
Button btnDateSet = (Button) findViewById(R.id.btnDateSet);
|
||||
Button btnTimeSet = (Button) findViewById(R.id.btnTimeSet);
|
||||
|
||||
findViewById(R.id.btnAdd).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickAdd();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnCancel).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickCancel();
|
||||
}
|
||||
});
|
||||
|
||||
btnDateSet.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DatePickerDialog datePicker = new DatePickerDialog(context, datePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
datePicker.show();
|
||||
}
|
||||
});
|
||||
|
||||
btnTimeSet.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
TimePickerDialog timePicker = new TimePickerDialog(context, timePickerListener, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
|
||||
timePicker.show();
|
||||
}
|
||||
});
|
||||
|
||||
txtDate.setText(dateFormat.format(new Date()));
|
||||
txtTime.setText(timeFormat.format(new Date()));
|
||||
}
|
||||
|
||||
private boolean validateInput()
|
||||
{
|
||||
boolean validate = true;
|
||||
|
||||
if( txtWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWeight.setError("Weight value ist required!");
|
||||
validate = false;
|
||||
} else if( !(Float.valueOf(txtWeight.getText().toString()) >= 0 && Float.valueOf(txtWeight.getText().toString()) <= 300) )
|
||||
{
|
||||
txtWeight.setError("Value must be in range from 0 to 300!");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtFat.getText().toString().length() == 0 )
|
||||
{
|
||||
txtFat.setError("Fat value ist required!");
|
||||
validate = false;
|
||||
} else if(!isInRange(txtFat.getText().toString()))
|
||||
{
|
||||
txtFat.setError("Value must be in range from 0 to 100");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
|
||||
if( txtWater.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWater.setError("Water value ist required!");
|
||||
validate = false;
|
||||
} else if(!isInRange(txtWater.getText().toString()))
|
||||
{
|
||||
txtWater.setError("Value must be in range from 0 to 100");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtMuscle.getText().toString().length() == 0 )
|
||||
{
|
||||
txtMuscle.setError("Muscle value ist required!");
|
||||
validate = false;
|
||||
} else if(!isInRange(txtMuscle.getText().toString()))
|
||||
{
|
||||
txtMuscle.setError("Value must be in range from 0 to 100");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
private boolean isInRange(String value)
|
||||
{
|
||||
if (value.length() == 0)
|
||||
return false;
|
||||
|
||||
float val = Float.valueOf(value);
|
||||
|
||||
if (val >= 0 && val <= 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void btnOnClickAdd()
|
||||
{
|
||||
if (validateInput())
|
||||
{
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
float weight = Float.valueOf(txtWeight.getText().toString());
|
||||
float fat = Float.valueOf(txtFat.getText().toString());
|
||||
float water = Float.valueOf(txtWater.getText().toString());
|
||||
float muscle = Float.valueOf(txtMuscle.getText().toString());
|
||||
|
||||
String date = txtDate.getText().toString();
|
||||
String time = txtTime.getText().toString();
|
||||
|
||||
openScale.addScaleData(date + " " + time, weight, fat, water, muscle);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void btnOnClickCancel()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
|
||||
txtDate.setText(String.format("%02d.%02d.%04d", selectedDay, selectedMonth+1, selectedYear));
|
||||
}
|
||||
};
|
||||
|
||||
private TimePickerDialog.OnTimeSetListener timePickerListener = new TimePickerDialog.OnTimeSetListener() {
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
txtTime.setText(String.format("%02d:%02d", hourOfDay, minute));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lecho.lib.hellocharts.model.ArcValue;
|
||||
import lecho.lib.hellocharts.model.PieChartData;
|
||||
import lecho.lib.hellocharts.util.Utils;
|
||||
import lecho.lib.hellocharts.view.PieChartView;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
public class OverviewFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View overviewView;
|
||||
private PieChartView pieChart;
|
||||
private TextView txtAvgWeight;
|
||||
private TextView txtAvgFat;
|
||||
private TextView txtAvgWater;
|
||||
private TextView txtAvgMuscle;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
overviewView = inflater.inflate(R.layout.fragment_overview, container, false);
|
||||
|
||||
pieChart = (PieChartView) overviewView.findViewById(R.id.data_pie_chart);
|
||||
txtAvgWeight = (TextView) overviewView.findViewById(R.id.txtAvgWeight);
|
||||
txtAvgFat = (TextView) overviewView.findViewById(R.id.txtAvgFat);
|
||||
txtAvgWater = (TextView) overviewView.findViewById(R.id.txtAvgWater);
|
||||
txtAvgMuscle = (TextView) overviewView.findViewById(R.id.txtAvgMuscle);
|
||||
|
||||
overviewView.findViewById(R.id.btnInsertData).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickInsertData();
|
||||
}
|
||||
});
|
||||
|
||||
updateOnView(OpenScale.getInstance(overviewView.getContext()).getScaleDBEntries());
|
||||
|
||||
return overviewView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDBEntries)
|
||||
{
|
||||
List<ArcValue> arcValues = new ArrayList<ArcValue>();
|
||||
|
||||
if (scaleDBEntries.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScaleData lastEntry = scaleDBEntries.get(0);
|
||||
|
||||
arcValues.add(new ArcValue((float) lastEntry.fat, Utils.COLOR_ORANGE));
|
||||
arcValues.add(new ArcValue((float) lastEntry.water, Utils.COLOR_BLUE));
|
||||
arcValues.add(new ArcValue((float) lastEntry.muscle, Utils.COLOR_GREEN));
|
||||
|
||||
PieChartData pieChartData = new PieChartData(arcValues);
|
||||
pieChartData.setHasLabels(true);
|
||||
pieChartData.setHasCenterCircle(true);
|
||||
pieChartData.setCenterText1(Float.toString(lastEntry.weight) + " kg");
|
||||
pieChartData.setCenterText1FontSize(35);
|
||||
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy (EE)").format(lastEntry.date_time));
|
||||
pieChartData.setCenterText2FontSize(15);
|
||||
|
||||
pieChart.setPieChartData(pieChartData);
|
||||
|
||||
double avgWeight = 0;
|
||||
double avgFat = 0;
|
||||
double avgWater = 0;
|
||||
double avgMuscle = 0;
|
||||
|
||||
for (ScaleData scaleData : scaleDBEntries)
|
||||
{
|
||||
avgWeight += scaleData.weight;
|
||||
avgFat += scaleData.fat;
|
||||
avgWater += scaleData.water;
|
||||
avgMuscle += scaleData.muscle;
|
||||
}
|
||||
|
||||
avgWeight = avgWeight / scaleDBEntries.size();
|
||||
avgFat = avgFat / scaleDBEntries.size();
|
||||
avgWater = avgWater / scaleDBEntries.size();
|
||||
avgMuscle = avgMuscle / scaleDBEntries.size();
|
||||
|
||||
txtAvgWeight.setText(String.format( "%.1f kg", avgWeight));
|
||||
txtAvgFat.setText(String.format( "%.1f %%", avgFat));
|
||||
txtAvgWater.setText(String.format( "%.1f %%", avgWater));
|
||||
txtAvgMuscle.setText(String.format( "%.1f %%", avgMuscle));
|
||||
}
|
||||
|
||||
public void btnOnClickInsertData()
|
||||
{
|
||||
Intent intent = new Intent(overviewView.getContext(), NewEntryActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.MultiSelectListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
initSummary(getPreferenceScreen());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// Set up a listener whenever a key changes
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// Unregister the listener whenever a key changes
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
updatePrefSummary(findPreference(key));
|
||||
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
if(prefs.getBoolean("btEnable", true))
|
||||
{
|
||||
String deviceName = prefs.getString("btDeviceName", "openScale");
|
||||
OpenScale.getInstance(getApplicationContext()).startBluetoothServer(deviceName);
|
||||
} else {
|
||||
OpenScale.getInstance(getApplicationContext()).stopBluetoothServer();
|
||||
}
|
||||
}
|
||||
|
||||
private void initSummary(Preference p) {
|
||||
if (p instanceof PreferenceGroup) {
|
||||
PreferenceGroup pGrp = (PreferenceGroup) p;
|
||||
for (int i = 0; i < pGrp.getPreferenceCount(); i++) {
|
||||
initSummary(pGrp.getPreference(i));
|
||||
}
|
||||
} else {
|
||||
updatePrefSummary(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePrefSummary(Preference p) {
|
||||
if (p instanceof ListPreference) {
|
||||
ListPreference listPref = (ListPreference) p;
|
||||
p.setSummary(listPref.getEntry());
|
||||
}
|
||||
if (p instanceof EditTextPreference) {
|
||||
EditTextPreference editTextPref = (EditTextPreference) p;
|
||||
if (p.getTitle().toString().contains("assword"))
|
||||
{
|
||||
p.setSummary("******");
|
||||
} else {
|
||||
p.setSummary(editTextPref.getText());
|
||||
}
|
||||
}
|
||||
if (p instanceof MultiSelectListPreference) {
|
||||
EditTextPreference editTextPref = (EditTextPreference) p;
|
||||
p.setSummary(editTextPref.getText());
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(prefs.getBoolean("btEnable", true))
|
||||
{
|
||||
findPreference("btDeviceName").setEnabled(true);
|
||||
} else {
|
||||
findPreference("btDeviceName").setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TableRow.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View tableView;
|
||||
private TableLayout tableDataView;
|
||||
|
||||
public TableFragment() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
tableView = inflater.inflate(R.layout.fragment_table, container, false);
|
||||
|
||||
tableDataView = (TableLayout) tableView.findViewById(R.id.tableDataView);
|
||||
|
||||
tableView.findViewById(R.id.btnImportData).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
openImportDialog();
|
||||
}
|
||||
});
|
||||
|
||||
tableView.findViewById(R.id.btnExportData).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
openExportDialog();
|
||||
}
|
||||
});
|
||||
|
||||
tableView.findViewById(R.id.btnDeleteAll).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
openDeleteAllDialog();
|
||||
}
|
||||
});
|
||||
|
||||
return tableView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDBEntries)
|
||||
{
|
||||
TableRow headerRow = (TableRow) tableView.findViewById(R.id.tableHeader);
|
||||
tableDataView.removeAllViews();
|
||||
tableDataView.addView(headerRow);
|
||||
|
||||
for(ScaleData scaleEntry: scaleDBEntries)
|
||||
{
|
||||
TableRow dataRow = new TableRow(tableView.getContext());
|
||||
dataRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
|
||||
TextView dateTextView = new TextView(tableView.getContext());
|
||||
dateTextView.setText(new SimpleDateFormat("dd. MMM yyyy (EE)").format(scaleEntry.date_time));
|
||||
dateTextView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(dateTextView);
|
||||
|
||||
TextView timeTextView = new TextView(tableView.getContext());
|
||||
timeTextView.setText(new SimpleDateFormat("HH:mm").format(scaleEntry.date_time));
|
||||
timeTextView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(timeTextView);
|
||||
|
||||
TextView weightView = new TextView(tableView.getContext());
|
||||
weightView.setText(Float.toString(scaleEntry.weight));
|
||||
weightView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(weightView);
|
||||
|
||||
TextView fatView = new TextView(tableView.getContext());
|
||||
fatView.setText(Float.toString(scaleEntry.fat));
|
||||
fatView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(fatView);
|
||||
|
||||
TextView waterView = new TextView(tableView.getContext());
|
||||
waterView.setText(Float.toString(scaleEntry.water));
|
||||
waterView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(waterView);
|
||||
|
||||
TextView muscleView = new TextView(tableView.getContext());
|
||||
muscleView.setText(Float.toString(scaleEntry.muscle));
|
||||
muscleView.setPadding(5, 5, 5, 5);
|
||||
dataRow.addView(muscleView);
|
||||
|
||||
tableDataView.addView(dataRow, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
}
|
||||
|
||||
public void openImportDialog()
|
||||
{
|
||||
AlertDialog.Builder filenameDialog = new AlertDialog.Builder(getActivity());
|
||||
|
||||
filenameDialog.setTitle("Set filename on /sdcard ...");
|
||||
|
||||
final EditText txtFilename = new EditText(tableView.getContext());
|
||||
txtFilename.setText("/openScale_data.csv");
|
||||
|
||||
filenameDialog.setView(txtFilename);
|
||||
|
||||
filenameDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
boolean isError = false;
|
||||
|
||||
try {
|
||||
OpenScale.getInstance(tableView.getContext()).importData(Environment.getExternalStorageDirectory().getPath() + txtFilename.getText().toString());
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(tableView.getContext(), "Error importing " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError) {
|
||||
Toast.makeText(tableView.getContext(), "Data imported from /sdcard" + txtFilename.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
updateOnView(OpenScale.getInstance(tableView.getContext()).getScaleDBEntries());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
filenameDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
filenameDialog.show();
|
||||
}
|
||||
|
||||
public void openExportDialog()
|
||||
{
|
||||
AlertDialog.Builder filenameDialog = new AlertDialog.Builder(getActivity());
|
||||
|
||||
filenameDialog.setTitle("Set filename on /sdcard ...");
|
||||
|
||||
final EditText txtFilename = new EditText(tableView.getContext());
|
||||
txtFilename.setText("/openScale_data.csv");
|
||||
|
||||
filenameDialog.setView(txtFilename);
|
||||
|
||||
filenameDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
boolean isError = false;
|
||||
|
||||
try {
|
||||
OpenScale.getInstance(tableView.getContext()).exportData(Environment.getExternalStorageDirectory().getPath() + txtFilename.getText().toString());
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(tableView.getContext(), "Error exporting " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError) {
|
||||
Toast.makeText(tableView.getContext(), "Data exported to /sdcard" + txtFilename.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
filenameDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
filenameDialog.show();
|
||||
}
|
||||
|
||||
public void openDeleteAllDialog()
|
||||
{
|
||||
AlertDialog.Builder deleteAllDialog = new AlertDialog.Builder(getActivity());
|
||||
|
||||
deleteAllDialog.setMessage("Do you really want to delete all database entries?");
|
||||
|
||||
deleteAllDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
OpenScale.getInstance(tableView.getContext()).deleteAllDBEntries();
|
||||
|
||||
Toast.makeText(tableView.getContext(), "All database entries deleted!", Toast.LENGTH_SHORT).show();
|
||||
updateOnView(OpenScale.getInstance(tableView.getContext()).getScaleDBEntries());
|
||||
}
|
||||
});
|
||||
|
||||
deleteAllDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
deleteAllDialog.show();
|
||||
}
|
||||
}
|
5
android_app/app/src/main/res/drawable/flat_selector.xml
Normal file
5
android_app/app/src/main/res/drawable/flat_selector.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/rect_pressed"/>
|
||||
<item android:drawable="@drawable/rect_normal"/>
|
||||
</selector>
|
BIN
android_app/app/src/main/res/drawable/ic_launcher.png
Normal file
BIN
android_app/app/src/main/res/drawable/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
11
android_app/app/src/main/res/drawable/rect_normal.xml
Normal file
11
android_app/app/src/main/res/drawable/rect_normal.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/rect_pressed" />
|
||||
|
||||
<item android:bottom="@dimen/layer_padding">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/corner_radius" />
|
||||
<solid android:color="@color/blue_normal" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
6
android_app/app/src/main/res/drawable/rect_pressed.xml
Normal file
6
android_app/app/src/main/res/drawable/rect_pressed.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/corner_radius" />
|
||||
<solid android:color="@color/blue_pressed" />
|
||||
</shape>
|
6
android_app/app/src/main/res/layout/activity_main.xml
Normal file
6
android_app/app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.health.openscale.gui.MainActivity" />
|
189
android_app/app/src/main/res/layout/activity_newentry.xml
Normal file
189
android_app/app/src/main/res/layout/activity_newentry.xml
Normal file
@ -0,0 +1,189 @@
|
||||
<?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/com.health.openscale"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:stretchColumns="*" >
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Weight" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="Enter value in kg"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Fat" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtFat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="Enter value in %"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Water" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtWater"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="Enter value in %"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgFat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Muscle" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtMuscle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="Enter value in %"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:inputType="date" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDateSet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Set"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgWater"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Time" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:ems="10"
|
||||
android:enabled="false"
|
||||
android:inputType="time" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTimeSet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Set"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="Add" />
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="Cancel" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
25
android_app/app/src/main/res/layout/fragment_graph.xml
Normal file
25
android_app/app/src/main/res/layout/fragment_graph.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<RelativeLayout 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"
|
||||
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.health.openscale.MainActivity$PlaceholderFragment" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<lecho.lib.hellocharts.view.LineChartView
|
||||
android:id="@+id/data_chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
122
android_app/app/src/main/res/layout/fragment_overview.xml
Normal file
122
android_app/app/src/main/res/layout/fragment_overview.xml
Normal file
@ -0,0 +1,122 @@
|
||||
<RelativeLayout 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"
|
||||
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.health.openscale.MainActivity$PlaceholderFragment" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<lecho.lib.hellocharts.view.PieChartView
|
||||
android:id="@+id/data_pie_chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="top|center"
|
||||
android:layout_weight="0" />
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="Weight Ø"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgWeight"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="Fat Ø"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgFat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:text="0" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="Water Ø"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgWater"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="Muscle Ø"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtAvgMuscle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:text="0" />
|
||||
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|bottom"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnInsertData"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="+"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
111
android_app/app/src/main/res/layout/fragment_table.xml
Normal file
111
android_app/app/src/main/res/layout/fragment_table.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<RelativeLayout 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"
|
||||
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.health.openscale.MainActivity$PlaceholderFragment" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="80dp" >
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/tableDataView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="*" >
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Date"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Time"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Weight"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Fat"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Water"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Muscle"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDeleteAll"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="Delete All"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="15dp" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnImportData"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="Import"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnExportData"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="Export"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
12
android_app/app/src/main/res/menu/main.xml
Normal file
12
android_app/app/src/main/res/menu/main.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<menu 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"
|
||||
tools:context="com.example.openscale.MainActivity" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
12
android_app/app/src/main/res/values-v14/styles.xml
Normal file
12
android_app/app/src/main/res/values-v14/styles.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 14+. This theme completely replaces
|
||||
AppBaseTheme from BOTH res/values/styles.xml and
|
||||
res/values-v11/styles.xml on API 14+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- API 14 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
5
android_app/app/src/main/res/values/colors.xml
Normal file
5
android_app/app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="blue_pressed">@android:color/holo_blue_dark</color>
|
||||
<color name="blue_normal">@android:color/holo_blue_light</color>
|
||||
</resources>
|
9
android_app/app/src/main/res/values/dimens.xml
Normal file
9
android_app/app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="corner_radius">4dp</dimen>
|
||||
<dimen name="layer_padding">3dp</dimen>
|
||||
|
||||
</resources>
|
10
android_app/app/src/main/res/values/strings.xml
Normal file
10
android_app/app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">openScale</string>
|
||||
<string name="title_overview">overview</string>
|
||||
<string name="title_graph">graph</string>
|
||||
<string name="title_frag">table</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
</resources>
|
20
android_app/app/src/main/res/values/styles.xml
Normal file
20
android_app/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
9
android_app/app/src/main/res/xml/preferences.xml
Normal file
9
android_app/app/src/main/res/xml/preferences.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="Bluetooth"><CheckBoxPreference android:title="Enable Bluetooth Server" android:key="btEnable" android:defaultValue="true"/><EditTextPreference android:key="btDeviceName" android:defaultValue="openScale" android:title="Device Name"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
</PreferenceScreen>
|
15
android_app/build.gradle
Normal file
15
android_app/build.gradle
Normal file
@ -0,0 +1,15 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
BIN
android_app/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
android_app/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
android_app/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
android_app/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed Apr 10 15:27:10 PDT 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
164
android_app/gradlew
vendored
Executable file
164
android_app/gradlew
vendored
Executable file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
android_app/gradlew.bat
vendored
Normal file
90
android_app/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
21
android_app/openScale.iml
Normal file
21
android_app/openScale.iml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
1
android_app/settings.gradle
Normal file
1
android_app/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app'
|
Loading…
x
Reference in New Issue
Block a user