Commit b771f479 authored by Kethmi1999's avatar Kethmi1999

Android app

parent e7d215d5
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
WaterQualityApp
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/New folder (2)/Update App/app/src/main/res/layout/activity_login_screen.xml" value="0.1" />
<entry key="..\:/New folder (2)/Update App/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_login_screen.xml" value="0.10364583333333334" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_main.xml" value="0.209375" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_select_device.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_setting.xml" value="0.209375" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_taks_part.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_tank2.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_tank2_new.xml" value="0.12962962962962962" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_toolbar.xml" value="0.12916666666666668" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_usage.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_welcome.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/activity_welcome2.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/device_info_layout.xml" value="0.1" />
<entry key="..\:/Users/dtc/Desktop/APP/WaterQualityApp/app/src/main/res/layout/tank2.xml" value="0.12962962962962962" />
<entry key="..\:/Users/dtc/Desktop/Final Dev/Water Care App/app/src/main/res/layout/activity_login_screen.xml" value="0.18333333333333332" />
<entry key="..\:/Users/dtc/Desktop/Final Dev/Water Care App/app/src/main/res/layout/activity_main.xml" value="0.19375" />
<entry key="..\:/YEAR 04/Reasearch/WaterQualityApp/app/src/main/res/layout/activity_main.xml" value="0.1" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 33
buildToolsVersion "30.0.2"
defaultConfig {
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
}
applicationId "com.example.waterqualityapp"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.firebase:firebase-firestore:21.3.1'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
{
"project_info": {
"project_number": "35762680707",
"project_id": "my-water-quality-app",
"storage_bucket": "my-water-quality-app.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:35762680707:android:4a67d381b6a2d9469c3cb6",
"android_client_info": {
"package_name": "com.example.waterqualityapp"
}
},
"oauth_client": [
{
"client_id": "35762680707-u0i4mqqsvkr9fmhat2ist3btv5psb1cr.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCwsFf13qRJl9QAkrg0uv65fUFzN5v-kQM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "35762680707-u0i4mqqsvkr9fmhat2ist3btv5psb1cr.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.example.waterqualityapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.waterqualityapp", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.waterqualityapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <!-- Permissions for Bluetooth access -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
tools:ignore="CoarseFineLocation" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!--Permissions for internet-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WaterQualityApp">
<activity
android:name=".LoginScreen"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SelectDeviceActivity"
android:exported="false" />
<activity
android:name=".Tank2_New"
android:exported="false" />
<activity
android:name=".Toolbar"
android:exported="false" />
<activity
android:name=".Usage"
android:exported="false" />
<activity
android:name=".Setting"
android:exported="false" />
<activity
android:name=".Welcome2"
android:exported="false" />
<activity
android:name=".Welcome"
android:exported="false" />
<activity
android:name=".Tanks_part"
android:exported="false" />
<activity
android:name=".Tank2"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false">
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.waterqualityapp;
public class DeviceInfoModel {
private String deviceName, deviceHardwareAddress;
public DeviceInfoModel(){}
public DeviceInfoModel(String deviceName, String deviceHardwareAddress){
this.deviceName = deviceName;
this.deviceHardwareAddress = deviceHardwareAddress;
}
public String getDeviceName(){return deviceName;}
public String getDeviceHardwareAddress(){return deviceHardwareAddress;}
}
\ No newline at end of file
package com.example.waterqualityapp;
import android.content.Intent;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class DeviceListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private List<Object> deviceList;
public static class ViewHolder extends RecyclerView.ViewHolder {
TextView textName, textAddress;
LinearLayout linearLayout;
public ViewHolder(View v) {
super(v);
textName = v.findViewById(R.id.textViewDeviceName);
textAddress = v.findViewById(R.id.textViewDeviceAddress);
linearLayout = v.findViewById(R.id.linearLayoutDeviceInfo);
}
}
public DeviceListAdapter(Context context, List<Object> deviceList) {
this.context = context;
this.deviceList = deviceList;
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.device_info_layout, parent, false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
ViewHolder itemHolder = (ViewHolder) holder;
final DeviceInfoModel deviceInfoModel = (DeviceInfoModel) deviceList.get(position);
itemHolder.textName.setText(deviceInfoModel.getDeviceName());
itemHolder.textAddress.setText(deviceInfoModel.getDeviceHardwareAddress());
// When a device is selected
itemHolder.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context,MainActivity.class);
// Send device details to the MainActivity
intent.putExtra("deviceName", deviceInfoModel.getDeviceName());
intent.putExtra("deviceAddress",deviceInfoModel.getDeviceHardwareAddress());
// Call MainActivity
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
int dataCount = deviceList.size();
return dataCount;
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class LoginScreen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
Button login = findViewById(R.id.loginBtn);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginScreen.this, Welcome2.class);
LoginScreen.this.startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;
//firebase
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import static android.content.ContentValues.TAG;
public class MainActivity extends AppCompatActivity {
private String deviceName = null;
private String deviceAddress;
public static Handler handler;
public static BluetoothSocket mmSocket;
public static ConnectedThread connectedThread;
public static CreateConnectThread createConnectThread;
private final static int CONNECTING_STATUS = 1; // used in bluetooth handler to identify message status
private final static int MESSAGE_READ = 2; // used in bluetooth handler to identify message update
//buffering arrays
ArrayList<Double> phArray = new ArrayList<Double>();
ArrayList<Double> tdsArray = new ArrayList<Double>();
ArrayList<Double> distanceArray = new ArrayList<Double>();
ArrayList<Double> turbidityArray = new ArrayList<Double>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// UI Initialization
final Button buttonConnect = findViewById(R.id.buttonConnect);
final Toolbar toolbar = findViewById(R.id.toolbar);
final ProgressBar progressBar = findViewById(R.id.progressBar);
progressBar.setVisibility(View.GONE);
final TextView textViewInfo = findViewById(R.id.textViewInfo);
final Button buttonToggle = findViewById(R.id.buttonToggle);
buttonToggle.setEnabled(false);
// final ImageView imageView = findViewById(R.id.imageView);
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
Button btnTDS = findViewById(R.id.btnTDS);
Button btnDistance = findViewById(R.id.btnDistance);
Button btnPH = findViewById(R.id.btnPH);
Button btnTurbidity = findViewById(R.id.btnTurb);
// If a bluetooth device has been selected from SelectDeviceActivity
deviceName = getIntent().getStringExtra("deviceName");
if (deviceName != null){
// Get the device address to make BT Connection
deviceAddress = getIntent().getStringExtra("deviceAddress");
// Show progree and connection status
toolbar.setSubtitle("Connecting to " + deviceName + "...");
progressBar.setVisibility(View.VISIBLE);
buttonConnect.setEnabled(false);
/*
This is the most important piece of code. When "deviceName" is found
the code will call a new thread to create a bluetooth connection to the
selected device (see the thread code below)
*/
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
createConnectThread = new CreateConnectThread(bluetoothAdapter,deviceAddress);
createConnectThread.start();
}
/*
Second most important piece of Code. GUI Handler
*/
handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg){
switch (msg.what){
case CONNECTING_STATUS:
switch(msg.arg1){
case 1:
toolbar.setSubtitle("Connected to " + deviceName);
progressBar.setVisibility(View.GONE);
buttonConnect.setEnabled(true);
buttonToggle.setEnabled(true);
break;
case -1:
toolbar.setSubtitle("Device fails to connect");
progressBar.setVisibility(View.GONE);
buttonConnect.setEnabled(true);
break;
}
break;
case MESSAGE_READ:
String arduinoMsg = msg.obj.toString(); // Read message from Arduino
String[] arrOfStr = arduinoMsg.split("_");
String type = arrOfStr[0];
switch (type.toLowerCase()){
case "led is turned on":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOn));
textViewInfo.setText("Arduino Message : " + arduinoMsg);
break;
case "led is turned off":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
textViewInfo.setText("Arduino Message : " + arduinoMsg);
break;
case "tds":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
double tdsVal = Double.parseDouble(arrOfStr[1]);
tdsArray.add(tdsVal);
textViewInfo.setText("TDS : " + arrOfStr[1]);
break;
case "distance":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
double disVal = Double.parseDouble(arrOfStr[1]);
distanceArray.add(disVal);
textViewInfo.setText("Distance : " + arrOfStr[1]);
break;
case "ph":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
double phVal = Double.parseDouble(arrOfStr[1]);
phArray.add(phVal);
textViewInfo.setText("PH : " + arrOfStr[1]);
break;
case "turbidity":
// imageView.setBackgroundColor(getResources().getColor(R.color.colorOff));
double turbVal = Double.parseDouble(arrOfStr[1]);
turbidityArray.add(turbVal);
textViewInfo.setText("Turbidity : " + arrOfStr[1]);
break;
}
break;
}
}
};
// Select Bluetooth Device
buttonConnect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Move to adapter list
Intent intent = new Intent(MainActivity.this, SelectDeviceActivity.class);
startActivity(intent);
}
});
// Button to ON/OFF LED on Arduino Board
buttonToggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
double ph=0;
double tds=0;
double turb=0;
double dist=0;
String sph="";
String stds="";
String sturb="";
String sdis="";
if(!phArray.isEmpty()){
ph = phArray.get(0);
sph = String.valueOf(ph);
}
if(!tdsArray.isEmpty()){
tds = tdsArray.get(0);
stds = String.valueOf(tds);
}
if(!turbidityArray.isEmpty()){
turb = turbidityArray.get(0);
sturb = String.valueOf(turb);
}
if(!distanceArray.isEmpty()){
dist = distanceArray.get(0);
sdis = String.valueOf(dist);
}
textViewInfo.setText("ph="+sph+"tds="+stds+"distance="+sdis+"turbidity="+sturb);
addToFirestore(progressBar,phArray,tdsArray,distanceArray,turbidityArray);
}
});
btnTDS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String cmdText = "<get tds>";
String btnState = buttonToggle.getText().toString().toLowerCase();
switch ("get tds"){
case "get tds":
// Command to turn on LED on Arduino. Must match with the command in Arduino code
cmdText = "<get tds>";
break;
case "turn off":
// Command to turn off LED on Arduino. Must match with the command in Arduino code
cmdText = "<turn off>";
break;
}
// Send command to Arduino board
connectedThread.write(cmdText);
}
});
btnDistance.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String cmdText = "<get dis>";
String btnState = buttonToggle.getText().toString().toLowerCase();
switch ("get dis"){
case "get dis":
// Command to turn on LED on Arduino. Must match with the command in Arduino code
cmdText = "<get dis>";
break;
case "turn off":
// Command to turn off LED on Arduino. Must match with the command in Arduino code
cmdText = "<turn off>";
break;
}
// Send command to Arduino board
connectedThread.write(cmdText);
}
});
btnPH.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String cmdText = "<get ph>";
String btnState = buttonToggle.getText().toString().toLowerCase();
switch ("get ph"){
case "get ph":
// Command to turn on LED on Arduino. Must match with the command in Arduino code
cmdText = "<get ph>";
break;
case "turn off":
// Command to turn off LED on Arduino. Must match with the command in Arduino code
cmdText = "<turn off>";
break;
}
// Send command to Arduino board
connectedThread.write(cmdText);
}
});
btnTurbidity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String cmdText = "<get turbidity>";
String btnState = buttonToggle.getText().toString().toLowerCase();
switch ("get turbidity"){
case "get turbidity":
// Command to turn on LED on Arduino. Must match with the command in Arduino code
cmdText = "<get turbidity>";
break;
case "turn off":
// Command to turn off LED on Arduino. Must match with the command in Arduino code
cmdText = "<turn off>";
break;
}
// Send command to Arduino board
connectedThread.write(cmdText);
}
});
}
private void addToFirestore(ProgressBar progressBar, ArrayList<Double> phArray, ArrayList<Double> tdsArray, ArrayList<Double> distanceArray, ArrayList<Double> turbidityArray) {
progressBar.setVisibility(View.VISIBLE);
double area = 20;
double totalVolume = 10000;
double avgPH = getAvg(phArray);
double avgTds = getAvg(tdsArray);
double avgVolume = totalVolume - getAvg(distanceArray) * area;
double avgTurb = getAvg(turbidityArray);
addToDatabase(avgPH,"phValues",progressBar);
addToDatabase(avgTds,"tdsValues",progressBar);
addToDatabase(avgVolume,"volumeValues",progressBar);
addToDatabase(avgTurb,"turbidityValues",progressBar);
progressBar.setVisibility(View.GONE);
}
private void addToDatabase(Double avgVal, String collectionRef, ProgressBar progressBar) {
CollectionReference dbPh = FirebaseFirestore.getInstance().collection(collectionRef);
Map<String, Double> values = new HashMap<>();
values.put("data", avgVal);
values.put("time", Double.valueOf(System.currentTimeMillis()));
dbPh.add(values).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
// after the data addition is successful
// we are displaying a success toast message.
Toast.makeText(MainActivity.this, "Your Data has been added to Firebase Firestore", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// this method is called when the data addition process is failed.
// displaying a toast message when data addition is failed.
Toast.makeText(MainActivity.this, "Fail to add data \n" + e, Toast.LENGTH_SHORT).show();
}
});
}
private Double getAvg(ArrayList<Double> valArray) {
double avg=0;
double total = 0;
for(int i = 0; i < valArray.size(); i++){
total += valArray.get(i);
}
avg = total/(valArray.size());
return avg;
}
/* ============================ Thread to Create Bluetooth Connection =================================== */
public static class CreateConnectThread extends Thread {
@SuppressLint("MissingPermission")
public CreateConnectThread(BluetoothAdapter bluetoothAdapter, String address) {
/*
Use a temporary object that is later assigned to mmSocket
because mmSocket is final.
*/
BluetoothDevice bluetoothDevice = bluetoothAdapter.getRemoteDevice(address);
BluetoothSocket tmp = null;
@SuppressLint("MissingPermission") UUID uuid = bluetoothDevice.getUuids()[0].getUuid();
try {
/*
Get a BluetoothSocket to connect with the given BluetoothDevice.
Due to Android device varieties,the method below may not work fo different devices.
You should try using other methods i.e. :
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
*/
tmp = bluetoothDevice.createInsecureRfcommSocketToServiceRecord(uuid);
} catch (IOException e) {
Log.e(TAG, "Socket's create() method failed", e);
}
mmSocket = tmp;
}
@SuppressLint("MissingPermission")
public void run() {
// Cancel discovery because it otherwise slows down the connection.
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
bluetoothAdapter.cancelDiscovery();
try {
// Connect to the remote device through the socket. This call blocks
// until it succeeds or throws an exception.
mmSocket.connect();
Log.e("Status", "Device connected");
handler.obtainMessage(CONNECTING_STATUS, 1, -1).sendToTarget();
} catch (IOException connectException) {
// Unable to connect; close the socket and return.
try {
mmSocket.close();
Log.e("Status", "Cannot connect to device");
handler.obtainMessage(CONNECTING_STATUS, -1, -1).sendToTarget();
} catch (IOException closeException) {
Log.e(TAG, "Could not close the client socket", closeException);
}
return;
}
// The connection attempt succeeded. Perform work associated with
// the connection in a separate thread.
connectedThread = new ConnectedThread(mmSocket);
connectedThread.run();
}
// Closes the client socket and causes the thread to finish.
public void cancel() {
try {
mmSocket.close();
} catch (IOException e) {
Log.e(TAG, "Could not close the client socket", e);
}
}
}
/* =============================== Thread for Data Transfer =========================================== */
public static class ConnectedThread extends Thread {
private final BluetoothSocket mmSocket;
private final InputStream mmInStream;
private final OutputStream mmOutStream;
public ConnectedThread(BluetoothSocket socket) {
mmSocket = socket;
InputStream tmpIn = null;
OutputStream tmpOut = null;
// Get the input and output streams, using temp objects because
// member streams are final
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
} catch (IOException e) { }
mmInStream = tmpIn;
mmOutStream = tmpOut;
}
public void run() {
byte[] buffer = new byte[1024]; // buffer store for the stream
int bytes = 0; // bytes returned from read()
// Keep listening to the InputStream until an exception occurs
while (true) {
try {
/*
Read from the InputStream from Arduino until termination character is reached.
Then send the whole String message to GUI Handler.
*/
buffer[bytes] = (byte) mmInStream.read();
String readMessage;
if (buffer[bytes] == '\n'){
readMessage = new String(buffer,0,bytes);
Log.e("Arduino Message",readMessage);
handler.obtainMessage(MESSAGE_READ,readMessage).sendToTarget();
bytes = 0;
} else {
bytes++;
}
} catch (IOException e) {
e.printStackTrace();
break;
}
}
}
/* Call this from the main activity to send data to the remote device */
public void write(String input) {
byte[] bytes = input.getBytes(); //converts entered String into bytes
try {
mmOutStream.write(bytes);
} catch (IOException e) {
Log.e("Send Error","Unable to send message",e);
}
}
/* Call this from the main activity to shutdown the connection */
public void cancel() {
try {
mmSocket.close();
} catch (IOException e) { }
}
}
/* ============================ Terminate Connection at BackPress ====================== */
@Override
public void onBackPressed() {
// Terminate Bluetooth Connection and close app
if (createConnectThread != null){
createConnectThread.cancel();
}
Intent a = new Intent(Intent.ACTION_MAIN);
a.addCategory(Intent.CATEGORY_HOME);
a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(a);
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.view.View;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class SelectDeviceActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_device);
// Bluetooth Setup
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// Get List of Paired Bluetooth Device
@SuppressLint("MissingPermission") Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
List<Object> deviceList = new ArrayList<>();
if (pairedDevices.size() > 0) {
// There are paired devices. Get the name and address of each paired device.
for (BluetoothDevice device : pairedDevices) {
@SuppressLint("MissingPermission") String deviceName = device.getName();
String deviceHardwareAddress = device.getAddress(); // MAC address
DeviceInfoModel deviceInfoModel = new DeviceInfoModel(deviceName,deviceHardwareAddress);
deviceList.add(deviceInfoModel);
}
// Display paired device using recyclerView
RecyclerView recyclerView = findViewById(R.id.recyclerViewDevice);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
DeviceListAdapter deviceListAdapter = new DeviceListAdapter(this,deviceList);
recyclerView.setAdapter(deviceListAdapter);
recyclerView.setItemAnimator(new DefaultItemAnimator());
} else {
View view = findViewById(R.id.recyclerViewDevice);
Snackbar snackbar = Snackbar.make(view, "Activate Bluetooth or pair a Bluetooth device", Snackbar.LENGTH_INDEFINITE);
snackbar.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) { }
});
snackbar.show();
}
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class Setting extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
ImageView backBtn = (ImageView) findViewById(R.id.backBtn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Setting.super.onBackPressed();
}
});
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Tank2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tank2);
Button yourTanks = (Button) findViewById(R.id.yourtanks);
yourTanks.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Tank2.this, Tanks_part.class);
Tank2.this.startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class Tank2_New extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tank2_new);
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Tanks_part extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_taks_part);
Button tank1Btn = (Button) findViewById(R.id.tank1btn);
Button tank2Btn = (Button) findViewById(R.id.tank2btn);
tank2Btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Tanks_part.this, MainActivity.class);
Tanks_part.this.startActivity(intent);
}
});
tank1Btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Tanks_part.this, MainActivity.class);
Tanks_part.this.startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class Toolbar extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_toolbar);
ImageView backBtn = (ImageView) findViewById(R.id.backBtn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toolbar.super.onBackPressed();
}
});
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class Usage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_usage);
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
public class Welcome extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
Intent intent = new Intent(Welcome.this, Tank2.class);
Welcome.this.startActivity(intent);
}
}
\ No newline at end of file
package com.example.waterqualityapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Welcome2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome2);
Button usageBtn = (Button) findViewById(R.id.usagebtn);
Button youTanks = (Button) findViewById(R.id.yourtanks);
Button settings = (Button) findViewById(R.id.settingsButton);
usageBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Welcome2.this, Usage.class);
Welcome2.this.startActivity(intent);
}
});
youTanks.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Welcome2.this, Tanks_part.class);
Welcome2.this.startActivity(intent);
}
});
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Welcome2.this, Setting.class);
Welcome2.this.startActivity(intent);
}
});
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2596be"
tools:context=".LoginScreen">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Water Care"
android:textColor="#260461"
android:textSize="60dp" />
<androidx.cardview.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_marginTop="100dp"
android:layout_marginBottom="10dp"
app:cardBackgroundColor="@color/purple_500"
app:cardCornerRadius="20dp"
app:cardElevation="10dp"
app:cardMaxElevation="12dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="46dp"
android:focusable="true"
android:hint="Password"
android:inputType="textPassword"
android:textColorHighlight="#FF1515"
android:textColorHint="#FFFF00" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText"
android:layout_alignEnd="@+id/editText"
android:layout_alignRight="@+id/editText"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:ems="10"
android:hint="Enter Name"
android:textColorHint="#FFFF00" />
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/loginBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/card"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="115dp"
android:layout_marginTop="132dp"
android:layout_marginEnd="114dp"
android:text="Login" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="-125dp"
android:layout_marginLeft="-125dp"
android:layout_marginBottom="191dp"
android:layout_toEndOf="@+id/textview"
android:layout_toRightOf="@+id/textview"
android:text="Cancel"
tools:ignore="UnknownId" />
</RelativeLayout>
\ No newline at end of file
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:id="@+id/constrainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
tools:context=".MainActivity">
<Button
android:id="@+id/btnTurb"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="616dp"
android:text="Turbidity"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnPH"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="564dp"
android:text="Get PH"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnTDS"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="450dp"
android:text="Get TDS"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:subtitleTextColor="@android:color/background_light"
app:title="Bluetooth Connection"
app:titleTextColor="@android:color/background_light" />
<Button
android:id="@+id/buttonConnect"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Connect"
android:textColor="@android:color/background_light"
app:layout_constraintBottom_toBottomOf="@+id/toolbar"
app:layout_constraintEnd_toEndOf="@+id/toolbar"
app:layout_constraintTop_toTopOf="@+id/toolbar" />
<Button
android:id="@+id/buttonToggle"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
android:text="Upload"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnDistance"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="508dp"
android:text="Get Volume"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewInfo"
android:layout_width="379dp"
android:layout_height="wrap_content"
android:layout_marginTop="192dp"
android:textAlignment="center"
android:textStyle="italic"
android:textSize="20dp"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
tools:layout_editor_absoluteX="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SelectDeviceActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewDevice"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Setting">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="@+id/left_icon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="53dp"
android:layout_toEndOf="@+id/left_icon"
android:text="Settings"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/right_icon"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
<ImageView
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="?attr/actionModeCloseDrawable" />
</RelativeLayout>
<Button
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="100dp"
android:layout_marginStart="100dp"
android:id="@+id/helpbtn"
android:layout_marginTop="100dp"
android:text="Help"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="100dp"
android:layout_marginStart="100dp"
android:id="@+id/reportbtn"
android:layout_marginTop="160dp"
android:text="Report An Issue"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="100dp"
android:layout_marginStart="100dp"
android:id="@+id/aboutbtn"
android:layout_marginTop="220dp"
android:text="About Us"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/accountbtn"
android:layout_marginTop="280dp"
android:text="Account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="100dp"
android:layout_marginStart="100dp"/>
<Button
android:id="@+id/logoutbtn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="340dp"
android:layout_marginEnd="100dp"
android:text="Logout" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_light"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="@+id/left_icon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textColor="@color/black"
android:textSize="20sp"
android:layout_toEndOf="@+id/left_icon"
android:layout_centerVertical="true"
android:text="Your Tanks"/>
<Button
android:id="@+id/tank1btn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="120dp"
android:layout_marginEnd="100dp"
android:text="Tank 1" />
<Button
android:id="@+id/tank2btn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="170dp"
android:layout_marginEnd="100dp"
android:text="Tank 2" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/right_icon"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/imageView6"
android:layout_width="148dp"
android:layout_height="127dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="223dp"
android:layout_marginTop="345dp"
android:layout_marginEnd="41dp"
android:layout_marginBottom="258dp" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="148dp"
android:layout_height="127dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="223dp"
android:layout_marginTop="201dp"
android:layout_marginEnd="41dp"
android:layout_marginBottom="403dp" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="148dp"
android:layout_height="127dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="48dp"
android:layout_marginTop="203dp"
android:layout_marginEnd="216dp"
android:layout_marginBottom="401dp" />
<ImageView
android:id="@+id/imageView9"
android:layout_width="148dp"
android:layout_height="127dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="51dp"
android:layout_marginTop="349dp"
android:layout_marginEnd="213dp"
android:layout_marginBottom="255dp" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_light"
tools:context=".MainActivity">
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Tank2_New">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="@+id/left_icon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textColor="@color/black"
android:textSize="20sp"
android:layout_toEndOf="@+id/left_icon"
android:layout_centerVertical="true"
android:text="Tank 2"/>
<Button
android:id="@+id/tank1btn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="120dp"
android:layout_marginEnd="100dp"
android:text="Quality : " />
<Button
android:id="@+id/tank2btn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="170dp"
android:layout_marginEnd="100dp"
android:text="Status : " />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/right_icon"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Toolbar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<Button
android:id="@+id/toolbarbtn"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="100dp"
android:layout_marginTop="140dp"
android:layout_marginEnd="100dp"
android:text="Toolbar" />
<ImageView
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="?attr/actionModeCloseDrawable" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Usage">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="@+id/left_icon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:textColor="@color/black"
android:textSize="20sp"
android:layout_toEndOf="@+id/left_icon"
android:layout_centerVertical="true"
android:text="Usage"
android:textStyle="bold"/>
</RelativeLayout>
<TextView
android:id="@+id/textViewDaily"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginTop="100dp"
android:layout_marginEnd="106dp"
android:text="Average Usage Per Day : 4litre"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewmonthly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginTop="200dp"
android:layout_marginEnd="106dp"
android:text="Average Usage Per Month : 40litre"
android:textSize="24sp"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Welcome">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_light"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:id="@+id/left_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_toEndOf="@+id/left_icon"
android:text="Welcome !"
android:textColor="@color/black"
android:textSize="20sp" />
<ImageView
android:id="@+id/right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp" />
<Button
android:id="@+id/settingsButton"
android:layout_width="112dp"
android:layout_height="38dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="51dp"
android:text="Settings"
app:srcCompat="?attr/popupMenuBackground" />
</RelativeLayout>
<Button
android:id="@+id/yourtanks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="92dp"
android:layout_marginEnd="80dp"
android:layout_marginBottom="235dp"
android:text="Your Tanks"
android:textColor="@android:color/holo_red_dark"
android:textSize="25dp"
android:textStyle="bold" />
<Button
android:id="@+id/usagebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="92dp"
android:layout_marginEnd="80dp"
android:layout_marginBottom="165dp"
android:text="Daily Usage"
android:textColor="@android:color/holo_red_dark"
android:textSize="25dp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="178dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="149dp"
android:layout_marginBottom="408dp" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayoutDeviceInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textViewDeviceName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewDeviceAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayoutDeviceInfo" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
<ImageView
android:id="@+id/left_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_toEndOf="@+id/left_icon"
android:text="Your Tanks"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="20sp" />
<ImageView
android:id="@+id/right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="51dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="57dp"
android:layout_marginTop="540dp"
android:layout_marginEnd="205dp"
android:layout_marginBottom="140dp"
android:text="Quality :"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView3"
android:layout_width="149dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="58dp"
android:layout_marginTop="599dp"
android:layout_marginEnd="204dp"
android:layout_marginBottom="84dp"
android:text="Status :"
android:textSize="24sp"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WaterQualityApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">WaterQualityApp</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WaterQualityApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
package com.example.waterqualityapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
\ No newline at end of file
#Sat Sep 03 23:33:42 IST 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# 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\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# 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
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
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" -a "$nonstop" = "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"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# 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
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@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
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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=
@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 Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_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=%*
: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
include ':app'
rootProject.name = "WaterQualityApp"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment