Updating project
This commit is contained in:
parent
a4427b98dc
commit
60aaac5690
@ -5,6 +5,7 @@
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
|
||||
@ -33,6 +33,10 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata:2.2.0"
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation "androidx.room:room-runtime:2.2.5"
|
||||
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
@ -41,3 +45,4 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,13 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyRealEstateAgency">
|
||||
|
||||
<activity android:name=".view.AgentsActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!--
|
||||
The API key for Google Maps-based APIs is defined as a string resource.
|
||||
(See the file "res/values/google_maps_api.xml").
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView.Adapter;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
import fr.romanet.vj.apps.myrealestateagency.adapter.AgentsAdapter.AgentViewHolder;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
import fr.romanet.vj.apps.myrealestateagency.R;
|
||||
|
||||
public final class AgentsAdapter extends Adapter<AgentViewHolder>{
|
||||
|
||||
public static final class AgentViewHolder extends ViewHolder{
|
||||
|
||||
private final TextView agentFirstName;
|
||||
|
||||
private final TextView agentLastName;
|
||||
|
||||
private final TextView nameOfAgency;
|
||||
|
||||
public AgentViewHolder(@NonNull View itemView)
|
||||
{
|
||||
super(itemView);
|
||||
agentFirstName = itemView.findViewById(R.id.agentFirstName);
|
||||
agentLastName = itemView.findViewById(R.id.agentLastName);
|
||||
nameOfAgency = itemView.findViewById(R.id.nameOfAgency);
|
||||
}
|
||||
|
||||
public void update(final Agent agent)
|
||||
{
|
||||
agentFirstName.setText(agent.agentFirstName);
|
||||
agentLastName.setText(agent.agentLastName);
|
||||
nameOfAgency.setText(agent.agencyEmployerId);
|
||||
}
|
||||
}
|
||||
|
||||
private final List<Agent> agents;
|
||||
|
||||
public AgentsAdapter(List<Agent> agents)
|
||||
{
|
||||
this.agents = agents;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AgentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
|
||||
{
|
||||
final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.viewholder_agent, parent, false);
|
||||
return new AgentViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AgentViewHolder holder, int position)
|
||||
{
|
||||
holder.update(agents.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount()
|
||||
{
|
||||
return agents.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.dao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Transaction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.AgencyWithProperties;
|
||||
|
||||
@Dao
|
||||
public interface AgencyWithPropertiesDao {
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT * FROM agency")
|
||||
List<AgencyWithProperties> getAgenciesAndProperties();
|
||||
}
|
||||
@ -14,6 +14,9 @@ public interface AgentDao {
|
||||
@Query("SELECT * FROM agent")
|
||||
List<Agent> getAgentList();
|
||||
|
||||
@Query("SELECT agency_name FROM agency INNER JOIN agent ON agent.agent_id = agency.agency_id WHERE agent.agency_employer_id = :idAgencyEmployer")
|
||||
String getAgencyName(int idAgencyEmployer);
|
||||
|
||||
@Insert
|
||||
void insertAgent(Agent agent);
|
||||
}
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.database;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.TypeConverters;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.dao.AgencyDao;
|
||||
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.PropertyDao;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.AgencyWithProperties;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
import fr.romanet.vj.apps.myrealestateagency.dao.AgentDao;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
||||
|
||||
@Database(entities = {Agency.class, Agent.class, Property.class}, version = 1)
|
||||
@Database(entities = {Agency.class, Agent.class, Property.class}, version = 1, exportSchema = false)
|
||||
@TypeConverters({Property.Converters.class})
|
||||
public abstract class RealEstateAgencyDatabase extends RoomDatabase {
|
||||
|
||||
@ -24,6 +23,6 @@ public abstract class RealEstateAgencyDatabase extends RoomDatabase {
|
||||
public abstract AgencyDao agencyDao();
|
||||
public abstract PropertyDao propertyDao();
|
||||
public abstract AgencyWithAgentsDao agencyWithAgentsDao();
|
||||
// public abstract AgencyWithPropertiesDao agencyWithPropertiesDaoDao();
|
||||
public abstract AgencyWithPropertiesDao agencyWithPropertiesDaoDao();
|
||||
|
||||
}
|
||||
|
||||
@ -27,4 +27,12 @@ public class Agency {
|
||||
public int getAgencyId() {
|
||||
return agencyId;
|
||||
}
|
||||
|
||||
public static Agency[] populateAgencyTable(){
|
||||
return new Agency[]{
|
||||
new Agency("AgenceOFParis"),
|
||||
new Agency("AgenceOFMarseille")
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,23 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.entities;
|
||||
package fr.romanet.vj.apps.myrealestateagency.entities;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
import androidx.room.Relation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//public class AgencyWithProperties {
|
||||
// public int agency_id;
|
||||
// @Relation(
|
||||
// parentColumn = "agency_id",
|
||||
// entityColumn = "belongs_agency_id"
|
||||
// )
|
||||
// public List<AgencyWithProperties> agents;
|
||||
//}
|
||||
public class AgencyWithProperties {
|
||||
@Embedded public Agency agency;
|
||||
@Relation(
|
||||
parentColumn = "agency_id",
|
||||
entityColumn = "belongs_agency_id"
|
||||
)
|
||||
public List<Property> properties;
|
||||
|
||||
public Agency getAgency() {
|
||||
return agency;
|
||||
}
|
||||
|
||||
public List<Property> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package fr.romanet.vj.apps.myrealestateagency.entities;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.ForeignKey;
|
||||
import androidx.room.Ignore;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@ -30,6 +31,9 @@ public class Agent {
|
||||
@ColumnInfo(name = "agency_employer_id", index = true)
|
||||
public int agencyEmployerId;
|
||||
|
||||
@Ignore
|
||||
public String nameOfAgency;
|
||||
|
||||
public Agent(String agentFirstName, String agentLastName, int agencyEmployerId)
|
||||
{
|
||||
agentId = 0;
|
||||
@ -42,4 +46,19 @@ public class Agent {
|
||||
{
|
||||
return agentFirstName;
|
||||
}
|
||||
|
||||
public void setNameOfAgency(String nameOfAgency)
|
||||
{
|
||||
this.nameOfAgency = nameOfAgency;
|
||||
}
|
||||
|
||||
public int getAgencyEmployerId() {return agencyEmployerId;}
|
||||
|
||||
public static Agent[] populateAgentsTable(){
|
||||
return new Agent[]{
|
||||
new Agent("Bader", "Guetari", 1),
|
||||
new Agent("Khalil", "Guetari", 2),
|
||||
new Agent("Achref", "Guetari", 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,19 +36,23 @@ public class Property {
|
||||
@ColumnInfo(name = "latitude")
|
||||
public long latitude;
|
||||
|
||||
//@Embedded
|
||||
//public PropertyStatue propertyStatue;
|
||||
@Embedded
|
||||
public PropertyStatue propertyStatue;
|
||||
|
||||
@ColumnInfo(name = "belongs_agency_id")
|
||||
@Embedded
|
||||
public PropertyType propertyType;
|
||||
|
||||
@ColumnInfo(name = "belongs_agency_id", index = true)
|
||||
public int belongsToAgencyId;
|
||||
|
||||
public Property(String description, String address, long longitude, long latitude)
|
||||
public Property(String description, String address, long longitude, long latitude, int belongsToAgencyId)
|
||||
{
|
||||
propertyId = 0;
|
||||
this.description = description;
|
||||
this.address = address;
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.belongsToAgencyId = belongsToAgencyId;
|
||||
}
|
||||
|
||||
public static class Converters {
|
||||
|
||||
@ -17,8 +17,4 @@ public class PropertyStatue{
|
||||
|
||||
@ColumnInfo(name = "price")
|
||||
public double price;
|
||||
|
||||
@Embedded
|
||||
public PropertyType propertyType;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.repository;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class MapsActivityRepository {
|
||||
public List<Address> get_lat_long_from_address(String address, Context context) throws IOException {
|
||||
Geocoder gc = new Geocoder(context);
|
||||
return gc.getFromLocationName(address, 1);
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,14 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.repository;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
|
||||
import androidx.room.Room;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.database.RealEstateAgencyDatabase;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
||||
|
||||
public final class MyRealEstateAgencyRepository {
|
||||
private static volatile MyRealEstateAgencyRepository instance;
|
||||
@ -34,14 +31,14 @@ public final class MyRealEstateAgencyRepository {
|
||||
|
||||
private final RealEstateAgencyDatabase realEstateAgencyDatabaseDatabase;
|
||||
|
||||
private MyRealEstateAgencyRepository(Context context)
|
||||
public MyRealEstateAgencyRepository(Context context)
|
||||
{
|
||||
realEstateAgencyDatabaseDatabase = Room.databaseBuilder(context, RealEstateAgencyDatabase.class, "real_estate_agency_db").allowMainThreadQueries().build();
|
||||
}
|
||||
|
||||
public List<Agent> getAgents(){return realEstateAgencyDatabaseDatabase.agentDao().getAgentList();}
|
||||
public void addAgency(Agency agency){realEstateAgencyDatabaseDatabase.agencyDao().insertAgency(agency);}
|
||||
public void addAgent(Agent agent){realEstateAgencyDatabaseDatabase.agentDao().insertAgent(agent);}
|
||||
|
||||
|
||||
|
||||
public void addProperty(Property property){realEstateAgencyDatabaseDatabase.propertyDao().insertProperty(property);}
|
||||
public String getAgencyName(Agent agent){return realEstateAgencyDatabaseDatabase.agentDao().getAgencyName(agent.agencyEmployerId);}
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.view;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.R;
|
||||
import fr.romanet.vj.apps.myrealestateagency.Repository.MyRealEstateAgencyRepository;
|
||||
import fr.romanet.vj.apps.myrealestateagency.adapter.AgentsAdapter;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.AgentsActivityViewModel;
|
||||
|
||||
final public class AgentsActivity extends AppCompatActivity implements OnClickListener {
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
private AgentsActivityViewModel viewModel;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_agents);
|
||||
recyclerView = findViewById(R.id.recyclerViewAgents);
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
|
||||
viewModel = new ViewModelProvider(this).get(AgentsActivityViewModel.class);
|
||||
observeAgents();
|
||||
}
|
||||
|
||||
private void observeAgents()
|
||||
{
|
||||
viewModel.agents.observe(this, new Observer<List<Agent>>() {
|
||||
@Override
|
||||
public void onChanged(List<Agent> agents) {
|
||||
final AgentsAdapter agentsAdapter = new AgentsAdapter(agents);
|
||||
recyclerView.setAdapter(agentsAdapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.view;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.R;
|
||||
import fr.romanet.vj.apps.myrealestateagency.repository.MapsActivityRepository;
|
||||
|
||||
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
|
||||
|
||||
private GoogleMap mMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_maps);
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||
* we just add a marker near Sydney, Australia.
|
||||
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||
* installed Google Play services and returned to the app.
|
||||
*/
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
// Add a marker in Sydney and move the camera
|
||||
LatLng sydney = new LatLng(-34, 151);
|
||||
// mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
|
||||
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
|
||||
// List<String> ll = MapsActivityRepository.get
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package fr.romanet.vj.apps.myrealestateagency.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleEventObserver;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.Repository.MyRealEstateAgencyRepository;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
|
||||
public final class AgentsActivityViewModel extends AndroidViewModel implements LifecycleObserver {
|
||||
|
||||
public MutableLiveData<List<Agent>> agents = new MutableLiveData<>();
|
||||
|
||||
private MyRealEstateAgencyRepository myRealEstateAgencyRepository;
|
||||
|
||||
public AgentsActivityViewModel(@NonNull Application application)
|
||||
{
|
||||
super(application);
|
||||
myRealEstateAgencyRepository = new MyRealEstateAgencyRepository(application);
|
||||
agents.postValue(MyRealEstateAgencyRepository.getInstance(getApplication()).getAgents());
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
private void start_counter_on_activity_start(){
|
||||
agents.postValue(MyRealEstateAgencyRepository.getInstance(getApplication()).getAgents());
|
||||
}
|
||||
|
||||
}
|
||||
21
app/src/main/res/layout/activity_agents.xml
Normal file
21
app/src/main/res/layout/activity_agents.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?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=".view.AgentsActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewAgents"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
9
app/src/main/res/layout/activity_maps.xml
Normal file
9
app/src/main/res/layout/activity_maps.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:map="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".view.MapsActivity" />
|
||||
44
app/src/main/res/layout/viewholder_agent.xml
Normal file
44
app/src/main/res/layout/viewholder_agent.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?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="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/agentFirstName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@id/agentLastName"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/agentLastName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@id/nameOfAgency"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/agentFirstName"
|
||||
app:layout_constraintTop_toBottomOf="@id/agentFirstName"
|
||||
tools:text="@tools:sample/full_names"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameOfAgency"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/agentLastName"
|
||||
tools:text="@tools:sample/us_phones"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Reference in New Issue
Block a user