Deleting some files
This commit is contained in:
parent
b35f86cd0d
commit
a4427b98dc
@ -30,16 +30,6 @@
|
|||||||
android:name="com.google.android.geo.API_KEY"
|
android:name="com.google.android.geo.API_KEY"
|
||||||
android:value="@string/google_maps_key" />
|
android:value="@string/google_maps_key" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".view.MapsActivity"
|
|
||||||
android:label="@string/title_activity_maps"></activity>
|
|
||||||
<activity android:name=".view.MainActivity">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -1,16 +0,0 @@
|
|||||||
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();
|
|
||||||
//}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
package fr.romanet.vj.apps.myrealestateagency.repository;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LifecycleObserver;
|
|
||||||
|
|
||||||
public class MainActivityRepository implements LifecycleObserver {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
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,76 +0,0 @@
|
|||||||
package fr.romanet.vj.apps.myrealestateagency.view;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.R;
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.repository.MyRealEstateAgencyRepository;
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.MainActivityViewModel;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private static final String TAG = "MyActivity";
|
|
||||||
|
|
||||||
// - Init ViewModel
|
|
||||||
MainActivityViewModel mainActivityViewModel;
|
|
||||||
|
|
||||||
// - Init widgets
|
|
||||||
private TextView tv1;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
// - Define widget
|
|
||||||
tv1 = (TextView) findViewById(R.id.tv1);
|
|
||||||
|
|
||||||
// - Link the ViewModel
|
|
||||||
mainActivityViewModel = new ViewModelProvider(this).get(MainActivityViewModel.class);
|
|
||||||
getLifecycle().addObserver(mainActivityViewModel);
|
|
||||||
observe_counter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertSingleTodo(View view) {
|
|
||||||
Agency test1 = new Agency("AgenceOFParis");
|
|
||||||
|
|
||||||
Agency test2 = new Agency("AgenceOFMarseille");
|
|
||||||
|
|
||||||
Agent test = new Agent("Bader", "Guetari", 1);
|
|
||||||
|
|
||||||
Agent test3 = new Agent("Khalil", "Guetari", 2);
|
|
||||||
|
|
||||||
Agent test10 = new Agent("Achref", "Guetari", 1);
|
|
||||||
|
|
||||||
MyRealEstateAgencyRepository.getInstance(this).addAgency(test1);
|
|
||||||
MyRealEstateAgencyRepository.getInstance(this).addAgency(test2);
|
|
||||||
MyRealEstateAgencyRepository.getInstance(this).addAgent(test);
|
|
||||||
MyRealEstateAgencyRepository.getInstance(this).addAgent(test3);
|
|
||||||
MyRealEstateAgencyRepository.getInstance(this).addAgent(test10);
|
|
||||||
|
|
||||||
String query = "SELECT agency_id FROM agency INNER JOIN agent ON agency.agency_id = agent.agent_id WHERE agency_name =" + "AgenceOFParis" + "GROUP BY agency_name";
|
|
||||||
String query1 = "SELECT agency_id FROM agent INNER JOIN agency ON agency.agency_id = agent.agent_id WHERE agency_name =" + "AgenceOFParis" + "GROUP BY agency_name";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void BTN_go_to_map(View view){
|
|
||||||
Intent i = new Intent(MainActivity.this, MapsActivity.class);
|
|
||||||
MainActivity.this.startActivity(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void observe_counter(){
|
|
||||||
mainActivityViewModel.counter.observe(this, counter ->
|
|
||||||
{
|
|
||||||
tv1.setText(counter.toString());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
package fr.romanet.vj.apps.myrealestateagency.viewmodel;
|
|
||||||
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
|
|
||||||
import androidx.lifecycle.Lifecycle;
|
|
||||||
import androidx.lifecycle.LifecycleObserver;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.OnLifecycleEvent;
|
|
||||||
import androidx.lifecycle.ViewModel;
|
|
||||||
|
|
||||||
import fr.romanet.vj.apps.myrealestateagency.view.MainActivity;
|
|
||||||
|
|
||||||
public final class MainActivityViewModel extends ViewModel implements LifecycleObserver {
|
|
||||||
|
|
||||||
public enum LoadingState
|
|
||||||
{
|
|
||||||
Loading, Loaded
|
|
||||||
}
|
|
||||||
|
|
||||||
public MutableLiveData<LoadingState> loadingState = new MutableLiveData<>();
|
|
||||||
public MutableLiveData<Integer> counter = new MutableLiveData<>();
|
|
||||||
|
|
||||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
|
||||||
private void start_counter_on_activity_start(){
|
|
||||||
counter.postValue(0);
|
|
||||||
for (int i = 0; i<10; i++){
|
|
||||||
new Handler().postDelayed(() ->
|
|
||||||
{
|
|
||||||
counter.postValue(15);
|
|
||||||
}, i*1000);
|
|
||||||
// counter.postValue(i);
|
|
||||||
// SystemClock.sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
<?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.MainActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Hello World!"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.498"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias="0.3" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/buttonZ"
|
|
||||||
android:layout_width="95dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:onClick="insertSingleTodo"
|
|
||||||
android:text="Button"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv1" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:onClick="BTN_go_to_map"
|
|
||||||
android:text="To Map ->"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.496"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/buttonZ" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<?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" />
|
|
||||||
Loading…
Reference in New Issue
Block a user