Linked Disconnect BTN to SharedPrefs Reset
Ungrouped common IF block statements (EditPropertyActivity) Bonne nuit !
This commit is contained in:
parent
327da05ac0
commit
944ad6b562
@ -28,6 +28,13 @@ public class SharedPrefs {
|
||||
.apply();
|
||||
}
|
||||
|
||||
public void reset_agent_id(){
|
||||
sharedPreferences = MyApp.getContext().getSharedPreferences(Config.getSharedPreferences(), MODE_PRIVATE);
|
||||
sharedPreferences.edit()
|
||||
.putInt(Config.get_selected_agency_index(), -1)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public void set_dollar_rate(double rate){
|
||||
sharedPreferences = MyApp.getContext().getSharedPreferences(Config.getSharedPreferences(), MODE_PRIVATE);
|
||||
sharedPreferences.edit()
|
||||
|
||||
@ -91,28 +91,28 @@ public class EditPropertyActivity extends AppCompatActivity {
|
||||
boolean sale = property.propertyStatue.statueSale;
|
||||
String saleOrNot;
|
||||
String dateOfSaleString;
|
||||
|
||||
type.setText(property.propertyType.typeDescription);
|
||||
numberRooms.setText(Integer.toString(property.propertyType.numberRooms));
|
||||
price.setText((new DecimalFormat("##.##").format(property.propertyStatue.price)));
|
||||
surface.setText((new DecimalFormat("##.##").format(property.propertyType.surfaceArea)));
|
||||
description.setText(property.description);
|
||||
|
||||
|
||||
if(sale == true)
|
||||
{
|
||||
saleOrNot = "sold";
|
||||
type.setText(property.propertyType.typeDescription);
|
||||
numberRooms.setText(Integer.toString(property.propertyType.numberRooms));
|
||||
price.setText((new DecimalFormat("##.##").format(property.propertyStatue.price)));
|
||||
surface.setText((new DecimalFormat("##.##").format(property.propertyType.surfaceArea)));
|
||||
statue.setText(saleOrNot);
|
||||
dateOfSale.setText(dateFormat.format(property.propertyStatue.soldDate));
|
||||
description.setText(property.description);
|
||||
statue.setText(saleOrNot);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
saleOrNot = "Not sold";
|
||||
dateOfSaleString = "No date of sale";
|
||||
type.setText(property.propertyType.typeDescription);
|
||||
numberRooms.setText(Integer.toString(property.propertyType.numberRooms));
|
||||
price.setText((new DecimalFormat("##.##").format(property.propertyStatue.price)));
|
||||
surface.setText((new DecimalFormat("##.##").format(property.propertyType.surfaceArea)));
|
||||
|
||||
statue.setText(saleOrNot);
|
||||
dateOfSale.setText(dateOfSaleString);
|
||||
description.setText(property.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,10 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.List;
|
||||
|
||||
import fr.romanet.vj.apps.myrealestateagency.R;
|
||||
import fr.romanet.vj.apps.myrealestateagency.SharedPrefs;
|
||||
import fr.romanet.vj.apps.myrealestateagency.adapter.PropertiesAdapter;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agency;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
|
||||
import fr.romanet.vj.apps.myrealestateagency.entities.Property;
|
||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.PropertiesActivityViewModel;
|
||||
import fr.romanet.vj.apps.myrealestateagency.viewmodel.PropertiesActivityViewModelFactory;
|
||||
@ -78,6 +80,8 @@ public class PropertiesActivity extends AppCompatActivity implements OnClickList
|
||||
{
|
||||
if (item.getItemId() == R.id.item_disconnect)
|
||||
{
|
||||
SharedPrefs sharedPrefs = new SharedPrefs();
|
||||
sharedPrefs.reset_agent_id();
|
||||
finish();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
@ -19,13 +19,14 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewProperties"
|
||||
android:layout_width="411dp"
|
||||
android:layout_height="670dp"
|
||||
android:layout_height="508dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbarDisconnect" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbarDisconnect"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/buttonAddProperty"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user