Skip to content

Commit

Permalink
Merge branch 'PantallaPrincipal'
Browse files Browse the repository at this point in the history
  • Loading branch information
Franverri committed Oct 11, 2017
2 parents 7df4bad + af8f7b4 commit 4dc5a60
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 23 deletions.
32 changes: 31 additions & 1 deletion FIUBER/app/src/main/java/com/taller/fiuber/CarsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.TextView;

import com.bakerj.infinitecards.InfiniteCardView;
import com.bakerj.infinitecards.transformer.DefaultTransformerToBack;
Expand All @@ -16,19 +18,30 @@

public class CarsActivity extends AppCompatActivity {

Button btnNext;
private static final String TAG = "CarsActivity";

Button btnNext, btnSelect;
TextView carsTitle;
InfiniteCardView infiniteCardView;
CarAdapter carAdapter;
List<Integer> images = new ArrayList<>();
int indice;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cars_acctivity);

btnNext = (Button) findViewById(R.id.cars_next);
btnSelect = (Button) findViewById(R.id.cars_select);
infiniteCardView = (InfiniteCardView) findViewById(R.id.cars_view);
carsTitle = (TextView) findViewById(R.id.cars_title);

//Seteo el primer nombre de titulo
carsTitle.setText("Auto 0");

//Creo la lista de autos junto con su indice
indice = 0;
images.add(R.drawable.auto1);
images.add(R.drawable.auto2);
images.add(R.drawable.auto3);
Expand All @@ -42,11 +55,28 @@ protected void onCreate(Bundle savedInstanceState) {
infiniteCardView.setZIndexTransformerToBack(new DefaultZIndexTransformerCommon());
infiniteCardView.setAdapter(carAdapter);

//Click en "Siguiente"
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
infiniteCardView.bringCardToFront(carAdapter.getCount()-1);
if(indice == 0){
indice = carAdapter.getCount()-1;
} else {
indice --;
}
Log.v(TAG, "Auto "+ indice);
carsTitle.setText("Auto "+ indice);
}
});

//Click en "Seleccionar auto"
btnSelect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.v(TAG, "Auto "+ indice +" seleccionado.");
}
});

}
}
5 changes: 4 additions & 1 deletion FIUBER/app/src/main/java/com/taller/fiuber/MapsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ public void onMapReady(GoogleMap googleMap) {

locationManager.requestLocationUpdates("gps", 5000, 0, locationListener);

final GoogleMap finalMap = mMap;
latitud = -34.617335;
longitud = -58.368231;
LatLng ubicacion = new LatLng(latitud, longitud);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ubicacion, 15));
}

/**
Expand Down
65 changes: 44 additions & 21 deletions FIUBER/app/src/main/res/layout/activity_cars_acctivity.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"
android:orientation="vertical"
tools:context="com.taller.fiuber.CarsActivity">

<com.bakerj.infinitecards.InfiniteCardView
android:id="@+id/cars_view"
app:animDuration="1000"
app:cardRatio="1"
<android.support.v7.widget.CardView
android:layout_margin="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">

</com.bakerj.infinitecards.InfiniteCardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:weightSum="2"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/cars_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Auto X"
android:gravity="center_horizontal"
android:textStyle="bold"
android:textSize="30dp"/>

<com.bakerj.infinitecards.InfiniteCardView
android:id="@+id/cars_view"
app:animDuration="1000"
app:cardRatio="1"
android:layout_gravity="center"
android:layout_marginTop="35dp"
android:layout_marginBottom="20dp"
android:layout_width="380dp"
android:layout_height="400dp">

</com.bakerj.infinitecards.InfiniteCardView>

<Button
android:id="@+id/cars_next"
android:text="Siguiente"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>

</LinearLayout>
</android.support.v7.widget.CardView>

<Button
android:id="@+id/cars_next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Siguiente" />

<Button
android:id="@+id/cars_select"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Seleccionar auto" />

</RelativeLayout>
</LinearLayout>

0 comments on commit 4dc5a60

Please sign in to comment.