SSH was working :(

SSH is connected to InputFields
This commit is contained in:
JG-Cody 2021-03-10 21:13:55 +01:00
parent 782cfad891
commit 4bc3832218
19 changed files with 79 additions and 136 deletions

View File

@ -10,6 +10,16 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Terraplex">
<activity
android:name=".IntroActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Terraplex.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"

View File

@ -1,15 +1,15 @@
package de.jg_cody.Terraplex;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.VideoView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.navigation.NavigationView;
import androidx.navigation.NavController;
@ -20,6 +20,7 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import static de.jg_cody.Terraplex.ui.Konsole.KonsoleFragment.command;
import static de.jg_cody.Terraplex.ui.home.HomeFragment.ip;
import static de.jg_cody.Terraplex.ui.home.HomeFragment.password;
import static de.jg_cody.Terraplex.ui.home.HomeFragment.user;
@ -27,24 +28,23 @@ import static de.jg_cody.Terraplex.ui.home.HomeFragment.user;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
private AppBarConfiguration mAppBarConfiguration;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Log.d("I","ACTION BUTTON CLICKED");
SSH_connection.executeRemoteCommand(ip, user, password);
SSH_connection.executeRemoteCommand(ip, user, password, command);
} catch (Exception e) {
}}
});
@ -53,8 +53,8 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_badezimmer, R.id.nav_kueche, R.id.nav_wohnzimmer, R.id.nav_schlafzimmer, R.id.nav_flur, R.id.nav_toilette)
.setDrawerLayout(drawer)
R.id.nav_home, R.id.nav_badezimmer, R.id.nav_kueche, R.id.nav_wohnzimmer, R.id.nav_schlafzimmer, R.id.nav_flur, R.id.nav_toilette, R.id.nav_konsole)
.setOpenableLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
@ -74,4 +74,6 @@ public class MainActivity extends AppCompatActivity {
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}

View File

@ -10,7 +10,7 @@ public class HomeViewModel extends ViewModel {
public HomeViewModel() {
mText = new MutableLiveData<>();
mText.setValue("Servus Cody, Willkommen in deiner HOMEAUTOMATIONS-APP");
mText.setValue("Welcome to your HOMEAUTOMATION-APP");
}
public LiveData<String> getText() {

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
@ -24,4 +25,5 @@
app:itemIconTint="@color/white"
app:itemTextColor="#FFFFFF"
app:menu="@menu/activity_main_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout
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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,36 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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.home.HomeFragment"
android:background="@drawable/background">
android:background="@drawable/background"
tools:context=".ui.home.HomeFragment">
<TextView
android:id="@+id/text_home"
android:layout_width="309dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/ipInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="253dp"
android:layout_height="wrap_content"
android:text="Bitte stellen sie eine Verbindung zu Ihrem Automationserver her!"
android:gravity="center_horizontal"
android:text="Please connect to your automationserver!"
android:textAlignment="center"
android:textColor="#FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_home"
android:gravity="center_horizontal" />
app:layout_constraintTop_toBottomOf="@+id/text_home" />
<EditText
android:id="@+id/ipInput"
@ -38,13 +39,13 @@
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:ems="10"
android:hint="IP-Adresse"
android:hint="ip-address"
android:inputType="text"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
app:layout_constraintBottom_toTopOf="@+id/userInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent" />
<EditText
@ -53,7 +54,7 @@
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:ems="10"
android:hint="E-mail"
android:hint="user"
android:inputType="textEmailAddress"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
@ -69,7 +70,7 @@
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:ems="10"
android:hint="Passwort"
android:hint="password"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
@ -86,4 +87,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordInput" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
@ -20,99 +21,4 @@
app:layout_constraintStart_toStartOf="parent"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/textView3"
android:layout_width="193dp"
android:layout_height="33dp"
android:layout_marginTop="200dp"
android:text="Raumtemperatur in °C"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/seekBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/textView4"
android:layout_width="193dp"
android:layout_height="33dp"
android:text="Elektrogeräte EIN/AUS"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal" />
<SeekBar
android:id="@+id/seekBar"
style="@android:style/Widget.DeviceDefault.Light.SeekBar"
android:layout_width="235dp"
android:layout_height="45dp"
android:max="30"
android:progress="15"
app:layout_constraintBottom_toTopOf="@+id/textView4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:text="Steckdose 1 "
android:textColor="#FFFFFF"
app:layout_constraintBottom_toTopOf="@+id/switch3"
app:layout_constraintEnd_toStartOf="@+id/switch2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<Switch
android:id="@+id/switch3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="200dp"
android:text="Steckdose 3 "
android:textColor="#FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/switch4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch1" />
<Switch
android:id="@+id/switch2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:text="Steckdose 2 "
android:textColor="#FFFFFF"
app:layout_constraintBottom_toTopOf="@+id/switch4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/switch1"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<Switch
android:id="@+id/switch4"
android:layout_width="129dp"
android:layout_height="22dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="200dp"
android:text="Steckdose 4 "
android:textColor="#FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/switch3"
app:layout_constraintTop_toBottomOf="@+id/switch2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
@ -7,6 +8,9 @@
<item
android:id="@+id/nav_home"
android:title="@string/menu_home" />
<item
android:id="@+id/nav_konsole"
android:title="Konsole" />
<item
android:id="@+id/nav_badezimmer"
android:title="Badezimmer" />

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
@ -8,9 +9,15 @@
<fragment
android:id="@+id/nav_home"
android:name="de.jg_cody.Terraplex.ui.home.HomeFragment"
android:label="@string/menu_home"
android:label="Home"
tools:layout="@layout/fragment_home" />
<fragment
android:id="@+id/nav_konsole"
android:name="de.jg_cody.Terraplex.ui.Konsole.KonsoleFragment"
android:label="Konsole"
tools:layout="@layout/fragment_konsole" />
<fragment
android:id="@+id/nav_badezimmer"
android:name="de.jg_cody.Terraplex.ui.badezimmer.BadezimmerFragment"

View File

@ -8,7 +8,7 @@
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnSecondary">@color/white</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FC8686</color>
<color name="purple_200">#EE0000</color>
<color name="purple_500">#EE0000</color>
<color name="purple_700">#B30000</color>
<color name="teal_200">#DA0303</color>