mirror of
https://git.wmi.amu.edu.pl/s470664/WRSDv2.git
synced 2024-09-01 12:15:35 +02:00
.
This commit is contained in:
parent
8e55375c32
commit
4821b01a71
@ -1 +0,0 @@
|
|||||||
Print("Hello World")
|
|
@ -44,6 +44,7 @@ dependencies {
|
|||||||
implementation 'androidx.navigation:navigation-ui:2.4.1'
|
implementation 'androidx.navigation:navigation-ui:2.4.1'
|
||||||
implementation 'com.google.firebase:firebase-database:20.1.0'
|
implementation 'com.google.firebase:firebase-database:20.1.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
@ -6,22 +6,48 @@
|
|||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/wrsdlogo"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.WRSD"
|
android:theme="@style/Theme.WRSD"
|
||||||
tools:targetApi="31" >
|
tools:targetApi="31" >
|
||||||
|
<activity
|
||||||
|
android:name=".DeviceSettings"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.lib_name"
|
||||||
|
android:value="" />
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".RoomActivity_1"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar" >
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.lib_name"
|
||||||
|
android:value="" />
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".AddDeviceActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.lib_name"
|
||||||
|
android:value="" />
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity2"
|
android:name=".MainActivity2"
|
||||||
android:exported="false" >
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.lib_name"
|
android:name="android.app.lib_name"
|
||||||
android:value="" />
|
android:value="" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".RegisterUser"
|
android:name=".RegisterUser"
|
||||||
android:exported="false" >
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.lib_name"
|
android:name="android.app.lib_name"
|
||||||
android:value="" />
|
android:value="" />
|
||||||
@ -38,7 +64,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.login.LoginActivity"
|
android:name=".ui.login.LoginActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/Theme.WRSD.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
28
WRSD2/app/src/main/java/com/example/wrsd/Device.java
Normal file
28
WRSD2/app/src/main/java/com/example/wrsd/Device.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,164 @@
|
|||||||
package com.example.wrsd;
|
package com.example.wrsd;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import static com.example.wrsd.RoomActivity_1.setWindowFlag;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
|
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.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 {
|
public class MainActivity2 extends AppCompatActivity {
|
||||||
|
|
||||||
FirebaseAuth mAuth;
|
FirebaseAuth mAuth;
|
||||||
|
FirebaseFirestore firestore;
|
||||||
|
public String userEmail;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
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);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_main2);
|
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();
|
mAuth = FirebaseAuth.getInstance();
|
||||||
|
firestore = FirebaseFirestore.getInstance();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
|
||||||
|
// DocumentReference docIdRef = rootRef.collection("users").document("FJQULeLWxEMLsAleYBkl");
|
||||||
|
// docIdRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
|
||||||
|
// @Override
|
||||||
|
// public void onComplete(@NonNull Task<DocumentSnapshot> 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<Void>() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(Void aVoid) {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
// firestore.collection("users").add(users).addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
|
||||||
|
// @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<QuerySnapshot>() {
|
||||||
|
// @Override
|
||||||
|
// public void onComplete(@NonNull Task<QuerySnapshot> 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<DocumentReference>() {
|
||||||
|
// @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);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,13 +1,18 @@
|
|||||||
package com.example.wrsd;
|
package com.example.wrsd;
|
||||||
|
|
||||||
|
import static com.example.wrsd.RoomActivity_1.setWindowFlag;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@ -38,6 +43,14 @@ public class RegisterUser extends AppCompatActivity{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
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);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_register_user);
|
setContentView(R.layout.activity_register_user);
|
||||||
|
|
||||||
|
257
WRSD2/app/src/main/java/com/example/wrsd/RoomActivity_1.java
Normal file
257
WRSD2/app/src/main/java/com/example/wrsd/RoomActivity_1.java
Normal file
@ -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<Device> deviceList = new ArrayList<>();
|
||||||
|
public List<String> deviceFromBase = new ArrayList<>();
|
||||||
|
public List<String> 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<DocumentSnapshot>() {
|
||||||
|
@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<String, Object> docData = new HashMap<>();
|
||||||
|
//
|
||||||
|
// query.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
|
||||||
|
// @Override
|
||||||
|
// public void onComplete(@NonNull Task<QuerySnapshot> 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();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,30 +1,26 @@
|
|||||||
package com.example.wrsd.ui.login;
|
package com.example.wrsd.ui.login;
|
||||||
|
|
||||||
import android.app.Activity;
|
import static com.example.wrsd.RoomActivity_1.setWindowFlag;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.lifecycle.Observer;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.text.Editable;
|
import android.util.Patterns;
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.example.wrsd.MainActivity;
|
|
||||||
import com.example.wrsd.MainActivity2;
|
import com.example.wrsd.MainActivity2;
|
||||||
import com.example.wrsd.R;
|
import com.example.wrsd.R;
|
||||||
import com.example.wrsd.RegisterUser;
|
import com.example.wrsd.RegisterUser;
|
||||||
@ -51,6 +47,14 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
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);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
binding = ActivityLoginBinding.inflate(getLayoutInflater());
|
binding = ActivityLoginBinding.inflate(getLayoutInflater());
|
||||||
@ -70,73 +74,74 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
usernameEditText2 = (EditText) findViewById(R.id.username);
|
usernameEditText2 = (EditText) findViewById(R.id.username);
|
||||||
passwordEditText2 = (EditText) findViewById(R.id.password);
|
passwordEditText2 = (EditText) findViewById(R.id.password);
|
||||||
progressBar = (ProgressBar) findViewById(R.id.loading);
|
progressBar = (ProgressBar) findViewById(R.id.loading);
|
||||||
|
login_button = (Button) findViewById(R.id.login);
|
||||||
|
|
||||||
loginViewModel.getLoginFormState().observe(this, new Observer<LoginFormState>() {
|
// loginViewModel.getLoginFormState().observe(this, new Observer<LoginFormState>() {
|
||||||
@Override
|
// @Override
|
||||||
public void onChanged(@Nullable LoginFormState loginFormState) {
|
// public void onChanged(@Nullable LoginFormState loginFormState) {
|
||||||
if (loginFormState == null) {
|
// if (loginFormState == null) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
loginButton.setEnabled(loginFormState.isDataValid());
|
// loginButton.setEnabled(loginFormState.isDataValid());
|
||||||
if (loginFormState.getUsernameError() != null) {
|
// if (loginFormState.getUsernameError() != null) {
|
||||||
usernameEditText.setError(getString(loginFormState.getUsernameError()));
|
// usernameEditText.setError(getString(loginFormState.getUsernameError()));
|
||||||
}
|
// }
|
||||||
if (loginFormState.getPasswordError() != null) {
|
// if (loginFormState.getPasswordError() != null) {
|
||||||
passwordEditText.setError(getString(loginFormState.getPasswordError()));
|
// passwordEditText.setError(getString(loginFormState.getPasswordError()));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
loginViewModel.getLoginResult().observe(this, new Observer<LoginResult>() {
|
// loginViewModel.getLoginResult().observe(this, new Observer<LoginResult>() {
|
||||||
@Override
|
// @Override
|
||||||
public void onChanged(@Nullable LoginResult loginResult) {
|
// public void onChanged(@Nullable LoginResult loginResult) {
|
||||||
if (loginResult == null) {
|
// if (loginResult == null) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
progressBar.setVisibility(View.GONE);
|
// progressBar.setVisibility(View.GONE);
|
||||||
if (loginResult.getError() != null) {
|
// if (loginResult.getError() != null) {
|
||||||
showLoginFailed(loginResult.getError());
|
// showLoginFailed(loginResult.getError());
|
||||||
}
|
// }
|
||||||
if (loginResult.getSuccess() != null) {
|
// if (loginResult.getSuccess() != null) {
|
||||||
updateUiWithUser(loginResult.getSuccess());
|
// updateUiWithUser(loginResult.getSuccess());
|
||||||
}
|
// }
|
||||||
setResult(Activity.RESULT_OK);
|
// 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
|
// @Override
|
||||||
finish();
|
// public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
}
|
// if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
});
|
// loginViewModel.login(usernameEditText.getText().toString(),
|
||||||
|
// passwordEditText.getText().toString());
|
||||||
TextWatcher afterTextChangedListener = new TextWatcher() {
|
// }
|
||||||
@Override
|
// return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// loginButton.setOnClickListener(new View.OnClickListener() {
|
// loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
// @Override
|
// @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() {
|
login_button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -170,10 +175,29 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
public void LoginUser(){
|
public void LoginUser(){
|
||||||
String email = usernameEditText2.getText().toString().trim();
|
String email = usernameEditText2.getText().toString().trim();
|
||||||
String password = passwordEditText2.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<AuthResult>() {
|
mAuth.signInWithEmailAndPassword(email, password).addOnSuccessListener(new OnSuccessListener<AuthResult>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(AuthResult authResult) {
|
public void onSuccess(AuthResult authResult) {
|
||||||
Toast.makeText(getApplicationContext(), "Użytkownik zalogowany", Toast.LENGTH_LONG).show();
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
openMainActivity();
|
openMainActivity();
|
||||||
|
|
||||||
@ -185,10 +209,14 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openMainActivity(){
|
public void openMainActivity(){
|
||||||
|
|
||||||
|
String email = usernameEditText2.getText().toString().trim();
|
||||||
Intent intent = new Intent(this, MainActivity2.class);
|
Intent intent = new Intent(this, MainActivity2.class);
|
||||||
|
intent.putExtra("key", email);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,13 +225,13 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUiWithUser(LoggedInUserView model) {
|
// private void updateUiWithUser(LoggedInUserView model) {
|
||||||
String welcome = getString(R.string.welcome) + model.getDisplayName();
|
// String welcome = getString(R.string.welcome) + model.getDisplayName();
|
||||||
// TODO : initiate successful logged in experience
|
// // TODO : initiate successful logged in experience
|
||||||
Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show();
|
// Toast.makeText(getApplicationContext(), welcome, Toast.LENGTH_LONG).show();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void showLoginFailed(@StringRes Integer errorString) {
|
// private void showLoginFailed(@StringRes Integer errorString) {
|
||||||
Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show();
|
// Toast.makeText(getApplicationContext(), errorString, Toast.LENGTH_SHORT).show();
|
||||||
}
|
// }
|
||||||
}
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 831 KiB After Width: | Height: | Size: 831 KiB |
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 24 KiB |
56
WRSD2/app/src/main/res/layout/activity_add_device.xml
Normal file
56
WRSD2/app/src/main/res/layout/activity_add_device.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?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/back"
|
||||||
|
tools:context=".AddDeviceActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextTextName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Nazwa urządzenia"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.129"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.311" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="35dp"
|
||||||
|
android:layout_marginTop="38dp"
|
||||||
|
android:layout_marginEnd="210dp"
|
||||||
|
android:layout_marginBottom="86dp"
|
||||||
|
android:text="Dodajesz nowe urządzenie"
|
||||||
|
android:textSize="30dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/editTextTextName"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.046"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.775" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Dodaj"
|
||||||
|
android:clickable="true"
|
||||||
|
android:onClick="DeviceName"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.863"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.919" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -16,7 +16,7 @@
|
|||||||
android:id="@+id/username"
|
android:id="@+id/username"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="288dp"
|
android:layout_marginTop="328dp"
|
||||||
android:hint="@string/prompt_login"
|
android:hint="@string/prompt_login"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
@ -29,10 +29,9 @@
|
|||||||
android:id="@+id/password"
|
android:id="@+id/password"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="44dp"
|
android:layout_marginTop="40dp"
|
||||||
android:hint="@string/prompt_haslo"
|
android:hint="@string/prompt_haslo"
|
||||||
android:imeActionLabel="@string/action_sign_in_short"
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
android:imeOptions="actionDone"
|
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
@ -53,7 +52,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/password"
|
app:layout_constraintTop_toBottomOf="@+id/password"
|
||||||
app:layout_constraintVertical_bias="0.42" />
|
app:layout_constraintVertical_bias="0.811" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/loading"
|
android:id="@+id/loading"
|
||||||
@ -61,15 +60,13 @@
|
|||||||
android:layout_height="89dp"
|
android:layout_height="89dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginBottom="64dp"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@+id/login"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/password"
|
app:layout_constraintEnd_toEndOf="@+id/password"
|
||||||
app:layout_constraintHorizontal_bias="0.483"
|
app:layout_constraintHorizontal_bias="0.483"
|
||||||
app:layout_constraintStart_toStartOf="@+id/password"
|
app:layout_constraintStart_toStartOf="@+id/password"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/password"
|
||||||
app:layout_constraintVertical_bias="0.766"
|
app:layout_constraintVertical_bias="1.0"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -81,7 +78,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.265"
|
app:layout_constraintVertical_bias="0.239"
|
||||||
app:srcCompat="@drawable/wrsdlogo" />
|
app:srcCompat="@drawable/wrsdlogo" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -91,9 +88,9 @@
|
|||||||
android:text="Nie masz konta? Zarejestruj się"
|
android:text="Nie masz konta? Zarejestruj się"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.497"
|
app:layout_constraintHorizontal_bias="0.469"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/login"
|
app:layout_constraintTop_toBottomOf="@+id/login"
|
||||||
app:layout_constraintVertical_bias="0.292" />
|
app:layout_constraintVertical_bias="0.534" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,372 +4,231 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/back"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".MainActivity2">
|
tools:context=".MainActivity2">
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="wrap_content"
|
<ImageView
|
||||||
android:layout_height="wrap_content">
|
android:id="@+id/imageView2"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="130dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
app:srcCompat="@drawable/wrsdlogo" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
|
android:background="@drawable/back">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/textView2"
|
android:layout_width="200dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="200dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_margin="20dp"
|
||||||
android:layout_marginTop="5dp"
|
android:backgroundTint="#F3F0D8"
|
||||||
android:text="Dostępne pokoje:"
|
app:cardCornerRadius="30dp"
|
||||||
android:textSize="20dp"
|
app:cardElevation="15dp">
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<HorizontalScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#101117">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/ll1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_gravity="center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="Salon"
|
||||||
|
android:gravity="center"
|
||||||
|
android:onClick="RoomActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<ImageView
|
||||||
android:layout_width="150dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="120dp"
|
||||||
android:layout_margin="20dp"
|
android:layout_marginTop="10dp"
|
||||||
app:cardCornerRadius="20dp"
|
android:contentDescription="salon"
|
||||||
app:cardElevation="10dp">
|
android:src="@drawable/livngroomtransparent" />
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical">
|
android:fontFamily="@font/ppmedium"
|
||||||
|
android:text="Salon"
|
||||||
<ImageView
|
android:textColor="@color/black"
|
||||||
android:layout_width="100dp"
|
android:textSize="20dp" />
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/livingroom" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Salon"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/kitchen" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Kuchnia"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/bedroom" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Sypialnia"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/bathroom" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Łazienka"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/kibelek" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Toaleta"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<androidx.cardview.widget.CardView
|
||||||
android:id="@+id/textView3"
|
android:layout_width="200dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="200dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_margin="20dp"
|
||||||
android:text="Dostępne urządzenia:"
|
android:backgroundTint="#F3F0D8"
|
||||||
android:layout_marginTop="20dp"
|
app:cardCornerRadius="30dp"
|
||||||
android:textSize="20dp"
|
app:cardElevation="15dp">
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<HorizontalScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="420dp"
|
|
||||||
android:background="#14161E">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="420dp"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_gravity="center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="Kuchnia"
|
||||||
|
android:gravity="center"
|
||||||
|
android:onClick="RoomActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<ImageView
|
||||||
android:layout_width="150dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="120dp"
|
||||||
android:layout_margin="20dp"
|
android:layout_marginTop="10dp"
|
||||||
app:cardCornerRadius="20dp"
|
android:src="@drawable/kitchentransparent" />
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical">
|
android:fontFamily="@font/ppmedium"
|
||||||
|
android:text="Kuchnia"
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
android:textColor="@color/black"
|
||||||
android:layout_width="100dp"
|
android:textSize="20sp" />
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/light" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Oświetlenie"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginLeft="30dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/tv" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="-10dp"
|
|
||||||
android:text="Telewizor"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginLeft="-350dp"
|
|
||||||
android:layout_marginTop="230dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/rolety" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="-10dp"
|
|
||||||
android:text="Rolety"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginLeft="50dp"
|
|
||||||
android:layout_marginTop="228dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:src="@drawable/glosnik" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:text="Głośniki"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
android:layout_marginStart="50dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
app:cardCornerRadius="20dp"
|
|
||||||
app:cardElevation="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@drawable/led" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="Oświetlenie dod."
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:backgroundTint="#F3F0D8"
|
||||||
|
app:cardCornerRadius="30dp"
|
||||||
|
app:cardElevation="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="Sypialnia"
|
||||||
|
android:gravity="center"
|
||||||
|
android:onClick="RoomActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:src="@drawable/bedroom" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:fontFamily="@font/ppmedium"
|
||||||
|
android:text="Sypialnia"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:backgroundTint="#F3F0D8"
|
||||||
|
app:cardCornerRadius="30dp"
|
||||||
|
app:cardElevation="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="Lazienka"
|
||||||
|
android:gravity="center"
|
||||||
|
android:onClick="RoomActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:src="@drawable/bathroom" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:fontFamily="@font/ppmedium"
|
||||||
|
android:text="Łazienka"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:backgroundTint="#F3F0D8"
|
||||||
|
app:cardCornerRadius="30dp"
|
||||||
|
app:cardElevation="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:contentDescription="Toaleta"
|
||||||
|
android:onClick="RoomActivity"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:src="@drawable/kibelek"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:fontFamily="@font/ppmedium"
|
||||||
|
android:text="Toaleta"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginTop="130dp"
|
||||||
|
app:srcCompat="@drawable/add" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
197
WRSD2/app/src/main/res/layout/activity_room1.xml
Normal file
197
WRSD2/app/src/main/res/layout/activity_room1.xml
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?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=".RoomActivity_1">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/back">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="200dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:onClick="addDevice"
|
||||||
|
app:srcCompat="@drawable/add" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="10">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="
|
||||||
|
9"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:weightSum="2">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="20\u2103"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="TEMP"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="50%"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:clipToPadding="true" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -13,4 +13,9 @@
|
|||||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="ThemeOverlay.WRSD.FullscreenContainer" parent="">
|
||||||
|
<item name="fullscreenBackgroundColor">@color/light_blue_900</item>
|
||||||
|
<item name="fullscreenTextColor">@color/light_blue_A400</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
6
WRSD2/app/src/main/res/values/attrs.xml
Normal file
6
WRSD2/app/src/main/res/values/attrs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<resources>
|
||||||
|
<declare-styleable name="FullscreenAttrs">
|
||||||
|
<attr name="fullscreenBackgroundColor" format="color" />
|
||||||
|
<attr name="fullscreenTextColor" format="color" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
@ -7,4 +7,9 @@
|
|||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="light_blue_600">#FF039BE5</color>
|
||||||
|
<color name="light_blue_900">#FF01579B</color>
|
||||||
|
<color name="light_blue_A200">#FF40C4FF</color>
|
||||||
|
<color name="light_blue_A400">#FF00B0FF</color>
|
||||||
|
<color name="black_overlay">#66000000</color>
|
||||||
</resources>
|
</resources>
|
@ -21,4 +21,8 @@
|
|||||||
<string name="hello_first_fragment">Hello first fragment</string>
|
<string name="hello_first_fragment">Hello first fragment</string>
|
||||||
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
|
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
|
||||||
<string name="title_activity_register_user">RegisterUser</string>
|
<string name="title_activity_register_user">RegisterUser</string>
|
||||||
|
<string name="title_activity_room2">RoomActivity2</string>
|
||||||
|
<string name="dummy_button">Dummy Button</string>
|
||||||
|
<string name="dummy_content">DUMMY\nCONTENT</string>
|
||||||
|
<string name="title_activity_device_settings">DeviceSettings</string>
|
||||||
</resources>
|
</resources>
|
11
WRSD2/app/src/main/res/values/styles.xml
Normal file
11
WRSD2/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Widget.Theme.WRSD.ActionBar.Fullscreen" parent="Widget.AppCompat.ActionBar">
|
||||||
|
<item name="android:background">@color/black_overlay</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.Theme.WRSD.ButtonBar.Fullscreen" parent="">
|
||||||
|
<item name="android:background">@color/black_overlay</item>
|
||||||
|
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -22,4 +22,15 @@
|
|||||||
<style name="Theme.WRSD.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="Theme.WRSD.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
<style name="Theme.WRSD.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
<style name="Theme.WRSD.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
||||||
|
<style name="Theme.WRSD.Fullscreen" parent="Theme.WRSD">
|
||||||
|
<item name="android:actionBarStyle">@style/Widget.Theme.WRSD.ActionBar.Fullscreen</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:windowBackground">@null</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ThemeOverlay.WRSD.FullscreenContainer" parent="">
|
||||||
|
<item name="fullscreenBackgroundColor">@color/light_blue_600</item>
|
||||||
|
<item name="fullscreenTextColor">@color/light_blue_A200</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user