mirror of
https://git.wmi.amu.edu.pl/s470664/WRSDv2.git
synced 2024-12-28 18:50:29 +01:00
2
This commit is contained in:
parent
ae3ecfa943
commit
bb54c11e11
@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public class AddDeviceActivity extends AppCompatActivity {
|
||||
|
||||
static String[] deviceTypes = new String[]{"Blinds", "Bulb", "Heater"};
|
||||
static String[] deviceTypes = new String[]{"Rolety", "Oświetlenie", "Ogrzewanie"};
|
||||
|
||||
Spinner deviceTypeDropdown;
|
||||
EditText editTextTextName;
|
||||
@ -44,6 +44,18 @@ public class AddDeviceActivity extends AppCompatActivity {
|
||||
|
||||
public void DeviceName(View view){
|
||||
String editTextName = editTextTextName.getText().toString().trim();
|
||||
|
||||
if (editTextName.isEmpty()) {
|
||||
editTextTextName.setError("Podaj nazwę");
|
||||
editTextTextName.requestFocus();
|
||||
return;
|
||||
}
|
||||
if (editTextTextName.getText().toString().contains(" ")){
|
||||
editTextTextName.setError("Nazwa nie może zawierać spacji");
|
||||
editTextTextName.requestFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
String deviceType = deviceTypeDropdown.getSelectedItem().toString();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("name", editTextName);
|
||||
|
@ -9,7 +9,7 @@ public class BulbDevice extends Device{
|
||||
public BulbDevice(String id, String name) {
|
||||
super(id, name, DeviceType.BULB);
|
||||
this.state = false;
|
||||
this.brightness = 0;
|
||||
this.brightness = 000;
|
||||
}
|
||||
|
||||
public boolean isState() {
|
||||
@ -32,6 +32,6 @@ public class BulbDevice extends Device{
|
||||
public String toString() {
|
||||
String stateString = state? "1" : "0";
|
||||
String brightnessString = Integer.toString(brightness);
|
||||
return deviceType.toString() + name + "?" + stateString + brightnessString;
|
||||
return deviceType.toString() + name + "?" + stateString + "?" + brightnessString;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ import static com.example.wrsd.RoomActivity_1.setWindowFlag;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
@ -12,6 +16,7 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
@ -26,10 +31,12 @@ import com.google.firebase.firestore.FirebaseFirestore;
|
||||
public class DeviceSettings extends AppCompatActivity {
|
||||
|
||||
private Button deleteButton;
|
||||
private TextView progressLabel;
|
||||
private TextView progressLabel, roomText;
|
||||
private Switch stateSwitch;
|
||||
private SeekBar progressBar;
|
||||
private String device, userEmail, type, room, code;
|
||||
private String device, userEmail, type, room, code, state;
|
||||
private Integer techNotification = 0;
|
||||
private String onOff, tempTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -47,6 +54,9 @@ public class DeviceSettings extends AppCompatActivity {
|
||||
progressLabel = (TextView) findViewById(R.id.progressLabel);
|
||||
stateSwitch = (Switch) findViewById(R.id.state);
|
||||
progressBar = (SeekBar) findViewById(R.id.progress);
|
||||
roomText = (TextView) findViewById(R.id.textView4);
|
||||
|
||||
stateSwitch.setChecked(true);
|
||||
|
||||
progressLabel.setVisibility(View.INVISIBLE);
|
||||
stateSwitch.setVisibility(View.INVISIBLE);
|
||||
@ -60,40 +70,204 @@ public class DeviceSettings extends AppCompatActivity {
|
||||
room = extras.getString("room");
|
||||
type = extras.getString("type");
|
||||
code = extras.getString("code");
|
||||
// state = extras.getString("state");
|
||||
roomText.setText(room);
|
||||
//The key argument here must match that used in the other activity
|
||||
|
||||
if (type.equals("Blinds")) {
|
||||
stateSwitch.setText("Up/Down");
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
} else if (type.equals("Bulb")) {
|
||||
stateSwitch.setText("On/Off");
|
||||
progressLabel.setText("Brightness");
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
progressLabel.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
} else if (type.equals("Heater")) {
|
||||
stateSwitch.setText("On/Off");
|
||||
progressLabel.setText("Temperature");
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
progressLabel.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
// if(state.equals("1")){
|
||||
// stateSwitch.setChecked(true);
|
||||
// }else{
|
||||
// stateSwitch.setChecked(false);
|
||||
// }
|
||||
|
||||
deleteButton = (Button) findViewById(R.id.deleteButton);
|
||||
FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
|
||||
|
||||
|
||||
stateSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(isChecked==true){
|
||||
onOff = "włączone";
|
||||
}else{
|
||||
onOff = "wyłączone";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (type.equals("Blinds")) {
|
||||
if(onOff == "włączone"){
|
||||
stateSwitch.setText("Opuść rolety");
|
||||
|
||||
}else{
|
||||
stateSwitch.setText("Podnieś rolety");
|
||||
}
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
} else if (type.equals("Bulb")) {
|
||||
if(onOff == "włączone"){
|
||||
stateSwitch.setText("Wyłącz oświetlenie");
|
||||
|
||||
}else{
|
||||
stateSwitch.setText("Włącz oświetlenie");
|
||||
}
|
||||
progressLabel.setText("Jasność");
|
||||
tempTextView = "Jasność";
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
progressLabel.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
} else if (type.equals("Heater")) {
|
||||
if(onOff == "włączone"){
|
||||
stateSwitch.setText("Wyłącz ogrzewanie");
|
||||
|
||||
}else{
|
||||
stateSwitch.setText("Włącz ogrzewanie");
|
||||
}
|
||||
tempTextView = "Temperatura";
|
||||
progressLabel.setText("Temperatura");
|
||||
stateSwitch.setVisibility(View.VISIBLE);
|
||||
progressLabel.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
deleteButton.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
|
||||
DocumentReference docRef = rootRef.collection("users").document(userEmail).collection("rooms").document(room);
|
||||
docRef.update("Urzadzenia", FieldValue.arrayRemove(code));
|
||||
Toast.makeText(getApplicationContext(), "Usunięto " + device, Toast.LENGTH_LONG).show();
|
||||
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("name", "!");
|
||||
intent.putExtra("type", "!");
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
progressBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
int progress = progressBar.getProgress();
|
||||
|
||||
boolean started = false; //use this variable to see whether the user clicked the right place
|
||||
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) {
|
||||
if(!started){ //check to see if user clicks the right place
|
||||
//if the user clicks within a specific threshold
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
|
||||
NotificationChannel channel = new NotificationChannel("Moje powiadomienie", "Moje powiadomienie", NotificationManager.IMPORTANCE_DEFAULT );
|
||||
NotificationManager manager = getSystemService(NotificationManager.class);
|
||||
manager.createNotificationChannel(channel);
|
||||
|
||||
}
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), "Moje powiadomienie");
|
||||
builder.setContentTitle("WRSD Home");
|
||||
builder.setContentText(tempTextView + " w urządzeniu " + device + " w pokoju " + room + " została zmieniona.");
|
||||
builder.setStyle( new
|
||||
NotificationCompat.BigTextStyle().bigText(tempTextView + " w urządzeniu " + device + " w pokoju: " + room + " została zmieniona."));
|
||||
builder.setSmallIcon(R.drawable.wrsdlogo);
|
||||
builder.setAutoCancel(false);
|
||||
|
||||
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(getApplicationContext());
|
||||
managerCompat.notify(techNotification,builder.build());
|
||||
techNotification++;
|
||||
}
|
||||
|
||||
if(started) {
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
|
||||
NotificationChannel channel = new NotificationChannel("Moje powiadomienie", "Moje powiadomienie", NotificationManager.IMPORTANCE_DEFAULT );
|
||||
NotificationManager manager = getSystemService(NotificationManager.class);
|
||||
manager.createNotificationChannel(channel);
|
||||
|
||||
}
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), "Moje powiadomienie");
|
||||
builder.setContentTitle("WRSD Home");
|
||||
builder.setContentText(tempTextView + " w urządzeniu " + device + " w pokoju: " + room + " została zmieniona.");
|
||||
builder.setStyle( new
|
||||
NotificationCompat.BigTextStyle().bigText(tempTextView + " w urządzeniu " + device + " w pokoju: " + room + " została zmieniona."));
|
||||
builder.setSmallIcon(R.drawable.wrsdlogo);
|
||||
builder.setAutoCancel(false);
|
||||
|
||||
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(getApplicationContext());
|
||||
managerCompat.notify(techNotification,builder.build());
|
||||
techNotification++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
System.out.println("onStartTracking:" + progress + "/" + seekBar.getMax());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
System.out.println("onStopTracking:" + progress + "/" + seekBar.getMax());
|
||||
//DO WHATEVER YOU NEED TO DO WHEN PROGRESS IS DONE CHANGING
|
||||
|
||||
started = false; //remember to set variable to false
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Notification(View view){
|
||||
if (type.equals("Bulb")) {
|
||||
if (onOff == "włączone") {
|
||||
stateSwitch.setText("Wyłącz oświetlenie");
|
||||
|
||||
} else {
|
||||
stateSwitch.setText("Włącz oświetlenie");
|
||||
}
|
||||
}else if (type.equals("Heater")) {
|
||||
if (onOff == "włączone") {
|
||||
stateSwitch.setText("Wyłącz ogrzewanie");
|
||||
|
||||
} else {
|
||||
stateSwitch.setText("Włącz ogrzewanie");
|
||||
}
|
||||
}else if (type.equals("Blinds")) {
|
||||
if (onOff == "włączone") {
|
||||
stateSwitch.setText("Opuść rolety");
|
||||
|
||||
} else {
|
||||
stateSwitch.setText("Podnieś rolety");
|
||||
}
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
|
||||
NotificationChannel channel = new NotificationChannel("Moje powiadomienie", "Moje powiadomienie", NotificationManager.IMPORTANCE_DEFAULT );
|
||||
NotificationManager manager = getSystemService(NotificationManager.class);
|
||||
manager.createNotificationChannel(channel);
|
||||
|
||||
}
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), "Moje powiadomienie");
|
||||
builder.setContentTitle("WRSD Home");
|
||||
builder.setContentText("Urządzenie: " + device + " w pokoju: " + room + " zostało " + onOff);
|
||||
builder.setStyle( new
|
||||
NotificationCompat.BigTextStyle().bigText("Urządzenie: " + device + " w pokoju: " + room + " zostało " + onOff));
|
||||
builder.setSmallIcon(R.drawable.wrsdlogo);
|
||||
builder.setAutoCancel(false);
|
||||
|
||||
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(getApplicationContext());
|
||||
managerCompat.notify(techNotification,builder.build());
|
||||
techNotification++;
|
||||
|
||||
}
|
||||
|
||||
public void GetSeekBarValue(){
|
||||
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ public class HeaterDevice extends Device {
|
||||
public HeaterDevice(String id, String name) {
|
||||
super(id, name, DeviceType.HEATER);
|
||||
this.state = false;
|
||||
this.temperature = 20;
|
||||
this.temperature = 000;
|
||||
}
|
||||
|
||||
public boolean isState() {
|
||||
@ -32,6 +32,6 @@ public class HeaterDevice extends Device {
|
||||
public String toString() {
|
||||
String stateString = state? "1" : "0";
|
||||
String temperatureString = Integer.toString(temperature);
|
||||
return deviceType.toString() + name + "?" + stateString + temperatureString;
|
||||
return deviceType.toString() + name + "?" + stateString + "?" + temperatureString;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,12 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Adapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.wrsd.databinding.ActivityDeviceSettingsBinding;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.firebase.firestore.DocumentReference;
|
||||
@ -36,10 +39,12 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
public List<String> temp = new ArrayList<>();
|
||||
private RecyclerView recyclerView;
|
||||
private SingleRoomAdapter mAdapter;
|
||||
private String userEmail;
|
||||
public String roomvalue;
|
||||
private String userEmail, code;
|
||||
public String roomvalue, deviceState;
|
||||
private TextView roomName1;
|
||||
public Integer la;
|
||||
TextView myTextView;
|
||||
ImageView ivDevice;
|
||||
|
||||
|
||||
public static void setWindowFlag(Activity activity, final int bits, boolean on) {
|
||||
@ -86,6 +91,7 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
|
||||
roomName1 = (TextView) findViewById(R.id.textView);
|
||||
roomName1.setText(roomvalue);
|
||||
|
||||
@ -97,6 +103,7 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
|
||||
private void getData() {
|
||||
deviceFromBase.clear();
|
||||
deviceList.clear();
|
||||
FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
|
||||
|
||||
rootRef.collection("users").document(userEmail).collection("rooms").document(roomvalue)
|
||||
@ -119,7 +126,7 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(), "Brak urządzeń w pokoju", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getApplicationContext(), "Błąd", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@ -145,6 +152,7 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
String[] parts = encodedDevice.split("\\?");
|
||||
String deviceType = parts[0].substring(0,1);
|
||||
String deviceName = parts[0].substring(1);
|
||||
deviceState = parts[1];
|
||||
String deviceId = getLastUsedId();
|
||||
|
||||
if (deviceType.equals(DeviceType.BLINDS.toString())) {
|
||||
@ -184,10 +192,10 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
|
||||
// }
|
||||
|
||||
public void onBackClicked(View view) {
|
||||
startActivity(new Intent(getApplicationContext(), MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
// public void onBackClicked(View view) {
|
||||
// startActivity(new Intent(getApplicationContext(), MainActivity.class));
|
||||
// finish();
|
||||
// }
|
||||
|
||||
|
||||
public void addDevice(View view){
|
||||
@ -195,6 +203,7 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
startActivityForResult(i, 1);
|
||||
}
|
||||
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 1) {
|
||||
@ -202,24 +211,40 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
|
||||
String strEditText = data.getStringExtra("name");
|
||||
String deviceType = data.getStringExtra("type");
|
||||
Device newDevice;
|
||||
String deviceId = getLastUsedId();
|
||||
if(!deviceType.equals("!")){
|
||||
Device newDevice;
|
||||
String deviceId = getLastUsedId();
|
||||
|
||||
if (deviceType.equals("Blinds")) {
|
||||
newDevice = new BlindsDevice(deviceId, strEditText);
|
||||
} else if (deviceType.equals("Bulb")) {
|
||||
newDevice = new BulbDevice(deviceId, strEditText);
|
||||
} else if (deviceType.equals("Heater")) {
|
||||
newDevice = new HeaterDevice(deviceId, strEditText);
|
||||
} else {
|
||||
newDevice = new BlindsDevice(deviceId, strEditText);
|
||||
if (deviceType.equals("Rolety")) {
|
||||
newDevice = new BlindsDevice(deviceId, strEditText);
|
||||
} else if (deviceType.equals("Oświetlenie")) {
|
||||
newDevice = new BulbDevice(deviceId, strEditText);
|
||||
} else if (deviceType.equals("Ogrzewanie")) {
|
||||
newDevice = new HeaterDevice(deviceId, strEditText);
|
||||
} else {
|
||||
newDevice = new BlindsDevice(deviceId, strEditText);
|
||||
}
|
||||
deviceList.add(newDevice);
|
||||
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
DocumentReference docRef = rootRef.collection("users").document(userEmail).collection("rooms").document(roomvalue);
|
||||
docRef.update("Urzadzenia", FieldValue.arrayUnion(newDevice.toString()));
|
||||
Toast.makeText(getApplicationContext(), "Dodano " + strEditText, Toast.LENGTH_LONG).show();
|
||||
|
||||
}else{
|
||||
for(int j=0; j<deviceList.size();j++) {
|
||||
if (deviceList.get(j).toString().equals(code)) {
|
||||
deviceList.remove(j);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
deviceList.add(newDevice);
|
||||
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
DocumentReference docRef = rootRef.collection("users").document(userEmail).collection("rooms").document(roomvalue);
|
||||
docRef.update("Urzadzenia", FieldValue.arrayUnion(newDevice.toString()));
|
||||
|
||||
}
|
||||
}
|
||||
@ -227,10 +252,11 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
|
||||
public void settings(View view){
|
||||
|
||||
|
||||
TextView b = (TextView) view;
|
||||
String dn = b.getText().toString();
|
||||
String type = "";
|
||||
String code = "";
|
||||
code = "";
|
||||
for (Device device : deviceList) {
|
||||
if (device.name.equals(dn)) {
|
||||
code = device.toString();
|
||||
@ -249,9 +275,8 @@ public class RoomActivity_1 extends AppCompatActivity {
|
||||
intent.putExtra("room", roomvalue);
|
||||
intent.putExtra("type", type);
|
||||
intent.putExtra("code", code);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
// intent.putExtra("state", deviceState);
|
||||
startActivityForResult(intent, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
@ -26,6 +27,8 @@ public class SingleRoomAdapter extends RecyclerView.Adapter<SingleRoomAdapter.My
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext())
|
||||
@ -40,6 +43,18 @@ public class SingleRoomAdapter extends RecyclerView.Adapter<SingleRoomAdapter.My
|
||||
|
||||
holder.title.setText(d1.getName());
|
||||
|
||||
if (d1.deviceType == DeviceType.BLINDS) {
|
||||
holder.imageView.setBackgroundResource(R.drawable.rolety);
|
||||
|
||||
} else if (d1.deviceType == DeviceType.BULB) {
|
||||
holder.imageView.setBackgroundResource(R.drawable.light);
|
||||
|
||||
} else if (d1.deviceType == DeviceType.HEATER) {
|
||||
holder.imageView.setBackgroundResource(R.drawable.heater);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -51,11 +66,13 @@ public class SingleRoomAdapter extends RecyclerView.Adapter<SingleRoomAdapter.My
|
||||
public class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
public TextView title;
|
||||
public CardView cardView;
|
||||
public ImageView imageView;
|
||||
|
||||
public MyViewHolder(View view) {
|
||||
super(view);
|
||||
title = view.findViewById(R.id.title);
|
||||
cardView = view.findViewById(R.id.card_view);
|
||||
imageView = view.findViewById(R.id.deviceView);
|
||||
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 235 KiB |
@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/back"
|
||||
android:backgroundTint="#007FFE"
|
||||
tools:context=".AddDeviceActivity">
|
||||
|
||||
|
||||
@ -18,38 +19,36 @@
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.129"
|
||||
app:layout_constraintHorizontal_bias="0.233"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.311" />
|
||||
app:layout_constraintVertical_bias="0.439" />
|
||||
|
||||
<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:gravity="center"
|
||||
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_constraintHorizontal_bias="0.49"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.775" />
|
||||
app:layout_constraintVertical_bias="0.176" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/deviceTypeDropdown"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="49dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_width="299dp"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toTopOf="@+id/editTextTextName"
|
||||
app:layout_constraintEnd_toEndOf="@+id/editTextTextName"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.491"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_constraintVertical_bias="0.725"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
|
||||
<Button
|
||||
@ -65,4 +64,20 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.919" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="55dp"
|
||||
android:layout_marginEnd="323dp"
|
||||
android:layout_marginBottom="31dp"
|
||||
android:text="Wybierz typ urządzenia"
|
||||
app:layout_constraintBottom_toTopOf="@+id/deviceTypeDropdown"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:layout_constraintVertical_bias="0.4" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -14,16 +14,18 @@
|
||||
android:text="Usuń urządzenie"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintHorizontal_bias="0.852"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/progress"
|
||||
app:layout_constraintVertical_bias="0.136" />
|
||||
app:layout_constraintVertical_bias="0.93" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="142dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_width="228dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:clickable="true"
|
||||
android:onClick="Notification"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -31,20 +33,41 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progressLabel"
|
||||
android:layout_width="93dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_width="281dp"
|
||||
android:layout_height="59dp"
|
||||
android:layout_marginTop="76dp"
|
||||
android:text="TextView"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.138"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/state" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/state"
|
||||
android:layout_width="117dp"
|
||||
android:layout_height="59dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:layout_width="254dp"
|
||||
android:layout_height="71dp"
|
||||
android:layout_marginTop="152dp"
|
||||
android:clickable="true"
|
||||
android:onClick="Notification"
|
||||
android:text="Switch"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.273"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="213dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="51dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginEnd="147dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="TextView"
|
||||
android:textSize="30dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/state"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#007FFD"
|
||||
android:background="#0581FE"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
@ -16,7 +16,7 @@
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="328dp"
|
||||
android:layout_marginTop="316dp"
|
||||
android:hint="@string/prompt_login"
|
||||
android:inputType="textEmailAddress"
|
||||
android:minHeight="48dp"
|
||||
@ -78,7 +78,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.239"
|
||||
app:layout_constraintVertical_bias="0.187"
|
||||
app:srcCompat="@drawable/wrsdlogo" />
|
||||
|
||||
<TextView
|
||||
|
@ -14,7 +14,7 @@
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginTop="40dp"
|
||||
app:srcCompat="@drawable/wrsdlogo" />
|
||||
|
||||
<HorizontalScrollView
|
||||
@ -221,14 +221,14 @@
|
||||
|
||||
</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" />
|
||||
<!-- <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>
|
@ -72,6 +72,7 @@
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="60dp"
|
||||
android:hint="Hasło"
|
||||
android:imeActionLabel="@string/action_sign_in_short"
|
||||
android:minHeight="48dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -32,6 +32,7 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/deviceView"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/settings" />
|
||||
@ -55,7 +56,7 @@
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="48dp"
|
||||
android:shadowColor="@color/light_blue_600" />
|
||||
android:outlineAmbientShadowColor="@color/light_blue_600"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -10,7 +10,8 @@
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<item name="android:statusBarColor">@color/background_color</item>
|
||||
<item name="android:navigationBarColor">@color/background_color</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
|
@ -12,4 +12,5 @@
|
||||
<color name="light_blue_A200">#FF40C4FF</color>
|
||||
<color name="light_blue_A400">#FF00B0FF</color>
|
||||
<color name="black_overlay">#66000000</color>
|
||||
<color name="background_color">#FF007FFE</color>
|
||||
</resources>
|
@ -10,7 +10,8 @@
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<item name="android:statusBarColor">@color/background_color</item>
|
||||
<item name="android:navigationBarColor">@color/background_color</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user