Browse Source

Add files via upload

pull/3/head
Rav4s 6 years ago
committed by GitHub
parent
commit
9e91396758
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      Android_App/AndroidManifest.xml
  2. 18
      Android_App/CheckSensor.kt
  3. 18
      Android_App/GarageOpenActivity.kt
  4. 26
      Android_App/MainActivity.kt
  5. 16
      Android_App/activity_check_sensor.xml
  6. 18
      Android_App/activity_garage_open.xml
  7. 57
      Android_App/activity_main.xml
  8. 6
      Android_App/colors.xml
  9. 7
      Android_App/strings.xml
  10. 11
      Android_App/styles.xml

26
Android_App/AndroidManifest.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.garagedoorcontroller">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity android:name=".CheckSensor"></activity>
<activity android:name=".GarageOpenActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

18
Android_App/CheckSensor.kt

@ -0,0 +1,18 @@
package com.example.garagedoorcontroller
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
class CheckSensor : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_check_sensor)
val myWebView = WebView(this)
setContentView(myWebView)
myWebView.loadUrl("http://70.123.32.254:1234/sensor")
}
}

18
Android_App/GarageOpenActivity.kt

@ -0,0 +1,18 @@
package com.example.garagedoorcontroller
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
class GarageOpenActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_garage_open)
val myWebView = WebView(this)
setContentView(myWebView)
myWebView.loadUrl("http://70.123.32.254:1234/login")
}
}

26
Android_App/MainActivity.kt

@ -0,0 +1,26 @@
package com.example.garagedoorcontroller
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
fun openGarage(view: View) {
val intent = Intent(this, GarageOpenActivity::class.java).apply {
}
startActivity(intent)
}
fun checkSensor(view: View) {
val intent = Intent(this, CheckSensor::class.java).apply {
}
startActivity(intent)
}
}

16
Android_App/activity_check_sensor.xml

@ -0,0 +1,16 @@
<?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=".CheckSensor">
<WebView
android:layout_width="409dp"
android:layout_height="729dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

18
Android_App/activity_garage_open.xml

@ -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=".GarageOpenActivity">
<WebView
android:layout_width="409dp"
android:layout_height="729dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

57
Android_App/activity_main.xml

@ -0,0 +1,57 @@
<?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:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Text_under_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.304" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="openGarage"
android:text="@string/Button_text"
app:layout_constraintBottom_toTopOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkSensor"
android:text="@string/Sensor_button_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.187" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sensor_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button4"
app:layout_constraintVertical_bias="0.2" />
</androidx.constraintlayout.widget.ConstraintLayout>

6
Android_App/colors.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>

7
Android_App/strings.xml

@ -0,0 +1,7 @@
<resources>
<string name="app_name">Garage Door Controller</string>
<string name="Button_text">Open Garage</string>
<string name="Text_under_button">Opens the garage</string>
<string name="Sensor_button_text">Check Garage</string>
<string name="sensor_text">Check if the garage is open or closed.</string>
</resources>

11
Android_App/styles.xml

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Loading…
Cancel
Save