Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actualización 4/11/2022 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 38 additions & 1 deletion app/src/main/java/com/mdgz/dam/labdam2022/BusquedaFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

import com.mdgz.dam.labdam2022.repo.CiudadRepository;

/**
* A simple {@link Fragment} subclass.
Expand All @@ -24,6 +31,9 @@ public class BusquedaFragment extends Fragment {
private String mParam1;
private String mParam2;

Button buttonBuscar;
Spinner spinner;

public BusquedaFragment() {
// Required empty public constructor
}
Expand Down Expand Up @@ -59,6 +69,33 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_busqueda, container, false);

View vista = inflater.inflate(R.layout.fragment_busqueda, container, false);

buttonBuscar = vista.findViewById(R.id.buttonBuscar);

spinner = vista.findViewById(R.id.spinner2);

// ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
// CiudadRepository.listaCiudadesNombres(), android.R.layout.simple_spinner_dropdown_item);

ArrayAdapter adapte2 = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_dropdown_item,
CiudadRepository.listaCiudadesNombres());

spinner.setAdapter(adapte2);
buttonBuscar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setReorderingAllowed(true);

transaction.replace(R.id.linearLayoutBusqueda, ResultadoBusquedaFragment.newInstance("", ""));

transaction.commit();
}
});

return vista;
}
}
29 changes: 29 additions & 0 deletions app/src/main/java/com/mdgz/dam/labdam2022/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,41 @@
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import androidx.appcompat.widget.Toolbar;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar t1 = (Toolbar) findViewById(R.id.materialToolbar);
setSupportActionBar(t1);
}

@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.toolbar_menu,menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case R.id.item_fav:
//Hacer algo cuando presionen Home
break;
case R.id.item_reservs:

default:
//Hacer algo cuando por default
break;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class CiudadRepository {
public List<Ciudad> listaCiudades(){
return _CIUDADES;
}

public static List<String> listaCiudadesNombres() {
List<String> nombres = List.of();
for (int i = 0; i < _CIUDADES.size(); i++){
nombres.add(_CIUDADES.get(i).getNombre());
}
return nombres;
}
}
7 changes: 6 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
android:id="@+id/materialToolbar"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="#FFE500"
android:clickable="false"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/toolbar_menu"
app:title="Búsqueda"
app:titleMargin="0dp"
app:titleTextColor="#3A3A3A"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="2dp" />

Expand Down
97 changes: 93 additions & 4 deletions app/src/main/res/layout/fragment_busqueda.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayoutBusqueda"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".BusquedaFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/form_busqueda" />
android:layout_height="46dp"
android:fontFamily="@font/audiowide"
android:lineSpacingExtra="0sp"
android:text="Detalles de la búsqueda"
android:textAlignment="center"
android:textColor="#303030"
android:textSize="20sp" />

</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<CheckBox
android:id="@+id/checkBox"
android:layout_width="122dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Hoteles"
android:textAlignment="viewStart" />

<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Departamentos" />
</LinearLayout>

<EditText
android:id="@+id/editTextNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Capacidad de personas"
android:inputType="number"
android:minHeight="48dp"
android:textAlignment="center" />

<CheckBox
android:id="@+id/checkBox3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="¿Necesita Wifi?"
android:textAlignment="viewStart" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:id="@+id/editTextNumberDecimal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Precio Máximo"
android:inputType="numberDecimal"
android:minHeight="48dp"
android:textAlignment="center" />

<EditText
android:id="@+id/editTextNumberDecimal2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Precio Mínimo"
android:inputType="numberDecimal"
android:minHeight="48dp"
android:textAlignment="center" />
</LinearLayout>

<Spinner
android:id="@+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:spinnerMode="dropdown"
tools:ignore="SpeakableTextPresentCheck,SpeakableTextPresentCheck" />

<Button
android:id="@+id/buttonBuscar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#FFE500"
android:text="Buscar"
android:textColor="#1B1B1B" />

</LinearLayout>
45 changes: 40 additions & 5 deletions app/src/main/res/layout/fragment_resultado_busqueda.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/frameLayoutResult"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".ResultadoBusquedaFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/resultado_busqueda" />
android:layout_height="wrap_content"
android:fontFamily="@font/audiowide"
android:text="Resultados de la búsqueda"
android:textAlignment="center"
android:textSize="20sp" />

</FrameLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cardAlojamientos"
android:layout_width="match_parent"
android:layout_height="318dp"
card_view:cardBackgroundColor="@color"
card_view:cardCornerRadius="15dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
>
</androidx.cardview.widget.CardView>

<Button
android:id="@+id/buttonNuevaBusqueda"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#FFE500"
android:text="Nueva búsqueda"
android:textColor="#1B1B1B" />

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="206dp"
android:scrollbars="@str" />

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.LabDam2022" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.LabDam2022" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down