first commit
|
@ -0,0 +1,15 @@
|
|||
*.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
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AppInsightsSettings">
|
||||
<option name="tabSettings">
|
||||
<map>
|
||||
<entry key="Firebase Crashlytics">
|
||||
<value>
|
||||
<InsightsFilterSettings>
|
||||
<option name="connection">
|
||||
<ConnectionSetting>
|
||||
<option name="appId" value="com.maulanawirawisesa.airsavvy" />
|
||||
<option name="mobileSdkAppId" value="1:271516546506:android:adb0ea8441d5efc1cc4b33" />
|
||||
<option name="projectId" value="airsavvy-6e5e1" />
|
||||
<option name="projectNumber" value="271516546506" />
|
||||
</ConnectionSetting>
|
||||
</option>
|
||||
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||
<option name="timeIntervalDays" value="THIRTY_DAYS" />
|
||||
<option name="visibilityType" value="ALL" />
|
||||
</InsightsFilterSettings>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:/Program Files/Gradle/gradle-7.6.1" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,48 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.maulanawirawisesa.airsavvy'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.maulanawirawisesa.airsavvy"
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
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 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.firebase:firebase-database:21.0.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
implementation 'com.firebase:firebase-client-android:2.3.1'
|
||||
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
|
||||
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
|
||||
implementation "androidx.room:room-runtime:2.4.2"
|
||||
annotationProcessor "androidx.room:room-compiler:2.4.2"
|
||||
implementation "androidx.room:room-ktx:2.4.2"
|
||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "271516546506",
|
||||
"project_id": "airsavvy-6e5e1",
|
||||
"storage_bucket": "airsavvy-6e5e1.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:271516546506:android:adb0ea8441d5efc1cc4b33",
|
||||
"android_client_info": {
|
||||
"package_name": "com.maulanawirawisesa.airsavvy"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDDmW_TPBKMVyrCKse2kI2Z4j-1ssUKAcc"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# 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
|
|
@ -0,0 +1,26 @@
|
|||
package com.maulanawirawisesa.airsavvy;
|
||||
|
||||
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.maulanawirawisesa.airsavvy", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@drawable/logo"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@drawable/logo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AirSavvy"
|
||||
android:name=".FireApp"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.DashboardActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity android:name=".ui.HistoryActivity" />
|
||||
<service
|
||||
android:name="org.eclipse.paho.android.service.MqttService"
|
||||
android:enabled="true"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,15 @@
|
|||
package com.maulanawirawisesa.airsavvy;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.firebase.client.Firebase;
|
||||
|
||||
public class FireApp extends Application {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Firebase.setAndroidContext(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.maulanawirawisesa.airsavvy;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.maulanawirawisesa.airsavvy.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.maulanawirawisesa.airsavvy.R;
|
||||
import com.maulanawirawisesa.airsavvy.database.SensorData;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class SensorDataAdapter extends RecyclerView.Adapter<SensorDataAdapter.ViewHolder> {
|
||||
|
||||
private List<SensorData> sensorDataList;
|
||||
|
||||
public SensorDataAdapter(List<SensorData> sensorDataList) {
|
||||
this.sensorDataList = sensorDataList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sensor_data, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
SensorData sensorData = sensorDataList.get(position);
|
||||
holder.textViewSensorType.setText(sensorData.sensorType);
|
||||
holder.textViewSensorValue.setText(String.valueOf(sensorData.value));
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
String formattedDate = sdf.format(new Date(sensorData.timestamp));
|
||||
holder.textViewTimestamp.setText(formattedDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return sensorDataList.size();
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public TextView textViewSensorType;
|
||||
public TextView textViewSensorValue;
|
||||
public TextView textViewTimestamp;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
textViewSensorType = itemView.findViewById(R.id.textViewSensorType);
|
||||
textViewSensorValue = itemView.findViewById(R.id.textViewSensorValue);
|
||||
textViewTimestamp = itemView.findViewById(R.id.textViewTimestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.maulanawirawisesa.airsavvy.database;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "sensor_data")
|
||||
public class SensorData {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
|
||||
@ColumnInfo(name = "sensor_type")
|
||||
public String sensorType;
|
||||
|
||||
@ColumnInfo(name = "value")
|
||||
public float value;
|
||||
|
||||
@ColumnInfo(name = "timestamp")
|
||||
public long timestamp; // gunakan tipe data long untuk menyimpan timestamp
|
||||
|
||||
public static float getValue(SensorData data) {
|
||||
return data.value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.maulanawirawisesa.airsavvy.database;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface SensorDataDao {
|
||||
@Query("SELECT * FROM sensor_data")
|
||||
List<SensorData> getAll();
|
||||
|
||||
@Insert
|
||||
void insertAll(SensorData... sensorData);
|
||||
|
||||
@Query("SELECT * FROM sensor_data WHERE timestamp >= :startOfDay AND timestamp <= :endOfDay")
|
||||
List<SensorData> getDataForToday(long startOfDay, long endOfDay);
|
||||
|
||||
@Query("SELECT AVG(value) FROM sensor_data WHERE sensor_type = :type AND timestamp >= :dateStart AND timestamp < :dateEnd")
|
||||
float getAverageByTypeAndDate(String type, String dateStart, String dateEnd);
|
||||
|
||||
@Query("SELECT * FROM sensor_data WHERE timestamp >= :startOfDay AND timestamp <= :endOfDay")
|
||||
List<SensorData> getDataForTodayWithDate(long startOfDay, long endOfDay);
|
||||
|
||||
@Query("SELECT * FROM sensor_data WHERE sensor_type = 'CO' AND timestamp >= :startOfDay AND timestamp <= :endOfDay")
|
||||
List<SensorData> getCODataForToday(long startOfDay, long endOfDay);
|
||||
|
||||
@Query("SELECT * FROM sensor_data WHERE sensor_type = 'CO2' AND timestamp >= :startOfDay AND timestamp <= :endOfDay")
|
||||
List<SensorData> getCO2DataForToday(long startOfDay, long endOfDay);
|
||||
|
||||
default List<SensorData> getDataForToday(long startOfDay, long endOfDay, String dateStr) {
|
||||
return getDataForToday(startOfDay, endOfDay);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.maulanawirawisesa.airsavvy.database;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {SensorData.class}, version = 1)
|
||||
public abstract class SensorDatabase extends RoomDatabase {
|
||||
public abstract SensorDataDao sensorDataDao();
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.maulanawirawisesa.airsavvy.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import org.eclipse.paho.android.service.MqttAndroidClient;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttActionListener;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
|
||||
public class MqttHelper {
|
||||
|
||||
private MqttAndroidClient mqttAndroidClient;
|
||||
|
||||
final String serverUri = "tcp://192.168.0.106:1883";
|
||||
final String clientId = MqttClient.generateClientId();
|
||||
final String subscriptionTopic = "control";
|
||||
final String username = "airsavvy";
|
||||
final String password = "bismillah";
|
||||
|
||||
public MqttHelper(Context context) {
|
||||
mqttAndroidClient = new MqttAndroidClient(context, serverUri, clientId);
|
||||
mqttAndroidClient.setCallback(new MqttCallbackExtended() {
|
||||
@Override
|
||||
public void connectComplete(boolean reconnect, String serverURI) {
|
||||
Log.d("Mqtt", "Connected to: " + serverURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
Log.d("Mqtt", "Connection Lost");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||
Log.d("Mqtt", "Message Arrived: " + topic + ": " + new String(message.getPayload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
Log.d("Mqtt", "Delivery Complete");
|
||||
}
|
||||
});
|
||||
|
||||
connect();
|
||||
}
|
||||
|
||||
private void connect() {
|
||||
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
|
||||
mqttConnectOptions.setAutomaticReconnect(true);
|
||||
mqttConnectOptions.setCleanSession(false);
|
||||
mqttConnectOptions.setUserName(username);
|
||||
mqttConnectOptions.setPassword(password.toCharArray());
|
||||
|
||||
try {
|
||||
mqttAndroidClient.connect(mqttConnectOptions, null, new IMqttActionListener() {
|
||||
@Override
|
||||
public void onSuccess(IMqttToken asyncActionToken) {
|
||||
Log.d("Mqtt", "Connected!");
|
||||
|
||||
subscribeToTopic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
|
||||
Log.d("Mqtt", "Failed to connect to: " + serverUri);
|
||||
}
|
||||
});
|
||||
} catch (MqttException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void subscribeToTopic() {
|
||||
try {
|
||||
mqttAndroidClient.subscribe(subscriptionTopic, 0, null, new IMqttActionListener() {
|
||||
@Override
|
||||
public void onSuccess(IMqttToken asyncActionToken) {
|
||||
Log.d("Mqtt", "Subscribed!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
|
||||
Log.d("Mqtt", "Failed to subscribe");
|
||||
}
|
||||
});
|
||||
} catch (MqttException ex) {
|
||||
Log.e("Mqtt", "Exception whilst subscribing", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void publishMessage(String message, String topic) {
|
||||
try {
|
||||
MqttMessage mqttMessage = new MqttMessage();
|
||||
mqttMessage.setPayload(message.getBytes());
|
||||
mqttAndroidClient.publish(topic, mqttMessage);
|
||||
Log.d("Mqtt", "Message Published to " + topic);
|
||||
} catch (MqttException e) {
|
||||
Log.e("Mqtt", "Error Publishing: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallback(MqttCallbackExtended callback) {
|
||||
mqttAndroidClient.setCallback(callback);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,533 @@
|
|||
package com.maulanawirawisesa.airsavvy.ui;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.room.Room;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.firebase.client.DataSnapshot;
|
||||
import com.firebase.client.Firebase;
|
||||
import com.firebase.client.FirebaseError;
|
||||
import com.firebase.client.ValueEventListener;
|
||||
import com.google.android.material.progressindicator.CircularProgressIndicator;
|
||||
import com.google.android.material.progressindicator.LinearProgressIndicator;
|
||||
import com.maulanawirawisesa.airsavvy.R;
|
||||
import com.maulanawirawisesa.airsavvy.database.SensorData;
|
||||
import com.maulanawirawisesa.airsavvy.database.SensorDatabase;
|
||||
import com.maulanawirawisesa.airsavvy.helper.MqttHelper;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class DashboardActivity extends AppCompatActivity {
|
||||
|
||||
// inisialisasi textview nilai
|
||||
private TextView indicatorValueCO2;
|
||||
private TextView valueCO2;
|
||||
private TextView informationCO2;
|
||||
private TextView indicatorValueCO;
|
||||
private TextView valueCO;
|
||||
private TextView informationCO;
|
||||
private TextView highIndicatorValueCO2;
|
||||
private TextView timeHighKarbonDioksida;
|
||||
private TextView highIndicatorValueCO;
|
||||
private TextView timeHighKarbonMonoksida;
|
||||
private CircularProgressIndicator indicatorCO2;
|
||||
private CircularProgressIndicator indicatorCO;
|
||||
private LinearProgressIndicator highIndicatorCO2;
|
||||
private LinearProgressIndicator highIndicatorCO;
|
||||
|
||||
// reference untuk firebase (koneksi server / host firebase)
|
||||
private Firebase mRef1;
|
||||
private Firebase mRef2;
|
||||
private Firebase mRef3;
|
||||
private Firebase mRef4;
|
||||
private Firebase mRefMode;
|
||||
private Firebase mRefRelay1;
|
||||
private Firebase mRefRelay2;
|
||||
private Firebase mRefRelay3;
|
||||
private Firebase mRefRelay4;
|
||||
|
||||
// inisiasi mqtt
|
||||
MqttHelper mqttHelper;
|
||||
private ImageButton statusButton;
|
||||
private boolean isStatusTrue = false;
|
||||
private boolean isScrollable = false;
|
||||
private SwitchCompat switchFan1;
|
||||
private SwitchCompat switchFan2;
|
||||
private SwitchCompat switchFan3;
|
||||
private SwitchCompat switchFan4;
|
||||
private HorizontalScrollView scrollView;
|
||||
|
||||
// Variabel untuk menyimpan nilai CO dan CO2
|
||||
private float sumCO = 0;
|
||||
private float sumCO2 = 0;
|
||||
private int countCO = 0;
|
||||
private int countCO2 = 0;
|
||||
|
||||
private ImageView history;
|
||||
|
||||
// Database
|
||||
private SensorDatabase db;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_dashboard);
|
||||
|
||||
// navigasi ke page history
|
||||
history = findViewById(R.id.history);
|
||||
history.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Menggunakan Intent untuk memulai HistoryActivity
|
||||
Intent intent = new Intent(DashboardActivity.this, HistoryActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// Disable dan enable scroll dan fan
|
||||
scrollView = findViewById(R.id.scrollView);
|
||||
switchFan1 = findViewById(R.id.switchFan1);
|
||||
switchFan2 = findViewById(R.id.switchFan2);
|
||||
switchFan3 = findViewById(R.id.switchFan3);
|
||||
switchFan4 = findViewById(R.id.switchFan4);
|
||||
|
||||
// MQTT
|
||||
mqttHelper = new MqttHelper(this);
|
||||
statusButton = findViewById(R.id.statusButton);
|
||||
|
||||
// baca komponen nilai (textview)
|
||||
indicatorValueCO2 = (TextView) findViewById(R.id.indicatorValueCO2);
|
||||
valueCO2 = (TextView) findViewById(R.id.valueCO2);
|
||||
informationCO2 = (TextView) findViewById(R.id.informationCO2);
|
||||
indicatorValueCO = (TextView) findViewById(R.id.indicatorValueCO);
|
||||
valueCO = (TextView) findViewById(R.id.valueCO);
|
||||
informationCO = (TextView) findViewById(R.id.informationCO);
|
||||
indicatorCO2 = findViewById(R.id.indicatorCO2);
|
||||
indicatorCO = findViewById(R.id.indicatorCO);
|
||||
highIndicatorValueCO2 = findViewById(R.id.highIndicatorValueCO2);
|
||||
timeHighKarbonDioksida = findViewById(R.id.timeHighKarbonDioksida);
|
||||
highIndicatorValueCO = findViewById(R.id.highIndicatorValueCO);
|
||||
timeHighKarbonMonoksida = findViewById(R.id.timeHighKarbonMonoksida);
|
||||
highIndicatorCO2 = findViewById(R.id.highIndicatorCO2);
|
||||
highIndicatorCO = findViewById(R.id.highIndicatorCO);
|
||||
|
||||
// Inisialisasi database Room
|
||||
db = Room.databaseBuilder(getApplicationContext(),
|
||||
SensorDatabase.class, "sensor-db").build();
|
||||
|
||||
//buka koneksi ke host firebase
|
||||
mRef1 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/CO2_ppm");
|
||||
mRef2 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/CO_ppm");
|
||||
mRef3 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Kategori_CO");
|
||||
mRef4 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Kategori_CO2");
|
||||
mRefMode = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Mode");
|
||||
mRefRelay1 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Relay1");
|
||||
mRefRelay2 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Relay2");
|
||||
mRefRelay3 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Relay3");
|
||||
mRefRelay4 = new Firebase("https://airsavvy-6e5e1-default-rtdb.firebaseio.com/Relay4");
|
||||
|
||||
// proses realtime
|
||||
mRef1.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai field1
|
||||
String CO2_ppm = dataSnapshot.getValue(String.class);
|
||||
// Lakukan sesuatu dengan nilai yang Anda ambil
|
||||
indicatorValueCO2.setText(CO2_ppm);
|
||||
valueCO2.setText(CO2_ppm);
|
||||
|
||||
// Set nilai progress bar
|
||||
float CO2Value = Float.parseFloat(CO2_ppm);
|
||||
int progress = (int) (CO2Value / 2000 * 100);
|
||||
indicatorCO2.setProgressCompat(progress, true);
|
||||
saveSensorData("CO2", CO2Value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle kesalahan
|
||||
}
|
||||
});
|
||||
|
||||
mRef2.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai field2
|
||||
String CO_ppm = dataSnapshot.getValue(String.class);
|
||||
// Lakukan sesuatu dengan nilai yang Anda ambil
|
||||
indicatorValueCO.setText(CO_ppm);
|
||||
valueCO.setText(CO_ppm);
|
||||
|
||||
// Set nilai progress bar
|
||||
float COValue = Float.parseFloat(CO_ppm);
|
||||
int progress = (int) (COValue / 50 * 100);
|
||||
indicatorCO.setProgressCompat(progress, true);
|
||||
saveSensorData("CO", COValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle kesalahan
|
||||
}
|
||||
});
|
||||
|
||||
mRef3.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai field3
|
||||
String Kategori_CO = dataSnapshot.getValue(String.class);
|
||||
// Lakukan sesuatu dengan nilai yang Anda ambil
|
||||
informationCO.setText(Kategori_CO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle kesalahan
|
||||
}
|
||||
});
|
||||
|
||||
mRef4.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai field4
|
||||
String Kategori_CO2 = dataSnapshot.getValue(String.class);
|
||||
// Lakukan sesuatu dengan nilai yang Anda ambil
|
||||
informationCO2.setText(Kategori_CO2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle kesalahan
|
||||
}
|
||||
});
|
||||
|
||||
mRefMode.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai mode
|
||||
int Mode = dataSnapshot.getValue(Integer.class);
|
||||
if (Mode == 1) {
|
||||
statusButton.setImageResource(R.drawable.manual);
|
||||
// Mode 1: Enable scroll, enable switch fan
|
||||
scrollView.setOnTouchListener(null);
|
||||
switchFan1.setEnabled(true);
|
||||
switchFan2.setEnabled(true);
|
||||
switchFan3.setEnabled(true);
|
||||
switchFan4.setEnabled(true);
|
||||
mRefRelay1.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai mode
|
||||
String Relay1 = dataSnapshot.getValue(String.class);
|
||||
|
||||
// Update kondisi switch
|
||||
if (Relay1 != null) {
|
||||
if (Relay1.equals("ON")) {
|
||||
switchFan1.setChecked(true);
|
||||
} else if (Relay1.equals("OFF")) {
|
||||
switchFan1.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle possible errors.
|
||||
}
|
||||
});
|
||||
|
||||
mRefRelay2.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai mode
|
||||
String Relay2 = dataSnapshot.getValue(String.class);
|
||||
|
||||
// Update kondisi switch
|
||||
if (Relay2 != null) {
|
||||
if (Relay2.equals("ON")) {
|
||||
switchFan2.setChecked(true);
|
||||
} else if (Relay2.equals("OFF")) {
|
||||
switchFan2.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle possible errors.
|
||||
}
|
||||
});
|
||||
|
||||
mRefRelay3.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai mode
|
||||
String Relay3 = dataSnapshot.getValue(String.class);
|
||||
|
||||
// Update kondisi switch
|
||||
if (Relay3 != null) {
|
||||
if (Relay3.equals("ON")) {
|
||||
switchFan3.setChecked(true);
|
||||
} else if (Relay3.equals("OFF")) {
|
||||
switchFan3.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle possible errors.
|
||||
}
|
||||
});
|
||||
|
||||
mRefRelay4.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// Ambil nilai mode
|
||||
String Relay4 = dataSnapshot.getValue(String.class);
|
||||
|
||||
// Update kondisi switch
|
||||
if (Relay4 != null) {
|
||||
if (Relay4.equals("ON")) {
|
||||
switchFan4.setChecked(true);
|
||||
} else if (Relay4.equals("OFF")) {
|
||||
switchFan4.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle possible errors.
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Mode 0: Disable scroll, disable switch fan
|
||||
statusButton.setImageResource(R.drawable.auto);
|
||||
scrollView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
switchFan1.setEnabled(false);
|
||||
switchFan2.setEnabled(false);
|
||||
switchFan3.setEnabled(false);
|
||||
switchFan4.setEnabled(false);
|
||||
switchFan1.setChecked(false);
|
||||
switchFan2.setChecked(false);
|
||||
switchFan3.setChecked(false);
|
||||
switchFan4.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FirebaseError firebaseError) {
|
||||
// Handle possible errors.
|
||||
}
|
||||
});
|
||||
|
||||
// Ambil tanggal hari ini
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Date today = cal.getTime();
|
||||
|
||||
// Ambil tanggal 1 hari yang lalu
|
||||
cal.add(Calendar.DATE, -1);
|
||||
Date yesterday = cal.getTime();
|
||||
|
||||
// Format tanggal untuk query ke database
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// Ambil data dari database untuk CO dan CO2 dari 1 hari yang lalu
|
||||
new Thread(() -> {
|
||||
long startOfDay = getStartOfDay(yesterday);
|
||||
long endOfDay = getEndOfDay(yesterday);
|
||||
|
||||
List<SensorData> sensorDataCO = db.sensorDataDao().getCODataForToday(startOfDay, endOfDay);
|
||||
List<SensorData> sensorDataCO2 = db.sensorDataDao().getCO2DataForToday(startOfDay, endOfDay);
|
||||
|
||||
int totalCO = 0;
|
||||
for (SensorData data : sensorDataCO) {
|
||||
totalCO += data.value;
|
||||
}
|
||||
int avgCO = sensorDataCO.size() > 0 ? totalCO / sensorDataCO.size() : 0;
|
||||
|
||||
int totalCO2 = 0;
|
||||
for (SensorData data : sensorDataCO2) {
|
||||
totalCO2 += data.value;
|
||||
}
|
||||
int avgCO2 = sensorDataCO2.size() > 0 ? totalCO2 / sensorDataCO2.size() : 0;
|
||||
|
||||
// Update UI dengan menggunakan runOnUiThread
|
||||
runOnUiThread(() -> {
|
||||
highIndicatorValueCO.setText(String.valueOf(avgCO));
|
||||
highIndicatorValueCO2.setText(String.valueOf(avgCO2));
|
||||
timeHighKarbonDioksida.setText(formatDate(yesterday));
|
||||
timeHighKarbonMonoksida.setText(formatDate(yesterday));
|
||||
|
||||
// Set nilai rata-rata ke ProgressBar
|
||||
int progressCO = (int) (avgCO / 50f * 100);
|
||||
int progressCO2 = (int) (avgCO2 / 2000f * 100);
|
||||
highIndicatorCO.setProgressCompat(progressCO, true);
|
||||
highIndicatorCO2.setProgressCompat(progressCO2, true);
|
||||
});
|
||||
}).start();
|
||||
|
||||
|
||||
mqttHelper.setCallback(new MqttCallbackExtended() {
|
||||
@Override
|
||||
public void connectComplete(boolean reconnect, String serverURI) {
|
||||
mqttHelper.subscribeToTopic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
// Handle lost connection
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||
String status = new String(message.getPayload());
|
||||
isStatusTrue = "1".equals(status);
|
||||
updateButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
// Handle completed delivery
|
||||
}
|
||||
});
|
||||
|
||||
statusButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
toggleStatus();
|
||||
}
|
||||
});
|
||||
|
||||
switchFan1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mqttHelper.publishMessage(isChecked ? "0" : "1", "control/relay1");
|
||||
}
|
||||
});
|
||||
|
||||
switchFan2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mqttHelper.publishMessage(isChecked ? "0" : "1", "control/relay2");
|
||||
}
|
||||
});
|
||||
|
||||
switchFan3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mqttHelper.publishMessage(isChecked ? "0" : "1", "control/relay3");
|
||||
}
|
||||
});
|
||||
|
||||
switchFan4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mqttHelper.publishMessage(isChecked ? "0" : "1", "control/relay4");
|
||||
}
|
||||
});
|
||||
|
||||
scrollView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
// Mengembalikan nilai true agar scrollView dapat di-scroll
|
||||
boolean isScrolling = !isScrollable;
|
||||
switchFan1.setEnabled(!isScrolling);
|
||||
switchFan2.setEnabled(!isScrolling);
|
||||
switchFan3.setEnabled(!isScrolling);
|
||||
switchFan4.setEnabled(!isScrolling);
|
||||
return isScrolling;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void toggleStatus() {
|
||||
isStatusTrue = !isStatusTrue;
|
||||
mqttHelper.publishMessage(isStatusTrue ? "1" : "0", "control/mode");
|
||||
updateButton();
|
||||
|
||||
// Mengatur scrollability berdasarkan status tombol
|
||||
isScrollable = isStatusTrue;
|
||||
|
||||
// Mengatur disable/enable pada switchFan1, switchFan2, switchFan3, dan switchFan4
|
||||
switchFan1.setEnabled(!isScrollable);
|
||||
switchFan2.setEnabled(!isScrollable);
|
||||
switchFan3.setEnabled(!isScrollable);
|
||||
switchFan4.setEnabled(!isScrollable);
|
||||
}
|
||||
|
||||
private void updateButton() {
|
||||
if (isStatusTrue) {
|
||||
statusButton.setImageResource(R.drawable.manual);
|
||||
} else {
|
||||
statusButton.setImageResource(R.drawable.auto);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSensorData(String sensorType, float value) {
|
||||
// Buat objek SensorData
|
||||
SensorData sensorData = new SensorData();
|
||||
sensorData.sensorType = sensorType;
|
||||
sensorData.value = value;
|
||||
sensorData.timestamp = System.currentTimeMillis(); // set timestamp saat data disimpan
|
||||
|
||||
// Simpan data ke database menggunakan thread baru
|
||||
new Thread(() -> db.sensorDataDao().insertAll(sensorData)).start();
|
||||
}
|
||||
|
||||
private long getStartOfDay(Date date) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
|
||||
private long getEndOfDay(Date date) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
cal.set(Calendar.MINUTE, 59);
|
||||
cal.set(Calendar.SECOND, 59);
|
||||
cal.set(Calendar.MILLISECOND, 999);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
|
||||
private float calculateAverage(List<SensorData> sensorDataList) {
|
||||
float sum = 0;
|
||||
for (SensorData data : sensorDataList) {
|
||||
sum += data.value; // Menggunakan atribut 'value' dari objek SensorData
|
||||
}
|
||||
return sum / sensorDataList.size();
|
||||
}
|
||||
|
||||
private String formatDate(Date date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
|
||||
return sdf.format(date);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,276 @@
|
|||
package com.maulanawirawisesa.airsavvy.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.room.Room;
|
||||
import com.github.mikephil.charting.charts.LineChart;
|
||||
import com.github.mikephil.charting.components.Legend;
|
||||
import com.github.mikephil.charting.components.XAxis;
|
||||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
import com.github.mikephil.charting.data.LineData;
|
||||
import com.github.mikephil.charting.data.LineDataSet;
|
||||
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||
import com.maulanawirawisesa.airsavvy.R;
|
||||
import com.maulanawirawisesa.airsavvy.adapter.SensorDataAdapter;
|
||||
import com.maulanawirawisesa.airsavvy.database.SensorData;
|
||||
import com.maulanawirawisesa.airsavvy.database.SensorDatabase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class HistoryActivity extends AppCompatActivity {
|
||||
|
||||
private ImageView back;
|
||||
private RecyclerView recyclerViewToday;
|
||||
private RecyclerView recyclerViewYesterday;
|
||||
private SensorDataAdapter sensorDataAdapterToday;
|
||||
private SensorDataAdapter sensorDataAdapterYesterday;
|
||||
private LineChart lineChartToday;
|
||||
private LineChart lineChartYesterday;
|
||||
private SensorDatabase db;
|
||||
private Handler handler;
|
||||
private Runnable updateRunnable;
|
||||
private static final int UPDATE_INTERVAL = 5000; // Interval pembaruan dalam milidetik (misalnya 5000 = 5 detik)
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_history);
|
||||
|
||||
recyclerViewToday = findViewById(R.id.recyclerViewToday);
|
||||
recyclerViewToday.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerViewYesterday = findViewById(R.id.recyclerViewYesterday);
|
||||
recyclerViewYesterday.setLayoutManager(new LinearLayoutManager(this));
|
||||
lineChartToday = findViewById(R.id.lineChartToday);
|
||||
lineChartYesterday = findViewById(R.id.lineChartYesterday);
|
||||
|
||||
// Inisialisasi database Room
|
||||
db = Room.databaseBuilder(getApplicationContext(),
|
||||
SensorDatabase.class, "sensor-db").build();
|
||||
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
updateRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateDataAndCharts();
|
||||
handler.postDelayed(this, UPDATE_INTERVAL);
|
||||
}
|
||||
};
|
||||
|
||||
// Memulai pembaruan data secara periodik
|
||||
handler.post(updateRunnable);
|
||||
|
||||
// navigasi ke page history
|
||||
back = findViewById(R.id.back);
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Menggunakan Intent untuk memulai HistoryActivity
|
||||
Intent intent = new Intent(HistoryActivity.this, DashboardActivity.class);
|
||||
startActivity(intent);
|
||||
// Hentikan pembaruan periodik saat meninggalkan halaman
|
||||
handler.removeCallbacks(updateRunnable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateDataAndCharts() {
|
||||
// Mendapatkan timestamp awal hari ini
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
startCalendar.set(Calendar.MINUTE, 0);
|
||||
startCalendar.set(Calendar.SECOND, 0);
|
||||
long startOfDay = startCalendar.getTimeInMillis();
|
||||
|
||||
// Mendapatkan timestamp akhir hari ini
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
endCalendar.set(Calendar.MINUTE, 59);
|
||||
endCalendar.set(Calendar.SECOND, 59);
|
||||
long endOfDay = endCalendar.getTimeInMillis();
|
||||
|
||||
// Format timestamp menjadi jam, menit, dan detik
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
// ValueFormatter untuk mengubah tampilan timestamp menjadi jam, menit, dan detik
|
||||
ValueFormatter timeFormatter = new ValueFormatter() {
|
||||
@Override
|
||||
public String getFormattedValue(float value) {
|
||||
return sdf.format(new Date((long) value));
|
||||
}
|
||||
};
|
||||
|
||||
// Ambil dan perbarui data untuk hari ini
|
||||
new Thread(() -> {
|
||||
List<SensorData> sensorDataListToday = db.sensorDataDao().getDataForToday(startOfDay, endOfDay);
|
||||
runOnUiThread(() -> {
|
||||
sensorDataAdapterToday = new SensorDataAdapter(sensorDataListToday);
|
||||
recyclerViewToday.setAdapter(sensorDataAdapterToday);
|
||||
});
|
||||
|
||||
List<Entry> entriesCO = new ArrayList<>();
|
||||
List<Entry> entriesCO2 = new ArrayList<>();
|
||||
for (SensorData sensorData : sensorDataListToday) {
|
||||
if (sensorData.sensorType.equals("CO")) {
|
||||
entriesCO.add(new Entry(sensorData.timestamp, sensorData.value));
|
||||
} else if (sensorData.sensorType.equals("CO2")) {
|
||||
entriesCO2.add(new Entry(sensorData.timestamp, sensorData.value));
|
||||
}
|
||||
}
|
||||
LineDataSet dataSetCO = new LineDataSet(entriesCO, "CO");
|
||||
dataSetCO.setColor(Color.RED);
|
||||
dataSetCO.setLineWidth(2f);
|
||||
dataSetCO.setCircleColor(Color.RED);
|
||||
dataSetCO.setCircleRadius(4f);
|
||||
dataSetCO.setDrawValues(false);
|
||||
|
||||
LineDataSet dataSetCO2 = new LineDataSet(entriesCO2, "CO2");
|
||||
dataSetCO2.setColor(Color.BLUE);
|
||||
dataSetCO2.setLineWidth(2f);
|
||||
dataSetCO2.setCircleColor(Color.BLUE);
|
||||
dataSetCO2.setCircleRadius(4f);
|
||||
dataSetCO2.setDrawValues(false);
|
||||
|
||||
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||
dataSets.add(dataSetCO);
|
||||
dataSets.add(dataSetCO2);
|
||||
|
||||
LineData lineData = new LineData(dataSets);
|
||||
|
||||
runOnUiThread(() -> {
|
||||
lineChartToday.setData(lineData);
|
||||
lineChartToday.getDescription().setText("Hari Ini");
|
||||
lineChartToday.getDescription().setTextSize(12f);
|
||||
lineChartToday.getDescription().setTextColor(Color.BLACK);
|
||||
|
||||
Legend legend = lineChartToday.getLegend();
|
||||
legend.setForm(Legend.LegendForm.LINE);
|
||||
legend.setTextSize(12f);
|
||||
legend.setTextColor(Color.BLACK);
|
||||
|
||||
XAxis xAxis = lineChartToday.getXAxis();
|
||||
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
|
||||
xAxis.setTextSize(10f);
|
||||
xAxis.setTextColor(Color.BLACK);
|
||||
xAxis.setDrawGridLines(true);
|
||||
xAxis.setAvoidFirstLastClipping(true);
|
||||
xAxis.setValueFormatter(timeFormatter); // Mengatur format label sumbu X
|
||||
|
||||
YAxis leftAxis = lineChartToday.getAxisLeft();
|
||||
leftAxis.setTextSize(10f);
|
||||
leftAxis.setTextColor(Color.BLACK);
|
||||
leftAxis.setDrawGridLines(true);
|
||||
|
||||
YAxis rightAxis = lineChartToday.getAxisRight();
|
||||
rightAxis.setEnabled(false);
|
||||
|
||||
lineChartToday.animateX(1500);
|
||||
lineChartToday.animateY(1500);
|
||||
lineChartToday.invalidate(); // refresh chart
|
||||
});
|
||||
}).start();
|
||||
|
||||
// Ambil dan perbarui data untuk kemarin
|
||||
new Thread(() -> {
|
||||
long startOfYesterday = startOfDay - (24 * 60 * 60 * 1000);
|
||||
long endOfYesterday = endOfDay - (24 * 60 * 60 * 1000);
|
||||
List<SensorData> sensorDataListYesterday = db.sensorDataDao().getDataForToday(startOfYesterday, endOfYesterday);
|
||||
runOnUiThread(() -> {
|
||||
sensorDataAdapterYesterday = new SensorDataAdapter(sensorDataListYesterday);
|
||||
recyclerViewYesterday.setAdapter(sensorDataAdapterYesterday);
|
||||
});
|
||||
|
||||
List<Entry> entriesCO = new ArrayList<>();
|
||||
List<Entry> entriesCO2 = new ArrayList<>();
|
||||
for (SensorData sensorData : sensorDataListYesterday) {
|
||||
if (sensorData.sensorType.equals("CO")) {
|
||||
entriesCO.add(new Entry(sensorData.timestamp, sensorData.value));
|
||||
} else if (sensorData.sensorType.equals("CO2")) {
|
||||
entriesCO2.add(new Entry(sensorData.timestamp, sensorData.value));
|
||||
}
|
||||
}
|
||||
LineDataSet dataSetCO = new LineDataSet(entriesCO, "CO");
|
||||
dataSetCO.setColor(Color.RED);
|
||||
dataSetCO.setLineWidth(2f);
|
||||
dataSetCO.setCircleColor(Color.RED);
|
||||
dataSetCO.setCircleRadius(4f);
|
||||
dataSetCO.setDrawValues(false);
|
||||
|
||||
LineDataSet dataSetCO2 = new LineDataSet(entriesCO2, "CO2");
|
||||
dataSetCO2.setColor(Color.BLUE);
|
||||
dataSetCO2.setLineWidth(2f);
|
||||
dataSetCO2.setCircleColor(Color.BLUE);
|
||||
dataSetCO2.setCircleRadius(4f);
|
||||
dataSetCO2.setDrawValues(false);
|
||||
|
||||
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||
dataSets.add(dataSetCO);
|
||||
dataSets.add(dataSetCO2);
|
||||
|
||||
LineData lineData = new LineData(dataSets);
|
||||
|
||||
runOnUiThread(() -> {
|
||||
lineChartYesterday.setData(lineData);
|
||||
lineChartYesterday.getDescription().setText("Kemarin");
|
||||
lineChartYesterday.getDescription().setTextSize(12f);
|
||||
lineChartYesterday.getDescription().setTextColor(Color.BLACK);
|
||||
|
||||
Legend legend = lineChartYesterday.getLegend();
|
||||
legend.setForm(Legend.LegendForm.LINE);
|
||||
legend.setTextSize(12f);
|
||||
legend.setTextColor(Color.BLACK);
|
||||
|
||||
XAxis xAxis = lineChartYesterday.getXAxis();
|
||||
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
|
||||
xAxis.setTextSize(10f);
|
||||
xAxis.setTextColor(Color.BLACK);
|
||||
xAxis.setDrawGridLines(true);
|
||||
xAxis.setAvoidFirstLastClipping(true);
|
||||
xAxis.setValueFormatter(timeFormatter); // Mengatur format label sumbu X
|
||||
|
||||
YAxis leftAxis = lineChartYesterday.getAxisLeft();
|
||||
leftAxis.setTextSize(10f);
|
||||
leftAxis.setTextColor(Color.BLACK);
|
||||
leftAxis.setDrawGridLines(true);
|
||||
|
||||
YAxis rightAxis = lineChartYesterday.getAxisRight();
|
||||
rightAxis.setEnabled(false);
|
||||
|
||||
lineChartYesterday.animateX(1500);
|
||||
lineChartYesterday.animateY(1500);
|
||||
lineChartYesterday.invalidate(); // refresh chart
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
// Hentikan pembaruan periodik saat activity dihancurkan
|
||||
handler.removeCallbacks(updateRunnable);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<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>
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="35dp" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="m14.068,6.838c-0.345,-0.826 -1.137,-1.338 -2.068,-1.338s-1.724,0.513 -2.071,1.345l-3.893,9.719c-0.103,0.256 0.022,0.547 0.278,0.65 0.256,0.102 0.547,-0.022 0.65,-0.278l1.176,-2.936h7.545l1.096,2.925c0.075,0.201 0.266,0.325 0.468,0.325 0.059,0 0.118,-0.01 0.175,-0.032 0.259,-0.097 0.39,-0.385 0.293,-0.644l-3.65,-9.736ZM8.54,13l2.314,-5.777c0.223,-0.533 0.738,-0.723 1.146,-0.723s0.923,0.19 1.139,0.706l2.172,5.794h-6.77ZM12,0C5.383,0 0,5.383 0,12s5.383,12 12,12 12,-5.383 12,-12S18.617,0 12,0ZM12,23c-6.065,0 -11,-4.935 -11,-11S5.935,1 12,1s11,4.935 11,11 -4.935,11 -11,11Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="512dp"
|
||||
android:height="512dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10.957,12.354a0.5,0.5 0,0 1,0 -0.708l4.586,-4.585a1.5,1.5 0,0 0,-2.121 -2.122L8.836,9.525a3.505,3.505 0,0 0,0 4.95l4.586,4.586a1.5,1.5 0,0 0,2.121 -2.122Z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 75 KiB |
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/yellow" />
|
||||
<corners android:radius="50dp"/>
|
||||
</shape>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/blue" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="m21.5,9.5C21.5,4.253 17.247,0 12,0S2.5,4.253 2.5,9.5c0,4.9 3.73,8.945 8.5,9.446v3.054h-4c-0.552,0 -1,0.447 -1,1s0.448,1 1,1h10c0.552,0 1,-0.447 1,-1s-0.448,-1 -1,-1h-4v-3.054c4.77,-0.502 8.5,-4.546 8.5,-9.446ZM17.358,14.739c-0.927,-0.929 -2.234,-2.565 -3.23,-3.914 1.64,0.348 3.692,0.909 4.87,1.352 -0.37,0.965 -0.93,1.836 -1.64,2.563ZM19.5,9.5c0,0.244 -0.014,0.484 -0.037,0.722 -1.642,-0.588 -4.198,-1.251 -5.976,-1.554 0.677,-1.608 1.562,-4.081 1.96,-5.822 2.405,1.251 4.053,3.761 4.053,6.654ZM12,2c0.533,0 1.052,0.058 1.553,0.164 -0.252,1.206 -0.932,3.258 -1.553,4.859 -0.621,-1.602 -1.302,-3.654 -1.553,-4.86 0.502,-0.106 1.021,-0.164 1.553,-0.164ZM4.5,9.5c0,-2.893 1.649,-5.403 4.053,-6.654 0.397,1.74 1.282,4.214 1.96,5.822 -1.778,0.303 -4.335,0.967 -5.977,1.554 -0.023,-0.238 -0.037,-0.479 -0.037,-0.722ZM5.002,12.176c1.179,-0.442 3.23,-1.003 4.87,-1.352 -0.996,1.349 -2.303,2.985 -3.23,3.914 -0.71,-0.726 -1.27,-1.597 -1.64,-2.563ZM12,17c-1.375,0 -2.66,-0.378 -3.769,-1.026 1.24,-1.28 2.776,-3.277 3.769,-4.68 0.993,1.402 2.529,3.399 3.769,4.68 -1.109,0.648 -2.394,1.026 -3.769,1.026Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="24dp" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M24,7v1L0,8v-1C0,4.239 2.239,2 5,2h1L6,1c0,-0.552 0.448,-1 1,-1h0c0.552,0 1,0.448 1,1v1h8L16,1c0,-0.552 0.448,-1 1,-1h0c0.552,0 1,0.448 1,1v1h1c2.761,0 5,2.239 5,5ZM24,17c0,3.86 -3.141,7 -7,7s-7,-3.14 -7,-7 3.141,-7 7,-7 7,3.14 7,7ZM19,17.586l-1,-1v-1.586c0,-0.552 -0.448,-1 -1,-1h0c-0.552,0 -1,0.448 -1,1v2c0,0.265 0.105,0.52 0.293,0.707l1.293,1.293c0.39,0.39 1.024,0.39 1.414,0h0c0.39,-0.39 0.39,-1.024 0,-1.414ZM8,17c0,-2.829 1.308,-5.35 3.349,-7L0,10v9c0,2.761 2.239,5 5,5h6.349c-2.041,-1.65 -3.349,-4.171 -3.349,-7Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,170 @@
|
|||
<?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>
|
After Width: | Height: | Size: 137 KiB |
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="35dp" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="m12,0C5.383,0 0,5.383 0,12s5.383,12 12,12 12,-5.383 12,-12S18.617,0 12,0ZM12,23c-6.065,0 -11,-4.935 -11,-11S5.935,1 12,1s11,4.935 11,11 -4.935,11 -11,11ZM18,7.722v9.778c0,0.276 -0.224,0.5 -0.5,0.5s-0.5,-0.224 -0.5,-0.5L17,7.722c0,-0.361 -0.151,-0.622 -0.396,-0.68 -0.247,-0.052 -0.496,0.107 -0.657,0.432l-3.502,6.859c-0.085,0.167 -0.257,0.272 -0.445,0.272h0c-0.188,0 -0.36,-0.106 -0.445,-0.274l-3.5,-6.906c-0.158,-0.316 -0.392,-0.467 -0.634,-0.414 -0.194,0.046 -0.42,0.26 -0.42,0.711v9.778c0,0.276 -0.224,0.5 -0.5,0.5s-0.5,-0.224 -0.5,-0.5L6.001,7.722c0,-0.839 0.479,-1.516 1.191,-1.684 0.7,-0.165 1.39,0.203 1.756,0.938l3.054,6.027 3.053,-5.98c0.372,-0.744 1.069,-1.12 1.779,-0.953 0.708,0.167 1.167,0.815 1.167,1.652Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="512dp"
|
||||
android:height="512dp"
|
||||
android:viewportWidth="512"
|
||||
android:viewportHeight="512">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M480,224H32c-17.67,0 -32,14.33 -32,32s14.33,32 32,32h448c17.67,0 32,-14.33 32,-32S497.67,224 480,224z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M32,138.67h448c17.67,0 32,-14.33 32,-32s-14.33,-32 -32,-32H32c-17.67,0 -32,14.33 -32,32S14.33,138.67 32,138.67z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M480,373.33H32c-17.67,0 -32,14.33 -32,32s14.33,32 32,32h448c17.67,0 32,-14.33 32,-32S497.67,373.33 480,373.33z"/>
|
||||
</vector>
|
After Width: | Height: | Size: 76 KiB |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/red" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 5.2 KiB |
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke android:width="1.8dp" android:color="@color/blue" />
|
||||
<size android:width="18dp" android:height="18dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/unchecked_thumb" />
|
||||
<stroke android:width="1.8dp" android:color="@color/unchecked_track" />
|
||||
<size android:width="18dp" android:height="18dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/unchecked_track" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/blue" />
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="@color/yellow" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="Quicksand"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
|
||||
</font-family>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="name=Quicksand&weight=700"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
|
||||
</font-family>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="name=Quicksand&weight=300"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
|
||||
</font-family>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="name=Quicksand&weight=500"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
|
||||
</font-family>
|
|
@ -0,0 +1,812 @@
|
|||
<?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"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".ui.DashboardActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@drawable/profile"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearanceOverlay="@style/customImageStyle" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcomeText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/welcome_text"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/history"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@drawable/history"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="25dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@color/red"
|
||||
app:cardCornerRadius="30dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/shadow1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/indicatorCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:progress="50"
|
||||
app:indicatorColor="@color/white"
|
||||
app:indicatorSize="100dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackColor="@color/white_thin"
|
||||
app:trackCornerRadius="15dp"
|
||||
app:trackThickness="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/indicatorValueCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO2"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/indicatorCO2"
|
||||
app:layout_constraintEnd_toEndOf="@+id/indicatorCO2"
|
||||
app:layout_constraintStart_toStartOf="@id/indicatorCO2"
|
||||
app:layout_constraintTop_toTopOf="@id/indicatorCO2" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/indicatorCO2"
|
||||
app:layout_constraintStart_toEndOf="@+id/indicatorCO2"
|
||||
app:layout_constraintTop_toTopOf="@id/indicatorCO2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karbonDioksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/karbon_dioksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/valueCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO2"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/karbonDioksida" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ppmCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/ppm"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/valueCO2"
|
||||
app:layout_constraintStart_toEndOf="@+id/valueCO2"
|
||||
app:layout_constraintTop_toTopOf="@+id/valueCO2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/informationCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/kurang_baik"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/valueCO2" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@color/yellow"
|
||||
app:cardCornerRadius="30dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/shadow"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/indicatorCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:progress="15"
|
||||
app:indicatorColor="@color/white"
|
||||
app:indicatorSize="100dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:trackColor="@color/yellow_thin"
|
||||
app:trackCornerRadius="15dp"
|
||||
app:trackThickness="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/indicatorValueCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/indicatorCO"
|
||||
app:layout_constraintEnd_toEndOf="@+id/indicatorCO"
|
||||
app:layout_constraintStart_toStartOf="@id/indicatorCO"
|
||||
app:layout_constraintTop_toTopOf="@id/indicatorCO" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/indicatorCO"
|
||||
app:layout_constraintEnd_toStartOf="@+id/indicatorCO"
|
||||
app:layout_constraintTop_toTopOf="@id/indicatorCO">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/karbonMonoksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/karbon_monoksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/valueCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ppmCO"
|
||||
app:layout_constraintTop_toBottomOf="@+id/karbonMonoksida" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ppmCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/ppm"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/valueCO"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/valueCO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/informationCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/kurang_baik"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/valueCO" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@color/blue"
|
||||
app:cardCornerRadius="30dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/shadow3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/shadow2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highKarbonDioksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/karbon_dioksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timeHighKarbonDioksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/time_karbon_dioksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/highKarbonDioksida"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/highKarbonDioksida" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/highIndicatorCO2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:progress="50"
|
||||
app:indicatorColor="@color/red"
|
||||
app:indicatorSize="80dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/highKarbonDioksida"
|
||||
app:trackColor="@color/blue_thin"
|
||||
app:trackCornerRadius="15dp"
|
||||
app:trackThickness="30dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highIndicatorValueCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO2"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/highIndicatorCO2"
|
||||
app:layout_constraintStart_toStartOf="@id/highIndicatorCO2"
|
||||
app:layout_constraintTop_toTopOf="@id/highIndicatorCO2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ppmHighCO2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/ppm"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/highIndicatorCO2"
|
||||
app:layout_constraintStart_toEndOf="@id/highIndicatorValueCO2"
|
||||
app:layout_constraintTop_toTopOf="@id/highIndicatorCO2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highKarbonMonoksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/karbon_monoksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ppmHighCO2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timeHighKarbonMonoksida"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/time_karbon_monoksida"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/highKarbonMonoksida"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/highKarbonMonoksida" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/highIndicatorCO"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:progress="15"
|
||||
app:indicatorColor="@color/yellow"
|
||||
app:indicatorSize="80dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/highKarbonMonoksida"
|
||||
app:trackColor="@color/blue_thin"
|
||||
app:trackCornerRadius="15dp"
|
||||
app:trackThickness="30dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highIndicatorValueCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/value_CO"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/highIndicatorCO"
|
||||
app:layout_constraintStart_toStartOf="@id/highIndicatorCO"
|
||||
app:layout_constraintTop_toTopOf="@id/highIndicatorCO" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ppmHighCO"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/ppm"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/highIndicatorCO"
|
||||
app:layout_constraintStart_toEndOf="@id/highIndicatorValueCO"
|
||||
app:layout_constraintTop_toTopOf="@id/highIndicatorCO" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controlText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/control_text"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/statusButton"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_button_yellow"
|
||||
android:contentDescription="@string/button_status"
|
||||
android:src="@drawable/auto"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fan1"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:src="@drawable/fan"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFan1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/fan_1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fan1" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/switchFan1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumb="@drawable/thumb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textFan1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/textFan1"
|
||||
app:track="@drawable/track" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fan2"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:src="@drawable/fan"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFan2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/fan_2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fan2" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/switchFan2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumb="@drawable/thumb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textFan2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/textFan2"
|
||||
app:track="@drawable/track" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fan3"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:src="@drawable/fan"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFan3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/fan_3"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fan3" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/switchFan3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumb="@drawable/thumb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textFan3"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/textFan3"
|
||||
app:track="@drawable/track" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fan4"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:src="@drawable/fan"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFan4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/fan_4"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fan4" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/switchFan4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumb="@drawable/thumb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textFan4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/textFan4"
|
||||
app:track="@drawable/track" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,249 @@
|
|||
<?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=".ui.HistoryActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/appbar"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="65dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="65dp"
|
||||
android:background="@drawable/background"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/todayHistory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/today"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/lineChartToday"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/history"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/jenis"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/nilai"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2.2"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/waktu"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewToday"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/yesterdayHistory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="@string/yesterday"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
android:id="@+id/lineChartYesterday"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:text="@string/history"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/jenis"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/nilai"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2.2"
|
||||
android:fontFamily="@font/quicksand_bold"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/waktu"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/black" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewYesterday"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,18 @@
|
|||
<?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=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewSensorType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/jenis"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewSensorValue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/nilai"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTimestamp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2.2"
|
||||
android:fontFamily="@font/quicksand_medium"
|
||||
android:letterSpacing=".2"
|
||||
android:padding="5dp"
|
||||
android:text="@string/waktu"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/unchecked_track" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<?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>
|
|
@ -0,0 +1,5 @@
|
|||
<?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>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 982 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
|
@ -0,0 +1,16 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.AirSavvy" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/blue_thin</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">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,20 @@
|
|||
<?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>
|
||||
<color name="background">#FFF4FCFF</color>
|
||||
<color name="red">#FFF66955</color>
|
||||
<color name="blue">#FFA0A5FF</color>
|
||||
<color name="yellow">#FFF5CD54</color>
|
||||
<color name="white_thin">#FFFE7F6D</color>
|
||||
<color name="yellow_thin">#FFFFDF7C</color>
|
||||
<color name="blue_thin">#FFBCBFFF</color>
|
||||
<color name="unchecked_thumb">#FF8C8C8C</color>
|
||||
<color name="unchecked_track">#FFCDCDCD</color>
|
||||
<color name="appbar">#FFF4FCFF</color>
|
||||
</resources>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="customImageStyle">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSizeTopRight">50%</item>
|
||||
<item name="cornerSizeBottomRight">50%</item>
|
||||
<item name="cornerSizeBottomLeft">50%</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<array name="com_google_android_gms_fonts_certs">
|
||||
<item>@array/com_google_android_gms_fonts_certs_dev</item>
|
||||
<item>@array/com_google_android_gms_fonts_certs_prod</item>
|
||||
</array>
|
||||
<string-array name="com_google_android_gms_fonts_certs_dev">
|
||||
<item>
|
||||
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
|
||||
</item>
|
||||
</string-array>
|
||||
<string-array name="com_google_android_gms_fonts_certs_prod">
|
||||
<item>
|
||||
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
|
||||
</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<array name="preloaded_fonts" translatable="false">
|
||||
<item>@font/quicksand</item>
|
||||
<item>@font/quicksand_bold</item>
|
||||
<item>@font/quicksand_light</item>
|
||||
<item>@font/quicksand_medium</item>
|
||||
</array>
|
||||
</resources>
|
|
@ -0,0 +1,24 @@
|
|||
<resources>
|
||||
<string name="app_name">AirSavvy</string>
|
||||
<string name="welcome_text">Hi! Maulana</string>
|
||||
<string name="value_CO2">2000</string>
|
||||
<string name="karbon_dioksida">Karbon Dioksida</string>
|
||||
<string name="ppm">PPM</string>
|
||||
<string name="kurang_baik">Kurang Baik</string>
|
||||
<string name="value_CO">20</string>
|
||||
<string name="karbon_monoksida">Karbon Monoksida</string>
|
||||
<string name="time_karbon_dioksida">08 : 17 : 56</string>
|
||||
<string name="time_karbon_monoksida">10 : 03 : 29</string>
|
||||
<string name="control_text">Control</string>
|
||||
<string name="fan_1">Fan 1</string>
|
||||
<string name="fan_2">Fan 2</string>
|
||||
<string name="fan_3">Fan 3</string>
|
||||
<string name="fan_4">Fan 4</string>
|
||||
<string name="button_status">Status Button</string>
|
||||
<string name="today">Today</string>
|
||||
<string name="yesterday">Yesterday</string>
|
||||
<string name="jenis">Jenis</string>
|
||||
<string name="nilai">Nilai</string>
|
||||
<string name="waktu">Waktu</string>
|
||||
<string name="history">History Report</string>
|
||||
</resources>
|
|
@ -0,0 +1,16 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.AirSavvy" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/blue_thin</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">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
|
@ -0,0 +1,17 @@
|
|||
package com.maulanawirawisesa.airsavvy;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.google.gms:google-services:4.4.1'
|
||||
}
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.3.1' apply false
|
||||
id 'com.android.library' version '7.3.1' apply false
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
# 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
|
||||
android.enableJetifier=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.suppressUnsupportedCompileSdk=34
|
|
@ -0,0 +1,6 @@
|
|||
#Thu May 16 10:27:10 ICT 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## 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='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# 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 or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@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 Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@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="-Xmx64m" "-Xms64m"
|
||||
|
||||
@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 execute
|
||||
|
||||
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 execute
|
||||
|
||||
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
|
||||
|
||||
: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 %*
|
||||
|
||||
: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
|
|
@ -0,0 +1,27 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven{
|
||||
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
|
||||
}
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
maven{
|
||||
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
|
||||
}
|
||||
maven{
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "AirSavvy"
|
||||
include ':app'
|