diff --git a/HelloWorld.py b/HelloWorld.py
deleted file mode 100644
index be1da56..0000000
--- a/HelloWorld.py
+++ /dev/null
@@ -1 +0,0 @@
-Print("Hello World")
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 42b38cd..0000000
--- a/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# WRSDv2
-Witamy w repozytorium projektu WRSD
diff --git a/TEST.PY b/TEST.PY
deleted file mode 100644
index 19c96f6..0000000
--- a/TEST.PY
+++ /dev/null
@@ -1 +0,0 @@
-print("hej")
\ No newline at end of file
diff --git a/Tescik b/Tescik
deleted file mode 100644
index 7e82250..0000000
--- a/Tescik
+++ /dev/null
@@ -1 +0,0 @@
-Hej Hej
\ No newline at end of file
diff --git a/WRSD2/app/build.gradle b/WRSD2/app/build.gradle
index 3f148a4..29a804e 100644
--- a/WRSD2/app/build.gradle
+++ b/WRSD2/app/build.gradle
@@ -44,6 +44,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
diff --git a/WRSD2/app/src/main/AndroidManifest.xml b/WRSD2/app/src/main/AndroidManifest.xml
index 8993dcf..1ce212a 100644
--- a/WRSD2/app/src/main/AndroidManifest.xml
+++ b/WRSD2/app/src/main/AndroidManifest.xml
@@ -6,22 +6,48 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
- android:icon="@mipmap/ic_launcher"
+ android:icon="@drawable/wrsdlogo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WRSD"
tools:targetApi="31" >
+
+
+
+
+
+
+
+
+
+ android:exported="false"
+ android:theme="@style/Theme.WRSD.NoActionBar">
+ android:exported="false"
+ android:theme="@style/Theme.WRSD.NoActionBar">
@@ -38,7 +64,8 @@
+ android:label="@string/app_name"
+ android:theme="@style/Theme.WRSD.NoActionBar">
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/AddDeviceActivity.java b/WRSD2/app/src/main/java/com/example/wrsd/AddDeviceActivity.java
new file mode 100644
index 0000000..916e8da
--- /dev/null
+++ b/WRSD2/app/src/main/java/com/example/wrsd/AddDeviceActivity.java
@@ -0,0 +1,38 @@
+package com.example.wrsd;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+
+public class AddDeviceActivity extends AppCompatActivity {
+
+ EditText editTextTextName;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_add_device);
+
+ editTextTextName = (EditText) findViewById(R.id.editTextTextName);
+ }
+
+
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == 1) {
+ if(resultCode == RESULT_OK) {
+ String strEditText = data.getStringExtra("editTextValue");
+ }
+ }
+ }
+
+ public void DeviceName(View view){
+ String editTextName = editTextTextName.getText().toString().trim();
+ Intent intent = new Intent();
+ intent.putExtra("name", editTextName);
+ setResult(RESULT_OK, intent);
+ finish();
+ }
+}
\ No newline at end of file
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/Device.java b/WRSD2/app/src/main/java/com/example/wrsd/Device.java
new file mode 100644
index 0000000..77ad2ef
--- /dev/null
+++ b/WRSD2/app/src/main/java/com/example/wrsd/Device.java
@@ -0,0 +1,28 @@
+package com.example.wrsd;
+
+public class Device {
+
+ String id;
+ String name;
+
+ public Device(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/MainActivity2.java b/WRSD2/app/src/main/java/com/example/wrsd/MainActivity2.java
index de2abc2..9d09c08 100644
--- a/WRSD2/app/src/main/java/com/example/wrsd/MainActivity2.java
+++ b/WRSD2/app/src/main/java/com/example/wrsd/MainActivity2.java
@@ -1,20 +1,164 @@
package com.example.wrsd;
-import androidx.appcompat.app.AppCompatActivity;
-import android.os.Bundle;
+import static com.example.wrsd.RoomActivity_1.setWindowFlag;
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.Intent;
+import android.graphics.Color;
+import android.media.Image;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.wrsd.ui.login.LoginActivity;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.OnFailureListener;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.firestore.CollectionReference;
+import com.google.firebase.firestore.DocumentReference;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+
+import java.util.HashMap;
+import java.util.Map;
public class MainActivity2 extends AppCompatActivity {
FirebaseAuth mAuth;
+ FirebaseFirestore firestore;
+ public String userEmail;
@Override
protected void onCreate(Bundle savedInstanceState) {
+ if (Build.VERSION.SDK_INT >= 19) {
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+ //make fully Android Transparent Status bar
+ if (Build.VERSION.SDK_INT >= 21) {
+ setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
+ getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+
+ userEmail = extras.getString("key");
+ Toast.makeText(getApplicationContext(), "Cześć " + userEmail, Toast.LENGTH_LONG).show();
+ //The key argument here must match that used in the other activity
+ }
+
mAuth = FirebaseAuth.getInstance();
+ firestore = FirebaseFirestore.getInstance();
+
+
+
+
+//
+// FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
+// DocumentReference docIdRef = rootRef.collection("users").document("FJQULeLWxEMLsAleYBkl");
+// docIdRef.get().addOnCompleteListener(new OnCompleteListener() {
+// @Override
+// public void onComplete(@NonNull Task task) {
+// if (task.isSuccessful()) {
+// DocumentSnapshot document = task.getResult();
+// if (document.exists()) {
+// Toast.makeText(getApplicationContext(), "exist", Toast.LENGTH_LONG).show();
+// } else {
+// Toast.makeText(getApplicationContext(), "not", Toast.LENGTH_LONG).show();
+// }
+// } else {
+// Toast.makeText(getApplicationContext(), "failure", Toast.LENGTH_LONG).show();
+//
+// }
+// }
+// });
+
+// FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
+// CollectionReference yourCollRef = rootRef.collection("users");
+// Query query = yourCollRef.whereEqualTo("email", userEmail);
+//
+// yourCollRef.document(userEmail).collection("rooms")
+// .document().set(rooms)
+// .addOnSuccessListener(new OnSuccessListener() {
+// @Override
+// public void onSuccess(Void aVoid) {
+//
+//
+//
+// }
+// });
+
+
+// firestore.collection("users").add(users).addOnSuccessListener(new OnSuccessListener() {
+// @Override
+// public void onSuccess(DocumentReference documentReference) {
+// Toast.makeText(getApplicationContext(), "success firestore", Toast.LENGTH_LONG).show();
+//
+// }
+// }).addOnFailureListener(new OnFailureListener() {
+// @Override
+// public void onFailure(@NonNull Exception e) {
+// Toast.makeText(getApplicationContext(), "Błąd zapisu danych! Spróbuj ponownie", Toast.LENGTH_LONG).show();
+//
+// }
+// });
+
+
+// query.get().addOnCompleteListener(new OnCompleteListener() {
+// @Override
+// public void onComplete(@NonNull Task task) {
+// if (task.isSuccessful()) {
+// if (task.getResult().isEmpty()) {
+// Toast.makeText(getApplicationContext(), "not exist", Toast.LENGTH_LONG).show();
+// firestore.collection("users").add(users).addOnSuccessListener(new OnSuccessListener() {
+// @Override
+// public void onSuccess(DocumentReference documentReference) {
+// Toast.makeText(getApplicationContext(), "succes firestore", Toast.LENGTH_LONG).show();
+//
+// }
+// }).addOnFailureListener(new OnFailureListener() {
+// @Override
+// public void onFailure(@NonNull Exception e) {
+// Toast.makeText(getApplicationContext(), "Błąd zapisu danych! Spróbuj ponownie", Toast.LENGTH_LONG).show();
+//
+// }
+// });
+// }
+// else {
+// Toast.makeText(getApplicationContext(), "exist", Toast.LENGTH_LONG).show();
+// }
+// } else {
+// Toast.makeText(getApplicationContext(), "Błąd pobrania danych! Spróbuj ponownie", Toast.LENGTH_LONG).show();
+// }
+// }
+// });
}
+
+ public void RoomActivity(View v){
+
+// ImageView b = (ImageView) v;
+// String imageText = b.getContentDescription().toString();
+ CharSequence description = v.getContentDescription();
+ String roomText = String.valueOf(description);
+ Intent intent = new Intent(this, RoomActivity_1.class);
+ intent.putExtra("room", roomText);
+ intent.putExtra("email", userEmail);
+ startActivity(intent);
+ }
}
\ No newline at end of file
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/RegisterUser.java b/WRSD2/app/src/main/java/com/example/wrsd/RegisterUser.java
index 599dacf..18606e7 100644
--- a/WRSD2/app/src/main/java/com/example/wrsd/RegisterUser.java
+++ b/WRSD2/app/src/main/java/com/example/wrsd/RegisterUser.java
@@ -1,13 +1,18 @@
package com.example.wrsd;
+import static com.example.wrsd.RoomActivity_1.setWindowFlag;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
+import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.util.Patterns;
import android.view.View;
+import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
@@ -38,6 +43,14 @@ public class RegisterUser extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
+ if (Build.VERSION.SDK_INT >= 19) {
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+ //make fully Android Transparent Status bar
+ if (Build.VERSION.SDK_INT >= 21) {
+ setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
+ getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_user);
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/RoomActivity_1.java b/WRSD2/app/src/main/java/com/example/wrsd/RoomActivity_1.java
new file mode 100644
index 0000000..4f60696
--- /dev/null
+++ b/WRSD2/app/src/main/java/com/example/wrsd/RoomActivity_1.java
@@ -0,0 +1,257 @@
+package com.example.wrsd;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.OnFailureListener;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.firestore.CollectionReference;
+import com.google.firebase.firestore.DocumentReference;
+import com.google.firebase.firestore.DocumentSnapshot;
+import com.google.firebase.firestore.FieldValue;
+import com.google.firebase.firestore.FirebaseFirestore;
+import com.google.firebase.firestore.Query;
+import com.google.firebase.firestore.QueryDocumentSnapshot;
+import com.google.firebase.firestore.QuerySnapshot;
+
+import org.w3c.dom.Text;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+public class RoomActivity_1 extends AppCompatActivity {
+
+ public List deviceList = new ArrayList<>();
+ public List deviceFromBase = new ArrayList<>();
+ public List temp = new ArrayList<>();
+ private RecyclerView recyclerView;
+ private SingleRoomAdapter mAdapter;
+ private String userEmail;
+ Integer roomIndex;
+ public String roomvalue;
+ private TextView roomName1;
+ TextView myTextView;
+ private TextView deviceName;
+
+
+ public static void setWindowFlag(Activity activity, final int bits, boolean on) {
+
+ Window win = activity.getWindow();
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ if (on) {
+ winParams.flags |= bits;
+ } else {
+ winParams.flags &= ~bits;
+ }
+ win.setAttributes(winParams);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ if (Build.VERSION.SDK_INT >= 19) {
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+ //make fully Android Transparent Status bar
+ if (Build.VERSION.SDK_INT >= 21) {
+ setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
+ getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_room1);
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+
+ roomName1 = (TextView) findViewById(R.id.textView);
+ roomvalue = extras.getString("room");
+ userEmail = extras.getString("email");
+ //The key argument here must match that used in the other activity
+ }
+
+
+ recyclerView = findViewById(R.id.recycler_view);
+
+ mAdapter = new SingleRoomAdapter(deviceList, getApplicationContext());
+ RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
+ recyclerView.setLayoutManager(mLayoutManager);
+ recyclerView.setItemAnimator(new DefaultItemAnimator());
+ recyclerView.setAdapter(mAdapter);
+
+ roomName1 = (TextView) findViewById(R.id.textView);
+ roomName1.setText(roomvalue);
+
+ myTextView =findViewById(R.id.textView);
+
+ getData();
+
+ }
+
+ private void getData() {
+ deviceFromBase.clear();
+ FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
+
+ rootRef.collection("users").document(userEmail).collection("rooms").document(roomvalue)
+ .get()
+ .addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(DocumentSnapshot documentSnapshot) {
+ if (documentSnapshot!=null) {
+ temp.add(documentSnapshot.getData().toString());
+ if(!temp.get(0).equals("{Urzadzenia=[]}")) {
+ String[] parts = temp.get(0).split(Pattern.quote("["));
+ String[] p2 = parts[1].split(Pattern.quote("]"));
+ String[] devices = p2[0].split("(,)|(\\s+)");
+ for (Integer i = 0; i < devices.length; i = i + 2) {
+ deviceFromBase.add(devices[i]);
+ }
+ Device d1;
+ Integer j = 0;
+
+ for (String d : deviceFromBase) {
+ String jStr = Integer.toString(j);
+ d1 = new Device(jStr, d);
+ deviceList.add(d1);
+ }
+ mAdapter.notifyDataSetChanged();
+ }
+ else{
+ Toast.makeText(getApplicationContext(), "Brak urządzeń w pokoju", Toast.LENGTH_LONG).show();
+ }
+
+ } else {
+ Toast.makeText(getApplicationContext(), "Brak urządzeń w pokoju", Toast.LENGTH_LONG).show();
+ }
+ }
+ }).addOnFailureListener(new OnFailureListener() {
+ @Override
+ public void onFailure(@NonNull Exception e) {
+ // Toast.makeText(, "", Toast.LENGTH_SHORT).show();
+ // Log.d("Tag",e.toString());
+// data="Failed";
+ }
+ });
+ }
+
+
+
+
+
+// CollectionReference usersCol = rootRef.collection("users");
+// Query query = usersCol.whereEqualTo("email", userEmail).whereEqualTo("rooms", roomvalue);
+// DocumentReference document = usersCol.document(userEmail).collection("rooms").document(roomvalue);
+//
+// Map docData = new HashMap<>();
+//
+// query.get().addOnCompleteListener(new OnCompleteListener() {
+// @Override
+// public void onComplete(@NonNull Task task) {
+// if (task.isSuccessful()) {
+// for (QueryDocumentSnapshot document : task.getResult()) {
+//// Log.d("TAG", document.getId() + " => " + document.getData());
+// deviceFromBase.add(document.getData().toString());
+// Toast.makeText(getApplicationContext(), "dobrze", Toast.LENGTH_LONG).show();
+// }
+// } else {
+// Toast.makeText(getApplicationContext(), "Błąd pobrania danych! Spróbuj ponownie", Toast.LENGTH_LONG).show(); }
+// }
+// });
+
+// }
+
+
+
+
+// private void prepareRoomData() {
+// getData();
+//
+// Device d1;
+// Integer j = 0;
+//
+// for(String d: deviceFromBase){
+// String jStr = Integer.toString(j);
+// d1 = new Device(jStr, d);
+// deviceList.add(d1);
+// }
+
+// d1 = new Device("1", "Oświetlenie");
+// deviceList.add(d1);
+// d1 = new Device("2", "Głośniki");
+// deviceList.add(d1);
+// d1 = new Device("3", "Rolety");
+// deviceList.add(d1);
+// d1 = new Device("4", "Ogrzewanie");
+// deviceList.add(d1);
+// d1 = new Device("5", "Odkurzacz");
+// deviceList.add(d1);
+
+// mAdapter.notifyDataSetChanged();
+// }
+
+ public void onBackClicked(View view) {
+ startActivity(new Intent(getApplicationContext(), MainActivity.class));
+ finish();
+ }
+
+
+ public void addDevice(View view){
+ Intent i = new Intent(this, AddDeviceActivity.class);
+ startActivityForResult(i, 1);
+ }
+
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == 1) {
+ if(resultCode == RESULT_OK) {
+ FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
+ String strEditText = data.getStringExtra("name");
+ Device d1 = new Device("6", strEditText);
+ deviceList.add(d1);
+
+ mAdapter.notifyDataSetChanged();
+
+ DocumentReference docRef = rootRef.collection("users").document(userEmail).collection("rooms").document(roomvalue);
+ docRef.update("Urzadzenia", FieldValue.arrayUnion(strEditText));
+
+ }
+ }
+ }
+
+ public void settings(View view){
+
+ TextView b = (TextView) view;
+ String dn = b.getText().toString();
+ Intent intent = new Intent(this, DeviceSettings.class);
+ intent.putExtra("device", dn);
+ intent.putExtra("email", userEmail);
+ intent.putExtra("room", roomvalue);
+ startActivity(intent);
+ finish();
+
+
+ }
+}
diff --git a/WRSD2/app/src/main/java/com/example/wrsd/ui/login/LoginActivity.java b/WRSD2/app/src/main/java/com/example/wrsd/ui/login/LoginActivity.java
index dbf3469..328fd99 100644
--- a/WRSD2/app/src/main/java/com/example/wrsd/ui/login/LoginActivity.java
+++ b/WRSD2/app/src/main/java/com/example/wrsd/ui/login/LoginActivity.java
@@ -1,30 +1,26 @@
package com.example.wrsd.ui.login;
-import android.app.Activity;
+import static com.example.wrsd.RoomActivity_1.setWindowFlag;
import androidx.annotation.NonNull;
-import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import android.content.Intent;
+import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.KeyEvent;
+import android.util.Patterns;
import android.view.View;
-import android.view.inputmethod.EditorInfo;
+import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
-import com.example.wrsd.MainActivity;
import com.example.wrsd.MainActivity2;
import com.example.wrsd.R;
import com.example.wrsd.RegisterUser;
@@ -51,6 +47,14 @@ public class LoginActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
+ if (Build.VERSION.SDK_INT >= 19) {
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+ //make fully Android Transparent Status bar
+ if (Build.VERSION.SDK_INT >= 21) {
+ setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
+ getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
super.onCreate(savedInstanceState);
binding = ActivityLoginBinding.inflate(getLayoutInflater());
@@ -70,73 +74,74 @@ public class LoginActivity extends AppCompatActivity {
usernameEditText2 = (EditText) findViewById(R.id.username);
passwordEditText2 = (EditText) findViewById(R.id.password);
progressBar = (ProgressBar) findViewById(R.id.loading);
+ login_button = (Button) findViewById(R.id.login);
- loginViewModel.getLoginFormState().observe(this, new Observer() {
- @Override
- public void onChanged(@Nullable LoginFormState loginFormState) {
- if (loginFormState == null) {
- return;
- }
- loginButton.setEnabled(loginFormState.isDataValid());
- if (loginFormState.getUsernameError() != null) {
- usernameEditText.setError(getString(loginFormState.getUsernameError()));
- }
- if (loginFormState.getPasswordError() != null) {
- passwordEditText.setError(getString(loginFormState.getPasswordError()));
- }
- }
- });
+// loginViewModel.getLoginFormState().observe(this, new Observer() {
+// @Override
+// public void onChanged(@Nullable LoginFormState loginFormState) {
+// if (loginFormState == null) {
+// return;
+// }
+// loginButton.setEnabled(loginFormState.isDataValid());
+// if (loginFormState.getUsernameError() != null) {
+// usernameEditText.setError(getString(loginFormState.getUsernameError()));
+// }
+// if (loginFormState.getPasswordError() != null) {
+// passwordEditText.setError(getString(loginFormState.getPasswordError()));
+// }
+// }
+// });
- loginViewModel.getLoginResult().observe(this, new Observer() {
- @Override
- public void onChanged(@Nullable LoginResult loginResult) {
- if (loginResult == null) {
- return;
- }
- progressBar.setVisibility(View.GONE);
- if (loginResult.getError() != null) {
- showLoginFailed(loginResult.getError());
- }
- if (loginResult.getSuccess() != null) {
- updateUiWithUser(loginResult.getSuccess());
- }
- setResult(Activity.RESULT_OK);
+// loginViewModel.getLoginResult().observe(this, new Observer() {
+// @Override
+// public void onChanged(@Nullable LoginResult loginResult) {
+// if (loginResult == null) {
+// return;
+// }
+// progressBar.setVisibility(View.GONE);
+// if (loginResult.getError() != null) {
+// showLoginFailed(loginResult.getError());
+// }
+// if (loginResult.getSuccess() != null) {
+// updateUiWithUser(loginResult.getSuccess());
+// }
+// setResult(Activity.RESULT_OK);
+//
+// //Complete and destroy login activity once successful
+// finish();
+// }
+//// });
+//
+// TextWatcher afterTextChangedListener = new TextWatcher() {
+// @Override
+// public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+// // ignore
+// }
+//
+// @Override
+// public void onTextChanged(CharSequence s, int start, int before, int count) {
+// // ignore
+// }
+//
+// @Override
+// public void afterTextChanged(Editable s) {
+// loginViewModel.loginDataChanged(usernameEditText.getText().toString(),
+// passwordEditText.getText().toString());
+// }
+// };
+// usernameEditText.addTextChangedListener(afterTextChangedListener);
+// passwordEditText.addTextChangedListener(afterTextChangedListener);
+// passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- //Complete and destroy login activity once successful
- finish();
- }
- });
-
- TextWatcher afterTextChangedListener = new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- // ignore
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- // ignore
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- loginViewModel.loginDataChanged(usernameEditText.getText().toString(),
- passwordEditText.getText().toString());
- }
- };
- usernameEditText.addTextChangedListener(afterTextChangedListener);
- passwordEditText.addTextChangedListener(afterTextChangedListener);
- passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
-
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_DONE) {
- loginViewModel.login(usernameEditText.getText().toString(),
- passwordEditText.getText().toString());
- }
- return false;
- }
- });
+// @Override
+// public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+// if (actionId == EditorInfo.IME_ACTION_DONE) {
+// loginViewModel.login(usernameEditText.getText().toString(),
+// passwordEditText.getText().toString());
+// }
+// return false;
+// }
+// });
// loginButton.setOnClickListener(new View.OnClickListener() {
// @Override
@@ -147,7 +152,7 @@ public class LoginActivity extends AppCompatActivity {
// }
// });
- login_button = (Button) findViewById(R.id.login);
+ login_button.setEnabled(true);
login_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -170,10 +175,29 @@ public class LoginActivity extends AppCompatActivity {
public void LoginUser(){
String email = usernameEditText2.getText().toString().trim();
String password = passwordEditText2.getText().toString().trim();
+
+ if (email.isEmpty()) {
+ usernameEditText2.setError("Podaj swój email");
+ usernameEditText2.requestFocus();
+ return;
+ } else if (!Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
+ usernameEditText2.setError("Podaj prawidłowy email!");
+ usernameEditText2.requestFocus();
+ return;
+ }
+ if (password.isEmpty()) {
+ passwordEditText2.setError("Podaj swoje hasło!");
+ passwordEditText2.requestFocus();
+ return;
+ } else if (password.length() <= 5) {
+ passwordEditText2.setError("Hasło musi mieć więcej niż 5 znaków");
+ passwordEditText2.requestFocus();
+ return;
+ }
+
mAuth.signInWithEmailAndPassword(email, password).addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(AuthResult authResult) {
- Toast.makeText(getApplicationContext(), "Użytkownik zalogowany", Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
openMainActivity();
@@ -185,10 +209,14 @@ public class LoginActivity extends AppCompatActivity {
progressBar.setVisibility(View.GONE);
}
});
+ progressBar.setVisibility(View.GONE);
}
public void openMainActivity(){
+
+ String email = usernameEditText2.getText().toString().trim();
Intent intent = new Intent(this, MainActivity2.class);
+ intent.putExtra("key", email);
startActivity(intent);
}
@@ -197,13 +225,13 @@ public class LoginActivity extends AppCompatActivity {
startActivity(intent);
}
- private void updateUiWithUser(LoggedInUserView model) {
- String welcome = getString(R.string.welcome) + model.getDisplayName();
- // TODO : initiate successful logged in experience
- Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show();
- }
-
- private void showLoginFailed(@StringRes Integer errorString) {
- Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show();
- }
+// private void updateUiWithUser(LoggedInUserView model) {
+// String welcome = getString(R.string.welcome) + model.getDisplayName();
+// // TODO : initiate successful logged in experience
+// Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show();
+// }
+//
+// private void showLoginFailed(@StringRes Integer errorString) {
+// Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show();
+// }
}
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/drawable/back.png b/WRSD2/app/src/main/res/drawable/back.png
index fc59d95..c55cdc5 100644
Binary files a/WRSD2/app/src/main/res/drawable/back.png and b/WRSD2/app/src/main/res/drawable/back.png differ
diff --git a/WRSD2/app/src/main/res/drawable/glosnik.png b/WRSD2/app/src/main/res/drawable/glosnik.png
index 08b4960..95db9ce 100644
Binary files a/WRSD2/app/src/main/res/drawable/glosnik.png and b/WRSD2/app/src/main/res/drawable/glosnik.png differ
diff --git a/WRSD2/app/src/main/res/layout/activity_add_device.xml b/WRSD2/app/src/main/res/layout/activity_add_device.xml
new file mode 100644
index 0000000..7d8ac52
--- /dev/null
+++ b/WRSD2/app/src/main/res/layout/activity_add_device.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/layout/activity_login.xml b/WRSD2/app/src/main/res/layout/activity_login.xml
index b99e19a..9a788a5 100644
--- a/WRSD2/app/src/main/res/layout/activity_login.xml
+++ b/WRSD2/app/src/main/res/layout/activity_login.xml
@@ -16,7 +16,7 @@
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginTop="288dp"
+ android:layout_marginTop="328dp"
android:hint="@string/prompt_login"
android:inputType="textEmailAddress"
android:minHeight="48dp"
@@ -29,10 +29,9 @@
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginTop="44dp"
+ android:layout_marginTop="40dp"
android:hint="@string/prompt_haslo"
android:imeActionLabel="@string/action_sign_in_short"
- android:imeOptions="actionDone"
android:inputType="textPassword"
android:minHeight="48dp"
android:selectAllOnFocus="true"
@@ -53,7 +52,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/password"
- app:layout_constraintVertical_bias="0.42" />
+ app:layout_constraintVertical_bias="0.811" />
+ app:layout_constraintVertical_bias="0.534" />
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/layout/activity_main2.xml b/WRSD2/app/src/main/res/layout/activity_main2.xml
index df8976c..8b3af54 100644
--- a/WRSD2/app/src/main/res/layout/activity_main2.xml
+++ b/WRSD2/app/src/main/res/layout/activity_main2.xml
@@ -4,372 +4,231 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@drawable/back"
android:orientation="vertical"
tools:context=".MainActivity2">
-
+
+
+
+
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
-
-
-
+
+ android:layout_gravity="center"
+ android:clickable="true"
+ android:contentDescription="Salon"
+ android:gravity="center"
+ android:onClick="RoomActivity"
+ android:orientation="vertical">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:clickable="true"
+ android:contentDescription="Kuchnia"
+ android:gravity="center"
+ android:onClick="RoomActivity"
+ android:orientation="vertical">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/layout/activity_room1.xml b/WRSD2/app/src/main/res/layout/activity_room1.xml
new file mode 100644
index 0000000..8cc5159
--- /dev/null
+++ b/WRSD2/app/src/main/res/layout/activity_room1.xml
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values-night/themes.xml b/WRSD2/app/src/main/res/values-night/themes.xml
index c39a5d2..5cd5c96 100644
--- a/WRSD2/app/src/main/res/values-night/themes.xml
+++ b/WRSD2/app/src/main/res/values-night/themes.xml
@@ -13,4 +13,9 @@
- ?attr/colorPrimaryVariant
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values/attrs.xml b/WRSD2/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..e52391d
--- /dev/null
+++ b/WRSD2/app/src/main/res/values/attrs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values/colors.xml b/WRSD2/app/src/main/res/values/colors.xml
index f8c6127..426ac4e 100644
--- a/WRSD2/app/src/main/res/values/colors.xml
+++ b/WRSD2/app/src/main/res/values/colors.xml
@@ -7,4 +7,9 @@
#FF018786
#FF000000
#FFFFFFFF
+ #FF039BE5
+ #FF01579B
+ #FF40C4FF
+ #FF00B0FF
+ #66000000
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values/strings.xml b/WRSD2/app/src/main/res/values/strings.xml
index 05c7747..a11ccb5 100644
--- a/WRSD2/app/src/main/res/values/strings.xml
+++ b/WRSD2/app/src/main/res/values/strings.xml
@@ -21,4 +21,8 @@
Hello first fragment
Hello second fragment. Arg: %1$s
RegisterUser
+ RoomActivity2
+ Dummy Button
+ DUMMY\nCONTENT
+ DeviceSettings
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values/styles.xml b/WRSD2/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..96cc584
--- /dev/null
+++ b/WRSD2/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WRSD2/app/src/main/res/values/themes.xml b/WRSD2/app/src/main/res/values/themes.xml
index 08b3028..88b884c 100644
--- a/WRSD2/app/src/main/res/values/themes.xml
+++ b/WRSD2/app/src/main/res/values/themes.xml
@@ -22,4 +22,15 @@
+
+
+
+
\ No newline at end of file
diff --git a/testowy b/testowy
deleted file mode 100644
index ef54628..0000000
--- a/testowy
+++ /dev/null
@@ -1 +0,0 @@
-ttt
\ No newline at end of file