This commit is contained in:
agata 2023-01-08 15:01:03 +01:00
parent 8e55375c32
commit 4821b01a71
25 changed files with 1129 additions and 448 deletions

View File

@ -1 +0,0 @@
Print("Hello World")

View File

@ -1,2 +0,0 @@
# WRSDv2
Witamy w repozytorium projektu WRSD

View File

@ -1 +0,0 @@
print("hej")

1
Tescik
View File

@ -1 +0,0 @@
Hej Hej

View File

@ -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'

View File

@ -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" >
<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
android:name=".MainActivity2"
android:exported="false" >
android:exported="false"
android:theme="@style/Theme.WRSD.NoActionBar">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".RegisterUser"
android:exported="false" >
android:exported="false"
android:theme="@style/Theme.WRSD.NoActionBar">
<meta-data
android:name="android.app.lib_name"
android:value="" />
@ -38,7 +64,8 @@
<activity
android:name=".ui.login.LoginActivity"
android:exported="true"
android:label="@string/app_name" >
android:label="@string/app_name"
android:theme="@style/Theme.WRSD.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -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();
}
}

View 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;
}
}

View File

@ -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<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);
}
}

View File

@ -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);

View 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();
}
}

View File

@ -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<LoginFormState>() {
@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<LoginFormState>() {
// @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<LoginResult>() {
@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<LoginResult>() {
// @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<AuthResult>() {
@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();
// }
}

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

View 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>

View File

@ -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" />
<ProgressBar
android:id="@+id/loading"
@ -61,15 +60,13 @@
android:layout_height="89dp"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="64dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/login"
app:layout_constraintEnd_toEndOf="@+id/password"
app:layout_constraintHorizontal_bias="0.483"
app:layout_constraintStart_toStartOf="@+id/password"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.766"
app:layout_constraintTop_toBottomOf="@+id/password"
app:layout_constraintVertical_bias="1.0"
tools:visibility="visible" />
<ImageView
@ -81,7 +78,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.265"
app:layout_constraintVertical_bias="0.239"
app:srcCompat="@drawable/wrsdlogo" />
<TextView
@ -91,9 +88,9 @@
android:text="Nie masz konta? Zarejestruj się"
app:layout_constraintBottom_toBottomOf="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_constraintTop_toBottomOf="@+id/login"
app:layout_constraintVertical_bias="0.292" />
app:layout_constraintVertical_bias="0.534" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -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">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
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
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Dostępne pokoje:"
android:textSize="20dp"
android:textStyle="bold" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#101117">
<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="wrap_content"
android:id="@+id/ll1"
android:layout_width="match_parent"
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
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="20dp"
app:cardCornerRadius="20dp"
app:cardElevation="10dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:contentDescription="salon"
android:src="@drawable/livngroomtransparent" />
<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/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>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/ppmedium"
android:text="Salon"
android:textColor="@color/black"
android:textSize="20dp" />
</LinearLayout>
</HorizontalScrollView>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dostępne urządzenia:"
android:layout_marginTop="20dp"
android:textSize="20dp"
android:textStyle="bold" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="420dp"
android:background="#14161E">
<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="wrap_content"
android:layout_height="420dp"
android:orientation="horizontal">
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">
<androidx.cardview.widget.CardView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="20dp"
app:cardCornerRadius="20dp"
app:cardElevation="10dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:src="@drawable/kitchentransparent" />
<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/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>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/ppmedium"
android:text="Kuchnia"
android:textColor="@color/black"
android:textSize="20sp" />
</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>
</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>

View 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>

View File

@ -13,4 +13,9 @@
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</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>

View File

@ -0,0 +1,6 @@
<resources>
<declare-styleable name="FullscreenAttrs">
<attr name="fullscreenBackgroundColor" format="color" />
<attr name="fullscreenTextColor" format="color" />
</declare-styleable>
</resources>

View File

@ -7,4 +7,9 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</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>

View File

@ -21,4 +21,8 @@
<string name="hello_first_fragment">Hello first fragment</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_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>

View 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>

View File

@ -22,4 +22,15 @@
<style name="Theme.WRSD.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<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>

View File

@ -1 +0,0 @@
ttt