Correcting some xml
This commit is contained in:
parent
944ad6b562
commit
9138820ea1
@ -0,0 +1,16 @@
|
|||||||
|
package fr.romanet.vj.apps.myrealestateagency.dao;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import fr.romanet.vj.apps.myrealestateagency.entities.Modified;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface ModifiedDao {
|
||||||
|
|
||||||
|
@Query("SELECT * FROM modified")
|
||||||
|
LiveData<List<Modified>> getModifiedList();
|
||||||
|
}
|
||||||
@ -15,14 +15,16 @@ import fr.romanet.vj.apps.myrealestateagency.dao.AgencyDao;
|
|||||||
import fr.romanet.vj.apps.myrealestateagency.dao.AgencyWithAgentsDao;
|
import fr.romanet.vj.apps.myrealestateagency.dao.AgencyWithAgentsDao;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.dao.AgencyWithPropertiesDao;
|
import fr.romanet.vj.apps.myrealestateagency.dao.AgencyWithPropertiesDao;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.dao.DollarCurrencyDao;
|
import fr.romanet.vj.apps.myrealestateagency.dao.DollarCurrencyDao;
|
||||||
|
import fr.romanet.vj.apps.myrealestateagency.dao.ModifiedDao;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.dao.PropertyDao;
|
import fr.romanet.vj.apps.myrealestateagency.dao.PropertyDao;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.dao.AgentDao;
|
import fr.romanet.vj.apps.myrealestateagency.dao.AgentDao;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.DollarCurrency;
|
import fr.romanet.vj.apps.myrealestateagency.entities.DollarCurrency;
|
||||||
|
import fr.romanet.vj.apps.myrealestateagency.entities.Modified;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
||||||
|
|
||||||
@Database(entities = {Agency.class, Agent.class, Property.class, DollarCurrency.class}, version = 2, exportSchema = false)
|
@Database(entities = {Agency.class, Agent.class, Property.class, DollarCurrency.class, Modified.class}, version = 2, exportSchema = false)
|
||||||
@TypeConverters({Property.Converters.class})
|
@TypeConverters({Property.Converters.class})
|
||||||
public abstract class RealEstateAgencyDatabase extends RoomDatabase {
|
public abstract class RealEstateAgencyDatabase extends RoomDatabase {
|
||||||
|
|
||||||
@ -32,6 +34,7 @@ public abstract class RealEstateAgencyDatabase extends RoomDatabase {
|
|||||||
public abstract AgencyWithAgentsDao agencyWithAgentsDao();
|
public abstract AgencyWithAgentsDao agencyWithAgentsDao();
|
||||||
public abstract AgencyWithPropertiesDao agencyWithPropertiesDaoDao();
|
public abstract AgencyWithPropertiesDao agencyWithPropertiesDaoDao();
|
||||||
public abstract DollarCurrencyDao dollarCurrencyDao();
|
public abstract DollarCurrencyDao dollarCurrencyDao();
|
||||||
|
public abstract ModifiedDao modifiedDao();
|
||||||
|
|
||||||
private static RealEstateAgencyDatabase INSTANCE;
|
private static RealEstateAgencyDatabase INSTANCE;
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,8 @@ public class Agency implements Serializable {
|
|||||||
public static Agency[] populateAgencyTable(){
|
public static Agency[] populateAgencyTable(){
|
||||||
return new Agency[]{
|
return new Agency[]{
|
||||||
new Agency("Agency of Paris"),
|
new Agency("Agency of Paris"),
|
||||||
new Agency("Agency of Marseille"),
|
new Agency("France Habitation"),
|
||||||
new Agency("France Habitation")
|
new Agency("Agency of Marseille")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package fr.romanet.vj.apps.myrealestateagency.entities;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
@Entity(tableName = "modified",
|
||||||
|
primaryKeys = {"id_agent", "date_modification"})
|
||||||
|
public class Modified {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = "id_agent")
|
||||||
|
private int idAgent;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = "date_modification")
|
||||||
|
private Date dateModification;
|
||||||
|
|
||||||
|
public Modified(@NonNull int idAgent, @NonNull Date dateModification)
|
||||||
|
{
|
||||||
|
this.idAgent = idAgent;
|
||||||
|
this.dateModification = dateModification;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,8 @@ import androidx.room.TypeConverter;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
import static androidx.room.ForeignKey.CASCADE;
|
import static androidx.room.ForeignKey.CASCADE;
|
||||||
|
|
||||||
@ -111,12 +113,34 @@ public class Property implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Property[] populatePropertyTable() {
|
public static Property[] populatePropertyTable() throws ParseException {
|
||||||
|
String sDate1="30/10/2018";
|
||||||
|
String sDate2="05/05/2018";
|
||||||
|
String sDate3="04/12/2020";
|
||||||
|
String sDate4="31/12/2020";
|
||||||
|
Date date1= (Date) new SimpleDateFormat("dd/MM/yyyy").parse(sDate1);
|
||||||
|
Date date2= (Date) new SimpleDateFormat("dd/MM/yyyy").parse(sDate2);
|
||||||
|
Date date3= (Date) new SimpleDateFormat("dd/MM/yyyy").parse(sDate3);
|
||||||
|
Date date4= (Date) new SimpleDateFormat("dd/MM/yyyy").parse(sDate4);
|
||||||
return new Property[]{
|
return new Property[]{
|
||||||
new Property("Amazing property in the best district of Le Chesnay", "3 rue du docteur audigier", 15.8, 17.8, 1,
|
new Property("Amazing property of Le Chesnay", "3 rue du docteur audigier", 15.8, 17.8, 1,
|
||||||
|
new PropertyStatue(false, null, 15.8), new PropertyType("Apartment", 3, 9.8)),
|
||||||
|
new Property("Awesome house !", "124 Rue Saint-Dominique", 15.8, 17.8, 1,
|
||||||
|
new PropertyStatue(true, date1, 15.8), new PropertyType("House", 3, 9.8)),
|
||||||
|
new Property("Incredible neighbourhood", "14 Avenue de la Motte-Picquet", 15.8, 17.8, 1,
|
||||||
|
new PropertyStatue(false, null, 15.8), new PropertyType("House", 3, 9.8)),
|
||||||
|
new Property("The place to be", "11 Avenue du Dr François Arnaud", 15.8, 17.8, 2,
|
||||||
|
new PropertyStatue(true, date2, 15.8), new PropertyType("Apartment", 3, 9.8)),
|
||||||
|
new Property("Foreigners accepted !", "45 Avenue de Gravelle", 15.8, 17.8, 2,
|
||||||
|
new PropertyStatue(false, null, 15.8), new PropertyType("House", 3, 9.8)),
|
||||||
|
new Property("Family place", "11 Rue Jules Vallès", 15.8, 17.8, 2,
|
||||||
|
new PropertyStatue(true, date3, 15.8), new PropertyType("Apartment", 3, 9.8)),
|
||||||
|
new Property("Best district in Marseille", "2 Rue du Monastere", 15.8, 17.8, 3,
|
||||||
|
new PropertyStatue(false, null, 15.8), new PropertyType("House", 3, 9.8)),
|
||||||
|
new Property("Apartment near the port", "392 Rue Paradis", 15.8, 17.8, 3,
|
||||||
|
new PropertyStatue(true, date4, 15.8), new PropertyType("Apartment", 3, 9.8)),
|
||||||
|
new Property("Near the sea", "Rue François Taddei", 15.8, 17.8, 3,
|
||||||
new PropertyStatue(false, null, 15.8), new PropertyType("Apartment", 3, 9.8))
|
new PropertyStatue(false, null, 15.8), new PropertyType("Apartment", 3, 9.8))
|
||||||
//new Property("Best appartment in Velizy-Villacoublay", "Rue de Villacoublay, 78140 Vélizy-Villacoublay", 19.8, 20.8, 1),
|
|
||||||
//new Property("Amazing property in the best district of Marseille", "15 rue de Marseille", 15.8, 17.8, 1),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import fr.romanet.vj.apps.myrealestateagency.R;
|
|||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.repository.PropertyRepository;
|
import fr.romanet.vj.apps.myrealestateagency.repository.PropertyRepository;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.EditPropertyActivityViewModel;
|
import fr.romanet.vj.apps.myrealestateagency.viewmodel.EditPropertyActivityViewModel;
|
||||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.PropertiesDetailActivityViewModel;
|
|
||||||
|
|
||||||
public class EditPropertyActivity extends AppCompatActivity {
|
public class EditPropertyActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
app:layout_constraintBottom_toTopOf="@id/editPropertyPrice"
|
app:layout_constraintBottom_toTopOf="@id/editPropertyPrice"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="@+id/editPropertyType"
|
app:layout_constraintStart_toStartOf="@+id/editPropertyType"
|
||||||
app:layout_constraintTop_toBottomOf="@id/editPropertyType" />
|
app:layout_constraintTop_toBottomOf="@id/editPropertyType" />
|
||||||
|
|
||||||
@ -48,10 +49,9 @@
|
|||||||
android:hint="@string/price"
|
android:hint="@string/price"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
app:layout_constraintBottom_toTopOf="@id/editPropertySurface"
|
app:layout_constraintBottom_toTopOf="@id/editPropertySurface"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/textView2"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/editPropertyNumberOfRooms" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/editPropertyNumberOfRooms"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editPropertySurface"
|
android:id="@+id/editPropertySurface"
|
||||||
@ -60,10 +60,9 @@
|
|||||||
android:hint="@string/surface"
|
android:hint="@string/surface"
|
||||||
android:inputType="phone"
|
android:inputType="phone"
|
||||||
app:layout_constraintBottom_toTopOf="@id/editPropertyStatueSale"
|
app:layout_constraintBottom_toTopOf="@id/editPropertyStatueSale"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/editPropertyPrice"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/editPropertyPrice" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/editPropertyPrice"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editPropertyStatueSale"
|
android:id="@+id/editPropertyStatueSale"
|
||||||
@ -72,10 +71,9 @@
|
|||||||
android:hint="@string/statueSale"
|
android:hint="@string/statueSale"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
app:layout_constraintBottom_toTopOf="@id/editPropertySoldDate"
|
app:layout_constraintBottom_toTopOf="@id/editPropertySoldDate"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/textView2"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/editPropertySurface" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/editPropertySurface"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editPropertySoldDate"
|
android:id="@+id/editPropertySoldDate"
|
||||||
@ -84,10 +82,9 @@
|
|||||||
android:hint="@string/soldDate"
|
android:hint="@string/soldDate"
|
||||||
android:inputType="textPersonName"
|
android:inputType="textPersonName"
|
||||||
app:layout_constraintBottom_toTopOf="@id/editPropertyDescription"
|
app:layout_constraintBottom_toTopOf="@id/editPropertyDescription"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/editPropertyStatueSale"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/editPropertyStatueSale" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/editPropertyStatueSale"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editPropertyDescription"
|
android:id="@+id/editPropertyDescription"
|
||||||
@ -140,4 +137,38 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||||
app:layout_constraintVertical_bias="0.47" />
|
app:layout_constraintVertical_bias="0.47" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="246dp"
|
||||||
|
android:layout_height="37dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="TextView"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/editPropertyNumberOfRooms"
|
||||||
|
app:layout_constraintHorizontal_bias="0.517"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/editPropertyPrice"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/editPropertyNumberOfRooms" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
|
android:layout_width="238dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="TextView"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.544"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/editPropertySurface"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView5"
|
||||||
|
android:layout_width="209dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:text="TextView"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/editPropertyDescription"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.298"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/editPropertySoldDate" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Reference in New Issue
Block a user